diff --git a/backend/modules/shop/models/searchs/CommentSearch.php b/backend/modules/shop/models/searchs/CommentSearch.php index becdd17..ac8e189 100644 --- a/backend/modules/shop/models/searchs/CommentSearch.php +++ b/backend/modules/shop/models/searchs/CommentSearch.php @@ -13,13 +13,13 @@ use backend\modules\shop\models\ars\Comment; class CommentSearch extends Comment { /** - * @return array - * 增加创建时间查询字段 - */ + * @return array + * 增加创建时间查询字段 + */ public function attributes() - { - return ArrayHelper::merge(['created_at_range'], parent::attributes()); - } + { + return ArrayHelper::merge(['created_at_range'], parent::attributes()); + } /** * {@inheritdoc} */ @@ -41,14 +41,14 @@ class CommentSearch extends Comment return Model::scenarios(); } /** - * @return array - * 列格式 - */ + * @return array + * 列格式 + */ public function columns() { return [ - 'id', - 'user_id', + 'id', + 'user_id', [ 'attribute' => 'order_goods_id', 'value' => function ($model) { @@ -56,8 +56,8 @@ class CommentSearch extends Comment }, 'label' => '商品名称' ], - 'star', - 'content', + 'star', + 'content', [ 'attribute' => 'status', 'value' => function ($model) { @@ -65,7 +65,7 @@ class CommentSearch extends Comment }, 'label' => '状态' ], - 'created_at:datetime', + 'created_at:datetime', [ 'class' => 'iron\grid\ActionColumn', 'align' => 'center', @@ -106,10 +106,10 @@ class CommentSearch extends Comment ]; } /** - * @param $params - * @return ActiveDataProvider - * 不分页的所有数据 - */ + * @param $params + * @return ActiveDataProvider + * 不分页的所有数据 + */ public function allData($params) { $query = Comment::find(); @@ -151,11 +151,11 @@ class CommentSearch extends Comment return $this->filter($query, $dataProvider); } /** - * @param $query - * @param $dataProvider - * @return ActiveDataProvider - * 条件筛选 - */ + * @param $query + * @param $dataProvider + * @return ActiveDataProvider + * 条件筛选 + */ private function filter($query, $dataProvider){ if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails diff --git a/backend/modules/shop/views/comment/view.php b/backend/modules/shop/views/comment/view.php index beefa45..a57e1bb 100644 --- a/backend/modules/shop/views/comment/view.php +++ b/backend/modules/shop/views/comment/view.php @@ -1,5 +1,6 @@ params['breadcrumbs'][] = $this->title; 'attributes' => [ 'id', 'user_id', - 'order_goods_id', + [ + 'attribute' => 'order_goods_id', + 'value' => function ($model) { + return $model->orderGoods->goods_name; + }, + 'label' => '商品名称' + ], 'star', 'content:ntext', - 'status', - 'updated_at', - 'created_at', + [ + 'attribute' => 'status', + 'value' => function ($model) { + return Comment::$commentStatus[$model->status]; + }, + 'label' => '状态' + ], + 'updated_at:datetime', + 'created_at:datetime', ], ]) ?>