HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,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
Upload Files
File: /www/wwwroot//www.elwrky.com/application/api/controller/Ajax.php
<?php
// +----------------------------------------------------------------------
// | dzdcms [ 多站点CMS前端AJAX数据返回 ]
// +----------------------------------------------------------------------

namespace app\api\controller;

use app\cms\controller\Cmsbase;
use think\Db;

class Ajax extends Cmsbase
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = [];
    protected function initialize()
    {
        parent::initialize();
    }

    // 文档模型 标题搜索
    public function search()
    {
        $keyword = $this->request->param('w/s', '', 'trim,safe_replace,strip_tags,htmlspecialchars');
        $keyword = str_replace('%', '', $keyword); //过滤'%',用户全文搜索
        $where   = "theme like '%$keyword%'";
        $list    = db('docs')->where($where)->field('id,theme as title,catid,url')->select();
        $_list   = [];
        foreach ($list as $k => $v) {
            $v['url']  =  $v['url']?$v['url']: '/'. getCategory($v['catid'],'catdir').'/'.$v['id'].'.html';
            $_list[]   = $v;
        }
        $result = array("code" => 0, "data" => $_list, "msg"=>  "success");
        return json($result);
    }

    public function doctor()
    {
        $type = $this->request->param('type/s', '', 'trim,safe_replace,strip_tags,htmlspecialchars');
        $area = $this->request->param('area/s', '', 'trim,safe_replace,strip_tags,htmlspecialchars');

        if ($type == '不限') {
            $doctors = db('doctor')->where(['area' => $area])->field('theme as name,clinic as title')->select();
        } elseif ($area == '不限') {
            $doctors = db('doctor')->where(['type' => $type])->field('theme as name,clinic as title')->select();
        } else {
            $doctors = db('doctor')->where(['type' => $type, 'area' => $area])->field('theme as name,clinic as title')->select();
        }

        return $doctors;
    }

    public function hospital()
    {
        $catid    = $this->request->param('type/s', '', 'trim,safe_replace,strip_tags,htmlspecialchars');
        $area     = $this->request->param('city/s', '', 'trim,safe_replace,strip_tags,htmlspecialchars');
        $hospital = $this->request->param('hospital/s', '', 'trim,safe_replace,strip_tags,htmlspecialchars');

        if ($catid) {
            $hospitals = db('hospital')->where(['catid' => $catid])->field('theme as company')->select();
        } elseif ($area !='不限') {
            $hospitals = db('hospital')->where(['area' => $area])->field('theme as name')->select();
        }elseif ($hospital) {
            $hospitals = db('hospital')->where(['theme' => $hospital])->field('theme as name')->select();
        }
        else {
            $hospitals = db('hospital')->where(['catid' => $catid, 'area' => $area])->field('theme as name,clinic as title')->select();
        }
        return $hospitals;
    }

}