| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace addons\Store\client\controllers;
- use addons\Store\common\services\StaffService;
- use common\enums\ApiStatusEnum;
- use yii\helpers\Json;
- class ReserveApplyController extends BaseController
- {
- /**
- * 申请列表
- * @return mixed|null
- */
- public function actionIndex()
- {
- if (\Yii::$app->request->isAjax && \Yii::$app->request->isGet) {
- $data = \Yii::$app->request->get();
- $rules = [
- [['name','address', 'mobile', 'date_start', 'date_end', 'keyword'], 'string'],
- [['user_id', 'page', 'limit'], 'integer'],
- ];
- $res = \Yii::$app->services->validate->validate($data, $rules);
- if (!$res) return $this->error(\Yii::$app->services->validate->getErrorMessage());
- $ret = (new StaffService(['store_id' => $this->store_id, 'mall_id' => $this->mall_id]))->applyPage($data);
- if (!empty($ret['list'])) {
- foreach ($ret['list'] as &$item) {
- $item['idcard_images'] = [
- $item['idcard_front'],
- $item['idcard_back'],
- ];
- $item['qualification_certificate'] = Json::decode($item['qualification_certificate']);
- }
- }
- return is_string($ret) ? $this->error($ret) : $this->success('获取成功', $ret, ApiStatusEnum::CODE_SUCCESS, JSON_BIGINT_AS_STRING);
- }
- return $this->render('index');
- }
- /**
- * 审核
- * @return mixed|null
- */
- public function actionAudit()
- {
- $data = \Yii::$app->request->post();
- $rules = [
- [['id', 'status'], 'integer'],
- [['id', 'status', 'remark'], 'required'],
- [['remark'], 'string'],
- ];
- $res = \Yii::$app->services->validate->validate($data, $rules, [
- 'id' => '技师',
- 'status' => '审核结果',
- 'remark' => '审核备注'
- ]);
- if (!$res) return $this->error(\Yii::$app->services->validate->getErrorMessage());
- $ret = (new StaffService(['store_id' => $this->store_id, 'mall_id' => $this->mall_id]))->audit($data);
- return is_string($ret) ? $this->error($ret) : $this->success('获取成功', $ret);
- }
- }
|