<?php

namespace app\controller\api\v1;

use support\Request;
use hg\apidoc\annotation as Apidoc;

use App\Utils\ApiResponse;

use App\model\Withdraw;
// use App\dao\UserDao;

/**
 * @Apidoc\Title("提现管理")
 */
class WithdrawController
{  
     /**
     * @Apidoc\Title("查找所有提现记录")
     * @Apidoc\Url("/api/v1/withdraw/lists")
     * @Apidoc\Param(name="black", type="string", desc="是否黑户", required=false)
     * @Apidoc\Param(name="username", type="string", desc="账号", required=false)
     * @Apidoc\Method("POST")
     */
    public function lists(Request $request)
    {
        //根据id查找用户
        $db = Withdraw::all();
        //操作不成功
        if (!$db) {
            return ApiResponse::error (402, '操作失败');
        }
        return ApiResponse::success (200, $db );
    }

    //      /**
    //  * @Apidoc\Title("根据username找子级")
    //  * @Apidoc\Url("/api/v1/Invite/getSonId")
    //  * @Apidoc\Method("POST")
    //  * @Apidoc\Query("id", type="string",require=true, desc="账户id",default="1")
    //  */
    // public function getSonId(Request $request)
    // {
    //     $data = $request->post();
    //     $db = Invite::where('username', $data['id'])->get();

    //     // 如果查询结果为空，返回错误信息
    //     if ($db->isEmpty()) {
    //         return ApiResponse::error(402, '操作失败');
    //     }
    
    //     // 成功时返回查询结果
    //     return ApiResponse::success(200, $db);
    // }
}
