切换导航条
此项目
正在载入...
登录
潘浩文
/
maifuzi
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
潘浩文
6 years ago
提交
9189a36518ee49bb6edaa02331c6a3e2c52586eb
1 个父辈
d130b5cf
1 个管道 的构建
通过
耗费 1 秒
个人中心接口
变更
2
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
17 行增加
和
8 行删除
api/portal/controller/UserController.php
simplewind/cmf/common.php
api/portal/controller/UserController.php
查看文件 @
9189a36
...
...
@@ -66,11 +66,17 @@ class UserController extends RestBaseController
* @method POST
* @header name:XX-Token require:1 default: desc:token
* @param name:mobile require:1
* @param name:code require:1
*/
public
function
mobile
(){
$param
=
$this
->
request
->
param
();
Db
::
name
(
'user'
)
->
where
(
'id'
,
$this
->
getUserId
())
->
update
([
'mobile'
=>
$param
[
'mobile'
]]);
$this
->
success
(
'注册提交成功'
);
$re
=
cmf_check_verification_code
(
$param
[
'mobile'
],
$param
[
'code'
],
true
);
if
(
$re
==
""
)
{
Db
::
name
(
'user'
)
->
where
(
'id'
,
$this
->
getUserId
())
->
update
([
'mobile'
=>
$param
[
'mobile'
]]);
$this
->
success
(
'注册提交成功'
);
}
else
{
$this
->
error
(
$re
);
}
}
/**
...
...
@@ -83,19 +89,22 @@ class UserController extends RestBaseController
* @param name:mobile require:1
*/
public
function
getCode
(){
$param
=
$this
->
request
->
param
();
$param
[
'mobile'
]
=
17694933850
;
// require_once VENDOR_PATH . "sms/serverSid.php";
require_once
VENDOR_PATH
.
"sms/lib/Ucpaas.class.php"
;
$param
=
$this
->
request
->
param
();
$options
[
'accountsid'
]
=
'd63e23ab657c95babad1681133dbabdc'
;
//填写在开发者控制台首页上的Auth Token
$options
[
'token'
]
=
'1fc7377f48edb5bf1659284210f16418'
;
$send
=
new
\Ucpaas
(
$options
);
$code
=
cmf_get_verification_code
(
$param
[
'mobile'
],
4
);
$appid
=
"78950d10e37b4ae5bd9b9c08f3720db3"
;
//应用的ID,可在开发者控制台内的短信产品下查看
$templateid
=
"41494"
;
//可在后台短信产品→选择接入的应用→短信模板-模板ID,查看该模板ID
$uid
=
""
;
//70字内(含70字)计一条,超过70字,按67字/条计费,超过长度短信平台将会自动分割为多条发送。分割后的多条短信将按照具体占用条数计费。
echo
$send
->
SendSms
(
$appid
,
$templateid
,
$code
,
$param
[
'mobile'
],
$uid
);
$send
=
new
\Ucpaas
(
$options
);
$send
->
SendSms
(
$appid
,
$templateid
,
$code
,
$param
[
'mobile'
],
$uid
);
cmf_verification_code_log
(
$param
[
'mobile'
],
$code
,
180
);
$this
->
success
(
'验证码发送成功'
);
}
}
...
...
simplewind/cmf/common.php
查看文件 @
9189a36
...
...
@@ -1169,7 +1169,7 @@ function cmf_get_verification_code($account, $length = 6)
if
(
empty
(
$account
))
return
false
;
$verificationCodeQuery
=
Db
::
name
(
'verification_code'
);
$currentTime
=
time
();
$maxCount
=
5
;
$maxCount
=
20
;
$findVerificationCode
=
$verificationCodeQuery
->
where
(
'account'
,
$account
)
->
find
();
$result
=
false
;
if
(
empty
(
$findVerificationCode
))
{
...
...
请
注册
或
登录
后发表评论