|
|
@ -57,6 +57,7 @@ class Content extends Base |
|
|
{ |
|
|
{ |
|
|
//广告 |
|
|
//广告 |
|
|
$_data['ad'] = Db::name('ad')->where('status', 1)->order('sort DESC,create_time DESC')->limit(6)->select(); |
|
|
$_data['ad'] = Db::name('ad')->where('status', 1)->order('sort DESC,create_time DESC')->limit(6)->select(); |
|
|
|
|
|
$_data['ad'] = $this->replace_img_http($_data['ad']->toArray()); |
|
|
//三个产品分类 |
|
|
//三个产品分类 |
|
|
$field = 'id,create_time,sort,status,cate_id,title,author,source,image'; |
|
|
$field = 'id,create_time,sort,status,cate_id,title,author,source,image'; |
|
|
$_data['yinshidapeng'] = Db::name('product')->where('cate_id', 9) |
|
|
$_data['yinshidapeng'] = Db::name('product')->where('cate_id', 9) |
|
|
@ -67,6 +68,13 @@ class Content extends Base |
|
|
->field($field)->order('sort DESC,create_time DESC')->limit(4)->select(); |
|
|
->field($field)->order('sort DESC,create_time DESC')->limit(4)->select(); |
|
|
$_data['kepianxinshang'] = Db::name('product')->where('cate_id', 15) |
|
|
$_data['kepianxinshang'] = Db::name('product')->where('cate_id', 15) |
|
|
->field($field)->order('sort DESC,create_time DESC')->limit(4)->select(); |
|
|
->field($field)->order('sort DESC,create_time DESC')->limit(4)->select(); |
|
|
|
|
|
|
|
|
|
|
|
//替换CDN图片 |
|
|
|
|
|
$_data['yinshidapeng'] = $this->replace_img_http($_data['yinshidapeng']->toArray()); |
|
|
|
|
|
$_data['shijingpianchang'] = $this->replace_img_http($_data['shijingpianchang']->toArray()); |
|
|
|
|
|
$_data['peitaosheshi'] = $this->replace_img_http($_data['peitaosheshi']->toArray()); |
|
|
|
|
|
$_data['kepianxinshang'] = $this->replace_img_http($_data['kepianxinshang']->toArray()); |
|
|
|
|
|
|
|
|
return $this->result($_data, 1, ''); |
|
|
return $this->result($_data, 1, ''); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -85,7 +93,7 @@ class Content extends Base |
|
|
{ |
|
|
{ |
|
|
//联系我们 |
|
|
//联系我们 |
|
|
$_data = Db::name('page')->where('id', 1)->field('content')->find(); |
|
|
$_data = Db::name('page')->where('id', 1)->field('content')->find(); |
|
|
$_data['content'] = strip_tags($_data['content']); |
|
|
$_data['content'] = $_data['content']; |
|
|
// $_data['map'] = Db::name('page')->where('id', 1)->field('content')->find(); |
|
|
// $_data['map'] = Db::name('page')->where('id', 1)->field('content')->find(); |
|
|
$_system = Db::name('system')->where('id', 1)->find(); |
|
|
$_system = Db::name('system')->where('id', 1)->find(); |
|
|
$_data['address'] = $_system['address']; |
|
|
$_data['address'] = $_system['address']; |
|
|
@ -137,6 +145,7 @@ class Content extends Base |
|
|
$_data = $_db->where('cate_id', $cate_id)->field('id,image,cate_id,title') |
|
|
$_data = $_db->where('cate_id', $cate_id)->field('id,image,cate_id,title') |
|
|
->where('status', 1) |
|
|
->where('status', 1) |
|
|
->page($page, $limit)->select(); |
|
|
->page($page, $limit)->select(); |
|
|
|
|
|
$_data = $this->replace_img_http($_data->toArray()); |
|
|
return $this->result($_data, 1, ''); |
|
|
return $this->result($_data, 1, ''); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -153,18 +162,22 @@ class Content extends Base |
|
|
*/ |
|
|
*/ |
|
|
public function detail_product(int $id) |
|
|
public function detail_product(int $id) |
|
|
{ |
|
|
{ |
|
|
$_db = Db::name('product'); |
|
|
$_db = Db::name('product'); |
|
|
$_data['detail'] = $_db->field('id,title,create_time,source,cate_id,image,images,content,summary') |
|
|
$_data['detail'] = $_db->field('id,title,create_time,source,cate_id,image,images,content,summary') |
|
|
->where('status', 1) |
|
|
->where('status', 1) |
|
|
->find($id); |
|
|
->find($id); |
|
|
// $_data['detail']['content'] = strip_tags($_data['detail']['content'], '<img>'); |
|
|
// $_data['detail']['content'] = strip_tags($_data['detail']['content'], '<img>'); |
|
|
//替换img 标签 |
|
|
//替换img 标签 |
|
|
// $_data['detail']['content'] = $this->replace_img_alt($_data['detail']['content']); |
|
|
// $_data['detail']['content'] = $this->replace_img_alt($_data['detail']['content']); |
|
|
//$_data['detail']['content'] = str_ireplace('<img', '<image', $_data['detail']['content']); |
|
|
//$_data['detail']['content'] = str_ireplace('<img', '<image', $_data['detail']['content']); |
|
|
$_cate = Db::name('cate')->where('id', $_data['detail']['cate_id'])->find(); |
|
|
//替换cdn前缀 |
|
|
|
|
|
$_data['detail']['content'] = $this->replace_img_http($_data['detail']['content']); |
|
|
|
|
|
$_data['detail']['image'] = $this->replace_img_http($_data['detail']['image']); |
|
|
|
|
|
$_cate = Db::name('cate')->where('id', $_data['detail']['cate_id'])->find(); |
|
|
$_data['detail']['source'] = $_cate['cate_name']; |
|
|
$_data['detail']['source'] = $_cate['cate_name']; |
|
|
$_data['postion']= Db::name('product')->field('id,title,image')->limit(4) |
|
|
$_data['postion'] = Db::name('product')->field('id,title,image')->limit(4) |
|
|
->order('sort DESC,create_time DESC')->select(); |
|
|
->order('sort DESC,create_time DESC')->select(); |
|
|
|
|
|
$_data['postion'] = $this->replace_img_http($_data['postion']->toArray()); |
|
|
return $this->result($_data, 1, ''); |
|
|
return $this->result($_data, 1, ''); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -191,4 +204,24 @@ class Content extends Base |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function replace_img_http($http = '') |
|
|
|
|
|
{ |
|
|
|
|
|
if (empty($http)) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$find_url = 'https://api.junfei.iiixo.com/uploads'; |
|
|
|
|
|
$replace_url = 'http://cdn.junfei.iiixo.com'; |
|
|
|
|
|
|
|
|
|
|
|
if (is_array($http)) { |
|
|
|
|
|
array_walk($http, function (&$v, $k) use ($find_url, $replace_url) { |
|
|
|
|
|
$v['image'] = str_replace($find_url, $replace_url, $v['image']); |
|
|
|
|
|
}); |
|
|
|
|
|
return $http; |
|
|
|
|
|
} |
|
|
|
|
|
$http = str_replace($find_url, $replace_url, $http); |
|
|
|
|
|
return $http; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|