|
|
|
@ -8,6 +8,7 @@ use Org\UcenterSDK\Ucservice;
|
|
|
|
|
use User\Api\MemberApi;
|
|
|
|
|
use Admin\Model\PointTypeModel;
|
|
|
|
|
use Think\Log;
|
|
|
|
|
use Base\Tool\TaskClient;
|
|
|
|
|
|
|
|
|
|
class UserController extends BaseController
|
|
|
|
|
{
|
|
|
|
@ -337,7 +338,9 @@ class UserController extends BaseController
|
|
|
|
|
$password = $safeinfo['password'];
|
|
|
|
|
$sex = $safeinfo['sex'];
|
|
|
|
|
|
|
|
|
|
$this->checksafecode($phone, $safecode, false);
|
|
|
|
|
if (!$this->checksafecode($phone, $safecode)) {
|
|
|
|
|
return $this->ajaxReturn(array('status' => 0, 'msg' => '验证失败'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**是否开启ucenter**/
|
|
|
|
@ -577,17 +580,15 @@ class UserController extends BaseController
|
|
|
|
|
*/
|
|
|
|
|
public function telsafecode($phone = '', $delay = 10, $flag = true)
|
|
|
|
|
{
|
|
|
|
|
$result = R('Common/Sms/send_sms_code', array($phone, $delay, false));
|
|
|
|
|
|
|
|
|
|
if ($result['code'] == 200) {
|
|
|
|
|
$taskClient = new TaskClient();
|
|
|
|
|
$result = $taskClient->sendSms($phone);
|
|
|
|
|
$data = [];
|
|
|
|
|
if ($result['code'] == TaskClient::SUCCESS) {
|
|
|
|
|
$data['status'] = 1;
|
|
|
|
|
$data['data'] = $result['data'];
|
|
|
|
|
} else {
|
|
|
|
|
$data['status'] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data['msg'] = $result['msg'];
|
|
|
|
|
|
|
|
|
|
$data['msg'] = $result['message'];
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
@ -614,24 +615,16 @@ class UserController extends BaseController
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手机安全码验证
|
|
|
|
|
* @param bool $flag true 用于直接异步请求 false 用于方法调用
|
|
|
|
|
* @param [type] $vcode [description]
|
|
|
|
|
*/
|
|
|
|
|
public function checksafecode($phone, $vcode, $flag = true)
|
|
|
|
|
public function checksafecode($phone, $code)
|
|
|
|
|
{
|
|
|
|
|
$result = R('Common/Sms/verify_sms_code', array($phone, $vcode, false));
|
|
|
|
|
|
|
|
|
|
if ($result['code'] == 200) {
|
|
|
|
|
$data['status'] = 1;
|
|
|
|
|
if ($flag) {
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$taskClient = new TaskClient();
|
|
|
|
|
$result = $taskClient->checkSms($phone, $code);
|
|
|
|
|
$data = [];
|
|
|
|
|
if ($result && $result['code'] == TaskClient::SUCCESS) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
$data['status'] = 0;
|
|
|
|
|
$data['msg'] = $result['msg'];
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
exit;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -645,8 +638,11 @@ class UserController extends BaseController
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
|
|
|
|
|
$phone = $_POST['phone'];
|
|
|
|
|
$code = $_REQUEST['code'];
|
|
|
|
|
|
|
|
|
|
$this->checksafecode($phone, $_REQUEST['code'], false);
|
|
|
|
|
if (!$this->checksafecode($phone, $code)) {
|
|
|
|
|
return $this->ajaxReturn(array('status' => 0, 'msg' => '验证失败'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->success('验证成功', U('User/forget1', array('phone' => $phone)));
|
|
|
|
|
|
|
|
|
@ -662,8 +658,16 @@ class UserController extends BaseController
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
$new_pwd = $_REQUEST['new_pwd'];
|
|
|
|
|
$u_uid['phone'] = $_REQUEST['phone'];
|
|
|
|
|
$code = $_REQUEST['code'];
|
|
|
|
|
//验证短信验证码
|
|
|
|
|
$this->checksafecode($u_uid['phone'], $_REQUEST['code'], false);
|
|
|
|
|
if (!$this->checksafecode($u_uid['phone'], $code)) {
|
|
|
|
|
$this->error("验证失败");
|
|
|
|
|
}
|
|
|
|
|
$user = M('user', 'tab_')->where($u_uid)->find();
|
|
|
|
|
if (!$user) {
|
|
|
|
|
$this->error("账号不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$result = M('user', 'tab_')->where($u_uid)->setField('password', think_ucenter_md5($new_pwd, UC_AUTH_KEY));
|
|
|
|
|
if ($result != false) {
|
|
|
|
|
$this->success("修改成功", U('User/login'));
|
|
|
|
@ -700,7 +704,6 @@ class UserController extends BaseController
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
$result = $this->telsafecode($account);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -880,7 +883,10 @@ class UserController extends BaseController
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
$code = I("post.scode");
|
|
|
|
|
$phone = I("post.phone");
|
|
|
|
|
$this->checksafecode($phone, $code, false);
|
|
|
|
|
if (!$this->checksafecode($phone, $code)) {
|
|
|
|
|
echo json_encode(array('status' => 0, 'msg' => '验证失败'));
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
if (!$user['phone']) {
|
|
|
|
|
$where['account'] = $phone;
|
|
|
|
|
$where['phone'] = $phone;
|
|
|
|
|