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
585d8a5b
Commit
585d8a5b
authored
Mar 01, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
通过token获取用户信息
parent
713a59ee
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
1 deletion
+45
-1
Broker.php
application/api_broker/controller/Broker.php
+4
-1
Agents.php
application/model/Agents.php
+41
-0
No files found.
application/api_broker/controller/Broker.php
View file @
585d8a5b
...
@@ -364,8 +364,10 @@ class Broker extends Basic
...
@@ -364,8 +364,10 @@ class Broker extends Basic
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getAgentsByPhone
()
{
public
function
getAgentsByPhone
()
{
$data
=
$this
->
a_agents
->
getInfo
(
$this
->
params
[
'phone'
]);
$agents
=
new
Agents
();
$data
=
$agents
->
getInfo
(
$this
->
params
[
'phone'
]);
$data
[
'openid'
]
=
""
;
$data
[
'openid'
]
=
""
;
$data
[
'token'
]
=
$this
->
authToken
;
return
$this
->
response
(
200
,
""
,
$data
);
return
$this
->
response
(
200
,
""
,
$data
);
}
}
}
}
\ No newline at end of file
application/model/Agents.php
View file @
585d8a5b
...
@@ -215,5 +215,46 @@ class Agents extends Model
...
@@ -215,5 +215,46 @@ class Agents extends Model
->
field
(
'realname,phone,head_portrait,agentshopname'
)
->
field
(
'realname,phone,head_portrait,agentshopname'
)
->
find
();
->
find
();
}
}
/**
* 返回经纪人和部门信息
*
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getInfo
(
$phone
)
{
$agents_data
=
$this
->
where
([
'phone'
=>
$phone
,
'inuse'
=>
1
,
'level'
=>
[
'in'
,
'2,5'
]
])
->
find
();
if
(
!
empty
(
$agents_data
->
store_id
))
{
$store_name
=
Db
::
table
(
'a_store'
)
->
where
(
'id'
,
$agents_data
[
'store_id'
])
->
value
(
'store_name'
);
$agents_data
[
'department'
]
=
$store_name
;
}
if
(
!
empty
(
$agents_data
->
auth_group_id
))
{
$district_name
=
Db
::
table
(
'a_district'
)
->
where
(
'id'
,
$agents_data
[
'district_id'
])
->
value
(
'district_name'
);
$agents_data
[
'department'
]
=
$agents_data
[
'department'
]
?
$district_name
.
'-'
.
$store_name
:
$district_name
;
}
$agents_data
[
'commission'
]
=
500
;
switch
(
$agents_data
[
'level'
])
{
case
10
:
$agents_data
[
'level_name'
]
=
'业务员'
;
break
;
case
20
:
$agents_data
[
'level_name'
]
=
'店长'
;
break
;
case
30
:
$agents_data
[
'level_name'
]
=
'总监'
;
break
;
case
40
:
$agents_data
[
'level_name'
]
=
'总监'
;
break
;
}
return
$agents_data
;
}
}
}
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