|
@@ -143,7 +143,7 @@ class UserController extends BaseController
|
|
|
public function sendCode(Request $request)
|
|
|
{
|
|
|
$phone = $request->post('phone');
|
|
|
- if (($this->phone && $this->phone === $phone) || !$this->phone) {
|
|
|
+ if ($phone) {
|
|
|
$code = random_int(1000, 9999);
|
|
|
Redis::setex('quser_code:' . $phone, 120, $code);
|
|
|
AliSMS::send($phone, 'quickapp_user_bind_phone', ['code' => $code]);
|
|
@@ -177,9 +177,7 @@ class UserController extends BaseController
|
|
|
$old = Redis::get('quser_code:' . $phone);
|
|
|
if ($old && $old == $code) {
|
|
|
Redis::del('quser_code:' . $phone);
|
|
|
- if ($this->phone == $phone) {
|
|
|
- return response()->success();
|
|
|
- } else if (!$this->phone) {
|
|
|
+ if (!$this->phone) {
|
|
|
$result = (new QappUserService)->bindPhone($this->uid, $phone);
|
|
|
if (!$result) {
|
|
|
return response()->success();
|
|
@@ -187,7 +185,7 @@ class UserController extends BaseController
|
|
|
return response()->error('WAP_BIND_PHONE_EXIST');
|
|
|
}
|
|
|
} else {
|
|
|
- return response()->error('WAP_BIND_PHONE_EXIST');
|
|
|
+ return response()->success();
|
|
|
}
|
|
|
} else {
|
|
|
return response()->error('WAP_SEND_CODE_ERROR');
|