| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- namespace App\Http\Controllers\Api\v1;
- use App\Http\Controllers\Api\BaseController;
- use App\Http\Validator\MasterValidator;
- use App\Services\MasterService;
- use Illuminate\Http\Request;
- /**
- * 法师控制器类
- * @author wesmiler
- * @since 2020/11/10
- * Class MasterController
- * @package App\Http\Controllers
- */
- class MasterController extends BaseController
- {
- /**
- * 构造函数
- * @author wesmiler
- * @since 2020/11/11
- * MasterController constructor.
- */
- public function __construct()
- {
- parent::__construct();
- $this->service = new MasterService();
- }
- /**
- * 获取用户信息
- * @return array|mixed
- */
- public function info(){
- $userId = request()->get('id', 0);
- $info = $this->service->getUserInfo($userId, $this->userId);
- return message(MESSAGE_OK,true, $info);
- }
- /**
- * 咨询记录
- * @return array
- */
- public function advice(){
- return $this->service->advice($this->userId);
- }
- /**
- * 咨询记录
- * @return array
- */
- public function adviceList(){
- return $this->service->adviceList($this->userId);
- }
- /**
- * 打分
- * @return array
- */
- public function score(){
- return $this->service->score($this->userId);
- }
- /**
- * 法师申请
- * @param MasterValidator $validator
- * @return array
- */
- public function apply(MasterValidator $validator){
- $params = $validator->check(request()->all(),'save');
- if(!is_array($params)){
- return message($params, false);
- }
- return $this->service->apply($this->userId);
- }
- /**
- * 法师列表
- * @return mixed
- */
- public function index(){
- return $this->service->getDataList($this->userId);
- }
- }
|