| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 | <?phpnamespace app\api\controller;use app\common\controller\Api;use think\Db;/** * 首页接口 */class Index extends Api{    protected $noNeedLogin = ['*'];    protected $noNeedRight = ['*'];    public function index()    {        $this->success();    }    /**     * 首页     */    public function home(){        //        $home = Db::name('home')->order('id asc')->select();        $home = list_domain_image($home,['image','remark_image']);        $home_top = [];        $home_button = [];        foreach ($home as $k => $v){            if($v['category'] == 1){                $home_top[] = $v;            }else{                $home_button[] = $v;            }        }        $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,audio_file,video_file,updatetime')->order('weigh','desc')->find();        $zhengce = info_domain_image($zhengce,['image','audio_file','video_file']);        //        $result = [            '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.ysszd_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);    }}
 |