Commit f852e444 authored by clone's avatar clone

bug

parent aed133bf
...@@ -103,11 +103,11 @@ class Register extends Basic ...@@ -103,11 +103,11 @@ class Register extends Basic
*/ */
public function removeBinding() public function removeBinding()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"buyer_id" => 5, "buyer_id" => 5,
"user_id" => 25983, "user_id" => 25983,
);*/ );*/
$checkResult = $this->validate($params, "RegisterValidate.removeBind"); $checkResult = $this->validate($params, "RegisterValidate.removeBind");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
...@@ -120,4 +120,28 @@ class Register extends Basic ...@@ -120,4 +120,28 @@ class Register extends Basic
return $this->response("101", "解绑失败"); return $this->response("101", "解绑失败");
} }
} }
/**
* 绑定微信
* @return \think\Response
*/
public function bindingWx()
{
$params = $this->params;
/* $params = array(
"wx_union_id" => "asdfasfasdf",
"phone" => 25983,
);*/
$checkResult = $this->validate($params, "RegisterValidate.bind");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$msg = $this->service_->binding($params["wx_union_id"], $params["phone"]);
if ($msg["code"] == 101) {
return $this->response("101", $msg["data"]);
} else {
return $this->response("200", "绑定成功", $msg["data"]);
}
}
} }
\ No newline at end of file
...@@ -132,6 +132,18 @@ class RegisterService ...@@ -132,6 +132,18 @@ class RegisterService
return $this->userModel->unbundlingWx($params); return $this->userModel->unbundlingWx($params);
} }
/**
* 绑定微信
* @param $wx_union_id
* @param $phone
* @return array
*/
public function binding($wx_union_id, $phone)
{
return $this->userRegister($phone, 0, 0, $wx_union_id, 0);
}
/** /**
* 组装bin * 组装bin
* @param $user_nick * @param $user_nick
...@@ -182,7 +194,7 @@ class RegisterService ...@@ -182,7 +194,7 @@ class RegisterService
$userParams["update_time"] = date("Y-m-d H:i:s", time()); $userParams["update_time"] = date("Y-m-d H:i:s", time());
//分享出去激活的不记录登录时间和ip //分享出去激活的不记录登录时间和ip
if ($referrer_id == 0) { if ($referrer_id == 0 && $last_login_ip != 0) {
$userParams["last_login_ip"] = $last_login_ip; $userParams["last_login_ip"] = $last_login_ip;
$userParams["last_login_time"] = date("Y-m-d H:i:s", time()); $userParams["last_login_time"] = date("Y-m-d H:i:s", time());
} }
......
...@@ -39,5 +39,6 @@ class RegisterValidate extends Validate ...@@ -39,5 +39,6 @@ class RegisterValidate extends Validate
'verify' => [ 'phone', 'device_id' ], 'verify' => [ 'phone', 'device_id' ],
'register' => [ 'phone', 'device_id', 'code' ], 'register' => [ 'phone', 'device_id', 'code' ],
'removeBind' => [ 'user_id', 'buyer_id' ], 'removeBind' => [ 'user_id', 'buyer_id' ],
'bind' => [ 'user_id', 'wx_union_id' ],
]; ];
} }
\ No newline at end of file
...@@ -317,6 +317,7 @@ Route::group('api', [ ...@@ -317,6 +317,7 @@ Route::group('api', [
'sendCode' => [ 'api/Register/registerSendCode', [ 'method' => 'POST' ] ], 'sendCode' => [ 'api/Register/registerSendCode', [ 'method' => 'POST' ] ],
'userVerify' => [ 'api/Register/registerVerify', [ 'method' => 'POST' ] ], 'userVerify' => [ 'api/Register/registerVerify', [ 'method' => 'POST' ] ],
'removeBind' => [ 'api/Register/removeBinding', [ 'method' => 'POST|GET' ] ], 'removeBind' => [ 'api/Register/removeBinding', [ 'method' => 'POST|GET' ] ],
'bindingWx' => [ 'api/Register/bindingWx', [ 'method' => 'POST' ] ], //绑定微信
]); ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment