| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 | <?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,updatetime')->order('weigh','desc')->find();        $zhengce = info_domain_image($zhengce,['image']);        //        $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);    }}
 |