|
@@ -20,39 +20,72 @@ class Index extends Api
|
|
|
|
|
|
/**
|
|
|
* 首页
|
|
|
- *
|
|
|
*/
|
|
|
public function home(){
|
|
|
|
|
|
- //轮播图
|
|
|
- $banner = Db::name('banner')->field('id, title, image, url')->where(['status' => 1])->order('weigh', 'desc')->select();
|
|
|
- $banner = list_domain_image($banner, ['image']);
|
|
|
-
|
|
|
- //四个顶部分类
|
|
|
- $top_category = Db::name('unishop_category')->field('id, name, image')->where(['status' => 'normal','is_top' => 1])->order('weigh', 'asc')->limit(4)->select();
|
|
|
- $top_category = list_domain_image($top_category, ['image']);
|
|
|
- foreach($top_category as $key => $val){
|
|
|
- $val['type'] = 'product';
|
|
|
- if($key == 3){
|
|
|
- $val['type'] = 'news';
|
|
|
- }
|
|
|
+ //
|
|
|
+ $home = Db::name('home')->order('id asc')->select();
|
|
|
+ $home = list_domain_image($home,['image','remark_image']);
|
|
|
|
|
|
- $top_category[$key] = $val;
|
|
|
+ $home_top = [];
|
|
|
+ $home_button = [];
|
|
|
+ foreach ($home as $k => $v){
|
|
|
+ if($v['category'] == 1){
|
|
|
+ $home_top[] = $v;
|
|
|
+ }else{
|
|
|
+ $home_button[] = $v;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //底部所有分类
|
|
|
- $buttom_category = Db::name('unishop_category')->field('id, name, image')->where(['status' => 'normal','is_top' => 0])->order('weigh', 'asc')->select();
|
|
|
- $buttom_category = list_domain_image($buttom_category, ['image']);
|
|
|
+ $zhengwu = Db::name('zhengwufuwu')->where('status',1)->order('weigh','desc')->select();
|
|
|
|
|
|
+ $gonggao = Db::name('message_sys')->field('id,title,info,updatetime')->order('weigh','desc')->find();
|
|
|
|
|
|
+ $zhengce = Db::name('zhengcejiedu')->field('id,title,image,updatetime')->order('weigh','desc')->find();
|
|
|
+ $zhengce = info_domain_image($zhengce,['image']);
|
|
|
//
|
|
|
$result = [
|
|
|
- 'banner' => $banner,
|
|
|
- 'top_category' => $top_category,
|
|
|
- 'buttom_category' => $buttom_category,
|
|
|
+ 'index_logo' => localpath_to_netpath(config('site.index_logo')),
|
|
|
+ 'index_title' => config('site.index_title'),
|
|
|
+ 'index_title_info' => config('site.index_title_info'),
|
|
|
+ 'ysszd_logo' => localpath_to_netpath(config('site.yssd_logo')),
|
|
|
+ 'ysszd_title' => config('site.ysszd_title'),
|
|
|
+ 'ysszd_title_info' => config('site.ysszd_title_info'),
|
|
|
+ 'ysszd_icon' => localpath_to_netpath(config('site.ysszd_icon')),
|
|
|
+ 'ysszd_url' => config('site.ysszd_url'),
|
|
|
+
|
|
|
+ 'home_top' => $home_top,
|
|
|
+ 'home_button' => $home_button,
|
|
|
+ 'zhengwu' => $zhengwu,
|
|
|
+ 'gonggao' => $gonggao,
|
|
|
+ 'zhengce' => $zhengce,
|
|
|
];
|
|
|
$this->success(1,$result);
|
|
|
}
|
|
|
|
|
|
+ //便民页
|
|
|
+ public function bianmin(){
|
|
|
+
|
|
|
+ $cate = Db::name('bianmin_category')->order('id', 'asc')->select();
|
|
|
+ $bianmin = Db::name('bianmin')->order('id', 'asc')->select();
|
|
|
+ $bianmin = list_domain_image($bianmin, ['image','remark_image']);
|
|
|
+
|
|
|
+ foreach ($cate as $key => $item) {
|
|
|
+ foreach ($bianmin as $value) {
|
|
|
+ if($item['id'] == $value['category_id']){
|
|
|
+ $cate[$key]['child'][] = $value;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $rs = [
|
|
|
+ 'index_logo' => localpath_to_netpath(config('site.index_logo')),
|
|
|
+ 'index_title' => config('site.index_title'),
|
|
|
+ 'index_title_info' => config('site.index_title_info'),
|
|
|
+ 'bianmin' => $cate,
|
|
|
+ ];
|
|
|
+ $this->success(1,$rs);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|