| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190 |
- <?php
- namespace App\Http\Controllers\Api\v1;
- use App\Http\Controllers\Api\BaseController;
- use App\Http\Validator\MasterValidator;
- use App\Http\Validator\MemberValidator;
- use App\Http\Validator\WithdrawValidator;
- use App\Http\Validator\YigongValidator;
- use App\Services\MasterService;
- use App\Services\MemberService;
- use App\Services\WithdrawService;
- use App\Services\YigongService;
- use Illuminate\Http\Request;
- /**
- * 会员控制器类
- * @author wesmiler
- * @since 2020/11/10
- * Class MemberController
- * @package App\Http\Controllers
- */
- class MemberController extends BaseController
- {
- /**
- * 构造函数
- * @author wesmiler
- * @since 2020/11/11
- * MemberController constructor.
- */
- public function __construct()
- {
- parent::__construct();
- $this->service = new MemberService();
- $this->yigongService = new YigongService();
- $this->masterService = new MasterService();
- $this->withdrawService = new WithdrawService();
- }
- /**
- * 获取用户信息
- * @return array|mixed
- */
- public function info(){
- $type = request()->get('type', 1);
- $userId = request()->get('user_id', 0);
- $info = $this->service->getUserInfo(['m.id'=> $this->userId],'',$type);
- return message(MESSAGE_OK,true, $info);
- }
- /**
- * 获取用户信息
- * @return array|mixed
- */
- public function master(){
- $userId = request()->get('user_id', 0);
- $info = $this->masterService->getUserInfo($userId,$this->userId);
- return message(MESSAGE_OK,true, $info);
- }
- /**
- * 保存资料
- * @param MemberValidator $validator
- * @return array
- */
- public function saveInfo(MemberValidator $validator){
- $params = $validator->check(request()->all(),'save');
- if(!is_array($params)){
- return message($params, false);
- }
- return $this->service->saveInfo($this->userId);
- }
- /**
- * 法师申请
- * @param MasterValidator $validator
- * @return array
- */
- public function masterApply(MasterValidator $validator){
- $params = $validator->check(request()->all(),'save');
- if(!is_array($params)){
- return message($params, false);
- }
- return $this->masterService->apply($this->userId);
- }
- /**
- * 法师列表
- * @return mixed
- */
- public function masterList(){
- return $this->masterService->getDataList($this->userId);
- }
- /**
- * 加入会员
- * @return array
- */
- public function vip(){
- return $this->service->buyVip($this->userId);
- }
- /**
- * 签到
- * @return mixed
- */
- public function sign(){
- return $this->service->sign($this->userId);
- }
- /**
- * 功德榜
- * @return array
- */
- public function gdList(){
- return $this->service->gdList($this->userId);
- }
- /**
- * 关注
- * @return array
- */
- public function follow(){
- return $this->service->follow($this->userId);
- }
- /**
- * 关注列表
- * @return array
- */
- public function followList(){
- return $this->service->followList($this->userId);
- }
- /**
- * 感兴趣的人
- * @return array
- */
- public function recommand(){
- return $this->service->recommand($this->userId);
- }
- /**
- * 义工申请信息
- * @return mixed
- */
- public function yigong(){
- return $this->yigongService->applyInfo($this->userId);
- }
- /**
- * 申请成为义工
- * @param Request $request
- * @param YigongValidator $validate
- * @return array
- */
- public function yigongApply(Request $request, YigongValidator $validate){
- $params = $validate->check($request->all(),'apply');
- if(!is_array($params)){
- return message($params, false);
- }
- return $this->yigongService->apply($this->userId);
- }
- /**
- * 工资提现
- * @param Request $request
- * @param WithdrawValidator $validate
- * @return array
- */
- public function withdraw(Request $request, WithdrawValidator $validate){
- $params = $validate->check($request->all(),'pay');
- if(!is_array($params)){
- return message($params, false);
- }
- return $this->withdrawService->withdraw($this->userId);
- }
- /**
- * 注销账号
- */
- public function logout(){
- return $this->service->logout($this->userId);
- }
- }
|