package com.starry.admin.modules.weichat.controller;

import com.starry.admin.common.aspect.ClerkUserLogin;
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
import com.starry.admin.modules.clerk.service.IPlayClerkRankingInfoService;
import com.starry.admin.modules.weichat.entity.order.PlayOrderHistoryRankingReturnVo;
import com.starry.admin.modules.weichat.entity.order.PlayOrderRankingReturnVo;
import com.starry.common.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author admin
 * @since 2024/5/25 下午10:25
 **/
@Slf4j
@RestController
@RequestMapping("/wx/orderRanking")
public class WxPlayOrderRankingController {


    @Resource
    private IPlayClerkRankingInfoService playClerkRankingInfoService;


    /**
     * 查询当前排行
     */
    @ClerkUserLogin
    @GetMapping("/clerk/selectCurrentRanking")
    public R selectCurrentRanking() {
        PlayOrderRankingReturnVo result = playClerkRankingInfoService.selectCurrentRanking(ThreadLocalRequestDetail.getClerkUserInfo().getId());
        return R.ok(result);

    }

    /**
     * 查询历史排行
     */
    @ClerkUserLogin
    @GetMapping("/clerk/selectHistoryRanking")
    public R selectHistoryRanking() {
        List<PlayOrderHistoryRankingReturnVo> result = playClerkRankingInfoService.selectHistoryRanking(ThreadLocalRequestDetail.getClerkUserInfo().getId());
        return R.ok(result);

    }
}
