<?php
/**
 * Created by PhpStorm
 * DateTime: 2022/11/5 0:31
 *
 * @description
 */
namespace App\Http\Controllers\V1\Share;

use App\Http\Controllers\V1\Controller;
use App\Models\ShareConfig;
use App\Models\UserWithdraw;

class ShareController extends Controller
{
    public function income()
    {
        // 已提现
        $been = UserWithdraw::where('user_id', \user()->id)
            ->where('status', 2)
            ->sum('price');
        // 待打款
        $wait = UserWithdraw::where('user_id', \user()->id)
            ->where('status', 1)
            ->sum('price');
        return $this->success([
            'been' =>$been,
            'wait' =>$wait,
        ]);
    }

    public function tips()
    {
        $config = ShareConfig::first();
        return $this->success($config->withdraw_desc);
    }

    public function setting()
    {
        $config = ShareConfig::first();
        return $this->success($config);
    }
}
