123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php
- namespace App\Http\Controllers\Client;
- use App\Http\Controllers\Controller;
- use App\Services\Client\UserService;
- use Illuminate\Http\Request;
- /**
- * @group 用户端
- *
- * 用户相关的API接口
- */
- class UserController extends Controller
- {
- protected UserService $service;
- public function __construct(UserService $service)
- {
- $this->service = $service;
- }
- /**
- * [用户]获取用户信息
- *
- * 获取当前用户的信息
- *
- * @authenticated
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "id": 1,
- * "mobile": "13800138000",
- * "nickname": "用户昵称"
- * }
- * }
- */
- public function show()
- {
- return $this->service->getUserInfo();
- }
- /**
- * [用户]修改用户信息
- *
- * 修改当前用户的信息
- *
- * @authenticated
- *
- * @bodyParam nickname string 用户昵称. Example: 用户昵称
- * @bodyParam avatar string 用户头像. Example: https://example.com/avatar.jpg
- *
- * @response {
- * "code": 200,
- * "message": "修改成功",
- * "data": null
- * }
- */
- public function update(Request $request)
- {
- $data = $request->all();
- $result = $this->service->updateUserInfo($data);
- return $result;
- }
- /**
- * [用户]用户反馈
- *
- * 提交用户的反馈信息
- *
- * @authenticated
- *
- * @bodyParam content string 反馈内容. Example: 这是一个反馈信息
- *
- * @response {
- * "code": 200,
- * "message": "提交成功",
- * "data": null
- * }
- */
- public function feedback(Request $request)
- {
- $content = $request->input('content');
- $result = $this->service->feedback($content);
- return $result;
- }
- /**
- * [用户]申请成为技师
- *
- * 申请成为技师
- *
- * @authenticated
- *
- * @bodyParam mobile string 手机号. Example: 13800138000
- * @bodyParam gender string 性别. Example: male
- * @bodyParam work_years string 工作年限. Example: 5
- * @bodyParam intention_city string 意向城市. Example: 杭州
- *
- * @response {
- * "code": 200,
- * "message": "申请成功",
- * "data": null
- * }
- */
- public function applyCoach(Request $request)
- {
- $mobile = $request->input('mobile');
- $gender = $request->input('gender');
- $work_years = $request->input('work_years');
- $intention_city = $request->input('intention_city');
- $result = $this->service->applyCoach($mobile, $gender, $work_years, $intention_city);
- return $result;
- }
- /**
- * [用户]生成二维码
- *
- * @description 生成当前用户的邀请码和对应的二维码
- *
- * @response {
- * "code": 200,
- * "message": "生成成功",
- * "data": {
- * "invite_code": "ABC123",
- * "qr_code": "data:image/png;base64,..."
- * }
- * }
- */
- public function generateInviteCode()
- {
- // 调用服务层生成邀请码
- return $this->service->generateInviteCode();
- }
- }
|