package com.czg.controller.user;

import com.czg.market.entity.MkShopConsumeDiscountRecord;
import com.czg.market.service.MkShopConsumeDiscountRecordService;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 新客立减相关
 *
 * @author Administrator
 */
@RestController
@RequestMapping("/user/consumeDiscount")
public class UShopConsumeDiscountController {
    @Resource
    private MkShopConsumeDiscountRecordService shopConsumeDiscountRecordService;

    /**
     * 获取新客立减金额
     * 返回新客立减当次减免金额
     * @param shopId 店铺id
     * @return 金额
     */
    @GetMapping
    public CzgResult<MkShopConsumeDiscountRecord> get(@RequestParam Long shopId, @RequestParam(required = false) Long orderId) {
//        shopConsumeDiscountRecordService.useDiscount(null, null,null,null);
        return CzgResult.success(shopConsumeDiscountRecordService.getDiscount(shopId, StpKit.USER.getLoginIdAsLong(), orderId));
    }

}
