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/index/controller/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : /www/wwwroot/0531yanglao.com/app/index/controller/Index.php
<?php

namespace app\index\controller;

use app\common\model\Adv;
use app\common\model\Article;
use app\common\model\Dictionary;
use app\common\model\Recommend;
use think\facade\View;

class Index extends Controller
{
    /**
     * 首页
     *
     * @method GET
     *
     * @return json
     */
    public function index()
    {
        //热门推荐
        $recommend_1 = Recommend::getRecommendList('NursingHome', 1, 9);
        if($recommend_1) {
            foreach ($recommend_1 as $item) {
                $item->append(['location_name', 'service_name']);
            }
        }
        //口碑
        $recommend_2 = Recommend::getRecommendList('NursingHome', 2, 9);
        if($recommend_2) {
            foreach ($recommend_2 as $item) {
                $item->append(['location_name', 'service_name']);
            }
        }

        //最新动态
        $article_1 = Article::getAll(['type'=>'news'], 8, ['create_time'=>'desc']);
        //常见问题
        $article_2 = Article::getAll(['type'=>'help'], 8, ['create_time'=>'desc']);
        //政法政策
        $article_3 = Article::getAll(['type'=>'regulations'], 8, ['create_time'=>'desc']);

        //热门旅居推荐
        //$recommend_2 = Recommend::getRecommendList('sojourn', 2, 8);
        /*if($recommend_1) {
            foreach ($recommend_1 as $item) {
                $item->append(['location_name', 'service_name']);
            }
        }*/
        //首页热门旅居推荐
        $adv_13 = Adv::getAdvData(13);
        //数据字典
        $dict = Dictionary::getCacheData();
        
        View::assign(compact('dict','recommend_1','recommend_2','article_1','article_2','article_3','adv_13'));

        return view();
    }
}