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
c1229b4b
Commit
c1229b4b
authored
Jan 03, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
商铺图片编辑优化
parent
3f576a4d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
5 deletions
+88
-5
HouseService.php
application/index/service/HouseService.php
+41
-5
GHousesImgs.php
application/model/GHousesImgs.php
+47
-0
No files found.
application/index/service/HouseService.php
View file @
c1229b4b
...
...
@@ -174,18 +174,54 @@ class HouseService
}
}
if
(
empty
(
$data
[
'id'
]))
{
$house_img
->
add
(
$data
,
$house_id
);
//只记录新增图片
}
else
{
$image_result
=
$house_img
->
edit
(
$data
,
$house_id
);
//编辑图片
if
(
isset
(
$data
[
'cover'
]))
{
$image_result
=
$house_img
->
editV2
(
$data
[
'cover'
],
$house_id
,
1
);
if
(
$image_result
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑主图图片失败,'
.
$image_result
[
'msg'
];
return
$result
;
}
}
if
(
isset
(
$data
[
'slide_show'
]))
{
$image_result
=
$house_img
->
editV2
(
$data
[
'slide_show'
],
$house_id
,
2
);
if
(
$image_result
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'
编辑图片失败,'
.
$validate
->
getError
()
;
$result
[
'msg'
]
=
'
新增或编辑轮播图片失败,'
.
$image_result
[
'msg'
]
;
return
$result
;
}
}
if
(
isset
(
$data
[
'plan'
]))
{
$image_result
=
$house_img
->
editV2
(
$data
[
'plan'
],
$house_id
,
3
);
if
(
$image_result
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑楼盘图片失败,'
.
$image_result
[
'msg'
];
return
$result
;
}
}
if
(
isset
(
$data
[
'exclusive_img'
]))
{
$image_result
=
$house_img
->
editV2
(
$data
[
'exclusive_img'
],
$house_id
,
4
);
if
(
$image_result
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'新增或编辑独家图片失败,'
.
$image_result
[
'msg'
];
return
$result
;
}
}
// if (empty($data['id'])) {
// $house_img->add($data, $house_id); //只记录新增图片
// } else {
// $image_result = $house_img->edit($data, $house_id); //编辑图片
//
// if ($image_result['status'] == 'fail') {
// $result['status'] = 'fail';
// $result['msg'] = '编辑图片失败,' . $validate->getError();
// return $result;
// }
// }
//案场权限人
if
(
isset
(
$data
[
'agent_data'
]))
{
$result_agent_data
=
$this
->
releaseRelationshipV2
(
$data
[
'agent_data'
],
$house_id
,
1
,
$agent_id
,
$data
[
'internal_title'
],
$site_id
);
...
...
application/model/GHousesImgs.php
View file @
c1229b4b
...
...
@@ -187,6 +187,53 @@ class GHousesImgs extends BaseModel
return
$result
;
}
/**
* 商铺图片编辑
*
* @param $image_arr
* @param $house_id
* @param $type
* @return mixed
*/
public
function
editV2
(
$image_arr
,
$house_id
,
$type
)
{
try
{
$image_arr
=
array_unique
(
$image_arr
);
//编辑图片
$where
[
'img_status'
]
=
0
;
$where
[
'house_id'
]
=
$house_id
;
$where
[
'img_type'
]
=
$type
;
$house_img_data
=
$this
->
getListAll
(
'id,img_name'
,
$where
);
$house_img_edit
=
[];
$count
=
0
;
foreach
(
$house_img_data
as
$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
[
$count
][
'id'
]
=
$v
[
'id'
];
$house_img_edit
[
$count
][
'img_status'
]
=
1
;
$count
++
;
}
}
foreach
(
$image_arr
as
$v2
)
{
$house_img_edit
[
$count
][
'img_status'
]
=
0
;
$house_img_edit
[
$count
][
'img_name'
]
=
$v2
;
$house_img_edit
[
$count
][
'img_type'
]
=
$type
;
$house_img_edit
[
$count
][
'house_id'
]
=
$house_id
;
$count
++
;
}
$this
->
saveAll
(
$house_img_edit
);
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
/****** zw start *******/
/**
* 查询图片
...
...
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