小程序手机绑定接口更新,api新增注册+验证码发送接口

feat/task1-c-wallet
Devil 2021-03-04 23:14:21 +08:00
parent 97269bea42
commit 893657d66d
10 changed files with 156 additions and 74 deletions

View File

@ -44,49 +44,135 @@ class User extends Common
} }
/** /**
* [Reg 用户注册-数据添加] * 用户登录
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 0.0.1 * @version 1.0.0
* @datetime 2017-03-07T00:08:36+0800 * @date 2021-03-04
* @desc description
*/
public function Login()
{
return UserService::Login($this->data_post);
}
/**
* 用户登录-验证码发送
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/
public function LoginVerifySend()
{
return UserService::LoginVerifySend($this->data_post);
}
/**
* 用户注册
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/ */
public function Reg() public function Reg()
{ {
// 是否ajax请求 return UserService::Reg($this->data_post);
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 调用服务层
return UserService::AppReg($this->data_post);
} }
/** /**
* [RegVerifySend 用户注册-验证码发送] * 用户注册-验证码发送
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 0.0.1 * @version 1.0.0
* @datetime 2017-03-05T19:17:10+0800 * @date 2021-03-04
* @desc description
*/ */
public function RegVerifySend() public function RegVerifySend()
{ {
// 是否ajax请求 return UserService::RegVerifySend($this->data_post);
if(!IS_AJAX)
{
return $this->error('非法访问');
}
// 调用服务层
return UserService::AppUserBindVerifySend($this->data_post);
} }
/** /**
* [GetAlipayUserInfo 支付宝用户授权] * 密码找回
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
* @datetime 2017-09-23T21:52:49+0800 * @date 2021-03-04
* @desc description
*/
public function ForgetPwd()
{
return UserService::ForgetPwd($this->data_post);
}
/**
* 密码找回-验证码发送
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/
public function ForgetPwdVerifySend()
{
return UserService::ForgetPwdVerifySend($this->data_post);
}
/**
* 用户-验证码显示
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/
public function UserVerifyEntry()
{
$params = [
'width' => 100,
'height' => 26,
'key_prefix' => input('type', 'user_reg'),
];
$verify = new \base\Verify($params);
$verify->Entry();
}
/**
* app用户手机绑定
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/
public function AppMobileBind()
{
return UserService::AppMobileBind($this->data_post);
}
/**
* app用户手机绑定-验证码发送
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/
public function AppMobileBindVerifySend()
{
return UserService::AppMobileBindVerifySend($this->data_post);
}
/**
* 支付宝用户授权
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/ */
public function AlipayUserAuth() public function AlipayUserAuth()
{ {
@ -635,18 +721,5 @@ class User extends Common
$this->data_post['is_onekey_mobile_bind'] = 1; $this->data_post['is_onekey_mobile_bind'] = 1;
return UserService::AuthUserProgram($this->data_post, APPLICATION_CLIENT_TYPE.'_openid'); return UserService::AuthUserProgram($this->data_post, APPLICATION_CLIENT_TYPE.'_openid');
} }
/**
* 用户登录
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2021-03-04
* @desc description
*/
public function Login()
{
return UserService::Login($this->data_post);
}
} }
?> ?>

View File

@ -371,11 +371,11 @@ class User extends Common
*/ */
public function UserVerifyEntry() public function UserVerifyEntry()
{ {
$params = array( $params = [
'width' => 100, 'width' => 100,
'height' => 26, 'height' => 26,
'key_prefix' => input('type', 'user_reg'), 'key_prefix' => input('type', 'user_reg'),
); ];
$verify = new \base\Verify($params); $verify = new \base\Verify($params);
$verify->Entry(); $verify->Entry();
} }

View File

