// +---------------------------------------------------------------------- namespace App\Http\Controllers\Admin; use App\Services\Common\SupervisorsService; /** * 导师管理-控制器 * @author laravel开发员 * @since 2020/11/11 * @package App\Http\Controllers */ class SupervisorsController extends Backend { /** * 构造函数 * @author laravel开发员 * @since 2020/11/11 * MemberController constructor. */ public function __construct() { parent::__construct(); $this->service = new SupervisorsService(); } /** * 列表 * @return array */ public function index() { $result = $this->service->getList(); return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? [], $result['count'] ?? 0); } /** * 选项列表 * @return mixed */ public function options(){ $result = $this->service->options(); return message(1002,true, $result); } /** * 搜索用户(用于下拉选择) * @return array */ public function search() { $keyword = request()->input('keyword', ''); $limit = request()->input('limit', 20); $result = $this->service->searchUsers($keyword, $limit); return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? []); } /** * 获取详情 */ public function read() { $result = $this->service->getInfo(); return showJson($result['msg'], $result['code'] == 0, $result['data'] ?? []); } /** * 添加 */ public function add() { $result = $this->service->edit(); return showJson($result['msg'], $result['code'] == 0); } /** * 设置状态 */ public function status() { $result = $this->service->status(); return showJson($result['msg'], $result['code'] == 0); } /** * 设置认证 */ public function auth() { $result = $this->service->auth(); return showJson($result['msg'], $result['code'] == 0); } /** * 设置推荐 */ public function recommend() { $result = $this->service->recommend(); return showJson($result['msg'], $result['code'] == 0); } }