切换导航条
此项目
正在载入...
登录
李忠强
/
temporaryfood
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
何书鹏
3 years ago
提交
cca83e3a65041da3e9d364fd6b2b76abd2591921
1 个父辈
65045c28
商品评论管理
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
423 行增加
和
0 行删除
application/admin/controller/GoodsComment.php
application/admin/lang/zh-cn/goods_comment.php
application/admin/model/GoodsComment.php
application/admin/validate/GoodsComment.php
application/admin/view/goods_comment/add.html
application/admin/view/goods_comment/edit.html
application/admin/view/goods_comment/index.html
public/assets/js/backend/goods_comment.js
application/admin/controller/GoodsComment.php
0 → 100644
查看文件 @
cca83e3
<?php
namespace
app\admin\controller
;
use
app\common\controller\Backend
;
/**
* 商品评论
*
* @icon fa fa-circle-o
*/
class
GoodsComment
extends
Backend
{
/**
* GoodsComment模型对象
* @var \app\admin\model\GoodsComment
*/
protected
$model
=
null
;
public
function
_initialize
()
{
parent
::
_initialize
();
$this
->
model
=
new
\app\admin\model\GoodsComment
;
$this
->
view
->
assign
(
"statusList"
,
$this
->
model
->
getStatusList
());
}
public
function
import
()
{
parent
::
import
();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public
function
index
()
{
//当前是否为关联查询
$this
->
relationSearch
=
true
;
//设置过滤方法
$this
->
request
->
filter
([
'strip_tags'
,
'trim'
]);
if
(
$this
->
request
->
isAjax
())
{
//如果发送的来源是Selectpage,则转发到Selectpage
if
(
$this
->
request
->
request
(
'keyField'
))
{
return
$this
->
selectpage
();
}
list
(
$where
,
$sort
,
$order
,
$offset
,
$limit
)
=
$this
->
buildparams
();
$list
=
$this
->
model
->
with
([
'user'
,
'litestoregoods'
,
'litestoreorder'
])
->
where
(
$where
)
->
order
(
$sort
,
$order
)
->
paginate
(
$limit
);
foreach
(
$list
as
$row
)
{
$row
->
visible
([
'id'
,
'comment'
,
'images'
,
'score'
,
'createtime'
,
'status'
]);
$row
->
visible
([
'user'
]);
$row
->
getRelation
(
'user'
)
->
visible
([
'nickname'
]);
$row
->
visible
([
'litestoregoods'
]);
$row
->
getRelation
(
'litestoregoods'
)
->
visible
([
'goods_name'
]);
$row
->
visible
([
'litestoreorder'
]);
$row
->
getRelation
(
'litestoreorder'
)
->
visible
([
'order_no'
]);
}
$result
=
array
(
"total"
=>
$list
->
total
(),
"rows"
=>
$list
->
items
());
return
json
(
$result
);
}
return
$this
->
view
->
fetch
();
}
}
...
...
application/admin/lang/zh-cn/goods_comment.php
0 → 100644
查看文件 @
cca83e3
<?php
return
[
'User_id'
=>
'用户id'
,
'Goods_id'
=>
'物品id'
,
'Order_id'
=>
'订单id'
,
'Comment'
=>
'评论内容'
,
'Images'
=>
'评论图片'
,
'Score'
=>
'评价分数'
,
'Createtime'
=>
'创建时间'
,
'Status'
=>
'状态'
,
'Status normal'
=>
'正常'
,
'Status hidden'
=>
'隐藏'
,
'User.nickname'
=>
'评论人昵称'
,
'Litestoregoods.goods_name'
=>
'商品名称'
,
'Litestoreorder.order_no'
=>
'订单编号'
];
...
...
application/admin/model/GoodsComment.php
0 → 100644
查看文件 @
cca83e3
<?php
namespace
app\admin\model
;
use
think\Model
;
class
GoodsComment
extends
Model
{
// 表名
protected
$name
=
'goods_comment'
;
// 自动写入时间戳字段
protected
$autoWriteTimestamp
=
'int'
;
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
false
;
protected
$deleteTime
=
false
;
// 追加属性
protected
$append
=
[
'status_text'
];
public
function
getStatusList
()
{
return
[
'normal'
=>
__
(
'Status normal'
),
'hidden'
=>
__
(
'Status hidden'
)];
}
public
function
getStatusTextAttr
(
$value
,
$data
)
{
$value
=
$value
?
$value
:
(
isset
(
$data
[
'status'
])
?
$data
[
'status'
]
:
''
);
$list
=
$this
->
getStatusList
();
return
isset
(
$list
[
$value
])
?
$list
[
$value
]
:
''
;
}
public
function
user
()
{
return
$this
->
belongsTo
(
'User'
,
'user_id'
,
'id'
,
[],
'LEFT'
)
->
setEagerlyType
(
0
);
}
public
function
litestoregoods
()
{
return
$this
->
belongsTo
(
'\app\admin\model\litestore\Litestoregoods'
,
'goods_id'
,
'goods_id'
,
[],
'LEFT'
)
->
setEagerlyType
(
0
);
}
public
function
litestoreorder
()
{
return
$this
->
belongsTo
(
'\app\admin\model\litestore\Litestoreorder'
,
'order_id'
,
'id'
,
[],
'LEFT'
)
->
setEagerlyType
(
0
);
}
}
...
...
application/admin/validate/GoodsComment.php
0 → 100644
查看文件 @
cca83e3
<?php
namespace
app\admin\validate
;
use
think\Validate
;
class
GoodsComment
extends
Validate
{
/**
* 验证规则
*/
protected
$rule
=
[
];
/**
* 提示消息
*/
protected
$message
=
[
];
/**
* 验证场景
*/
protected
$scene
=
[
'add'
=>
[],
'edit'
=>
[],
];
}
...
...
application/admin/view/goods_comment/add.html
0 → 100644
查看文件 @
cca83e3
<form
id=
"add-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('User_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-field=
"nickname"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_id"
data-rule=
"required"
data-source=
"goods/index"
class=
"form-control selectpage"
name=
"row[goods_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Order_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-order_id"
data-rule=
"required"
data-source=
"order/index"
class=
"form-control selectpage"
name=
"row[order_id]"
type=
"text"
value=
""
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Comment')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-comment"
data-rule=
"required"
class=
"form-control"
name=
"row[comment]"
type=
"text"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
class=
"form-control"
size=
"50"
name=
"row[images]"
type=
"text"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"faupload-images"
class=
"btn btn-danger faupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline faupload-preview"
id=
"p-images"
></ul>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Score')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-score"
class=
"form-control"
name=
"row[score]"
type=
"number"
value=
"1"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="statusList" item="vo"}
<label
for=
"row[status]-{$key}"
><input
id=
"row[status]-{$key}"
name=
"row[status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"normal"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
...
...
application/admin/view/goods_comment/edit.html
0 → 100644
查看文件 @
cca83e3
<form
id=
"edit-form"
class=
"form-horizontal"
role=
"form"
data-toggle=
"validator"
method=
"POST"
action=
""
>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('User_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-user_id"
data-rule=
"required"
data-source=
"user/user/index"
data-field=
"nickname"
class=
"form-control selectpage"
name=
"row[user_id]"
type=
"text"
value=
"{$row.user_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Goods_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-goods_id"
data-rule=
"required"
data-source=
"goods/index"
class=
"form-control selectpage"
name=
"row[goods_id]"
type=
"text"
value=
"{$row.goods_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Order_id')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-order_id"
data-rule=
"required"
data-source=
"order/index"
class=
"form-control selectpage"
name=
"row[order_id]"
type=
"text"
value=
"{$row.order_id|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Comment')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-comment"
data-rule=
"required"
class=
"form-control"
name=
"row[comment]"
type=
"text"
value=
"{$row.comment|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Images')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"input-group"
>
<input
id=
"c-images"
class=
"form-control"
size=
"50"
name=
"row[images]"
type=
"text"
value=
"{$row.images|htmlentities}"
>
<div
class=
"input-group-addon no-border no-padding"
>
<span><button
type=
"button"
id=
"faupload-images"
class=
"btn btn-danger faupload"
data-input-id=
"c-images"
data-mimetype=
"image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple=
"true"
data-preview-id=
"p-images"
><i
class=
"fa fa-upload"
></i>
{:__('Upload')}
</button></span>
<span><button
type=
"button"
id=
"fachoose-images"
class=
"btn btn-primary fachoose"
data-input-id=
"c-images"
data-mimetype=
"image/*"
data-multiple=
"true"
><i
class=
"fa fa-list"
></i>
{:__('Choose')}
</button></span>
</div>
<span
class=
"msg-box n-right"
for=
"c-images"
></span>
</div>
<ul
class=
"row list-inline faupload-preview"
id=
"p-images"
></ul>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Score')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<input
id=
"c-score"
class=
"form-control"
name=
"row[score]"
type=
"number"
value=
"{$row.score|htmlentities}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"control-label col-xs-12 col-sm-2"
>
{:__('Status')}:
</label>
<div
class=
"col-xs-12 col-sm-8"
>
<div
class=
"radio"
>
{foreach name="statusList" item="vo"}
<label
for=
"row[status]-{$key}"
><input
id=
"row[status]-{$key}"
name=
"row[status]"
type=
"radio"
value=
"{$key}"
{
in
name=
"key"
value=
"$row.status"
}
checked
{/
in
}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div
class=
"form-group layer-footer"
>
<label
class=
"control-label col-xs-12 col-sm-2"
></label>
<div
class=
"col-xs-12 col-sm-8"
>
<button
type=
"submit"
class=
"btn btn-success btn-embossed disabled"
>
{:__('OK')}
</button>
<button
type=
"reset"
class=
"btn btn-default btn-embossed"
>
{:__('Reset')}
</button>
</div>
</div>
</form>
...
...
application/admin/view/goods_comment/index.html
0 → 100644
查看文件 @
cca83e3
<div
class=
"panel panel-default panel-intro"
>
<div
class=
"panel-heading"
>
{:build_heading(null,FALSE)}
<ul
class=
"nav nav-tabs"
data-field=
"status"
>
<li
class=
"{:$Think.get.status === null ? 'active' : ''}"
><a
href=
"#t-all"
data-value=
""
data-toggle=
"tab"
>
{:__('All')}
</a></li>
{foreach name="statusList" item="vo"}
<li
class=
"{:$Think.get.status === (string)$key ? 'active' : ''}"
><a
href=
"#t-{$key}"
data-value=
"{$key}"
data-toggle=
"tab"
>
{$vo}
</a></li>
{/foreach}
</ul>
</div>
<div
class=
"panel-body"
>
<div
id=
"myTabContent"
class=
"tab-content"
>
<div
class=
"tab-pane fade active in"
id=
"one"
>
<div
class=
"widget-body no-padding"
>
<div
id=
"toolbar"
class=
"toolbar"
>
<!--<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('goods_comment/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('goods_comment/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
<a
href=
"javascript:;"
class=
"btn btn-danger btn-del btn-disabled disabled {:$auth->check('goods_comment/del')?'':'hide'}"
title=
"{:__('Delete')}"
><i
class=
"fa fa-trash"
></i>
{:__('Delete')}
</a>
<!--<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('goods_comment/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>-->
<div
class=
"dropdown btn-group {:$auth->check('goods_comment/multi')?'':'hide'}"
>
<a
class=
"btn btn-primary btn-more dropdown-toggle btn-disabled disabled"
data-toggle=
"dropdown"
><i
class=
"fa fa-cog"
></i>
{:__('More')}
</a>
<ul
class=
"dropdown-menu text-left"
role=
"menu"
>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=normal"
><i
class=
"fa fa-eye"
></i>
{:__('Set to normal')}
</a></li>
<li><a
class=
"btn btn-link btn-multi btn-disabled disabled"
href=
"javascript:;"
data-params=
"status=hidden"
><i
class=
"fa fa-eye-slash"
></i>
{:__('Set to hidden')}
</a></li>
</ul>
</div>
</div>
<table
id=
"table"
class=
"table table-striped table-bordered table-hover table-nowrap"
data-operate-edit=
""
data-operate-del=
"{:$auth->check('goods_comment/del')}"
width=
"100%"
>
</table>
</div>
</div>
</div>
</div>
</div>
...
...
public/assets/js/backend/goods_comment.js
0 → 100644
查看文件 @
cca83e3
define
([
'jquery'
,
'bootstrap'
,
'backend'
,
'table'
,
'form'
],
function
(
$
,
undefined
,
Backend
,
Table
,
Form
)
{
var
Controller
=
{
index
:
function
()
{
// 初始化表格参数配置
Table
.
api
.
init
({
extend
:
{
index_url
:
'goods_comment/index'
+
location
.
search
,
add_url
:
'goods_comment/add'
,
edit_url
:
'goods_comment/edit'
,
del_url
:
'goods_comment/del'
,
multi_url
:
'goods_comment/multi'
,
import_url
:
'goods_comment/import'
,
table
:
'goods_comment'
,
}
});
var
table
=
$
(
"#table"
);
// 初始化表格
table
.
bootstrapTable
({
url
:
$
.
fn
.
bootstrapTable
.
defaults
.
extend
.
index_url
,
pk
:
'id'
,
sortName
:
'id'
,
columns
:
[
[
{
checkbox
:
true
},
{
field
:
'id'
,
title
:
__
(
'Id'
)},
{
field
:
'user.nickname'
,
title
:
__
(
'User.nickname'
),
operate
:
'LIKE'
},
{
field
:
'litestoregoods.goods_name'
,
title
:
__
(
'Litestoregoods.goods_name'
),
operate
:
'LIKE'
},
{
field
:
'litestoreorder.order_no'
,
title
:
__
(
'Litestoreorder.order_no'
),
operate
:
'LIKE'
},
{
field
:
'comment'
,
title
:
__
(
'Comment'
),
operate
:
'LIKE'
},
{
field
:
'images'
,
title
:
__
(
'Images'
),
operate
:
false
,
events
:
Table
.
api
.
events
.
image
,
formatter
:
Table
.
api
.
formatter
.
images
},
{
field
:
'score'
,
title
:
__
(
'Score'
)},
{
field
:
'createtime'
,
title
:
__
(
'Createtime'
),
operate
:
'RANGE'
,
addclass
:
'datetimerange'
,
autocomplete
:
false
,
formatter
:
Table
.
api
.
formatter
.
datetime
},
{
field
:
'status'
,
title
:
__
(
'Status'
),
searchList
:
{
"normal"
:
__
(
'Status normal'
),
"hidden"
:
__
(
'Status hidden'
)},
formatter
:
Table
.
api
.
formatter
.
status
},
{
field
:
'operate'
,
title
:
__
(
'Operate'
),
table
:
table
,
events
:
Table
.
api
.
events
.
operate
,
formatter
:
Table
.
api
.
formatter
.
operate
}
]
]
});
// 为表格绑定事件
Table
.
api
.
bindevent
(
table
);
},
add
:
function
()
{
Controller
.
api
.
bindevent
();
},
edit
:
function
()
{
Controller
.
api
.
bindevent
();
},
api
:
{
bindevent
:
function
()
{
Form
.
api
.
bindevent
(
$
(
"form[role=form]"
));
}
}
};
return
Controller
;
});
\ No newline at end of file
...
...
请
注册
或
登录
后发表评论