@ -251,17 +251,17 @@ function RegisterSuccessBack(e)
{ {
$.AMUI.progress.done(); $.AMUI.progress.done();
Prompt(e.msg, 'success'); Prompt(e.msg, 'success');
console.log(e.data)
// 登录返回html处理 // 登录返回html处理
if((e.data.body_html || null) != null) if((e.data.body_html || null) != null)
{ {
$('body').append(e.data.body_html); $('body').append(e.data.body_html);
} }
setTimeout(function() // setTimeout(function()
{ // {
window.location.href = '{{$referer_url}}'; // window.location.href = '{{$referer_url}}';
}, 1500); // }, 1500);
} else { } else {
$('.register-container form.am-form').find('button[type="submit"]').button('reset'); $('.register-container form.am-form').find('button[type="submit"]').button('reset');
$.AMUI.progress.done(); $.AMUI.progress.done();

View File

@ -822,7 +822,7 @@ class UserService
return $ret; return $ret;
} }
// 登录返回 // 成功返回
if(APPLICATION == 'app') if(APPLICATION == 'app')
{ {
$result = self::AppUserInfoHandle($user_id); $result = self::AppUserInfoHandle($user_id);
@ -985,7 +985,14 @@ class UserService
// 用户登录session纪录 // 用户登录session纪录
if(self::UserLoginRecord($user_ret['data']['user_id'])) if(self::UserLoginRecord($user_ret['data']['user_id']))
{ {
return DataReturn('注册成功', 0, $user_ret); // 成功返回
if(APPLICATION == 'app')
{
$result = self::AppUserInfoHandle($user_ret['data']['user_id']);
} else {
$result = $user_ret['data'];
}
return DataReturn('注册成功', 0, $result);
} }
return DataReturn('注册成功,请到登录页面登录帐号'); return DataReturn('注册成功,请到登录页面登录帐号');
} else { } else {
@ -1934,13 +1941,14 @@ class UserService
$body_html = []; $body_html = [];
// 注册成功后钩子 // 注册成功后钩子
$user = Db::name('User')->field('id,username,nickname,mobile,email,gender,avatar,province,city,birthday')->where(['id'=>$user_id])->find();
$hook_name = 'plugins_service_user_register_end'; $hook_name = 'plugins_service_user_register_end';
$ret = HookReturnHandle(Hook::listen($hook_name, [ $ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name, 'hook_name' => $hook_name,
'is_backend' => true, 'is_backend' => true,
'params' => &$params, 'params' => &$params,
'user_id' => $user_id, 'user_id' => $user_id,
'user' => Db::name('User')->field('id,username,nickname,mobile,email,gender,avatar,province,city,birthday')->where(['id'=>$user_id])->find(), 'user' => $user,
'body_html' => &$body_html, 'body_html' => &$body_html,
])); ]));
if(isset($ret['code']) && $ret['code'] != 0) if(isset($ret['code']) && $ret['code'] != 0)
@ -1960,7 +1968,7 @@ class UserService
} }
/** /**
* app用户注册 * app用户手机绑定
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
@ -1968,7 +1976,7 @@ class UserService
* @desc description * @desc description
* @param [array] $params [输入参数] * @param [array] $params [输入参数]
*/ */
public static function AppReg($params = []) public static function AppMobileBind($params = [])
{ {
// 数据验证 // 数据验证
$p = [ $p = [
@ -1989,8 +1997,8 @@ class UserService
return DataReturn($ret, -1); return DataReturn($ret, -1);
} }
// 用户注册前校验钩子 // 用户手机绑定前校验钩子
$hook_name = 'plugins_service_user_app_register_begin_check'; $hook_name = 'plugins_service_user_app_mobile_bind_begin_check';
$ret = HookReturnHandle(Hook::listen($hook_name, [ $ret = HookReturnHandle(Hook::listen($hook_name, [
'hook_name' => $hook_name, 'hook_name' => $hook_name,
'is_backend' => true, 'is_backend' => true,
@ -2009,7 +2017,7 @@ class UserService
// 验证码校验 // 验证码校验
$verify_params = [ $verify_params = [
'key_prefix' => 'bind_'.md5($params['mobile']), 'key_prefix' => 'user_bind_'.md5($params['mobile']),
'expire_time' => MyC('common_verify_expire_time') 'expire_time' => MyC('common_verify_expire_time')
]; ];
$obj = new \base\Sms($verify_params); $obj = new \base\Sms($verify_params);
@ -2128,7 +2136,7 @@ class UserService
} }
/** /**
* app用户绑定验证码发送 * app用户手机绑定验证码发送
* @author Devil * @author Devil
* @blog http://gong.gg/ * @blog http://gong.gg/
* @version 1.0.0 * @version 1.0.0
@ -2136,7 +2144,7 @@ class UserService
* @desc description * @desc description
* @param [array] $params [输入参数] * @param [array] $params [输入参数]
*/ */
public static function AppUserBindVerifySend($params = []) public static function AppMobileBindVerifySend($params = [])
{ {
// 数据验证 // 数据验证
$p = [ $p = [
@ -2160,8 +2168,8 @@ class UserService
// 验证码公共基础参数 // 验证码公共基础参数
$verify_params = [ $verify_params = [
'key_prefix' => 'bind_'.md5($params['mobile']), 'key_prefix' => 'user_bind_'.md5($params['mobile']),
'expire_time' => MyC('common_verify_expire_time'), 'expire_time' => MyC('common_verify_expire_time'),
'interval_time' => MyC('common_verify_interval_time'), 'interval_time' => MyC('common_verify_interval_time'),
]; ];

View File

@ -18,12 +18,13 @@ web端
3. 插件(上传、安装、卸载、删除)新增回调事件 3. 插件(上传、安装、卸载、删除)新增回调事件
4. 后台管理登录优化(新增帐号密码+图片验证码、邮件验证码、手机验证码) 4. 后台管理登录优化(新增帐号密码+图片验证码、邮件验证码、手机验证码)
5. 用户登录优化(新增帐号密码+图片验证码、邮件验证码、手机验证码) 5. 用户登录优化(新增帐号密码+图片验证码、邮件验证码、手机验证码)
6. API用户接口新增帐号密码、手机验证码、邮箱验证码登录方式 6. API用户接口新增帐号密码+手机+邮箱[登录、注册]方式、图片验证码+短信邮件验证码发送
小程序 小程序
1. 小程序商品详情标题去除高度限制 1. 小程序商品详情标题去除高度限制
2. 签到优化,不强制填写信息 2. 签到优化,不强制填写信息
3. 微信小程序适配官方新规授权登录逻辑更新 3. 微信小程序适配官方新规授权登录逻辑更新
4. 手机绑定接口更新
插件 插件
1. 应用商店在线自动安装应用插件、开发者提供优质插件、VIP授权管理 1. 应用商店在线自动安装应用插件、开发者提供优质插件、VIP授权管理

View File

@ -85,7 +85,7 @@ Page({
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true}); this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
my.request({ my.request({
url: app.get_request_url('regverifysend', 'user'), url: app.get_request_url('appmobilebindverifysend', 'user'),
method: 'POST', method: 'POST',
data: {mobile: this.data.mobile}, data: {mobile: this.data.mobile},
dataType: 'json', dataType: 'json',
@ -149,7 +149,7 @@ Page({
// 网络请求 // 网络请求
my.request({ my.request({
url: app.get_request_url('reg', 'user'), url: app.get_request_url('appmobilebind', 'user'),
method: 'POST', method: 'POST',
data: e.detail.value, data: e.detail.value,
dataType: 'json', dataType: 'json',

View File

@ -94,7 +94,7 @@ Page({
this.setData({ verify_submit_text: '发送中', verify_loading: true, verify_disabled: true }); this.setData({ verify_submit_text: '发送中', verify_loading: true, verify_disabled: true });
swan.request({ swan.request({
url: app.get_request_url('regverifysend', 'user'), url: app.get_request_url('appmobilebindverifysend', 'user'),
method: 'POST', method: 'POST',
data: { mobile: this.data.mobile }, data: { mobile: this.data.mobile },
dataType: 'json', dataType: 'json',
@ -149,7 +149,7 @@ Page({
// 网络请求 // 网络请求
swan.request({ swan.request({
url: app.get_request_url('reg', 'user'), url: app.get_request_url('appmobilebind', 'user'),
method: 'POST', method: 'POST',
data: e.detail.value, data: e.detail.value,
dataType: 'json', dataType: 'json',

View File

@ -81,7 +81,7 @@ Page({
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true}); this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
qq.request({ qq.request({
url: app.get_request_url('regverifysend', 'user'), url: app.get_request_url('appmobilebindverifysend', 'user'),
method: 'POST', method: 'POST',
data: {mobile: this.data.mobile}, data: {mobile: this.data.mobile},
dataType: 'json', dataType: 'json',
@ -148,7 +148,7 @@ Page({
// 网络请求 // 网络请求
qq.request({ qq.request({
url: app.get_request_url('reg', 'user'), url: app.get_request_url('appmobilebind', 'user'),
method: 'POST', method: 'POST',
data: e.detail.value, data: e.detail.value,
dataType: 'json', dataType: 'json',

View File

@ -113,7 +113,7 @@ Page({
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true}); this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
tt.request({ tt.request({
url: app.get_request_url('regverifysend', 'user'), url: app.get_request_url('appmobilebindverifysend', 'user'),
method: 'POST', method: 'POST',
data: {mobile: this.data.mobile}, data: {mobile: this.data.mobile},
dataType: 'json', dataType: 'json',
@ -179,7 +179,7 @@ Page({
// 网络请求 // 网络请求
tt.request({ tt.request({
url: app.get_request_url('reg', 'user'), url: app.get_request_url('appmobilebind', 'user'),
method: 'POST', method: 'POST',
data: e.detail.value, data: e.detail.value,
dataType: 'json', dataType: 'json',

View File

@ -103,7 +103,7 @@ Page({
this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true}); this.setData({verify_submit_text: '发送中', verify_loading: true, verify_disabled: true});
wx.request({ wx.request({
url: app.get_request_url('regverifysend', 'user'), url: app.get_request_url('appmobilebindverifysend', 'user'),
method: 'POST', method: 'POST',
data: {mobile: this.data.mobile}, data: {mobile: this.data.mobile},
dataType: 'json', dataType: 'json',
@ -168,7 +168,7 @@ Page({
// 网络请求 // 网络请求
wx.request({ wx.request({
url: app.get_request_url('reg', 'user'), url: app.get_request_url('appmobilebind', 'user'),
method: 'POST', method: 'POST',
data: e.detail.value, data: e.detail.value,
dataType: 'json', dataType: 'json',