post()->goCheck(); $result = LoginLogic::login($params); if (false === $result) { return $this->fail(LoginLogic::getError()); } return $this->success('', $result); } /** * @notes 退出登录 */ public function logout() { LoginLogic::logout($this->userInfo); return $this->success(); } /** * @notes 小程序-登录接口 * @return * @author 段誉 * @date 2022/9/20 19:48 */ public function mnpLogin() { $params = (new WechatLoginValidate())->post()->goCheck('mnpLogin'); $res = LoginLogic::mnpLogin($params); if (false === $res) { return $this->fail(LoginLogic::getError()); } $res = LoginLogic::dealStaff($res); return $this->success('', $res); } /** * @notes 小程序绑定微信 * @return * @author 段誉 * @date 2022/9/20 19:48 */ public function mnpAuthBind() { $params = (new WechatLoginValidate())->post()->goCheck("wechatAuth"); $params['user_id'] = $this->userId; $result = LoginLogic::mnpAuthLogin($params); if ($result === false) { return $this->fail(LoginLogic::getError()); } return $this->success('绑定成功', [], 1, 1); } /** * @notes 更新用户头像昵称 * @return * @author 段誉 * @date 2023/2/22 11:15 */ public function updateUser() { $params = (new WechatLoginValidate())->post()->goCheck("updateUser"); $result = LoginLogic::updateUser($params, $this->userId); if ($result === false) { return $this->fail(LoginLogic::getError()); } return $this->success('操作成功', [], 1, 0); } /** * @notes 公众号授权绑定 */ public function OaAuthBind(){ $params=$this->request->post(); if($params){ $find=UserAuth::where('user_id',$params['uid'])->where('terminal',2)->find(); if(!$find){ UserAuth::create([ 'user_id'=>$params['uid'], 'terminal'=>2, 'openid'=>$params['openid'], ]); } } } }