生成会员码
This commit is contained in:
@@ -3,13 +3,21 @@ package com.czg.controller.admin;
|
||||
import com.czg.account.dto.ShopActivateDTO;
|
||||
import com.czg.account.service.ShopActivateService;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.config.RedisCst;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.util.WechatAuthUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 店铺充值活动管理
|
||||
@@ -23,6 +31,10 @@ import java.util.List;
|
||||
public class ShopActivateController {
|
||||
@Resource
|
||||
private ShopActivateService shopActivateService;
|
||||
@Resource
|
||||
private RedisService redisService;
|
||||
@Resource
|
||||
private WechatAuthUtil wechatUtil;
|
||||
|
||||
/**
|
||||
* 店铺充值活动列表
|
||||
@@ -54,4 +66,21 @@ public class ShopActivateController {
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated ShopActivateDTO activateDTO) {
|
||||
return CzgResult.success(shopActivateService.edit(activateDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员码
|
||||
* @param params shopId 必填
|
||||
* env_version 存在即生成体验版
|
||||
*/
|
||||
@PostMapping("/getVipCode")
|
||||
public CzgResult<Object> getVipCode(@RequestBody Map<String, Object> params) throws Exception {
|
||||
if (CollectionUtils.isEmpty(params) || !params.containsKey("shopId")) {
|
||||
throw new CzgException("参数错误");
|
||||
}
|
||||
String redisKey = RedisCst.SHOP_VIP_CODE + params.get("shopId");
|
||||
if (redisService.hasKey(redisKey)) {
|
||||
return CzgResult.success(redisService.get(redisKey));
|
||||
}
|
||||
return CzgResult.success(wechatUtil.getFetchQrCode(params));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user