request->get(); $id = $get['id'] ?? 0; $apply = ApplyClass::getById($id, true); if (empty($apply)) { util::fail('没有找到申请记录'); } if ($apply->status != 1) { util::fail('不是审核状态'); } $new = $apply->all == 1 ? 0 : 1; $apply->all = $new; $apply->save(); util::complete(); } //申请列表 public function actionList() { $get = Yii::$app->request->get(); $status = $get['status'] ?? 0; $name = $get['name'] ?? ''; $where = []; if (!empty($status)) { $where['status'] = $status; } if (!empty($name)) { if (is_numeric($name)) { $where['mobile'] = ['like', $name]; } else { $where['name'] = ['like', $name]; } } $list = ApplyService::getApplyList($where); util::success($list); } //审核 public function actionCheck() { ini_set('memory_limit', '2045M'); set_time_limit(0); $id = Yii::$app->request->post('id'); $status = Yii::$app->request->post('status', 0); $remark = Yii::$app->request->post('remark', ''); $apply = ApplyService::getById($id); if (empty($apply)) { util::fail('找不到申请记录'); } if (isset($apply['status']) && $apply['status'] == 2) { util::fail('已经审过了'); } if (isset($apply['style']) && $apply['style'] != dict::getDict('ptStyle', 'ghs')) { util::fail('暂时只支持审核批发商的申请'); } $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { ApplyService::updateById($id, ['status' => $status, 'remark' => $remark]); if ($status == 1) { \bizGhs\apply\services\ApplyService::pass($id); } $transaction->commit(); if ($status == 1) { $mobile = $apply['mobile'] ?? ''; $cf = '15280215347'; if (getenv('YII_ENV') == 'production') { //sms::freeSend($mobile . ',' . $cf, '恭喜,开店申请审核通过了,登录后请及时修改密码,如有疑问请联系 {$var}'); } } } catch (\Exception $exception) { $transaction->rollBack(); Yii::info("审核操作报错:" . $exception->getMessage()); util::fail('操作失败'); } util::complete(); } }