123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace App\Http\Controllers\Client;
- use App\Http\Controllers\Controller;
- use App\Services\Client\WalletService;
- use Auth;
- /**
- * @group 用户端
- *
- * 钱包相关的API接口
- */
- class WalletController extends Controller
- {
- protected WalletService $service;
- public function __construct(WalletService $service)
- {
- $this->service = $service;
- }
- /**
- * [钱包管理]获取钱包明细
- *
- * 获取钱包明细
- *
- * @authenticated
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "records": []
- * }
- * }
- */
- public function records()
- {
- return $this->service->getWalletRecords(Auth::user()->id, request('per_page', 10));
- }
- /**
- * [钱包管理]获取用户钱包
- *
- * 获取当前用户的钱包信息
- *
- * @authenticated
- *
- * @response {
- * "code": 200,
- * "message": "获取成功",
- * "data": {
- * "balance": 100.00,
- * "freeze": 0.00
- * }
- * }
- */
- public function wallet()
- {
- return $this->service->getUserWallet(Auth::user()->id);
- }
- }
|