|
|
|
@ -4,6 +4,7 @@ namespace Admin\Controller;
|
|
|
|
|
use User\Api\UserApi;
|
|
|
|
|
use Com\Wechat;
|
|
|
|
|
use Com\WechatAuth;
|
|
|
|
|
use Base\Tool\TaskClient;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 后台首页控制器
|
|
|
|
@ -78,7 +79,9 @@ class PublicController extends \Think\Controller
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
/* 检测验证码 TODO: */
|
|
|
|
|
|
|
|
|
|
$this->checksafecode($mobile, $verify, false);
|
|
|
|
|
if (!$this->checksafecode($mobile, $verify)) {
|
|
|
|
|
$this->error('验证码错误');
|
|
|
|
|
}
|
|
|
|
|
$promote = M('promote', 'tab_')->where([
|
|
|
|
|
'mobile_phone' => $mobile,
|
|
|
|
|
'level' => 1,
|
|
|
|
@ -341,41 +344,31 @@ class PublicController extends \Think\Controller
|
|
|
|
|
*/
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手机安全码验证
|
|
|
|
|
* @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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|