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
a5b12269
Commit
a5b12269
authored
Sep 05, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查询判断盘方是否存在
parent
6f7c4384
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
26 deletions
+33
-26
HouseService.php
application/index/service/HouseService.php
+33
-26
No files found.
application/index/service/HouseService.php
View file @
a5b12269
...
...
@@ -36,14 +36,15 @@ class HouseService
* @param int $agent_id
* @return array
*/
public
function
addHouse
(
array
$data
,
int
$agent_id
)
:
array
{
$result
=
[];
public
function
addHouse
(
array
$data
,
int
$agent_id
)
:
array
{
$result
=
[];
$validate
=
new
HouseValidate
();
$check
=
$validate
->
check
(
$data
);
$check
=
$validate
->
check
(
$data
);
if
(
true
!==
$check
)
{
if
(
true
!==
$check
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$validate
->
getError
();
$result
[
'msg'
]
=
$validate
->
getError
();
return
$result
;
}
...
...
@@ -58,20 +59,24 @@ class HouseService
if
(
empty
(
$house_id
))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑商铺失败'
;
return
$result
;
}
//商铺扩展字段
$sum
=
new
ResultsSummaryNewTask
();
$m_agent
=
new
AAgents
();
$houses_ext
=
new
GHousesExt
();
$house_img
=
new
GHousesImgs
();
$agents
=
new
GHousesToAgents
();
$records
=
new
GOperatingRecords
();
//商铺扩展字段
$houses_ext
->
addHouseExt
(
$data
,
$house_id
);
//商铺图片
$house_img
=
new
GHousesImgs
();
if
(
$data
[
'id'
]
==
''
)
{
$house_img
->
add
(
$data
,
$house_id
);
//只记录新增图片
}
$agents
=
new
GHousesToAgents
();
//案场权限人
if
(
isset
(
$data
[
'agent_data'
]))
{
$agents
->
addHouseAgent
(
$data
[
'agent_data'
],
$house_id
,
1
);
...
...
@@ -82,20 +87,16 @@ class HouseService
$agents
->
addHouseAgent
(
$data
[
'agent_dish'
],
$house_id
,
2
);
//更新业绩统计
$sum
=
new
ResultsSummaryNewTask
();
$m_agent
=
new
AAgents
();
$date
=
date
(
'Y-m-d H:i:s'
);
$date
=
date
(
'Y-m-d H:i:s'
);
$agent_name
=
[];
foreach
(
$data
[
'agent_dish'
]
as
$k
=>
$v
)
{
$agent_data
=
$m_agent
->
verifyUser
(
'id,store_id,district_id,name'
,
''
,
[
'id'
=>
$v
]);
//获取被修改人信息
foreach
(
$data
[
'agent_dish'
]
as
$k
=>
$v
)
{
$agent_data
=
$m_agent
->
verifyUser
(
'id,store_id,district_id,name'
,
''
,
[
'id'
=>
$v
]);
//获取被修改人信息
$sum
->
updateTotalByAgentId
(
$agent_data
[
'id'
],
$agent_data
[
'store_id'
],
$agent_data
[
'district_id'
],
$date
);
//被修改的人
$agent_name
[]
=
$agent_data
[
'name'
];
}
if
(
!
empty
(
$agent_name
))
{
//记录新增盘方
$records
=
new
GOperatingRecords
();
$records
->
record
(
''
,
2
,
'新增为:'
.
implode
(
','
,
$agent_name
),
$house_id
);
}
}
...
...
@@ -108,7 +109,7 @@ class HouseService
//解除案场权限人绑定关系
if
(
isset
(
$data
[
'del_agent_data'
]))
{
$agent_data_arr
=
explode
(
','
,
$data
[
'del_agent_data'
]);
foreach
(
$agent_data_arr
as
$k
=>
$v
)
{
foreach
(
$agent_data_arr
as
$k
=>
$v
)
{
$agents
->
del
(
$v
,
$house_id
);
}
}
...
...
@@ -116,9 +117,13 @@ class HouseService
//解除盘方绑定关系
if
(
isset
(
$data
[
'del_agent_dish'
]))
{
$agent_dish_arr
=
explode
(
','
,
$data
[
'del_agent_dish'
]);
foreach
(
$agent_dish_arr
as
$k
=>
$v
)
{
$agents
->
del
(
$v
,
$house_id
);
$del_agent_name
[]
=
$m_agent
->
getAgentsById
(
$v
,
'name'
);
//获取被修改人信息
foreach
(
$agent_dish_arr
as
$k
=>
$v
)
{
$num
=
$agents
->
getAgentHouseNum
(
$v
,
2
);
if
(
$num
>
0
)
{
$agents
->
del
(
$v
,
$house_id
);
$del_agent_name
[]
=
$m_agent
->
getAgentsById
(
$v
,
'name'
);
//获取被修改人信息
}
}
if
(
!
empty
(
$del_agent_name
))
{
...
...
@@ -129,8 +134,8 @@ class HouseService
}
$result
[
'data'
][
'house_id'
]
=
$house_id
;
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'新增或编辑成功!'
;
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'新增或编辑成功!'
;
return
$result
;
}
...
...
@@ -141,7 +146,8 @@ class HouseService
* @param $house_id
* @return mixed
*/
public
function
updateAgentHouse
(
$agent_id
,
$house_id
)
{
public
function
updateAgentHouse
(
$agent_id
,
$house_id
)
{
$agents
=
new
GHousesToAgents
();
$result
=
$agents
->
del
(
$agent_id
,
$house_id
);
...
...
@@ -161,17 +167,18 @@ class HouseService
* @param $house_id
* @return mixed
*/
public
function
getHouseFile
(
$house_id
)
{
public
function
getHouseFile
(
$house_id
)
{
if
(
empty
(
$house_id
))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'house_id 为空'
;
return
$result
;
}
$m_house
=
new
GHouseFile
();
$m_house
=
new
GHouseFile
();
$where
[
'status'
]
=
0
;
$where
[
'house_id'
]
=
$house_id
;
$data
=
$m_house
->
getHouseFileAll
(
'id,file_name'
,
$where
);
$data
=
$m_house
->
getHouseFileAll
(
'id,file_name'
,
$where
);
if
(
$data
)
{
$result
[
'data'
]
=
$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