|
@@ -51,6 +51,7 @@ class User extends Api
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="mobile", type="string", required=true, description="手机号")
|
|
|
* @ApiParams (name="captcha", type="string", required=true, description="验证码")
|
|
|
+ * @ApiParams (name="openid", type="string", required=true, description="微信登录授权返回的openid")
|
|
|
* @ApiReturnParams (name=code,type="integer",description=错误码:0=失败1=成功401=未登录403=没有权限)
|
|
|
* @ApiReturnParams (name=msg,type="string",description=提示信息)
|
|
|
* @ApiReturnParams (name=data,type="array",description=要返回的数据)
|
|
@@ -60,6 +61,7 @@ class User extends Api
|
|
|
{
|
|
|
$mobile = $this->request->post('mobile');
|
|
|
$captcha = $this->request->post('captcha');
|
|
|
+ $openid = $this->request->post('openid');
|
|
|
if (!$mobile || !$captcha) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
|
}
|
|
@@ -77,7 +79,7 @@ class User extends Api
|
|
|
//如果已经有账号则直接登录
|
|
|
$ret = $this->auth->direct($user->id);
|
|
|
} else {
|
|
|
- $ret = $this->auth->register('植提桥用户'.substr($mobile,-4), Random::alnum(), '', $mobile, []);
|
|
|
+ $ret = $this->auth->register('植提桥用户'.substr($mobile,-4), Random::alnum(), '', $mobile, ['openid'=>$openid]);
|
|
|
}
|
|
|
if ($ret) {
|
|
|
Sms::flush($mobile, 'register');
|
|
@@ -138,7 +140,7 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 第三方登录
|
|
|
+ * 微信登录
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiParams (name="code", type="string", required=true, description="code码")
|
|
|
* @ApiReturnParams (name=code,type="integer",description=错误码:0=失败1=成功401=未登录403=没有权限)
|