Commit a17e691d authored by hujun's avatar hujun

修改编辑商铺获取图片

parent d7dcf4f8
......@@ -286,7 +286,7 @@ class Shop extends Basic
$result['msg'] = 'Id is null';
} else {
//获取商铺详情
$result['data'] = $this->gHousesModel->getHouseById($this->params['id']);
$result['data'] = $this->gHousesModel->getHouseById($this->params['id'], 1);
}
}
......
......@@ -20,7 +20,7 @@ class GHouses extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHouseById($id)
public function getHouseById($id, $app = 0)
{
$data = array();
$fields = 'a.*,b.*';
......@@ -89,22 +89,47 @@ class GHouses extends BaseModel
$data['slide_show'] = [];
$data['plan'] = [];
$data['exclusive_img'] = [];
foreach ($img_data as $k => $v) {
$v->img_name = CK_IMG_URL . 'images/' . $v->img_name;
switch ($v->img_type) {
case 1 :
$data['cover'] = $v->img_name;
break;
case 2 :
$data['slide_show'][] = $v->img_name;
break;
case 3 :
$data['plan'][] = $v->img_name;
break;
default :
$data['exclusive_img'][] = $v->img_name;
if ($app == 0) {
foreach ($img_data as $k => $v) {
$v->img_name = CK_IMG_URL . 'images/' . $v->img_name;
switch ($v->img_type) {
case 1 :
$data['cover'] = $v->img_name;
break;
case 2 :
$data['slide_show'][] = $v->img_name;
break;
case 3 :
$data['plan'][] = $v->img_name;
break;
default :
$data['exclusive_img'][] = $v->img_name;
}
}
} else {
$file_url = [];
foreach ($img_data as $k => $v) {
$img_url = CK_IMG_URL . 'images/' . $v->img_name;
$file_url['file_name'] = $img_url;
$file_url['save_path'] = $v->img_name;
switch ($v->img_type) {
case 1 :
$data['cover'] = $file_url;
break;
case 2 :
$data['slide_show'][] = $file_url;
break;
case 3 :
$data['plan'][] = $file_url;
break;
default :
$data['exclusive_img'][] = $file_url;
}
}
}
/*图片 start*/
}
return $data;
......
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