1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- /**
- * @Name
- * @Description
- * @Author 刘学玺
- * @Date 2024/9/13 17:20
- */
- namespace App\Http\Controllers\Frontend\Client;
- use App\Http\Controllers\Controller;
- use App\Http\Requests\Request;
- use App\Http\Services\Frontend\Client\Coach\UserService;
- use App\Models\Coach\User;
- use Illuminate\Http\JsonResponse;
- class CoachController extends Controller
- {
- protected UserService $userService;
- public function __construct(UserService $userService)
- {
- $this->userService = $userService;
- }
- public function index(): JsonResponse
- {
- // $this->userService->getUserPage();
- $where = ['status' => 1];
- $userPage = User::query()->where($where)->paginate();
- return self::success(['list' => $userPage->items(), 'total' => $userPage->total()]);
- }
- public function show()
- {
- }
- /**
- * Method : 申请技师
- */
- public function create(Request $request): JsonResponse
- {
- $params = $request->only(['name', 'sex', 'birthday', 'mobile', 'city', 'work_img']);
- // 验证码验证手机号
- $user_id = 1;
- if (isset($user_id) && filled($user_id)) {
- // 判断技师资格是否已申请
- $isExists = User::query()->where('user_id', $user_id)->exists();
- if ($isExists) return ['code' => 500, 'msg' => '用户已经申请'];
- }
- $params['user_id'] = $user_id;
- // 判断邀请人$input['partner_id']
- $id = User::query()->create($params)->id;
- return self::success($id);
- }
- public function update()
- {
- }
- public function reapply()
- {
- }
- }
|