Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
亲子游项目
backend
Commits
bd16c14c
Commit
bd16c14c
authored
Jan 05, 2019
by
LiuJunYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
手机号授权问题
parent
cdeb74d7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
application/api/controller/User.php
+9
-9
No files found.
application/api/controller/User.php
View file @
bd16c14c
...
@@ -5,6 +5,7 @@ namespace app\api\controller;
...
@@ -5,6 +5,7 @@ namespace app\api\controller;
use
app\common\model\User
as
UserModel
;
use
app\common\model\User
as
UserModel
;
use
app\admin\controller\Upload
;
use
app\admin\controller\Upload
;
use
app\common\model\VipRelation
as
VipRelationModel
;
use
app\common\model\VipRelation
as
VipRelationModel
;
use
think\Db
;
use
think\Exception
;
use
think\Exception
;
class
User
extends
Base
class
User
extends
Base
...
@@ -311,18 +312,19 @@ class User extends Base
...
@@ -311,18 +312,19 @@ class User extends Base
public
function
savePhone
()
public
function
savePhone
()
{
{
try
{
try
{
Db
::
startTrans
();
if
(
!
$this
->
userinfo
)
{
if
(
!
$this
->
userinfo
)
{
return
[
"code"
=>
1
,
"msg"
=>
"未登录"
];
return
[
"code"
=>
1
,
"msg"
=>
"未登录"
];
}
}
//校验手机号
//校验手机号
if
(
!
preg_match
(
"/^1[0-9]
{
10}$|^0[0-9]{9,10
}
$/"
,
input
(
'phone'
)))
{
if
(
!
preg_match
(
"/^1[0-9]
{
10}$|^0[0-9]{9,10
}
$/"
,
input
(
'phone'
)))
{
return
[
'code'
=>
1
,
'请输入正确的手机号'
];
return
[
'code'
=>
1
,
'
msg'
=>
'
请输入正确的手机号'
];
}
}
//查询手机号是否重复
//查询手机号是否重复
$user
=
UserModel
::
get
([
'id'
=>
[
'neq'
,
$this
->
userinfo
[
0
]],
'phone'
=>
input
(
'phone'
)]);
$user
=
UserModel
::
get
([
'id'
=>
[
'neq'
,
$this
->
userinfo
[
0
]],
'phone'
=>
input
(
'phone'
)]);
if
(
$user
)
{
if
(
$user
)
{
return
[
'code'
=>
1
,
'该手机号已经注册过'
];
return
[
'code'
=>
1
,
'
msg'
=>
'
该手机号已经注册过'
];
}
}
$hidephone
=
substr_replace
(
input
(
'phone'
),
'****'
,
3
,
4
);
$hidephone
=
substr_replace
(
input
(
'phone'
),
'****'
,
3
,
4
);
$user
=
UserModel
::
get
(
$this
->
userinfo
[
0
]);
$user
=
UserModel
::
get
(
$this
->
userinfo
[
0
]);
...
@@ -331,14 +333,12 @@ class User extends Base
...
@@ -331,14 +333,12 @@ class User extends Base
$result
=
[
'phone'
=>
input
(
'phone'
),
'hidephone'
=>
$hidephone
];
$result
=
[
'phone'
=>
input
(
'phone'
),
'hidephone'
=>
$hidephone
];
//关联VIP
//关联VIP
$is_relation
=
$this
->
vipRelation
(
input
(
'phone'
));
$is_relation
=
$this
->
vipRelation
(
input
(
'phone'
));
Db
::
commit
();
return
[
"code"
=>
0
,
"msg"
=>
"获取成功"
,
'data'
=>
$result
,
'is_relation'
=>
$is_relation
];
return
[
"code"
=>
0
,
"msg"
=>
"获取成功"
,
'data'
=>
$result
,
'is_relation'
=>
$is_relation
];
}
catch
(
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
D
D
b
::
rollback
();
return
[
'code'
=>
1
,
'msg'
=>
'手机号保存失败'
];
return
[
'code'
=>
1
,
'msg'
=>
'手机号保存失败'
];
}
}
}
}
public
function
vipRelation
(
$phone
)
public
function
vipRelation
(
$phone
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment