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
e1242d55
Commit
e1242d55
authored
Sep 05, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
a19f1df4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
ImageDepotService.php
application/index/service/ImageDepotService.php
+17
-6
No files found.
application/index/service/ImageDepotService.php
View file @
e1242d55
...
@@ -24,9 +24,14 @@ class ImageDepotService
...
@@ -24,9 +24,14 @@ class ImageDepotService
* @param string $label 标签
* @param string $label 标签
* @return array|false|\PDOStatement|string|\think\Collection
* @return array|false|\PDOStatement|string|\think\Collection
*/
*/
public
function
getImageWidthRand
(
$img_type
=
0
,
$label
=
'商场美食'
)
public
function
getImageWidthRand
(
$img_type
=
0
,
$label
=
'商场美食'
,
$not_in_id
)
{
{
$params_
[
'img_status'
]
=
0
;
$params_
[
'img_status'
]
=
0
;
//$map['id']=array('not in','1,2,3');
if
(
!
empty
(
$not_in_id
))
{
$params_
[
'id'
]
=
[
'not in'
,
$not_in_id
];
}
if
(
!
empty
(
$img_type
))
{
if
(
!
empty
(
$img_type
))
{
$params_
[
'img_type'
]
=
$img_type
;
$params_
[
'img_type'
]
=
$img_type
;
}
}
...
@@ -41,8 +46,8 @@ class ImageDepotService
...
@@ -41,8 +46,8 @@ class ImageDepotService
$result
=
$this
->
imageDepot
->
getImageDepotIDList
(
$params_
);
$result
=
$this
->
imageDepot
->
getImageDepotIDList
(
$params_
);
if
(
!
$result
){
if
(
!
$result
){
//查询不到相关数据返回
0
//查询不到相关数据返回
''
return
1
;
return
''
;
}
}
$random_keys
=
array_rand
(
$result
,
1
);
$random_keys
=
array_rand
(
$result
,
1
);
...
@@ -59,10 +64,16 @@ class ImageDepotService
...
@@ -59,10 +64,16 @@ class ImageDepotService
public
function
getImage
(
$label
=
'商场美食'
)
public
function
getImage
(
$label
=
'商场美食'
)
{
{
//图片类型:0室外图 ,1室内图 ,2人群图
//图片类型:0室外图 ,1室内图 ,2人群图
$indoor_img_id
=
$this
->
getImageWidthRand
(
0
,
$label
);
//图片类型:0室外图
$indoor_img_id_
=
$this
->
getImageWidthRand
(
0
,
$label
);
//图片类型:0室外图
$outdoor_img_id
=
$this
->
getImageWidthRand
(
1
,
$label
);
//图片类型:1室内图
$indoor_img_id
=
$indoor_img_id_
?
$indoor_img_id_
:
1
;
$people_img_id
=
$this
->
getImageWidthRand
(
2
,
$label
);
//图片类型:2人群图
$outdoor_img_id_
=
$this
->
getImageWidthRand
(
1
,
$label
,
$indoor_img_id
);
//图片类型:1室内图
$outdoor_img_id
=
$outdoor_img_id_
?
$outdoor_img_id_
:
2
;
$not_in_id
=
$indoor_img_id
.
','
.
$outdoor_img_id
;
$people_img_id_
=
$this
->
getImageWidthRand
(
2
,
$label
,
$not_in_id
);
//图片类型:2人群图
$people_img_id
=
$people_img_id_
?
$people_img_id_
:
3
;
$return_arr
=
[
$indoor_img_id
,
$outdoor_img_id
,
$people_img_id
];
$return_arr
=
[
$indoor_img_id
,
$outdoor_img_id
,
$people_img_id
];
return
implode
(
','
,
$return_arr
);
return
implode
(
','
,
$return_arr
);
}
}
...
...
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