Server : nginx/1.20.1
System : Linux iZ2ze9ojcl78uluczwag69Z 4.18.0-240.22.1.el8_3.x86_64 #1 SMP Thu Apr 8 19:01:30 UTC 2021 x86_64
User : www ( 1000)
PHP Version : 7.3.28
Disable Function : passthru,exec,system,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Directory :  /www/wwwroot/0531yanglao.com/app/api/controller/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/0531yanglao.com/app/api/controller/Index.php
<?php
/*
 * @Description  : 首页
 * @Author       : https://github.com/skyselang
 * @Date         : 2020-05-17
 * @LastEditTime : 2020-11-24
 */

namespace app\api\controller;

use app\api\model\Goods;
use app\api\model\Team;
use app\common\model\article\Article;
use app\common\model\Cemetery;
use app\common\model\City;
use app\common\model\CustomerCase;
use app\common\model\FuneralParlor;
use app\common\model\Package;
use app\common\model\Store;
use think\facade\Config;

class Index extends Controller
{

    public function index()
    {

    }

    /**
     * @Description 首页
     * @author Aaron
     * @date 2021/4/29 下午2:46
     */
    public function home()
    {
        //新闻动态
        $article_1 = Article::getAll(['recommend'=>1], 6);
        //套餐
        $package = Package::getAll([], 0 ,['sort'=>'asc']);
        //服务团队
        $team = Team::getAll(['recommend'=>1], 4 ,['create_time'=>'asc']);
        //殡仪馆
        $funeral_parlor = FuneralParlor::getAll([], 4 ,['create_time'=>'asc'])
            ->visible(['funeral_parlor_id','title','filename']);
        //案例
        $customer_case = CustomerCase::getAll([], 4 ,['create_time'=>'asc']);
        //骨灰盒
        $goods_11 = Goods::getGoodsCategoryLimit(11, 6);
        //寿衣
        $goods_2 = Goods::getGoodsCategoryLimit(2, 6);
        //陵园
        $cemetery = Cemetery::getAll(['recommend'=>1], 4);
        //店铺
        $store = Store::getAll([], 4);

        return success(compact('article_1','package','team','funeral_parlor','customer_case','goods_11','goods_2','cemetery','store'));
    }

    /**
     * @Description 获取数据字典
     * @author Aaron
     * @date 2021/5/6 上午10:56
     */
    public function getDictionary($key = null)
    {
        $config = Config::get('dictionary');
        $data  = is_null($key) ? $config : ($config[$key] ?? $config);

        return success($data);
    }

    /**
     * @Description 获取城市列表
     * @return \json
     * @throws \think\Exception
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     * @author Aaron
     * @date 2021/5/7 上午10:30
     */
    public function getCity()
    {
        $data = City::getCityAll();

        return success($data['all']);
    }

}