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
007e0929
Commit
007e0929
authored
Oct 18, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑经纪人
parent
40560a9a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
25 deletions
+30
-25
Broker.php
application/index/controller/Broker.php
+5
-4
BrokerService.php
application/index/service/BrokerService.php
+16
-6
AAgentValidate.php
application/index/validate/AAgentValidate.php
+7
-8
AAgents.php
application/model/AAgents.php
+2
-7
No files found.
application/index/controller/Broker.php
View file @
007e0929
...
...
@@ -510,15 +510,16 @@ class Broker extends Basic
$result
[
'data'
]
=
[];
if
(
$this
->
request
->
isPost
())
{
$broker_service
=
new
BrokerService
();
$data
=
$broker_service
->
saveAgentData
(
$this
->
params
,
$this
->
params
[
'site_id'
],
$this
->
userId
);
if
(
$
result
[
'status'
]
==
'fail'
)
{
$data
=
$broker_service
->
saveAgentData
(
$this
->
params
,
$this
->
userId
);
if
(
$
data
[
'status'
]
==
'fail'
)
{
$result
[
'code'
]
=
101
;
$result
[
'msg'
]
=
$data
[
'msg'
];
}
$result
[
'msg'
]
=
$data
[
'msg'
];
}
else
{
//查看
$m_agent
=
new
AAgents
();
$result
[
'data'
]
=
$m_agent
->
verifyUser
(
'id,name,phone,password,district_id,store_id,sex,admin_off,remarks'
,
''
,
[
'id'
=>
$this
->
params
[
'id'
]]);
$field
=
'id,name,phone,password,district_id,store_id,sex,admin_off,remarks'
;
$result
[
'data'
]
=
$m_agent
->
verifyUser
(
$field
,
''
,
[
'id'
=>
$this
->
params
[
'id'
]]);
}
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result
[
'data'
]);
}
...
...
application/index/service/BrokerService.php
View file @
007e0929
...
...
@@ -11,6 +11,7 @@ namespace app\index\service;
use
app\index\validate\AAgentValidate
;
use
app\model\AAgents
;
use
app\model\ADistrict
;
class
BrokerService
{
...
...
@@ -26,13 +27,14 @@ class BrokerService
*
* @param array $data
* @param int $operation_id
* @param int $site_id
* @return mixed
*/
public
function
saveAgentData
(
array
$data
,
int
$
site_id
,
int
$
operation_id
)
public
function
saveAgentData
(
array
$data
,
int
$operation_id
)
{
$result
[
'status'
]
=
'fail'
;
$validate
=
new
AAgentValidate
();
$m_district
=
new
ADistrict
();
$data
[
'site_id'
]
=
$m_district
->
getDistrictKeyById
(
'site_id'
,
[
'id'
=>
$data
[
'district_id'
]]);
if
(
empty
(
$data
[
'id'
]))
{
$check
=
$validate
->
scene
(
'add'
)
->
check
(
$data
);
...
...
@@ -46,12 +48,22 @@ class BrokerService
}
$where
[
'phone'
]
=
$data
[
'phone'
];
$where
[
'site_id'
]
=
$
site_id
;
$where
[
'site_id'
]
=
$
data
[
'site_id'
]
;
$agent_data
=
$this
->
m_agent
->
verifyUser
(
'id,phone,password,site_id'
,
''
,
$where
);
if
(
empty
(
$data
[
'id'
]))
{
if
(
!
empty
(
$agent_data
))
{
$result
[
'msg'
]
=
'该用户已存在'
;
return
$result
;
}
$msg
=
'新增成功'
;
$data
[
'status'
]
=
0
;
$data
[
'level'
]
=
10
;
if
(
empty
(
$data
[
'password'
]))
{
$data
[
'password'
]
=
substr
(
$data
[
'phone'
],
-
6
);
//默认密码
}
}
else
{
if
(
empty
(
$agent_data
))
{
$result
[
'msg'
]
=
'没有该用户'
;
...
...
@@ -59,10 +71,8 @@ class BrokerService
}
$msg
=
'编辑成功'
;
if
(
!
empty
(
$data
[
'password'
]))
{
$md5_password
=
md5
(
$data
[
'password'
]);
if
((
$md5_password
==
$agent_data
[
'password'
])
||
(
$agent_data
[
'password'
]
==
$data
[
'password'
]))
{
if
((
$agent_data
[
'password'
]
==
$data
[
'password'
]))
{
unset
(
$data
[
'password'
]);
}
}
...
...
application/index/validate/AAgentValidate.php
View file @
007e0929
...
...
@@ -23,10 +23,10 @@ class AAgentValidate extends Validate
'level'
=>
'require|in:10,20,30,40'
,
'name'
=>
'require|length:1,60'
,
'phone'
=>
'require|length:1,20'
,
'password'
=>
'
require|
length:1,50'
,
'password'
=>
'length:1,50'
,
'sex'
=>
'require|in:0,1,2'
,
'img'
=>
'length:1,255'
,
'status'
=>
'
require|
in:0,1,2,3'
,
'status'
=>
'in:0,1,2,3'
,
'inviter_id'
=>
'between:1,9999999999'
,
'admin_off'
=>
'require|in:0,1'
,
'remarks'
=>
'length:0,255'
,
...
...
@@ -44,18 +44,16 @@ class AAgentValidate extends Validate
'district_id.between'
=>
'部门id错误'
,
'auth_group_id.require'
=>
'缺少角色id'
,
'auth_group_id.between'
=>
'角色id参数错误'
,
'level.require'
=>
'用户等级'
,
'level.require'
=>
'用户等级
为空
'
,
'level.in'
=>
'用户等级参数错误'
,
'name.require'
=>
'名字必填'
,
'name.length'
=>
'名字参数错误'
,
'phone.require'
=>
'手机号必填'
,
'phone.length'
=>
'手机参数错误'
,
'password.require'
=>
'手机号必填'
,
'password.length'
=>
'手机参数错误'
,
'password.length'
=>
'密码参数错误'
,
'sex.require'
=>
'缺少性别'
,
'sex.in'
=>
'性别参数错误'
,
'img.length'
=>
'头像参数错误'
,
'status.require'
=>
'缺少用户状态'
,
'status.in'
=>
'用户状态错误'
,
'inviter_id.between'
=>
'邀请人id参数错误'
,
'admin_off.require'
=>
'缺少访问后台参数'
,
...
...
@@ -63,7 +61,7 @@ class AAgentValidate extends Validate
'remarks.length'
=>
'备注参数错误'
];
protected
$scene
=
[
'add'
=>
'name,phone,store_id,district_id,
level,
password,sex,status,admin_off,site_id'
,
'edit'
=>
'id,name,phone,store_id,district_id,
level,
password,sex,status,admin_off,site_id'
,
'add'
=>
'name,phone,store_id,district_id,password,sex,status,admin_off,site_id'
,
'edit'
=>
'id,name,phone,store_id,district_id,password,sex,status,admin_off,site_id'
,
];
}
\ No newline at end of file
application/model/AAgents.php
View file @
007e0929
...
...
@@ -1283,11 +1283,6 @@ class AAgents extends BaseModel
$save_data
[
'district_id'
]
=
$params
[
'district_id'
];
}
//部门id
if
(
!
empty
(
$params
[
'district_id'
]))
{
$save_data
[
'district_id'
]
=
$params
[
'district_id'
];
}
//等级 10业务员 20店长 30总监 40店长和总监
if
(
!
empty
(
$params
[
'level'
]))
{
$save_data
[
'level'
]
=
$params
[
'level'
];
...
...
@@ -1295,7 +1290,7 @@ class AAgents extends BaseModel
//业务员姓名
if
(
!
empty
(
$params
[
'name'
]))
{
$save_data
[
'
level'
]
=
$params
[
'level
'
];
$save_data
[
'
name'
]
=
$params
[
'name
'
];
}
//业务员手机号
...
...
@@ -1305,7 +1300,7 @@ class AAgents extends BaseModel
//密码
if
(
!
empty
(
$params
[
'password'
]))
{
$save_data
[
'password'
]
=
md5
(
substr
(
$params
[
'phone'
],
-
6
)
);
//默认号码后6位
$save_data
[
'password'
]
=
md5
(
$params
[
'password'
]
);
//默认号码后6位
}
//性别 0保密 1男 2女
...
...
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