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
7e3f3535
Commit
7e3f3535
authored
Sep 05, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片异常处理
parent
56356a6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
75 deletions
+86
-75
HouseService.php
application/index/service/HouseService.php
+7
-1
GHousesImgs.php
application/model/GHousesImgs.php
+79
-74
No files found.
application/index/service/HouseService.php
View file @
7e3f3535
...
@@ -76,7 +76,13 @@ class HouseService
...
@@ -76,7 +76,13 @@ class HouseService
if
(
$data
[
'id'
]
==
''
)
{
if
(
$data
[
'id'
]
==
''
)
{
$house_img
->
add
(
$data
,
$house_id
);
//只记录新增图片
$house_img
->
add
(
$data
,
$house_id
);
//只记录新增图片
}
else
{
}
else
{
$house_img
->
edit
(
$data
,
$house_id
);
//编辑图片
$image_result
=
$house_img
->
edit
(
$data
,
$house_id
);
//编辑图片
if
(
$image_result
[
'status'
]
==
'fail'
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'编辑图片失败,'
.
$validate
->
getError
();
return
$result
;
}
}
}
//案场权限人
//案场权限人
...
...
application/model/GHousesImgs.php
View file @
7e3f3535
...
@@ -78,99 +78,104 @@ class GHousesImgs extends BaseModel
...
@@ -78,99 +78,104 @@ class GHousesImgs extends BaseModel
*
*
* @param $params
* @param $params
* @param $house_id
* @param $house_id
* @return array|false
* @return mixed
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
edit
(
$params
,
$house_id
)
{
public
function
edit
(
$params
,
$house_id
)
{
//编辑图片
try
{
$house_img_data
=
$this
->
field
(
'id,img_name,img_type'
)
//编辑图片
->
where
(
'img_status <> 1 AND house_id = '
.
$house_id
)
->
select
();
$house_img_data
=
$this
->
field
(
'id,img_name,img_type'
)
$key
=
0
;
->
where
(
'img_status <> 1 AND house_id = '
.
$house_id
)
->
select
();
$house_img_edit
=
array
();
$key
=
0
;
$slide_show
=
$params
[
'slide_show'
];
$house_img_edit
=
array
();
$plan
=
$params
[
'plan'
];
$slide_show
=
$params
[
'slide_show'
];
$exclusive_img
=
$params
[
'exclusive_img'
];
$plan
=
$params
[
'plan'
];
$exclusive_img
=
$params
[
'exclusive_img'
];
foreach
(
$house_img_data
as
$k
=>
$v
)
{
foreach
(
$house_img_data
as
$k
=>
$v
)
{
//1列表页封面图
//1列表页封面图
if
(
$v
->
img_type
==
1
)
{
if
(
$v
->
img_type
==
1
)
{
if
(
$params
[
'cover'
]
!=
$v
->
img_name
)
{
if
(
$params
[
'cover'
]
!=
$v
->
img_name
)
{
/*伪删除之前的图片*/
/*伪删除之前的图片*/
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
$key
++
;
}
else
{
}
else
{
/*提交图片相同清除提交的图片*/
/*提交图片相同清除提交的图片*/
$params
[
'cover'
]
=
0
;
$params
[
'cover'
]
=
0
;
}
}
}
}
//2详情页轮播图
//2详情页轮播图
if
(
$v
->
img_type
==
2
)
{
if
(
$v
->
img_type
==
2
)
{
if
(
$slide_show
!=
''
)
{
if
(
$slide_show
!=
''
)
{
foreach
(
$slide_show
as
$kk
=>
$vv
)
{
foreach
(
$slide_show
as
$kk
=>
$vv
)
{
if
(
in_array
(
$v
->
img_name
,
$slide_show
))
{
if
(
in_array
(
$v
->
img_name
,
$slide_show
))
{
$params
[
'slide_show'
]
=
del_array_string
(
$v
->
img_name
,
$params
[
'slide_show'
]);
$params
[
'slide_show'
]
=
del_array_string
(
$v
->
img_name
,
$params
[
'slide_show'
]);
}
else
{
}
else
{
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
$key
++
;
}
}
}
}
else
{
//伪删除全部的轮播图
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
}
}
}
else
{
//伪删除全部的轮播图
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
}
}
}
//3楼层平面图
//3楼层平面图
if
(
$v
->
img_type
==
3
)
{
if
(
$v
->
img_type
==
3
)
{
if
(
$plan
!=
''
)
{
if
(
$plan
!=
''
)
{
foreach
(
$plan
as
$kk
=>
$vv
)
{
foreach
(
$plan
as
$kk
=>
$vv
)
{
if
(
in_array
(
$v
->
img_name
,
$plan
))
{
if
(
in_array
(
$v
->
img_name
,
$plan
))
{
$params
[
'plan'
]
=
del_array_string
(
$v
->
img_name
,
$params
[
'plan'
]);
$params
[
'plan'
]
=
del_array_string
(
$v
->
img_name
,
$params
[
'plan'
]);
}
else
{
}
else
{
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
$key
++
;
}
}
}
}
else
{
//伪删除全部的平面图
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
}
}
}
else
{
//伪删除全部的平面图
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
}
}
}
//4独家合同
//4独家合同
if
(
$v
->
img_type
==
4
)
{
if
(
$v
->
img_type
==
4
)
{
if
(
$exclusive_img
!=
''
)
{
if
(
$exclusive_img
!=
''
)
{
foreach
(
$exclusive_img
as
$kk
=>
$vv
)
{
foreach
(
$exclusive_img
as
$kk
=>
$vv
)
{
if
(
in_array
(
$v
->
img_name
,
$exclusive_img
))
{
if
(
in_array
(
$v
->
img_name
,
$exclusive_img
))
{
$params
[
'exclusive_img'
]
=
del_array_string
(
$v
->
img_name
,
$params
[
'exclusive_img'
]);
$params
[
'exclusive_img'
]
=
del_array_string
(
$v
->
img_name
,
$params
[
'exclusive_img'
]);
}
else
{
}
else
{
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
$key
++
;
}
}
}
}
else
{
//伪删除全部的独家图片
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
}
}
}
else
{
//伪删除全部的独家图片
$house_img_edit
[
$key
][
'id'
]
=
$v
->
id
;
$house_img_edit
[
$key
][
'img_status'
]
=
1
;
$key
++
;
}
}
}
}
$this
->
add
(
$params
,
$house_id
);
$this
->
saveAll
(
$house_img_edit
);
$result
[
'status'
]
=
'successful'
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
}
$this
->
add
(
$params
,
$house_id
);
return
$result
;
return
$this
->
saveAll
(
$house_img_edit
);
}
}
/****** zw start *******/
/****** 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