...
|
...
|
@@ -195,6 +195,7 @@ class UserController extends CommonController |
|
|
$code = $request->param('code');
|
|
|
$where_code['tel'] = $data['tel'];
|
|
|
$where_code['type'] = 1;
|
|
|
$where_code['status'] = 1;
|
|
|
$where_code['create_time'] = array('egt',(time()-300));
|
|
|
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
|
|
|
if(!$find_code){
|
...
|
...
|
@@ -579,12 +580,20 @@ class UserController extends CommonController |
|
|
if($user_id){
|
|
|
if($data['newPassword'] == $data['sureNewPassword']){
|
|
|
$where_update['id'] = $user_id['id'];
|
|
|
$middleStr = rand(1000,9999).time().rand(100,999);
|
|
|
$update['token'] = $this->md5($middleStr);
|
|
|
// $middleStr = rand(1000,9999).time().rand(100,999);
|
|
|
// $update['token'] = $this->md5($middleStr);
|
|
|
$update['password'] = $this->md5($data['newPassword']);
|
|
|
$is_update = Db::name('Member')->where($where_update)->update($update);
|
|
|
$update['update_time'] = time();
|
|
|
|
|
|
$check['password'] = $data['newPassword'];
|
|
|
$validate = Loader::validate('User');
|
|
|
if (!$validate->scene('pass')->check($check)) {
|
|
|
$this->apiResponse('0', $validate->getError());
|
|
|
}else{
|
|
|
$is_update = Db::name('Member')->where($where_update)->update($update);
|
|
|
}
|
|
|
if($is_update){
|
|
|
$final['token'] = $update['token'];
|
|
|
$final['token'] = $data['token'];
|
|
|
$this->apiResponse('1','成功',$final);
|
|
|
}else{
|
|
|
$this->apiResponse('0','修改失败');
|
...
|
...
|
@@ -621,20 +630,23 @@ class UserController extends CommonController |
|
|
if(empty($data['code'])){
|
|
|
$this->apiResponse('0','请输入短信验证码');
|
|
|
}
|
|
|
$where_mem['tel'] = $data['tel'];
|
|
|
$where_mem['status'] = array('neq',9);
|
|
|
$is = Db::name('Member')->where($where_mem)->field('id')->find();
|
|
|
if(!$is){
|
|
|
$this->apiResponse('0','该手机号暂未注册');
|
|
|
}
|
|
|
// 验证手机验证码
|
|
|
$where_Code['tel'] = $data['tel'];
|
|
|
$where_Code['type'] = 2;
|
|
|
$where_Code['status'] = 1;
|
|
|
$where_Code['create_time'] = array('egt',(time()-300));
|
|
|
$code = Db::name('Code')->where($where_Code)->order('create_time desc')->find();
|
|
|
if($code['code'] != $data['code']){
|
|
|
$this->apiResponse('0','短信验证码错误');
|
|
|
}else{
|
|
|
$this->apiResponse('1','成功');
|
|
|
$where_mem['tel'] = $data['tel'];
|
|
|
$where_mem['status'] = array('neq',9);
|
|
|
$is = Db::name('Member')->where($where_mem)->field('id')->find();
|
|
|
if(!$is){
|
|
|
$this->apiResponse('0','该手机号暂未注册');
|
|
|
}else{
|
|
|
$this->apiResponse('1','成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}else{
|
...
|
...
|
@@ -650,7 +662,7 @@ class UserController extends CommonController |
|
|
* @title 密码找回第二步(sure)
|
|
|
* @description 接口说明
|
|
|
* @author 开发者
|
|
|
* @url /api/portal/User/findPassword
|
|
|
* @url /api/portal/User/findPasswordNext
|
|
|
* @method POST
|
|
|
* @param name:tel type:int require:1 default: other: desc:手机号
|
|
|
* @param name:newPassword type:int require:1 default: other: desc:新密码
|
...
|
...
|
@@ -675,6 +687,11 @@ class UserController extends CommonController |
|
|
if(!$is){
|
|
|
$this->apiResponse('0','该手机号暂未注册');
|
|
|
}
|
|
|
$choose['password'] = $data['newPassword'];
|
|
|
$validate = Loader::validate('User');
|
|
|
if (!$validate->scene('pass')->check($choose)) {
|
|
|
$this->apiResponse('0', $validate->getError());
|
|
|
}
|
|
|
if($data['newPassword'] == $data['sureNewPassword']){
|
|
|
$where_update['tel'] = $data['tel'];
|
|
|
$middleStr = rand(1000,9999).time().rand(100,999);
|
...
|
...
|
@@ -682,7 +699,7 @@ class UserController extends CommonController |
|
|
$update['password'] = $this->md5($data['newPassword']);
|
|
|
$is_update = Db::name('Member')->where($where_update)->update($update);
|
|
|
if($is_update){
|
|
|
$this->apiResponse('1','成功',$update['token']);
|
|
|
$this->apiResponse('1','密码重置成功',$update['token']);
|
|
|
}else{
|
|
|
$this->apiResponse('0','修改失败');
|
|
|
}
|
...
|
...
|
@@ -788,11 +805,18 @@ class UserController extends CommonController |
|
|
public function myCard(Request $request){
|
|
|
$data = $request->param();
|
|
|
$user = $this->myleft($data['token']);
|
|
|
if(!empty($data['bank_id']) && !empty($data['card_num'])){
|
|
|
if(!empty($data['card_num'])){
|
|
|
if(empty($data['bank_id'])){
|
|
|
$this->apiResponse('0','请选择银行名称');
|
|
|
}
|
|
|
if(strlen($data['card_num']) <16 && strlen($data['card_num']) >20){
|
|
|
$this->apiResponse('0', '银行卡号为16-20位!');
|
|
|
}
|
|
|
// 验证码
|
|
|
$where_code['type'] = 5;
|
|
|
$where_code['status'] = 1;
|
|
|
$where_code['tel'] = $user['tel'];
|
|
|
$where_code['create_time'] = array('egt',(time()-300));
|
|
|
$code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
|
|
|
if(!$code){
|
|
|
$this->apiResponse('0','请先获取验证码');
|
...
|
...
|
@@ -802,6 +826,10 @@ class UserController extends CommonController |
|
|
}
|
|
|
if($code['code'] != $data['code']){
|
|
|
$this->apiResponse('0','验证码错误');
|
|
|
}else{
|
|
|
$updateCode['status'] = 9;
|
|
|
$updateCode['update_time'] = time();
|
|
|
Db::name('Code')->where($where_code)->update($updateCode);
|
|
|
}
|
|
|
// $where_findC['card_num'] = $data['card_num'];
|
|
|
$where_findC['user_id'] = $user['id'];
|
...
|
...
|
@@ -810,6 +838,10 @@ class UserController extends CommonController |
|
|
if($is_issetCard){
|
|
|
$this->apiResponse('0','您已绑定银行卡');
|
|
|
}
|
|
|
if(empty($data['bank_id'])){
|
|
|
$this->apiResponse('0','请选择银行名称');
|
|
|
}
|
|
|
|
|
|
$add['bank_id'] = $data['bank_id'];
|
|
|
$add['card_num'] = $data['card_num'];
|
|
|
$add['create_time'] = time();
|
...
|
...
|
@@ -850,10 +882,17 @@ class UserController extends CommonController |
|
|
$this->apiResponse('0','银行卡id不能为空');
|
|
|
}
|
|
|
if(!empty($data['bank_id'])){
|
|
|
if(empty($data['card_num'])){
|
|
|
$this->apiResponse('0','银行卡号不能为空');
|
|
|
}
|
|
|
if(strlen($data['card_num']) <16 && strlen($data['card_num']) >20){
|
|
|
$this->apiResponse('0', '银行卡号为16-20位!');
|
|
|
}
|
|
|
// 验证码
|
|
|
$where_code['type'] = 5;
|
|
|
$where_code['status'] = 1;
|
|
|
$where_code['tel'] = $user['tel'];
|
|
|
$where_code['create_time'] = array('egt',(time()-300));
|
|
|
$code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
|
|
|
if(!$code){
|
|
|
$this->apiResponse('0','请先获取验证码');
|
...
|
...
|
@@ -863,6 +902,10 @@ class UserController extends CommonController |
|
|
}
|
|
|
if($code['code'] != $data['code']){
|
|
|
$this->apiResponse('0','验证码错误');
|
|
|
}else{
|
|
|
$updateCode['status'] = 9;
|
|
|
$updateCode['update_time'] = time();
|
|
|
Db::name('Code')->where($where_code)->update($updateCode);
|
|
|
}
|
|
|
$where_add['id'] = $data['card_id'];
|
|
|
$add['bank_id'] = $data['bank_id'];
|
...
|
...
|
|