Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
9a91f1b2
Commit
9a91f1b2
authored
Sep 12, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增客户验证器
parent
47bd27e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
7 deletions
+39
-7
UserService.php
application/index/service/UserService.php
+8
-0
MemberValidate.php
application/index/validate/MemberValidate.php
+31
-7
No files found.
application/index/service/UserService.php
View file @
9a91f1b2
...
...
@@ -10,6 +10,7 @@ namespace app\index\service;
use
app\api_broker\service\PushMessageService
;
use
app\index\validate\MemberValidate
;
use
app\model\AAgents
;
use
app\model\GOperatingRecords
;
use
app\model\Users
;
...
...
@@ -37,6 +38,13 @@ class UserService
*/
public
function
editUser
(
$id
,
$data
,
$operation_id
)
{
$validate
=
new
MemberValidate
();
if
(
!
$validate
->
scene
(
'add'
)
->
check
(
$data
))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$validate
->
getError
();
return
$result
;
}
$this
->
operation_id
=
$operation_id
;
$result
=
[];
$agent_id_old
=
$referrer_id_old
=
$referrer_source_old
=
0
;
...
...
application/index/validate/MemberValidate.php
View file @
9a91f1b2
...
...
@@ -6,24 +6,47 @@ use think\Validate;
/**
* Created by PhpStorm.
* User: zhuwei
* User: zhu
wei
* Date: 2018/8/29
* Time: 上午11:02
*/
class
MemberValidate
extends
Validate
{
protected
$regex
=
[
'phone'
=>
'/^1[23456789]{1}\d{9}$/'
];
protected
$rule
=
[
'agent_id_for_bind'
=>
'require|number|gt:0'
'agent_id_for_bind'
=>
'require|number|gt:0'
,
'user_nick'
=>
'length:0,80'
,
'user_name'
=>
'length:0,80'
,
'user_phone'
=>
'require|regex:phone'
,
'user_pswd'
=>
'length:0,255'
,
'sex'
=>
'in:0,1,2'
,
'referrer_source'
=>
'in:10,20'
,
'source'
=>
'in:10,20,30'
,
'source_intro'
=>
'in:0,1,2,3,4,5,6,7'
,
'user_status'
=>
'in:0,1,-1'
,
'user_label'
=>
'in:0,1,2'
,
];
protected
$message
=
[
'agent_id_for_bind.require'
=>
'agent_id_for_bind为必填字段'
,
'agent_id_for_bind.number'
=>
'agent_id_for_bind只能为数字'
,
'agent_id_for_bind.gt'
=>
'agent_id_for_bind必须大于0'
,
'agent_id_for_bind.require'
=>
'agent_id_for_bind为必填字段'
,
'agent_id_for_bind.number'
=>
'agent_id_for_bind只能为数字'
,
'agent_id_for_bind.gt'
=>
'agent_id_for_bind必须大于0'
,
'user_nick.length'
=>
'名字字数超过限制'
,
'user_name.length'
=>
'名字字数超过限制'
,
'user_phone.require'
=>
'手机号必填'
,
'user_phone.regex'
=>
'手机号格式错误'
,
'user_pswd.length'
=>
'密码长度超过限制'
,
'sex.in'
=>
'性别参数错误'
,
'referrer_source.in'
=>
'邀请来源参数错误'
,
'source.in'
=>
'注册来源参数错误'
,
'source_intro.in'
=>
'来源简述参数错误'
,
'user_status.in'
=>
'客户状态参数错误'
,
'user_label.in'
=>
'用户标签'
];
protected
$scene
=
[
'getUserList'
=>
[
'agent_id_for_bind'
],
'getUserList'
=>
[
'agent_id_for_bind'
],
'add'
=>
'user_phonp,user_name,user_nick,user_pswd,sex,referrer_source,source,source_intro,user_status,user_label'
];
}
\ No newline at end of file
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