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
93267776
Commit
93267776
authored
Nov 21, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店长默认编辑权限
parent
465bc488
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
18 deletions
+26
-18
GHouses.php
application/model/GHouses.php
+15
-18
GHousesFollowUp.php
application/model/GHousesFollowUp.php
+11
-0
No files found.
application/model/GHouses.php
View file @
93267776
...
...
@@ -289,11 +289,12 @@ class GHouses extends BaseModel
$house_id
=
[];
$house_follow_up
=
new
GHousesFollowUp
();
$m_house_agent
=
new
GHousesToAgents
();
$m_agent
=
new
AAgents
();
foreach
(
$data
as
$k
=>
$v
)
{
$house_id
[
$k
]
=
$v
[
'id'
];
$v
->
create_time
=
date
(
'Y-m-d'
,
strtotime
(
$v
->
create_time
));
$data
[
$k
][
'last_follow_up'
]
=
$house_follow_up
->
where
(
'house_id'
,
$v
[
'id'
])
->
value
(
'create_time'
);
$data
[
$k
][
'last_follow_up'
]
=
$house_follow_up
->
getAgentHouseFollowValue
(
'create_time'
,
[
'house_id'
=>
$v
[
'id'
]]
);
}
$result
=
array
();
...
...
@@ -301,26 +302,22 @@ class GHouses extends BaseModel
$result
=
$data
;
}
else
{
/*案场权限人和盘方*/
$house_agents
=
Db
::
table
(
'g_houses_to_agents'
)
->
alias
(
'a'
)
->
field
(
'a.houses_id,b.id,b.name,b.phone,a.agents_id'
)
->
join
(
'a_agents b'
,
'a.agents_id=b.id'
,
'left'
)
->
where
(
'a.houses_id'
,
'IN'
,
implode
(
','
,
$house_id
))
->
where
(
'a.is_del'
,
0
)
->
where
(
'a.type'
,
2
)
->
select
();
$agent_where
[
'a.houses_id'
]
=
[
'IN'
,
implode
(
','
,
$house_id
)];
$agent_where
[
'a.is_del'
]
=
0
;
$agent_where
[
'a.type'
]
=
2
;
$house_agents
=
$m_house_agent
->
getAgentsByHouseId
(
'a.houses_id,b.id,b.name,b.phone,a.agents_id,b.store_id'
,
$agent_where
);
$house_id_arr
=
[];
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
]
=
$v
->
toArray
();
$dish_name
=
''
;
$result
[
$k
][
'dish_name'
]
=
''
;
$dish_name
=
$result
[
$k
][
'dish_name'
]
=
''
;
foreach
(
$house_agents
as
$k2
=>
$v2
)
{
if
(
$v
[
'id'
]
==
$v2
[
'houses_id'
])
{
$dish_name
.=
$v2
[
'name'
]
.
','
;
$result
[
$k
][
'dish_name'
]
=
rtrim
(
$dish_name
,
','
);
if
(
$v2
[
'agents_id'
]
==
$agents_id
)
{
$store_agent_id
=
$m_agent
->
getAgentsByWhere
([
'store_id'
=>
$v2
[
'store_id'
],
'level'
=>
[
'in'
,
'20,40'
]],
'id'
);
//店长
if
(
$v2
[
'agents_id'
]
==
$agents_id
||
$store_agent_id
==
$agents_id
)
{
$house_id_arr
[]
=
$v
[
'id'
];
//存储盘方自己的商铺
}
}
...
...
@@ -334,11 +331,11 @@ class GHouses extends BaseModel
}
//独家方
$exclusive_
num
=
Db
::
table
(
'g_houses_to_agents'
)
->
where
(
'is_del'
,
0
)
->
where
(
'type'
,
3
)
->
where
(
'agents_id'
,
$agents_id
)
->
where
(
'houses_id'
,
$v
[
'id'
])
->
count
(
);
$exclusive_
where
[
'type'
]
=
3
;
$exclusive_where
[
'agents_id'
]
=
$agents_id
;
$exclusive_where
[
'houses_id'
]
=
$v
[
'id'
];
$exclusive_where
[
'is_del'
]
=
0
;
$exclusive_num
=
$m_house_agent
->
getTotal
(
$exclusive_where
);
if
(
$exclusive_num
>
0
)
{
$result
[
$k
][
'auth_edit_exclusive'
]
=
1
;
...
...
application/model/GHousesFollowUp.php
View file @
93267776
...
...
@@ -234,4 +234,14 @@ class GHousesFollowUp extends BaseModel
return
$return
;
}
/**
* @param $field
* @param $where
* @return mixed
*/
public
function
getAgentHouseFollowValue
(
$field
,
$where
)
{
return
$this
->
where
(
$where
)
->
value
(
$field
);
}
}
\ 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