|
@@ -66,11 +66,17 @@ class UserController extends RestBaseController |
|
@@ -66,11 +66,17 @@ class UserController extends RestBaseController |
66
|
* @method POST
|
66
|
* @method POST
|
67
|
* @header name:XX-Token require:1 default: desc:token
|
67
|
* @header name:XX-Token require:1 default: desc:token
|
68
|
* @param name:mobile require:1
|
68
|
* @param name:mobile require:1
|
|
|
69
|
+ * @param name:code require:1
|
69
|
*/
|
70
|
*/
|
70
|
public function mobile(){
|
71
|
public function mobile(){
|
71
|
$param=$this->request->param();
|
72
|
$param=$this->request->param();
|
72
|
- Db::name('user')->where('id',$this->getUserId())->update(['mobile'=>$param['mobile']]);
|
|
|
73
|
- $this->success('注册提交成功');
|
73
|
+ $re = cmf_check_verification_code($param['mobile'], $param['code'], true);
|
|
|
74
|
+ if ($re == "") {
|
|
|
75
|
+ Db::name('user')->where('id',$this->getUserId())->update(['mobile'=>$param['mobile']]);
|
|
|
76
|
+ $this->success('注册提交成功');
|
|
|
77
|
+ } else {
|
|
|
78
|
+ $this->error($re);
|
|
|
79
|
+ }
|
74
|
}
|
80
|
}
|
75
|
|
81
|
|
76
|
/**
|
82
|
/**
|
|
@@ -83,19 +89,22 @@ class UserController extends RestBaseController |
|
@@ -83,19 +89,22 @@ class UserController extends RestBaseController |
83
|
* @param name:mobile require:1
|
89
|
* @param name:mobile require:1
|
84
|
*/
|
90
|
*/
|
85
|
public function getCode(){
|
91
|
public function getCode(){
|
86
|
- $param=$this->request->param();
|
|
|
87
|
- $param['mobile']=17694933850;
|
|
|
88
|
-// require_once VENDOR_PATH . "sms/serverSid.php";
|
|
|
89
|
require_once VENDOR_PATH . "sms/lib/Ucpaas.class.php";
|
92
|
require_once VENDOR_PATH . "sms/lib/Ucpaas.class.php";
|
|
|
93
|
+ $param=$this->request->param();
|
90
|
$options['accountsid']='d63e23ab657c95babad1681133dbabdc';
|
94
|
$options['accountsid']='d63e23ab657c95babad1681133dbabdc';
|
91
|
//填写在开发者控制台首页上的Auth Token
|
95
|
//填写在开发者控制台首页上的Auth Token
|
92
|
$options['token']='1fc7377f48edb5bf1659284210f16418';
|
96
|
$options['token']='1fc7377f48edb5bf1659284210f16418';
|
93
|
- $send=new \Ucpaas($options);
|
97
|
+
|
|
|
98
|
+
|
94
|
$code = cmf_get_verification_code($param['mobile'], 4);
|
99
|
$code = cmf_get_verification_code($param['mobile'], 4);
|
95
|
$appid = "78950d10e37b4ae5bd9b9c08f3720db3"; //应用的ID,可在开发者控制台内的短信产品下查看
|
100
|
$appid = "78950d10e37b4ae5bd9b9c08f3720db3"; //应用的ID,可在开发者控制台内的短信产品下查看
|
96
|
$templateid = "41494"; //可在后台短信产品→选择接入的应用→短信模板-模板ID,查看该模板ID
|
101
|
$templateid = "41494"; //可在后台短信产品→选择接入的应用→短信模板-模板ID,查看该模板ID
|
97
|
$uid = "";
|
102
|
$uid = "";
|
98
|
//70字内(含70字)计一条,超过70字,按67字/条计费,超过长度短信平台将会自动分割为多条发送。分割后的多条短信将按照具体占用条数计费。
|
103
|
//70字内(含70字)计一条,超过70字,按67字/条计费,超过长度短信平台将会自动分割为多条发送。分割后的多条短信将按照具体占用条数计费。
|
99
|
- echo $send->SendSms($appid,$templateid,$code,$param['mobile'],$uid);
|
104
|
+
|
|
|
105
|
+ $send=new \Ucpaas($options);
|
|
|
106
|
+ $send->SendSms($appid,$templateid,$code,$param['mobile'],$uid);
|
|
|
107
|
+ cmf_verification_code_log($param['mobile'], $code, 180);
|
|
|
108
|
+ $this->success('验证码发送成功');
|
100
|
}
|
109
|
}
|
101
|
} |
110
|
} |