<?php

namespace app\controller\api;

use app\extra\basic\Base;
use app\middleware\WxMiddleware;
use LinFly\Annotation\Route\Controller;
use LinFly\Annotation\Route\Middleware;
use LinFly\Annotation\Route\Route;
use support\Request;
use support\Response;


#[Controller(prefix: "/wx_api/rank"),Middleware(WxMiddleware::class)]
class Rank extends Base
{

    protected array $noNeedLogin = ['getRankData'];

    /**
     * 排行榜,前100名
     * @param Request $request
     * @return Response
     */
    #[Route(path: "star",methods: "get")]
    public function getRankData(Request $request): Response
    {
        try {
            $param = $this->_valid([
                "type.default"  => "mon"
            ],$request->method());
            if (!is_array($param)) return error($param);
            $pool = 0; // 奖金池
            $rank = [
                [
                    "avatar_uri"    => "",
                    "nick_name"     => "",
                    "indicator_agg_format"  => "0.00", // 已结算收益,
                    "consume_format"        => "0.00", // 累计消耗
                    "task"          => 0,
                    "level"         => 1
                ]
            ];
            $self = [
                "avatar_uri"    => "",
                "nick_name"     => "",
                "indicator_agg_format"  => "0.00", // 已结算收益,
                "consume_format"        => "0.00", // 累计消耗
                "task"          => 0,
                "level"         => 1
            ];
            return successTrans("success.data",compact("pool","rank","self"));
        } catch (\Throwable $throwable) {
            return error($throwable->getMessage());
        }
    }

}