记得上下班打卡 | git大法好,push需谨慎

Commit cdcfddcb authored by 胡佳晨's avatar 胡佳晨

增加使用ar激活码 量

parent 8c0d33f2
...@@ -96,6 +96,8 @@ public class KylinRedisConst { ...@@ -96,6 +96,8 @@ public class KylinRedisConst {
public static final String ACTIVE_TICKET_AR_TICKET = "kylin:active:ar:ticket:";//互动券 public static final String ACTIVE_TICKET_AR_TICKET = "kylin:active:ar:ticket:";//互动券
public static final String ACTIVE_TICKET_AR_USER = "kylin:active:ar:user:";//互动券 绑定的用户 public static final String ACTIVE_TICKET_AR_USER = "kylin:active:ar:user:";//互动券 绑定的用户
public static final String ACTIVE_USE_AR_COUNT = "kylin:ar:use:count";//ar激活码使用量
public static final String RECOMMEND_ACTIVE = "kylin:active:recommend:";// 推荐活动 public static final String RECOMMEND_ACTIVE = "kylin:active:recommend:";// 推荐活动
......
...@@ -26,24 +26,25 @@ public class KylinArActiveServiceImpl implements IKylinArActiveService { ...@@ -26,24 +26,25 @@ public class KylinArActiveServiceImpl implements IKylinArActiveService {
private DataUtils dataUtils; private DataUtils dataUtils;
@Autowired @Autowired
private QueueUtils queueUtils; private QueueUtils queueUtils;
@Override @Override
public ResponseDto exchange(String code, String uid) { public ResponseDto exchange(String code, String uid) {
//1 查看是否有兑换码 //1 查看是否有兑换码
KylinTicketActive kylinTicketActive=dataUtils.getArTicket(code); KylinTicketActive kylinTicketActive = dataUtils.getArTicket(code);
if(null==kylinTicketActive){ if (null == kylinTicketActive) {
return ResponseDto.failure("请输入正确的激活码"); return ResponseDto.failure("请输入正确的激活码");
} }
//2、查看该用户是否绑定 //2、查看该用户是否绑定
if(null!=dataUtils.getUserStatus(uid)){ if (null != dataUtils.getUserStatus(uid)) {
return ResponseDto.failure("该用户已激活"); return ResponseDto.failure("该用户已激活");
} }
//判断是否用过卷了 //判断是否用过卷了
if(kylinTicketActive.getState()==2){ if (kylinTicketActive.getState() == 2) {
return ResponseDto.failure("该激活码已经兑换"); return ResponseDto.failure("该激活码已经兑换");
} }
//开始绑定 //开始绑定
//修改redis缓存 //修改redis缓存
dataUtils.setUser(uid,"1"); dataUtils.setUser(uid, "1");
kylinTicketActive.setState(2); kylinTicketActive.setState(2);
dataUtils.setArTicket(kylinTicketActive); dataUtils.setArTicket(kylinTicketActive);
//队列 修改券的状态。 //队列 修改券的状态。
...@@ -52,9 +53,10 @@ public class KylinArActiveServiceImpl implements IKylinArActiveService { ...@@ -52,9 +53,10 @@ public class KylinArActiveServiceImpl implements IKylinArActiveService {
SqlMapping.get( SqlMapping.get(
"kylin_ar_ticket.update", "kylin_ar_ticket.update",
new Object[]{ new Object[]{
2,uid, LocalDateTime.now(),code 2, uid, LocalDateTime.now(), code
} }
)); ));
dataUtils.incrArCode();
return ResponseDto.success(); return ResponseDto.success();
} }
} }
...@@ -1455,4 +1455,9 @@ public class DataUtils { ...@@ -1455,4 +1455,9 @@ public class DataUtils {
return (List<String>) obj; return (List<String>) obj;
} }
} }
//添加激活码使用量
public void incrArCode() {
redisUtil.incr(KylinRedisConst.ACTIVE_USE_AR_COUNT,1);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment