request->post(); $id = $post['id'] ?? 0; $mobile = $post['mobile'] ?? ''; if (empty($mobile)) { util::fail('没有手机号'); } if (!stringUtil::isMobile($mobile)) { util::fail('手机号错误'); } $event = LlEventClass::getById($id, true); if (empty($event)) { util::fail('没有找到'); } $shopId = $this->shopId; if (!isset($event['launchShopId']) || $event['launchShopId'] != $shopId) { util::fail('不是你提交的'); } LlEventClass::addMobile($event, $mobile); util::complete('添加成功'); } //添加微信 public function actionAddWx() { $post = Yii::$app->request->post(); $id = $post['id'] ?? 0; $wx = $post['mobile'] ?? ''; if (empty($wx)) { util::fail('没有微信'); } $event = LlEventClass::getById($id, true); if (empty($event)) { util::fail('没有找到'); } $shopId = $this->shopId; if (!isset($event['launchShopId']) || $event['launchShopId'] != $shopId) { util::fail('不是你提交的'); } LlEventClass::addWx($event, $wx); util::complete('添加成功'); } //添加身份证号 public function actionAddNo() { $post = Yii::$app->request->post(); $id = $post['id'] ?? 0; $no = $post['no'] ?? ''; if (empty($no)) { util::fail('没有身份证号'); } $event = LlEventClass::getById($id, true); if (empty($event)) { util::fail('没有找到'); } $shopId = $this->shopId; if (!isset($event['launchShopId']) || $event['launchShopId'] != $shopId) { util::fail('不是你提交的'); } LlEventClass::addNo($event, $no); util::complete('添加成功'); } public function actionDetail() { $get = Yii::$app->request->get(); $id = $get['id'] ?? 0; $event = LlEventClass::getById($id); if (empty($event)) { util::fail('没有找到'); } $shopId = $this->shopId; if (!isset($event['launchShopId']) || $event['launchShopId'] != $shopId) { util::fail('不是你提交的'); } $proveJson = $event['prove'] ?? ''; $proveData = json_decode($proveJson, true); $proveShort = []; $proveBig = []; $proveSmall = []; if (!empty($proveData)) { foreach ($proveData as $url) { $proveShort[] = $url; $small = imgUtil::groupImg($url) . "?x-oss-process=image/resize,m_fill,h_130,w_130"; $big = imgUtil::groupImg($url) . "?x-oss-process=image/resize,m_fill,h_700,w_700"; $proveBig[] = $big; $proveSmall[] = $small; } } $event['proveShort'] = $proveShort; $event['proveBig'] = $proveBig; $event['proveSmall'] = $proveSmall; util::success(['event' => $event]); } public function actionList() { $get = Yii::$app->request->get(); $requestType = $get['requestType'] ?? ''; $where = []; $sensitive = true; if ($requestType == 'my') { $shopId = $this->shopId; $where['launchShopId'] = $shopId; $sensitive = false; } $respond = LlEventClass::getEventList($where, $sensitive); util::success($respond); } public function actionAdd() { $post = Yii::$app->request->post(); $name = $post['name'] ?? ''; if (empty($name)) { util::fail('请填写店名或姓名'); } $no = $post['no'] ?? ''; if (!empty($no)) { $pattern = '/^(?:\d{15}|\d{17}[\dxX])$/'; $valid = preg_match($pattern, $no); if ($valid == false) { util::fail('身份证号错误'); } } $mobile = $post['mobile'] ?? ''; $wx = $post['wx'] ?? ''; if (empty($wx) && empty($mobile) && empty($no)) { util::fail('手机号、微信号、身份证必填一项'); } $prove = $post['prove'] ?? []; if (empty($prove)) { util::fail('证据最少要一张'); } $shop = $this->shop; $respond = LlEventClass::addEvent($post, $shop); util::success($respond); } }