request->post(); $params = (new LoginAccountValidate())->post()->goCheck(); $result = LoginLogic::login($params); if (false === $result) { return $this->fail(LoginLogic::getError()); } return $this->data($result); } /** * @notes 退出登录 */ public function logout() { LoginLogic::logout($this->userInfo); return $this->success(); } /** * @notes 小程序-登录接口 * @return \think\response\Json * @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()); } return $this->success('', $res); } /** * @notes 小程序绑定微信 * @return \think\response\Json * @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); } }