post()->goCheck('register'); $res = LoginLogic::confirmMobile($params); if(!$res){ return $this->fail(LoginLogic::getError()); } $result = LoginLogic::register($params); if (true === $result) { // 发送通知给平台配置的审核人 $noticeSetting = NoticeSetting::where('scene_id', NoticeEnum::WORKER_EXAMINE)->findOrEmpty()->toArray(); if($noticeSetting['oa_notice']['designated_user']??0 && $noticeSetting['oa_notice']['designated_user']){ event('Notice', [ 'scene_id' => NoticeEnum::WORKER_EXAMINE, 'params' => [ 'user_id' => 0, 'openid' => $noticeSetting['oa_notice']['designated_user'], ] ]); } return $this->success('注册成功', [], 1, 1); } return $this->fail(LoginLogic::getError()); } /** * 获取证件信息 * @return \think\response\Json */ // public function getCredentialName() // { // // } /** * @notes 账号密码/手机号密码/手机号验证码登录 * @return \think\response\Json * @author 段誉 * @date 2022/9/16 10:42 */ public function account() { $params = (new LoginAccountValidate())->post()->goCheck(); $result = LoginLogic::login($params); if (false === $result) { return $this->fail(LoginLogic::getError()); } if(!empty($params['wx_code']) and $params['terminal']==1){ $params['code'] = $params['wx_code']; $params['user_id'] = MasterWorker::where('sn',$result['sn'])->value('id'); $wx_result = LoginLogic::mnpAuthLogin($params); if ($wx_result === false) { return $this->fail(LoginLogic::getError()); } } return $this->data($result); } /** * @notes 退出登录 * @return \think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:42 */ public function logout() { LoginLogic::logout($this->userInfo); return $this->success(); } public function testWeChat() { try { // 发送通知给平台配置的审核人 $noticeSetting = NoticeSetting::where('scene_id', NoticeEnum::WORKER_EXAMINE)->findOrEmpty()->toArray(); if($noticeSetting['oa_notice']['designated_user']??0 && $noticeSetting['oa_notice']['designated_user']){ (new WeChatOaService())->sendTemplateMessage([ 'scene_id' => NoticeEnum::WORKER_EXAMINE, 'params' => [ 'user_id' => 0, 'openid' => $noticeSetting['oa_notice']['designated_user'], ] ]); /*event('Notice', [ 'scene_id' => NoticeEnum::WORKER_EXAMINE, 'params' => [ 'user_id' => 0, 'openid' => $noticeSetting['oa_notice']['designated_user'], ] ]);*/ } } catch (\Exception $e) { dd($e->getMessage()); } } }