123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- <?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();
- return $this->service->updateUserInfo($data);
- }
- /**
- * 获取用户钱包
- *
- * 获取当前用户的钱包信息
- *
- * @authenticated
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "balance": 100.00,
- * "freeze": 0.00
- * }
- * }
- */
- public function wallet()
- {
- return $this->service->getUserWallet();
- }
- /**
- * 用户提现
- *
- * 提现用户的余额
- *
- * @authenticated
- *
- * @bodyParam amount decimal 提现金额. Example: 100.00
- * @bodyParam type string 提现方式. Example: wechat
- * @bodyParam area_code string 行政区划代码. Example: 330100
- *
- * @response {
- * "code": 200,
- * "message": "提现成功",
- * "data": null
- * }
- */
- public function withdraw(Request $request)
- {
- $amount = $request->input('amount');
- $type = $request->input('type', 'wechat');
- $area_code = $request->input('area_code', '');
- return $this->service->withdraw($amount, $type, $area_code);
- }
- /**
- * 用户反馈
- *
- * 提交用户的反馈信息
- *
- * @authenticated
- *
- * @bodyParam content string 反馈内容. Example: 这是一个反馈信息
- *
- * @response {
- * "code": 200,
- * "message": "提交成功",
- * "data": null
- * }
- */
- public function feedback(Request $request)
- {
- $content = $request->input('content');
- return $this->service->feedback($content);
- }
- /**
- * 申请成为技师
- *
- * 申请成为技师
- *
- * @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');
- return $this->service->applyCoach($mobile, $gender, $work_years, $intention_city);
- }
- }
|