Commit e1242d55 authored by zhuwei's avatar zhuwei

bug

parent a19f1df4
......@@ -24,9 +24,14 @@ class ImageDepotService
* @param string $label 标签
* @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;
//$map['id']=array('not in','1,2,3');
if (!empty($not_in_id)) {
$params_['id'] = ['not in',$not_in_id];
}
if (!empty($img_type)) {
$params_['img_type'] = $img_type;
}
......@@ -41,8 +46,8 @@ class ImageDepotService
$result = $this->imageDepot->getImageDepotIDList($params_);
if(!$result){
//查询不到相关数据返回0
return 1;
//查询不到相关数据返回''
return '';
}
$random_keys=array_rand($result,1);
......@@ -59,10 +64,16 @@ class ImageDepotService
public function getImage($label='商场美食')
{
//图片类型:0室外图 ,1室内图 ,2人群图
$indoor_img_id = $this->getImageWidthRand(0,$label);//图片类型:0室外图
$outdoor_img_id = $this->getImageWidthRand(1,$label);//图片类型:1室内图
$people_img_id = $this->getImageWidthRand(2,$label);//图片类型:2人群图
$indoor_img_id_ = $this->getImageWidthRand(0,$label);//图片类型:0室外图
$indoor_img_id = $indoor_img_id_ ? $indoor_img_id_ :1;
$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 implode(',',$return_arr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment