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
502c8840
Commit
502c8840
authored
Apr 09, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
9de2b588
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
139 additions
and
42 deletions
+139
-42
Report.php
application/api_broker/controller/Report.php
+56
-0
AAgents.php
application/model/AAgents.php
+81
-42
route.php
application/route.php
+2
-0
No files found.
application/api_broker/controller/Report.php
View file @
502c8840
...
...
@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
use
app\api_broker\extend\Basic
;
use
app\api_broker\service\ReportService
;
use
app\model\AAgents
;
use
app\model\FollowUpLogModel
;
use
app\model\OReportModel
;
use
think\Exception
;
...
...
@@ -114,6 +115,61 @@ class Report extends Basic
}
/**
* 权限判定
* @return \think\Response
*/
public
function
appAgentAuth
()
{
$params
=
$this
->
params
;
/* $params = array(
"agent_id" => 51,
);*/
$auth_arr
=
[
'broker/report'
,
'broker/addFollowUp'
,
'broker/marchIn'
,
'broker/collectingBill'
,
'broker/refund'
,
'broker/bargain'
,
'broker/statusBargain'
,
];
$param
[
"name"
]
=
array
(
"in"
,
$auth_arr
);
$agents
=
new
AAgents
();
$is_auth
=
$agents
->
agentsAuthIds
(
$params
[
"agent_id"
],
$param
);
$result
[
"report"
]
=
$result
[
"addFollowUp"
]
=
$result
[
"marchIn"
]
=
$result
[
"collectingBill"
]
=
$result
[
"refund"
]
=
$result
[
"bargain"
]
=
$result
[
"statusBargain"
]
=
false
;
if
(
count
(
$is_auth
)
>
0
)
{
foreach
(
$is_auth
as
$item
)
{
if
(
$item
[
'name'
]
==
"broker/report"
)
{
$result
[
"report"
]
=
true
;
}
if
(
$item
[
'name'
]
==
"broker/addFollowUp"
)
{
$result
[
"addFollowUp"
]
=
true
;
}
if
(
$item
[
'name'
]
==
"broker/marchIn"
)
{
$result
[
"marchIn"
]
=
true
;
}
if
(
$item
[
'name'
]
==
"broker/collectingBill"
)
{
$result
[
"collectingBill"
]
=
true
;
}
if
(
$item
[
'name'
]
==
"broker/refund"
)
{
$result
[
"refund"
]
=
true
;
}
if
(
$item
[
'name'
]
==
"broker/bargain"
)
{
$result
[
"bargain"
]
=
true
;
}
if
(
$item
[
'name'
]
==
"broker/statusBargain"
)
{
$result
[
"statusBargain"
]
=
true
;
}
}
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
return
$this
->
response
(
"200"
,
"request null"
);
}
/**
* 新增跟进
...
...
application/model/AAgents.php
View file @
502c8840
...
...
@@ -363,7 +363,8 @@ class AAgents extends BaseModel
* @param string $field
* @return false|\PDOStatement|string|\think\Collection
*/
public
function
getAgentsListByTask
(
$pageNo
=
1
,
$pageSize
=
15
,
$field
=
"id"
){
public
function
getAgentsListByTask
(
$pageNo
=
1
,
$pageSize
=
15
,
$field
=
"id"
)
{
return
Db
::
table
(
$this
->
table
)
->
field
(
"id"
)
->
select
();
...
...
@@ -374,7 +375,8 @@ class AAgents extends BaseModel
* 获取经纪人总数
* @return int|string
*/
public
function
getAgentsCountByTask
(){
public
function
getAgentsCountByTask
()
{
return
Db
::
table
(
$this
->
table
)
->
count
();
}
...
...
@@ -395,20 +397,21 @@ class AAgents extends BaseModel
}
public
function
countAgentNum
(
$params
){
public
function
countAgentNum
(
$params
)
{
$where_
=
$whereOr_
=
[];
if
(
isset
(
$params
[
"quit_time"
]))
{
if
(
isset
(
$params
[
"quit_time"
]))
{
$whereOr_
[
"a.quit_time"
]
=
$params
[
"quit_time"
];
$whereOr_
[
"a.status"
]
=
3
;
}
if
(
isset
(
$params
[
"district_id"
]))
{
if
(
isset
(
$params
[
"district_id"
]))
{
$where_
[
"a.district_id"
]
=
$params
[
"district_id"
];
$where_
[
"a.status"
]
=
0
;
}
$result
=
Db
::
table
(
$this
->
table
)
->
field
(
"a.id,a.store_id ,b.store_name,count(a.id) as agent_num"
)
->
alias
(
"a"
)
->
join
(
"a_store b"
,
"a.store_id = b.id"
,
"left"
)
->
join
(
"a_store b"
,
"a.store_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
whereOr
(
function
(
$query
)
use
(
$whereOr_
)
{
$query
->
where
(
$whereOr_
);
...
...
@@ -432,11 +435,11 @@ class AAgents extends BaseModel
}
if
(
isset
(
$params
[
"store_id"
]))
{
$where_
[
"b.id"
]
=
$params
[
"store_id"
];
$where_
[
"a.level"
]
=
array
(
"in"
,
"20,40"
);
$where_
[
"a.level"
]
=
array
(
"in"
,
"20,40"
);
}
if
(
isset
(
$params
[
"district_id"
]))
{
$where_
[
"c.id"
]
=
$params
[
"district_id"
];
$where_
[
"a.level"
]
=
array
(
"in"
,
"30,40"
);
$where_
[
"a.level"
]
=
array
(
"in"
,
"30,40"
);
}
$where_
[
"a.status"
]
=
0
;
...
...
@@ -473,13 +476,14 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
agentsAuth
(
$id
,
$agents_id
)
{
public
function
agentsAuth
(
$id
,
$agents_id
)
{
return
$this
->
alias
(
'a'
)
->
field
(
'b.id'
)
->
join
(
'auth_group b'
,
'a.auth_group_id=b.id'
,
'left'
)
->
join
(
'auth_group b'
,
'a.auth_group_id=b.id'
,
'left'
)
->
where
(
"FIND_IN_SET(
{
$id
}
,b.rules)"
)
->
where
(
'a.id'
,
$agents_id
)
->
where
(
'b.status'
,
0
)
->
where
(
'a.id'
,
$agents_id
)
->
where
(
'b.status'
,
0
)
->
find
();
}
...
...
@@ -490,20 +494,47 @@ class AAgents extends BaseModel
* @param $rule
* @return mixed
*/
public
function
agentsAuthId
(
$agents_id
,
$rule
)
{
public
function
agentsAuthId
(
$agents_id
,
$rule
)
{
$rules
=
$this
->
alias
(
'a'
)
->
field
(
'b.id'
)
->
join
(
'auth_group b'
,
'a.auth_group_id=b.id'
,
'left'
)
->
where
(
'b.status'
,
0
)
->
where
(
'a.id'
,
$agents_id
)
->
join
(
'auth_group b'
,
'a.auth_group_id=b.id'
,
'left'
)
->
where
(
'b.status'
,
0
)
->
where
(
'a.id'
,
$agents_id
)
->
value
(
'rules'
);
$rule_model
=
new
AuthRule
();
return
$rule_model
->
where
(
'id'
,
'in'
,
$rules
)
->
where
(
'name'
,
$rule
)
->
where
(
'name'
,
$rule
)
->
value
(
'id'
);
}
/**
* 根据id检查是否有权限
*
* @param $agents_id
* @param $rule
* @return mixed
*/
public
function
agentsAuthIds
(
$agents_id
,
$rule
)
{
$rules
=
$this
->
alias
(
'a'
)
->
field
(
'b.id'
)
->
join
(
'auth_group b'
,
'a.auth_group_id=b.id'
,
'left'
)
->
where
(
'b.status'
,
0
)
->
where
(
'a.id'
,
$agents_id
)
->
value
(
'rules'
);
$rule_model
=
new
AuthRule
();
$result
=
$rule_model
->
field
(
"id,name"
)
->
where
(
'id'
,
'in'
,
$rules
)
->
where
(
$rule
)
->
select
();
return
$result
;
}
/**
* 根据id获取单个字段值
*
...
...
@@ -511,8 +542,9 @@ class AAgents extends BaseModel
* @param $fields
* @return mixed
*/
public
function
getAgentsById
(
$id
,
$fields
)
{
return
$this
->
where
(
'id'
,
$id
)
->
value
(
$fields
);
public
function
getAgentsById
(
$id
,
$fields
)
{
return
$this
->
where
(
'id'
,
$id
)
->
value
(
$fields
);
}
/**
...
...
@@ -523,10 +555,11 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentsStoreById
(
$where
,
$fields
)
{
public
function
getAgentsStoreById
(
$where
,
$fields
)
{
return
$this
->
alias
(
'a'
)
->
field
(
$fields
)
->
join
(
'a_store b'
,
'a.store_id=b.id'
,
'left'
)
->
join
(
'a_store b'
,
'a.store_id=b.id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
...
...
@@ -539,13 +572,14 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreOrAgentInfo
(
$field
,
$params
){
public
function
getStoreOrAgentInfo
(
$field
,
$params
)
{
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"a_store b"
,
"a.store_id = b.id"
,
"left"
)
->
join
(
"a_store b"
,
"a.store_id = b.id"
,
"left"
)
->
where
(
$params
)
->
where
(
'a.level'
,
[
'='
,
20
],[
'='
,
40
],
'or'
)
->
where
(
'a.level'
,
[
'='
,
20
],
[
'='
,
40
],
'or'
)
->
select
();
}
...
...
@@ -560,7 +594,8 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentInfo
(
$field
,
$agent_id
=
''
,
$params
=
''
)
{
public
function
getAgentInfo
(
$field
,
$agent_id
=
''
,
$params
=
''
)
{
if
(
$agent_id
!=
''
)
{
$where
[
'id'
]
=
$agent_id
;
}
else
{
...
...
@@ -577,7 +612,8 @@ class AAgents extends BaseModel
* @param $phone
* @return int|string
*/
public
function
getAgentExist
(
$phone
)
{
public
function
getAgentExist
(
$phone
)
{
return
$this
->
where
([
'phone'
=>
$phone
,
'status'
=>
0
...
...
@@ -593,20 +629,21 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentEelationByOrderId
(
$order_id
)
{
public
function
getAgentEelationByOrderId
(
$order_id
)
{
$order
=
new
OrderModel
();
$house_id
=
$order
->
where
(
'id'
,
$order_id
)
->
value
(
'house_id'
);
$house_id
=
$order
->
where
(
'id'
,
$order_id
)
->
value
(
'house_id'
);
$data
=
[];
if
(
!
empty
(
$house_id
))
{
$agent_device
=
$this
->
alias
(
'a'
)
->
field
(
'a.id,a.device_id'
)
->
join
(
'g_houses_to_agents b'
,
'a.id = b.agents_id'
,
'left'
)
->
where
(
'houses_id'
,
$house_id
)
->
where
(
'type'
,
'in'
,
'2,3'
)
->
where
(
'is_del'
,
0
)
->
join
(
'g_houses_to_agents b'
,
'a.id = b.agents_id'
,
'left'
)
->
where
(
'houses_id'
,
$house_id
)
->
where
(
'type'
,
'in'
,
'2,3'
)
->
where
(
'is_del'
,
0
)
->
select
();
foreach
(
$agent_device
as
$k
=>
$v
)
{
foreach
(
$agent_device
as
$k
=>
$v
)
{
$data
[
$k
]
=
$v
->
getData
();
}
}
...
...
@@ -624,10 +661,11 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getAgentAllById
(
$agent_id
=
[],
$field
=
'*'
)
{
public
function
getAgentAllById
(
$agent_id
=
[],
$field
=
'*'
)
{
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
where
(
'id'
,
'in'
,
implode
(
','
,
$agent_id
))
->
where
(
'status'
,
0
)
->
where
(
'id'
,
'in'
,
implode
(
','
,
$agent_id
))
->
where
(
'status'
,
0
)
->
select
();
}
...
...
@@ -640,13 +678,14 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreAgentId
(
$agent_id
)
{
public
function
getStoreAgentId
(
$agent_id
)
{
$store_id
=
$this
->
where
(
'id'
,
$agent_id
)
->
value
(
'store_id'
);
return
$this
->
alias
(
'a'
)
->
field
(
'b.store_name,a.id,a.device_id'
)
->
join
(
'a_store b'
,
'a.store_id=b.id'
)
->
where
(
'b.id'
,
$store_id
)
->
where
(
'level'
,
'in'
,
'20,30'
)
->
where
(
'b.id'
,
$store_id
)
->
where
(
'level'
,
'in'
,
'20,30'
)
->
find
();
}
...
...
@@ -658,7 +697,7 @@ class AAgents extends BaseModel
{
return
db
(
'a_agents'
)
->
alias
(
'a'
)
->
field
(
'name,phone,img,store_name'
)
->
join
(
'a_store b'
,
'a.store_id=b.id'
,
'left'
)
->
join
(
'a_store b'
,
'a.store_id=b.id'
,
'left'
)
->
where
(
'a.id'
,
$agent_id
)
->
find
();
}
...
...
@@ -692,8 +731,8 @@ class AAgents extends BaseModel
$data
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'u_evaluate b'
,
'a.id = b.agents_id'
,
'left'
)
->
join
(
'g_houses_to_agents c'
,
'a.id=c.agents_id'
,
'left'
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'type'
,
1
)
->
where
(
'c.houses_id'
,
$house_id
)
->
where
(
'type'
,
1
)
->
where
(
$params
)
->
group
(
'a.id'
)
->
order
(
$order_
)
...
...
application/route.php
View file @
502c8840
...
...
@@ -367,6 +367,8 @@ Route::group('broker', [
'searchAgents'
=>
[
'api_broker/OrderLog/searchAgents'
,
[
'method'
=>
'get'
]
],
'appAgentAuth'
=>
[
'api_broker/Report/appAgentAuth'
,
[
'method'
=>
'get'
]
],
'center'
=>
[
'api_broker/MyCenter/center'
,
[
'method'
=>
'get|post'
]
],
'houseEdit'
=>
[
'api_broker/shop/edit'
,
[
'method'
=>
'get|post'
]],
//编辑商铺
...
...
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