param('phone', ''); //手机号 $password = $request->param('password', ''); //密码 $openid = $request->param('openid', ''); //微信小程序openid if (empty($phone)) { return fail('请输入手机号'); } if (empty($password)) { return fail('请输入密码'); } $member_info = Member::where('mobile', $phone)->find();//查账户表信息是否存在 if (!$member_info) { return fail('账户手机号有误'); } $customerResources = \app\model\customer_resources\CustomerResources::where('member_id', $member_info['member_id'])->find();//查客户资源表信息是否存在 if (!$customerResources) { return fail('账户信息有误'); } //创建密码 //$a = create_password($password); //验证密码 if (!check_password($password, $member_info->password)) { return fail('手机号或密码不正确'); } $res = (new LoginService())->login($member_info, MemberLoginTypeDict::MOBILE); if (!$res) { return fail('账户信息有误'); } $res['user_type'] = '3';//用户类型|3=学员 return success($res); } //忘记密码-通过短信验证码进行密码重置(学生/员工通用) public function forgetPassword(Request $request) { $phone = $request->param('phone', '');//手机号 $code = $request->param('code', '');//短信验证码 $code_type = $request->param('code_type', '');//短信验证码类型(发送/验证 短信验证码的类型)|修改密码=editPassword $password = $request->param('password', '');//新密码 $user_type = $request->param('user_type', '');//用户类型|customer=学生|personnel=员工(销售/教师) if (empty($phone) || empty($code) || empty($code_type) || empty($password) || empty($user_type)) { return fail('缺少必填参数'); } //@todo 验证短信验证码是否正确(等发送短信验证码接入后在写) //... //重置密码 $res = (new CommonService())->forgetPassword($phone, $password, $user_type); if (!$res['code']) { return fail($res['msg']); } return success([]); } //获取配置信息 public function getConfig(Request $request) { $config_key = $request->param('config_key', '');//配置项关键字 if (empty($config_key)) { return fail('缺少必填参数'); } $where = [ 'config_key' => $config_key ]; $res = (new CommonService())->getConfig($where); if (!$res) { return fail('配置信息有误'); } return success($res); } public function getMiniWxOpenId(Request $request) { $code = $request->param('code', '');//微信code if (empty($code)) { return fail('缺少必填参数'); } $res = (new CommonService())->getMiniWxOpenId($code); if (!$res['code']) { return fail($res['msg']); } return success($res['data']); } }