<?php

namespace app\api\controller\h5;
use app\common\model\Banner;
use app\common\model\Config;
use app\common\model\Org;
use app\hander\HelpHander;
use think\Controller;
use think\Db;
use think\Exception;

class Common extends Base {
    public function banner() {
        $ret = model('Banner')->getList(5, 1);
        HelpHander::success($ret);
    }
    public function dep() {
        $lists = Db::name('dep')
            ->field('id,title')
            ->where('org_id', $this->orgId)
            ->where('enable', 1)
            ->where('del', 0)
            ->select();
        HelpHander::success($lists);
    }
    public function getOrg() {
        $info = (new Org())->getInfo($this->orgId);
        if (!$info) {
            HelpHander::error('项目不存在');
        }
        HelpHander::success($info);
    }
    // 获取系统配置
    public function getConfig() {
        $name = input('name', '', 'trim');
        $wyval = (new Config())->getConfig($name, $this->orgId);
        HelpHander::success(['val' => $wyval]);
    }
}