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
c95ebdc3
Commit
c95ebdc3
authored
May 30, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除图片
parent
2e9500f1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
4 deletions
+66
-4
OfficeService.php
application/index/service/OfficeService.php
+15
-2
OfficeGBuildingImg.php
application/model/OfficeGBuildingImg.php
+51
-2
No files found.
application/index/service/OfficeService.php
View file @
c95ebdc3
...
@@ -39,6 +39,7 @@ class OfficeService
...
@@ -39,6 +39,7 @@ class OfficeService
public
function
edit
(
array
$data
,
int
$agent_id
=
0
)
{
public
function
edit
(
array
$data
,
int
$agent_id
=
0
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
''
;
$result
[
'msg'
]
=
''
;
$result
[
'data'
]
=
[];
if
(
isset
(
$data
[
'id'
]))
{
if
(
isset
(
$data
[
'id'
]))
{
$scene
=
'edit'
;
$scene
=
'edit'
;
...
@@ -60,11 +61,18 @@ class OfficeService
...
@@ -60,11 +61,18 @@ class OfficeService
if
(
!
empty
(
$data
[
'add_building_stations'
]))
{
if
(
!
empty
(
$data
[
'add_building_stations'
]))
{
$add_building_stations
=
json_decode
(
$data
[
'add_building_stations'
],
true
);
$add_building_stations
=
json_decode
(
$data
[
'add_building_stations'
],
true
);
foreach
(
$add_building_stations
as
$k
=>
$v
)
{
foreach
(
$add_building_stations
as
$k
=>
$v
)
{
if
(
empty
(
$
data
[
'stations_id'
]))
{
if
(
empty
(
$
v
[
'stations_id'
]))
{
continue
;
continue
;
}
}
if
(
empty
(
$data
[
'distance'
]))
{
if
(
empty
(
$v
[
'distance'
]))
{
continue
;
}
$where
[
'building_id'
]
=
$id
;
$where
[
'stations_id'
]
=
$v
[
'stations_id'
];
$building_station_id
=
$this
->
m_building_stations
->
getFindData
(
'id'
,
$where
);
if
(
isset
(
$building_station_id
[
'id'
]))
{
continue
;
continue
;
}
}
$save_stations
[
$k
][
'building_id'
]
=
$id
;
$save_stations
[
$k
][
'building_id'
]
=
$id
;
...
@@ -82,6 +90,11 @@ class OfficeService
...
@@ -82,6 +90,11 @@ class OfficeService
$this
->
m_building_stations
->
updateData
([
'is_del'
=>
1
],
[
'id'
=>
[
'in'
,
$data
[
'del_building_stations'
]]]);
$this
->
m_building_stations
->
updateData
([
'is_del'
=>
1
],
[
'id'
=>
[
'in'
,
$data
[
'del_building_stations'
]]]);
}
}
//楼盘图片
if
(
!
empty
(
$data
[
'slide_show'
]))
{
$this
->
m_office_img
->
edit
(
$data
[
'slide_show'
],
$id
,
2
);
}
$result
[
'status'
]
=
'successful'
;
$result
[
'status'
]
=
'successful'
;
}
else
{
}
else
{
$result
[
'msg'
]
=
'新增或编辑失败!'
;
$result
[
'msg'
]
=
'新增或编辑失败!'
;
...
...
application/model/OfficeGBuildingImg.php
View file @
c95ebdc3
...
@@ -66,7 +66,7 @@ class OfficeGBuildingImg extends BaseModel
...
@@ -66,7 +66,7 @@ class OfficeGBuildingImg extends BaseModel
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
getFindData
(
$field
,
$where
)
{
public
function
getFindData
(
$field
,
$where
)
{
$where
[
'i
s_del
'
]
=
0
;
$where
[
'i
mg_status
'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
where
(
$where
)
->
find
();
->
find
();
...
@@ -82,7 +82,7 @@ class OfficeGBuildingImg extends BaseModel
...
@@ -82,7 +82,7 @@ class OfficeGBuildingImg extends BaseModel
*/
*/
public
function
getListAll
(
$field
,
$where
)
public
function
getListAll
(
$field
,
$where
)
{
{
$where
[
'i
s_del
'
]
=
0
;
$where
[
'i
mg_status
'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
where
(
$where
)
->
select
();
->
select
();
...
@@ -99,4 +99,53 @@ class OfficeGBuildingImg extends BaseModel
...
@@ -99,4 +99,53 @@ class OfficeGBuildingImg extends BaseModel
{
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
}
/**
* 商铺图片编辑
*
* @param $image_arr
* @param $house_id
* @param $type
* @return mixed
*/
public
function
edit
(
$image_arr
,
$house_id
,
$type
)
{
try
{
$image_arr
=
array_unique
(
$image_arr
);
//编辑图片
$where
[
'img_status'
]
=
0
;
$where
[
'building_id'
]
=
$house_id
;
$where
[
'img_type'
]
=
$type
;
$house_img_data
=
$this
->
getListAll
(
'id,img_name'
,
$where
);
$house_img_edit
=
[];
foreach
(
$house_img_data
as
$k
=>
$v
)
{
if
(
in_array
(
$v
[
'img_name'
],
$image_arr
))
{
$key
=
array_search
(
$v
[
'img_name'
],
$image_arr
);
if
(
$key
!==
false
)
{
unset
(
$image_arr
[
$key
]);
}
}
else
{
$house_img_edit
[
'img_status'
]
=
1
;
$this
->
db_
->
where
(
'id'
,
$v
[
'id'
])
->
update
(
$house_img_edit
);
}
}
foreach
(
$image_arr
as
$k2
=>
$v2
)
{
$house_img_add
[
$k2
][
'img_status'
]
=
0
;
$house_img_add
[
$k2
][
'img_name'
]
=
$v2
;
$house_img_add
[
$k2
][
'img_type'
]
=
$type
;
$house_img_add
[
$k2
][
'building_id'
]
=
$house_id
;
}
if
(
isset
(
$house_img_add
))
{
$this
->
db_
->
insertAll
(
$house_img_add
);
}
$this
->
saveAll
(
$house_img_edit
);
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
}
}
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