<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;
/**
 * 基础配置接口
 */
class Baseconfig extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];


    public function index(){

        $config = [
            'kefu_mobile' => config('site.kefu_mobile'),
            'kefu_weixin_qrcode' => localpath_to_netpath(config('site.kefu_weixin_qrcode')),
        ];

        $this->success('success',$config);
    }


    public function school_list(){
        $list = Db::name('school')->order('weigh desc,id desc')->select();

        $this->success('success',$list);
    }

    public function grade_list(){
        $school_id = input('school_id',1);
        $list = Db::name('grade')->where('school_id',$school_id)->order('weigh desc,id desc')->select();

        $this->success('success',$list);
    }


    public function classes_list(){
        $grade_id = input('grade_id',1);
        $list = Db::name('classes')->where('grade_id',$grade_id)->order('weigh desc,id desc')->select();

        $this->success('success',$list);
    }


}
