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

Commit ab6702bc authored by jiangxiulong's avatar jiangxiulong

Merge remote-tracking branch 'origin/dev_yy_dh' into dev_yy_dh

parents cb87b613 a15aa019
package com.liquidnet.service.goblin.controller; package com.liquidnet.service.goblin.controller;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.PagedResult; import com.liquidnet.service.base.PagedResult;
import com.liquidnet.service.base.ResponseDto; import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.vo.GoblinNftGoodsSkuInfoVo; import com.liquidnet.service.goblin.dto.vo.GoblinNftGoodsSkuInfoVo;
...@@ -71,4 +72,29 @@ public class GoblinNftGoodsAppController { ...@@ -71,4 +72,29 @@ public class GoblinNftGoodsAppController {
public ResponseDto<Integer> getPayType() { public ResponseDto<Integer> getPayType() {
return ResponseDto.success(redisUtils.getPayType()); return ResponseDto.success(redisUtils.getPayType());
} }
@PostMapping("nftTec")
@ApiOperation("设置 技术部nft特效开关")
@ApiImplicitParams({
@ApiImplicitParam(type = "from", required = true, dataType = "String", name = "value", value = "状态[0-关闭|1-开启]"),
})
public ResponseDto<Boolean> setOpenNftTec(@RequestParam("value") Integer value) {
redisUtils.setOpenNftTec(CurrentUtil.getCurrentUid(), value);
return ResponseDto.success();
}
@GetMapping("nftTec")
@ApiOperation("获取 技术部nft特效开关")
public ResponseDto<Integer> getOpenNftTec() {
return ResponseDto.success(redisUtils.getOpenNftTec(CurrentUtil.getCurrentUid()));
}
@GetMapping("hasNftTec")
@ApiOperation("获取 是否拥有技术nft权限")
public ResponseDto<Integer> getBuyNftTec() {
return ResponseDto.success(redisUtils.getBuyNftTec(CurrentUtil.getCurrentUid()));
}
} }
...@@ -167,7 +167,8 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS ...@@ -167,7 +167,8 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//goblinMongoUtils.setGoblinGoodsAnticipateShareVo(goblinGoodsAnticipateShareVo); //goblinMongoUtils.setGoblinGoodsAnticipateShareVo(goblinGoodsAnticipateShareVo);
//redis缓存 //redis缓存
goblinRedisUtils.setShare(skuId, uid, sid); Duration between = Duration.between(valueBySkuId.getAboutStartDate(), valueBySkuId.getAboutEndDate());
goblinRedisUtils.setShare(skuId, uid, sid,between.toDays());
//redis存储用户分享 //redis存储用户分享
goblinRedisUtils.setShareVo(goblinGoodsAnticipateShareVo); goblinRedisUtils.setShareVo(goblinGoodsAnticipateShareVo);
...@@ -193,7 +194,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS ...@@ -193,7 +194,7 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
//查询是否可以预约 //查询是否可以预约
GoblinGoodsAnticipateShareVo shareVo = goblinRedisUtils.getShareVo(sid); GoblinGoodsAnticipateShareVo shareVo = goblinRedisUtils.getShareVo(sid);
if (shareVo == null) { if (shareVo == null) {
return ResponseDto.failure("分享不存在!"); return ResponseDto.failure("分享不存在,!");
} }
Integer integer = GoblinAnticipateUtils.setState(shareVo.getAboutStartDate(), shareVo.getAboutEndDate()); Integer integer = GoblinAnticipateUtils.setState(shareVo.getAboutStartDate(), shareVo.getAboutEndDate());
if (integer != null && !integer.equals(1)) { if (integer != null && !integer.equals(1)) {
...@@ -254,9 +255,12 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS ...@@ -254,9 +255,12 @@ public class GoblinGoodsAnticipateServiceImpl implements IGoblinGoodsAnticipateS
public ResponseDto<HelpValueVo> getHelpValue(String sid) { public ResponseDto<HelpValueVo> getHelpValue(String sid) {
//获取分享助力信息 //获取分享助力信息
GoblinGoodsAnticipateShareVo shareVo = goblinRedisUtils.getShareVo(sid); GoblinGoodsAnticipateShareVo shareVo = goblinRedisUtils.getShareVo(sid);
HelpValueVo helpValueVo = HelpValueVo.getNew(); if (shareVo != null) {
helpValueVo.copy(shareVo); HelpValueVo helpValueVo = HelpValueVo.getNew();
return ResponseDto.success(helpValueVo); helpValueVo.copy(shareVo);
return ResponseDto.success(helpValueVo);
}
return ResponseDto.failure("该助力不存在!");
} }
@Override @Override
......
...@@ -160,15 +160,15 @@ public class GoblinRedisUtils { ...@@ -160,15 +160,15 @@ public class GoblinRedisUtils {
/** /**
* 存用户助力关联 * 存用户助力关联
*/ */
public void setShare(String skuId, String uid,String sid) { public void setShare(String skuId, String uid, String sid,Long day) {
String key = GoblinRedisConst.ANTICIPATE_SHARE_UID_SKUID.concat(uid).concat(":").concat(skuId); String key = GoblinRedisConst.ANTICIPATE_SHARE_UID_SKUID.concat(uid).concat(":").concat(skuId);
redisUtil.set(key,sid); redisUtil.set(key, sid,(day + 1) * 60 * 60 * 24);
} }
/** /**
* 获取用户是否开启关联助力 * 获取用户是否开启关联助力
*/ */
public String getShare(String skuId,String uid){ public String getShare(String skuId, String uid) {
String key = GoblinRedisConst.ANTICIPATE_SHARE_UID_SKUID.concat(uid).concat(":").concat(skuId); String key = GoblinRedisConst.ANTICIPATE_SHARE_UID_SKUID.concat(uid).concat(":").concat(skuId);
return (String) redisUtil.get(key); return (String) redisUtil.get(key);
} }
...@@ -176,7 +176,7 @@ public class GoblinRedisUtils { ...@@ -176,7 +176,7 @@ public class GoblinRedisUtils {
/** /**
* 缓存sku预约助力人数 * 缓存sku预约助力人数
*/ */
public void delSharePeopleBySkuId(String skuId){ public void delSharePeopleBySkuId(String skuId) {
String key = GoblinRedisConst.ANTICIPATE_SHARE_SKUID_PEOPLE.concat(skuId); String key = GoblinRedisConst.ANTICIPATE_SHARE_SKUID_PEOPLE.concat(skuId);
redisUtil.del(key); redisUtil.del(key);
} }
...@@ -197,7 +197,7 @@ public class GoblinRedisUtils { ...@@ -197,7 +197,7 @@ public class GoblinRedisUtils {
public List<String> getHelpUserAvatar(String sid) { public List<String> getHelpUserAvatar(String sid) {
GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid); GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid);
if (shareVo!=null){ if (shareVo != null) {
return shareVo.getAvatarImgList(); return shareVo.getAvatarImgList();
} else { } else {
return CollectionUtil.arrayListString(); return CollectionUtil.arrayListString();
...@@ -207,28 +207,28 @@ public class GoblinRedisUtils { ...@@ -207,28 +207,28 @@ public class GoblinRedisUtils {
/** /**
* 存储分享VO * 存储分享VO
*/ */
public void setShareVo(GoblinGoodsAnticipateShareVo goblinGoodsAnticipateShareVo){ public void setShareVo(GoblinGoodsAnticipateShareVo goblinGoodsAnticipateShareVo) {
redisUtil.set(GoblinRedisConst.ANTICIPATE_SHARE_VO.concat(goblinGoodsAnticipateShareVo.getSid()),goblinGoodsAnticipateShareVo); redisUtil.set(GoblinRedisConst.ANTICIPATE_SHARE_VO.concat(goblinGoodsAnticipateShareVo.getSid()), goblinGoodsAnticipateShareVo);
} }
/** /**
* 获取分享VO * 获取分享VO
*/ */
public GoblinGoodsAnticipateShareVo getShareVo(String sid){ public GoblinGoodsAnticipateShareVo getShareVo(String sid) {
return (GoblinGoodsAnticipateShareVo) redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_VO.concat(sid)); return (GoblinGoodsAnticipateShareVo) redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_VO.concat(sid));
} }
/** /**
* 缓存助力 * 缓存助力
*/ */
public void setHelpByUidAndSid(String uid,String sid,Long day){ public void setHelpByUidAndSid(String uid, String sid, Long day) {
redisUtil.set(GoblinRedisConst.ANTICIPATE_SHARE_HELPID_SID.concat(uid).concat(":").concat(sid),0,(day+1)*60*60*24); redisUtil.set(GoblinRedisConst.ANTICIPATE_SHARE_HELPID_SID.concat(uid).concat(":").concat(sid), 0, (day + 1) * 60 * 60 * 24);
} }
/** /**
* 获取助力 * 获取助力
*/ */
public Integer getHelpByUidAndSid(String uid,String sid){ public Integer getHelpByUidAndSid(String uid, String sid) {
return (Integer) redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_HELPID_SID.concat(uid).concat(":").concat(sid)); return (Integer) redisUtil.get(GoblinRedisConst.ANTICIPATE_SHARE_HELPID_SID.concat(uid).concat(":").concat(sid));
} }
...@@ -246,10 +246,10 @@ public class GoblinRedisUtils { ...@@ -246,10 +246,10 @@ public class GoblinRedisUtils {
/** /**
* 获取 助力id人数 * 获取 助力id人数
*/ */
public Integer getHelpSidAddHelp(String sid){ public Integer getHelpSidAddHelp(String sid) {
GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid); GoblinGoodsAnticipateShareVo shareVo = getShareVo(sid);
Integer people = null; Integer people = null;
if (shareVo!=null){ if (shareVo != null) {
people = shareVo.getHelpPeople(); people = shareVo.getHelpPeople();
} }
return people != null ? people : 0; return people != null ? people : 0;
...@@ -1819,6 +1819,61 @@ public class GoblinRedisUtils { ...@@ -1819,6 +1819,61 @@ public class GoblinRedisUtils {
} }
} }
public Integer getBuyNftTec(String uid) {
String rdk = GoblinRedisConst.BUY_NFT_TEC.concat(uid);
Object obj = redisUtil.get(rdk);
if (obj == null) {
return null;
} else {
return (int) obj;
}
}
/**
* 设置 技术部nft特效开关
*
* @param uid
* @param status
*/
public void setOpenNftTec(String uid, Integer status) {
String rdk = GoblinRedisConst.OPEN_NFT_TEC.concat(uid);
if (!(status == 0 || status == 1)) {
status = 0;
}
Integer data = getBuyNftTec(uid);
if (data == null) {
redisUtil.set(rdk, 0);
} else if (data == 1) {
redisUtil.set(rdk, status);
} else {
redisUtil.set(rdk, 0);
}
}
/**
* 获取 技术部nft特效开关
*
* @param uid
* @return
*/
public Integer getOpenNftTec(String uid) {
String rdk = GoblinRedisConst.OPEN_NFT_TEC.concat(uid);
Object obj = redisUtil.get(rdk);
if (obj == null) {
Integer data = getBuyNftTec(uid);
if (data == null) {
return null;
} else if (data == 1) {
setOpenNftTec(uid, 1);
return 1;
} else {
return null;
}
} else {
return (int) obj;
}
}
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */ /* ---------------------------------------- ---------------------------------------- */
} }
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