| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- namespace addons\Store\client\controllers;
- use addons\ReservationService\common\models\ReservationServiceUser;
- use addons\Store\common\services\ReserveCommentService;
- use common\enums\StatusEnum;
- class ReserveOrderCommentController extends BaseController
- {
- /**
- * 评价列表
- * @return mixed|null
- */
- public function actionIndex()
- {
- if (\Yii::$app->request->isAjax && \Yii::$app->request->isGet) {
- $data = \Yii::$app->request->get();
- $rules = [
- [['tech_id', 'page', 'limit', 'id'], 'integer'],
- ];
- $res = \Yii::$app->services->validate->validate($data, $rules);
- if (!$res) return $this->error(\Yii::$app->services->validate->getErrorMessage());
- $ret = (new ReserveCommentService(['store_id' => $this->store_id, 'mall_id' => $this->mall_id]))->page($data);
- $reservation_service_user = ReservationServiceUser::find()->where(['mall_id' => $this->mall_id, 'user_id' => $data['id'], 'status' => StatusEnum::ENABLED])->one();
- $ret['service_rating'] = $reservation_service_user['store_service_rating'] ?? 0;
- return is_string($ret) ? $this->error($ret) : $this->success('获取成功', $ret);
- }
- return $this->render('index');
- }
- }
|