| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 | <?phpnamespace app\admin\controller;use app\admin\common\AdminController;use app\common\api\BatchApi;/** * Description of Batch * * @author sgq */class Batch extends AdminController {    /**     * @auth {{/batch}}     * @return type     */    public function index() {        $declare_type_list = \app\common\api\DictApi::findChildDictByCode("declare_type");        return view("", ["declare_type_list" => $declare_type_list]);    }    /**     * @auth {{/batch/list}}     * @return type     */    public function list() {        return json(BatchApi::getList($this->request));    }    /**     * @auth {{/batch/add}}     * @return type     */    public function add() {        if ($this->request->isPost()) {            return json(BatchApi::create($this->request->param()));        }        return view("", ["source" => $this->user["type"]]);    }    /**     * @auth {{/batch/update}}     * @return type     */    public function edit() {        if ($this->request->isPost()) {            return json(BatchApi::update($this->request->param()));        }        $batch = BatchApi::getOne($this->request->param("id"));        return view("", ["batch" => $batch]);    }    /**     * @auth {{/batch/delete}}     * @return type     */    public function delete() {        if ($this->request->isPost()) {            return json(BatchApi::delete($this->request->param("batchId")));        }    }    /**     * @auth {{/batch/setActive}}     * @return type     */    public function setActive() {        if ($this->request->isPost()) {            return json(BatchApi::setActive($this->request->param("batchId"), 1));        }    }    /**     * @auth {{/batch/setNotActive}}     * @return type     */    public function setNotActive() {        if ($this->request->isPost()) {            return json(BatchApi::setActive($this->request->param("batchId"), 2));        }    }    /**     * @auth {{/batch/detail}}     * @return type     */    public function detail() {        return view();    }    public function listBatchByType() {        $type = $this->request["type"];        $talentType = $this->user["type"];        return json(BatchApi::getValidBatchs($type, $talentType));    }}
 |