package com.miaxis.pc.controller.extension;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.miaxis.common.core.controller.BaseController;
import com.miaxis.common.core.domain.Response;
import com.miaxis.common.core.domain.entity.UserInfo;
import com.miaxis.extension.service.IWxExtensionIncomeService;
import com.miaxis.extension.vo.ExtensionIncomeVo;
import com.miaxis.spread.service.IWxSpreadRelationService;
import com.miaxis.user.service.IUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author wwl
 * @version 1.0
 * @date 2021/11/29 15:58
 */
@RestController
@RequestMapping("/extension/income")
@Api(tags={"【PC-推广积分】"})
@AllArgsConstructor
public class PcWxExtensionIncomeController extends BaseController {

    private final IWxExtensionIncomeService extensionIncomeService;

    private final IUserInfoService userInfoService;

    private final IWxSpreadRelationService wxSpreadRelationService;




    /**
     * 查询下级推广积分
     */
    @GetMapping(value = "/extensionPoints")
    @ApiOperation("查询下级推广积分")
    public Response<List<ExtensionIncomeVo>> getDownLevelPoints(String openid) {
        List<ExtensionIncomeVo> list = userInfoService.getDownLevelPoints(openid);
        return Response.success(list);
    }



    @GetMapping(value = "/info")
    @ApiOperation("获取代理列表")
    public Response<List<UserInfo>> getInfo(){
        List<String> saleTypeList = new ArrayList<>();
        saleTypeList.add("2");
        saleTypeList.add("3");
        return Response.success(userInfoService.list(new QueryWrapper<UserInfo>().in("sale_type",saleTypeList)));
    }



}
