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

Commit 32e9e4d9 authored by 张国柄's avatar 张国柄

+api:商城:短信API/发送验证码;

+api:商城:短信API/校验验证码;
+api:用户安全设置/设置安全密;
~api:我的藏品管理/藏品列表:新增`transferState`转赠状态、`transferTimeLimit`转赠时间限制(单位秒;
~api:我的藏品管理/藏品详情:新增`transferState`转赠状态、`transferTimeLimit`转赠时间限制、`systime`系统当前时间;
parent ce851267
......@@ -3,6 +3,8 @@ package com.liquidnet.service.goblin.constant;
public class GoblinRedisConst {
public static final String PREFIX = "goblin:";
/* ----------------------------------------------------------------- */
public static final String VALID_SMS_CODE_MOBILE = PREFIX.concat("valid:sms:code:mobile:");
/* ----------------------------------------------------------------- */
/**
* IOS商品价格集
* {goblin:bsc:lib:ios_products, JsonNode}
......@@ -187,13 +189,13 @@ public class GoblinRedisConst {
/**
* 我的藏品ID列表(首页)
* {goblin:u_d_art:${uid}, JsonUtils.toJson(List<String:artwork_id>)}
* {goblin:u_d_art:${uid}, List<String:artwork_id>}
*/
public static final String USER_DIGITAL_ARTWORK_IDS = PREFIX.concat("u_d_art_ids:");
/**
* 我的藏品信息
* {goblin:u_d_art:${artwork_id}, JsonUtils.toJson(com.liquidnet.service.goblin.dto.vo.GoblinDigitalArtworkVo)}
* {goblin:u_d_art:${artwork_id}, com.liquidnet.service.goblin.dto.vo.GoblinUserDigitalArtworkVo}
*/
public static final String USER_DIGITAL_ARTWORK = PREFIX.concat("u_d_art:");
......@@ -350,4 +352,23 @@ public class GoblinRedisConst {
public static final String GOBLIN_NUM_LIST = PREFIX.concat("nft:num:");//$key+":"+$skuId 根据skuId获取序号list
public static final String GOBLIN_NUM_DETAILS = PREFIX.concat("nft:num:details:");//$key+$num+$skuId 根据num+skuId获取DTO
/* ----------------------------------------------------------------- */
/**
* NFT用户安全配置
* {goblin:u_safe_c:${uid}, com.liquidnet.service.goblin.dto.GoblinUserSafeConfigDto}
*/
public static final String USER_SAFE_CONFIG = PREFIX.concat("u_safe_c:");
/**
* NFT转赠约束时间(单位秒)
* {goblin:nft_tx_tl, long}
*/
public static final String NFT_TRANSFER_TIME_LIMIT = PREFIX.concat("nft_tx_tl");
/* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */
/* ----------------------------------------------------------------- */
}
package com.liquidnet.service.goblin.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@ApiModel(value = "GoblinUserSafeConfigDto", description = "NFT:用户安全配置")
@Data
@JsonIgnoreProperties(value = {"uid"}, ignoreUnknown = true)
public class GoblinUserSafeConfigDto implements Serializable, Cloneable {
private static final long serialVersionUID = -141364364882594556L;
@ApiModelProperty(position = 11, value = "安全密码[100]")
private String passwd;
private static final GoblinUserSafeConfigDto obj = new GoblinUserSafeConfigDto();
public static GoblinUserSafeConfigDto getNew() {
return obj.clone();
}
@Override
public GoblinUserSafeConfigDto clone() {
try {
return (GoblinUserSafeConfigDto) super.clone();
} catch (CloneNotSupportedException e) {
return new GoblinUserSafeConfigDto();
}
}
}
package com.liquidnet.service.goblin.dto.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.liquidnet.commons.lang.util.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@ApiModel(value = "GoblinUserDigitalArtworkInfoVo", description = "我的藏品详情")
@Data
......@@ -54,6 +57,14 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
@ApiModelProperty(position = 27, value = "展示预览图片URL[256]")
private String skuWatchPic;
@ApiModelProperty(position = 28, value = "转赠状态[PENDING|SUCCESS]")
private String transferState;
@ApiModelProperty(position = 29, value = "转赠时间限制(单位秒)")
private Long transferTimeLimit;
@ApiModelProperty(position = 30, value = "系统当前时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime systime;
private static final GoblinUserDigitalArtworkInfoVo obj = new GoblinUserDigitalArtworkInfoVo();
public static GoblinUserDigitalArtworkInfoVo getNew() {
......@@ -77,8 +88,8 @@ public class GoblinUserDigitalArtworkInfoVo implements Serializable, Cloneable {
this.setGenerateTime(source.getTradingAt());
this.setSource(source.getSource());
this.setState(source.getState());
// this.setAuthor();
// this.setPublisher();
this.setAuthor(source.getAuthor());
this.setPublisher(source.getPublisher());
// this.setDetails();
this.setSkuId(source.getSkuId());
return this;
......
......@@ -46,6 +46,10 @@ public class GoblinUserDigitalArtworkListVo implements Serializable, Cloneable {
@ApiModelProperty(position = 22, value = "创作者")
private String author;
@ApiModelProperty(position = 23, value = "转赠状态[PENDING|SUCCESS]")
private String transferState;
@ApiModelProperty(position = 24, value = "转赠时间限制(单位秒)")
private Long transferTimeLimit;
private static final GoblinUserDigitalArtworkListVo obj = new GoblinUserDigitalArtworkListVo();
......@@ -72,6 +76,7 @@ public class GoblinUserDigitalArtworkListVo implements Serializable, Cloneable {
// this.setOpeningTime();
this.setAuthor(source.getAuthor());
this.setTransferState(source.getTransferState());
return this;
}
}
......@@ -17,7 +17,7 @@ public class GoblinUserDigitalArtworkPageVo implements Cloneable {
@ApiModelProperty(position = 12, value = "藏品列表分页数据")
private PagedResult<GoblinUserDigitalArtworkListVo> pagedResult;
@ApiModelProperty(position = 13, value = "系统时间")
@ApiModelProperty(position = 13, value = "系统当前时间")
@JsonFormat(shape=JsonFormat.Shape.STRING, pattern= DateUtil.DATE_FULL_STR)
private LocalDateTime systime;
......
......@@ -20,6 +20,7 @@ public class GoblinUserDigitalArtworkVo implements Serializable, Cloneable {
private String releaseAt;
private String tradingTxhash;
private String tradingAt;
private String transferState;
private Integer source;
private Integer state;
private String delFlg;
......@@ -28,9 +29,10 @@ public class GoblinUserDigitalArtworkVo implements Serializable, Cloneable {
private LocalDateTime updatedAt;
private LocalDateTime deletedAt;
/* ---------------------- 冗余SPU信息 ---------------------- */
/* ---------------------- 冗余的关联信息 ---------------------- */
private String author;
private String publisher;
private String transferUser;
private String hitArtworkId;
private static final GoblinUserDigitalArtworkVo obj = new GoblinUserDigitalArtworkVo();
......
package com.liquidnet.service.goblin.service;
public interface IGoblinUserSafeConfigService {
/**
* 设置安全密码(首次)
*
* @param passwd 安全密码:MD5(******)
* @param uid UID
* @return boolean:true|false
*/
boolean initSafePasswd(String passwd, String uid);
}
......@@ -79,6 +79,11 @@ public class GoblinUserDigitalArtwork implements Serializable {
*/
private String tradingAt;
/**
* 转赠状态[PENDING|SUCCESS]
*/
private String transferState;
/**
* 获得方式[1-购买|2-兑换|3-赠送|5-受赠|31-空投赠送]
*/
......
package com.liquidnet.service.goblin.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 用户资产设置
* </p>
*
* @author liquidnet
* @since 2022-08-16
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class GoblinUserSafeConfig implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "mid", type = IdType.AUTO)
private Long mid;
/**
* UID
*/
private String uid;
/**
* 安全密码
*/
private String pwsswd;
/**
* 0-INIT,1-NORMAL,2-INVALID
*/
private Integer state;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
private String comment;
}
package com.liquidnet.service.goblin.mapper;
import com.liquidnet.service.goblin.entity.GoblinUserSafeConfig;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 用户资产设置 Mapper 接口
* </p>
*
* @author liquidnet
* @since 2022-08-16
*/
public interface GoblinUserSafeConfigMapper extends BaseMapper<GoblinUserSafeConfig> {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.liquidnet.service.goblin.mapper.GoblinUserSafeConfigMapper">
</mapper>
use dev_ln_scene;
# -- >>------------------------------------------------------------------------------------
alter table adam_real_name add node tinyint default 2 not null comment '认证节点[2-二要素|3-三要素]' after type;
/*alter table adam_real_name add node tinyint default 2 not null comment '认证节点[2-二要素|3-三要素]' after type;
alter table goblin_goods add spu_type tinyint default 0 not null comment '商品类型[0-常规|1-数字藏品]' after spu_no;
alter table goblin_goods add attention varchar(256) null comment '注意事项' after details;
......@@ -105,7 +105,7 @@ create table goblin_user_digital_artwork
updated_at datetime null,
deleted_at datetime null,
comment varchar(500)
) engine = InnoDB comment '用户数字藏品信息';
) engine = InnoDB comment '用户数字藏品信息';*/
# -- >>------------------------------------------------------------------------------------
# drop table if exists goblin_goods_sku_excode;
# create table goblin_goods_sku_excode
......
......@@ -1060,10 +1060,115 @@ create table goblin_user_coupon
) engine = InnoDB comment '商城用户券信息';
create unique index uidx_guc_ucoupon_id on goblin_user_coupon (ucoupon_id);
# -- >>------------------------------------------------------------------------------------ |20220323数字藏品NFT
alter table goblin_goods add spu_type tinyint default 0 not null comment '商品类型[0-常规|1-数字藏品]' after spu_no;
alter table goblin_goods add attention varchar(256) null comment '注意事项' after details;
alter table goblin_goods add sale_start_time datetime null comment '开售时间' after shelves_time;
alter table goblin_goods add sale_stop_time datetime null comment '停售时间' after sale_start_time;
alter table goblin_goods add author varchar(100) null comment '创作者' after spu_appear;
alter table goblin_goods add spu_canbuy char null comment '是否购买[0-否|1-是]' after spu_appear;
alter table goblin_goods add publisher varchar(100) null comment '发行方' after author;
# alter table goblin_goods add has_box tinyint default 0 null comment '存在盲盒[0-否|1-是]' after spu_appear;
alter table goblin_goods_sku add sku_type tinyint default 0 not null comment '商品类型[0-常规|1-数字藏品]' after sku_no;
alter table goblin_goods_sku add sku_watch varchar(256) null comment '展示文件URL' after sku_pic;
alter table goblin_goods_sku add watch_type char null comment '展示文件类型[1-图片|2-视频|3-模型]' after sku_watch;
alter table goblin_goods_sku add sku_watch_pic varchar(256) null comment '展示预览图片' after watch_type;
alter table goblin_goods_sku add intro varchar(256) null comment '简介' after weight;
alter table goblin_goods_sku add details text null comment '详情' after intro;
# alter table goblin_goods_sku add gift_stock int null comment '兑换库存' after sku_stock;
alter table goblin_goods_sku add price_v decimal(20, 2) null comment '苹果商品价格' after price;
alter table goblin_goods_sku add product_id varchar(20) null comment '苹果商品价格ID' after price_v;
alter table goblin_goods_sku add shelves_handle char default '1' comment '上架处理方式[1-等待手动上架|2-直接上架售卖|3-预约定时上架]' after store_id;
alter table goblin_goods_sku add shelves_time datetime null comment '预约上架时间[上架处理方式为3-预约定时上架时需要指定]' after shelves_handle;
alter table goblin_goods_sku add sale_start_time datetime null comment '开售时间' after shelves_time;
alter table goblin_goods_sku add sale_stop_time datetime null comment '停售时间' after sale_start_time;
alter table goblin_goods_sku add soldout_status char default '0' not null comment '是否售罄[0-否|1-是]' after shelves_status;
alter table goblin_goods_sku add sku_canbuy char null comment '是否购买[0-否|1-是]' after sku_appear;
alter table goblin_goods_sku add unbox char default '0' not null null comment '是否盲盒[0-否|1-是]' after sku_canbuy;
alter table goblin_goods_sku add hit_ratio decimal(8, 2) null comment '盲盒命中率[0.00~100%],0标识不参与盲盒,null标识均摊' after unbox;
alter table goblin_goods_sku add opening_time datetime null comment '盲盒开启时间' after hit_ratio;
alter table goblin_goods_sku add opening_limit int default 0 comment '盲盒开启时限[单位秒]' after opening_time;
drop table if exists goblin_goods_sku_nft;
create table goblin_goods_sku_nft
(
mid bigint auto_increment primary key,
sku_id varchar(64) not null comment '单品id',
route_type varchar(20) null comment 'NFT路由',
material_type char null comment '素材原始文件类型[1-图片|2-视频|3-模型]',
material_url varchar(256) null comment '素材原始文件URL',
upchain tinyint default 0 comment 'NFT上传声明状态[0-待上传|1-已声明|2-声明失败|9-声明中]',
display_url varchar(500) null comment 'NFT预览图URL',
nft_url varchar(500) null comment 'NFT素材访问URL',
series_id varchar(256) null comment 'NFT系列ID',
series_hash varchar(256) null comment 'NFT系列HASH',
nft_hash varchar(256) null comment 'NFT藏品HASH',
declare_at varchar(25) null comment 'NFT系列声明时间',
created_at datetime not null,
updated_at datetime null,
comment varchar(255)
) engine = InnoDB comment '商品NFT信息';
create unique index uidx_ggsn_sku_id on goblin_goods_sku_nft (sku_id);
drop table if exists goblin_goods_sku_tag;
create table goblin_goods_sku_tag
(
mid bigint auto_increment primary key,
sku_id varchar(64) not null comment '商品id',
tag_id varchar(30) not null comment '标签id,对应 goblin_self_tag.tag_id',
sort int default 0 comment '排序[数值越小,排序越前]',
tag_belong char default '0' comment '标签所属[0-普通标签|1-专属标签]',
del_flg char default '0' comment '删除标记[0-未删除|1-删除]',
comment varchar(255)
) engine = InnoDB comment '商品关联标签';
create unique index uidx_ggst_sku_tag on goblin_goods_sku_tag (sku_id, tag_id);
drop table if exists goblin_user_digital_artwork;
create table goblin_user_digital_artwork
(
mid bigint auto_increment primary key,
artwork_id varchar(64) not null comment '藏品ID',
uid varchar(64) not null comment '用户UID',
sku_id varchar(64) not null comment '单品ID',
order_id varchar(64) not null comment '藏品订单号',
edition_sn int null comment '序列号',
nft_id varchar(256) null comment '藏品NFT ID',
release_txhash varchar(256) null comment '发行HASH',
release_at varchar(25) null comment '发行时间',
trading_txhash varchar(256) null comment '发放HASH',
trading_at varchar(25) null comment '交易时间',
source tinyint null comment '获得方式[1-购买|2-兑换|3-赠送|5-受赠|31-空投赠送]',
state tinyint default 0 comment '藏品状态[0-生成中/未开启|1-已生成/已开启|2-生成失败/开启失败|5-待收取]',
del_flg char default '0' comment '删除标记[0-未删除|1-删除]',
opening_at datetime null comment '盲盒开启时间',
created_at datetime not null,
updated_at datetime null,
deleted_at datetime null,
comment varchar(500)
) engine = InnoDB comment '用户数字藏品信息';
# -- >>------------------------------------------------------------------------------------ |20220817数字藏品转赠安全密码
alter table goblin_user_digital_artwork
add transfer_state varchar(20) null comment '转赠状态[PENDING|SUCCESS]' after trading_at;
drop table if exists goblin_user_safe_config;
create table goblin_user_safe_config
(
mid bigint auto_increment primary key,
uid varchar(64) not null comment 'UID',
pwsswd varchar(100) comment '安全密码',
state tinyint default 1 comment '0-INIT,1-NORMAL,2-INVALID',
created_at datetime not null,
updated_at datetime null,
comment varchar(500)
) engine = InnoDB comment '用户资产设置';
create unique index idx_gusc_uid on goblin_user_safe_config (uid);
# -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------
# -- >>------------------------------------------------------------------------------------
\ No newline at end of file
package com.liquidnet.service.goblin.controller;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.common.sms.constant.SmsEnum;
import com.liquidnet.common.sms.processor.SmsProcessor;
import com.liquidnet.commons.lang.constant.LnsEnum;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Pattern;
@ApiSupport(order = 141000)
@Api(tags = "商城:短信API")
@Slf4j
@RestController
@RequestMapping("sms")
public class GoblinSmsController {
@Autowired
Environment env;
@Autowired
SmsProcessor smsProcessor;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@ApiOperationSupport(order = 1)
@ApiOperation(value = "发送验证码", notes = "验证码10分钟内有效,发送频率最短1分钟")
@PostMapping(value = {"code/send"})
public ResponseDto<Object> sendVerificationCode() {
String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
String smsCode = goblinRedisUtils.getSmsCodeByMobile(mobile);
if (StringUtils.isEmpty(smsCode)) {
smsCode = RandomStringUtils.randomNumeric(6);
} else {
Long ttl = goblinRedisUtils.ttlSmsCodeByMobile(mobile);
if (null != ttl && ttl != -2 && ttl > 540) {
return ResponseDto.failure(ErrorMapping.get("140000"));
}
}
ObjectNode msgNode = JsonUtils.OM().createObjectNode();
msgNode.put("code", smsCode);
boolean sendRst = smsProcessor.send(mobile, SmsEnum.ADSignName.M02.getVal(), SmsEnum.ADTemplate.SMS_221055862.name(), msgNode.toString());
if (sendRst) {
goblinRedisUtils.setSmsCodeByMobile(mobile, smsCode);
return ResponseDto.success();
}
return ResponseDto.failure(ErrorMapping.get("140017"));
}
@ApiOperationSupport(order = 2)
@ApiOperation(value = "校验验证码")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "code", value = "验证码"),
})
@PostMapping(value = {"code/check"})
public ResponseDto<Object> checkVerificationCode(@Pattern(regexp = "\\d{6}", message = "验证码格式有误") @RequestParam String code) {
String mobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
if (!LnsEnum.ENV.prod.name().equals(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
if (CurrentUtil.GRAY_LOGIN_SMS_CODE.equals(code)) {
return ResponseDto.success();
}
}
String smsCodeByMobile = goblinRedisUtils.getSmsCodeByMobile(mobile);
if (null == smsCodeByMobile) {
return ResponseDto.failure(ErrorMapping.get("140018"));
}
if (smsCodeByMobile.equals(code)) {
return ResponseDto.success();
}
return ResponseDto.failure(ErrorMapping.get("140019"));
}
}
package com.liquidnet.service.goblin.controller;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.liquidnet.commons.lang.constant.LnsEnum;
import com.liquidnet.commons.lang.util.CurrentUtil;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.dto.GoblinUserSafeConfigDto;
import com.liquidnet.service.goblin.service.IGoblinUserSafeConfigService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
@ApiSupport(order = 142001)
@Api(tags = "用户安全设置")
@Slf4j
@RestController
@RequestMapping("user/safe")
public class GoblinUserSafeController {
@Autowired
Environment env;
@Autowired
GoblinRedisUtils goblinRedisUtils;
@Autowired
IGoblinUserSafeConfigService goblinUserAssetConfigService;
@ApiOperationSupport(order = 1)
@ApiOperation(value = "设置安全密码")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "passwd", value = "安全密码:MD5(******)"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "code", value = "验证码"),
})
@PostMapping(value = {"passwd/set"})
public ResponseDto<Object> setSecurityCode(@Size(min = 32, max = 32, message = "安全密码无效") @RequestParam String passwd,
@Pattern(regexp = "\\d{6}", message = "验证码格式有误") @RequestParam String code
) {
String currentUid = CurrentUtil.getCurrentUid(), currentMobile = (String) CurrentUtil.getTokenClaims().get(CurrentUtil.TOKEN_MOBILE);
if (!LnsEnum.ENV.prod.name().equals(env.getProperty(CurrentUtil.CK_ENV_ACTIVE))) {
if (!CurrentUtil.GRAY_LOGIN_SMS_CODE.equals(code)) {
return ResponseDto.failure(ErrorMapping.get("140001"));
}
} else {
String cacheCode = goblinRedisUtils.getSmsCodeByMobile(currentMobile);
if (StringUtils.isEmpty(cacheCode)) {
return ResponseDto.failure(ErrorMapping.get("140018"));
}
if (!cacheCode.equals(code)) {
return ResponseDto.failure(ErrorMapping.get("140001"));
}
}
GoblinUserSafeConfigDto userSafeConfigDto = goblinRedisUtils.getUserSafeConfigDto(currentUid);
if (null != userSafeConfigDto) {
return ResponseDto.failure(ErrorMapping.get("140020"));
}
String lockKey = GoblinRedisConst.USER_SAFE_CONFIG.concat("l").concat(currentUid);
if (goblinRedisUtils.incr(lockKey, 1) > 1) {
return ResponseDto.failure(ErrorMapping.get("140000"));
}
boolean resultFlg = goblinUserAssetConfigService.initSafePasswd(passwd, currentUid);
goblinRedisUtils.del(lockKey);
return resultFlg ? ResponseDto.success() : ResponseDto.failure(ErrorMapping.get("140002"));
}
}
......@@ -55,10 +55,10 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
if (artworkNum > 30 && pageNum * pageSize > 30) {// 查询Mongo
// if ((long) pageNum * pageSize > artworkNum) pageNum = Math.toIntExact(artworkNum / pageSize);
subArtworkIdList = goblinMongoUtils.getPageUserDigitalArtworkIds(uid, pageNum, pageSize);
if (CollectionUtils.isEmpty(subArtworkIdList)) {
log.warn("#我的藏品列表:藏品IDS数据为空[uid={},artworkNum={}]", uid, artworkNum);
return pageVo.setArtworkNum((int) artworkNum).setPagedResult(listVoPagedResult).setSystime(LocalDateTime.now());
}
// if (CollectionUtils.isEmpty(subArtworkIdList)) {
// log.warn("#我的藏品列表:藏品IDS数据为空[uid={},artworkNum={}]", uid, artworkNum);
// return pageVo.setArtworkNum((int) artworkNum).setPagedResult(listVoPagedResult).setSystime(LocalDateTime.now());
// }
} else {
List<String> userDigitalArtworkIds = goblinRedisUtils.getUserDigitalArtworkIds(uid);
// if (CollectionUtils.isEmpty(userDigitalArtworkIds)) {
......@@ -72,7 +72,12 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
int fromIndex = (pageNum - 1) * pageSize;
subArtworkIdList = userDigitalArtworkIds.subList(fromIndex, Math.min(fromIndex + pageSize, cacheSize));
}
if (CollectionUtils.isEmpty(subArtworkIdList)) {
log.warn("#我的藏品列表:藏品IDS数据为空[uid={},artworkNum={}]", uid, artworkNum);
return pageVo.setArtworkNum((int) artworkNum).setPagedResult(listVoPagedResult).setSystime(LocalDateTime.now());
}
long transferTimeLimit = goblinRedisUtils.getUserDigitalArtworkTransferTimeLimit();
List<GoblinUserDigitalArtworkListVo> list = ObjectUtil.getGoblinUserDigitalArtworkListVoArrayList();
LocalDateTime now = LocalDateTime.now(), toCheckTime = now.minusSeconds(15);
for (int i = 0, subSize = subArtworkIdList.size(); i < subSize; i++) {
......@@ -89,6 +94,7 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
listVo.setEdition(goodsSkuInfoVo.getSkuStock());
listVo.setUnbox(goodsSkuInfoVo.getUnbox());
listVo.setOpeningTime(goodsSkuInfoVo.getOpeningTime());
listVo.setTransferTimeLimit(transferTimeLimit);
// 非盲盒 && 生成中 && 创建时间判断
if ("0".equals(listVo.getUnbox()) && 0 == listVo.getState() && listVo.getCreatedAt().isBefore(toCheckTime)) {// 15秒前创建的藏品,去主动核实发行交易状态
......@@ -112,7 +118,7 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
@Override
public GoblinUserDigitalArtworkInfoVo info(String uid, String artworkId) {
GoblinUserDigitalArtworkVo userDigitalArtworkVo = goblinRedisUtils.getUserDigitalArtworkVo(artworkId);
if (null != userDigitalArtworkVo && userDigitalArtworkVo.getUid().equals(uid)) {
/*if (null != userDigitalArtworkVo && userDigitalArtworkVo.getUid().equals(uid)) {
GoblinUserDigitalArtworkInfoVo artworkInfoVo = GoblinUserDigitalArtworkInfoVo.getNew().copy(userDigitalArtworkVo);
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId());
......@@ -136,6 +142,34 @@ public class GoblinUserDigitalArtworkServiceImpl implements IGoblinUserDigitalAr
// artworkInfoVo.setGenerateTime(goodsSkuInfoVo.getDeclareAt());
artworkInfoVo.setSkuWatchPic(goodsSkuInfoVo.getSkuWatchPic());
return artworkInfoVo;
}*/
if (null != userDigitalArtworkVo && userDigitalArtworkVo.getUid().equals(uid)) {
GoblinUserDigitalArtworkInfoVo artworkInfoVo = GoblinUserDigitalArtworkInfoVo.getNew().copy(userDigitalArtworkVo);
GoblinGoodsSkuInfoVo goodsSkuInfoVo = goblinRedisUtils.getGoodsSkuInfoVo(userDigitalArtworkVo.getSkuId());
// GoblinGoodsInfoVo goodsInfoVo = goblinRedisUtils.getGoodsInfoVo(goodsSkuInfoVo.getSpuId());
GoblinNftOrderVo nftOrder = goblinRedisUtils.getGoblinNftOrder(userDigitalArtworkVo.getOrderId());
if (null != nftOrder && StringUtils.isNotBlank(nftOrder.getBoxSkuId())) {
artworkInfoVo.setSkuId(nftOrder.getSkuId());
}
artworkInfoVo.setCoverPic(goodsSkuInfoVo.getSkuPic());
artworkInfoVo.setName(goodsSkuInfoVo.getName());
artworkInfoVo.setSubtitle(goodsSkuInfoVo.getSubtitle());
// artworkInfoVo.setAuthor(goodsInfoVo.getAuthor());
if ("0".equals(goodsSkuInfoVo.getUnbox()) && 1 == userDigitalArtworkVo.getState() && StringUtils.isEmpty(userDigitalArtworkVo.getTransferState())) {// 非盲盒 & 已上链 & 非转赠(转赠中、已转赠)
artworkInfoVo.setMaterialType(goodsSkuInfoVo.getMaterialType());
artworkInfoVo.setMaterialUrl(goodsSkuInfoVo.getMaterialUrl());
artworkInfoVo.setEdition(goodsSkuInfoVo.getSkuStock());
// artworkInfoVo.setPublisher(goodsInfoVo.getPublisher());
artworkInfoVo.setDetails(goodsSkuInfoVo.getDetails());
artworkInfoVo.setArUrlIos(goodsSkuInfoVo.getArUrlIos());
artworkInfoVo.setArUrlAndroid(goodsSkuInfoVo.getArUrlAndroid());
artworkInfoVo.setSkuWatchPic(goodsSkuInfoVo.getSkuWatchPic());
artworkInfoVo.setTransferTimeLimit(goblinRedisUtils.getUserDigitalArtworkTransferTimeLimit());
artworkInfoVo.setSystime(LocalDateTime.now());
}
return artworkInfoVo;
}
return null;
......
package com.liquidnet.service.goblin.service.impl;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.base.constant.MQConst;
import com.liquidnet.service.goblin.dto.GoblinUserSafeConfigDto;
import com.liquidnet.service.goblin.service.IGoblinUserSafeConfigService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
import com.liquidnet.service.goblin.util.QueueUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.LinkedList;
@Service
public class GoblinUserSafeConfigServiceImpl implements IGoblinUserSafeConfigService {
@Autowired
private QueueUtils queueUtils;
@Autowired
private GoblinRedisUtils goblinRedisUtils;
@Override
public boolean initSafePasswd(String passwd, String uid) {
GoblinUserSafeConfigDto userSafeConfigDto = GoblinUserSafeConfigDto.getNew();
userSafeConfigDto.setPasswd(passwd);
if (goblinRedisUtils.setUserSafeConfigDto(uid, userSafeConfigDto)) {
LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
toMqSqls.add(SqlMapping.get("goblin_user_safe_config.add_passwd"));
LinkedList<Object[]> initUserSafeConfigObjs = CollectionUtil.linkedListObjectArr();
initUserSafeConfigObjs.add(new Object[]{uid, passwd, LocalDateTime.now()});
queueUtils.sendMsgByRedis(MQConst.GoblinQueue.SQL_GOODS.getKey(), SqlMapping.gets(toMqSqls, initUserSafeConfigObjs));
return true;
}
return false;
}
}
......@@ -6,10 +6,12 @@ import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.CollectionUtil;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.RandomUtil;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.goblin.constant.GoblinRedisConst;
import com.liquidnet.service.goblin.constant.GoblinStatusConst;
import com.liquidnet.service.goblin.dto.GoblinStoreMarketDto;
import com.liquidnet.service.goblin.dto.GoblinUserNftAccInfoVo;
import com.liquidnet.service.goblin.dto.GoblinUserSafeConfigDto;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinGoodsAnticipateValueVo;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*;
......@@ -51,6 +53,24 @@ public class GoblinRedisUtils {
return redisUtil.get(key);
}
public long incr(String key, long delta) {
return redisUtil.incr(key, delta);
}
/* ---------------------------------------- 短信相关 ---------------------------------------- */
public boolean setSmsCodeByMobile(String mobile, String smsCode) {
return redisUtil.set(GoblinRedisConst.VALID_SMS_CODE_MOBILE + mobile, smsCode, 600);
}
public Long ttlSmsCodeByMobile(String mobile) {
return redisUtil.ttl(GoblinRedisConst.VALID_SMS_CODE_MOBILE + mobile);
}
public String getSmsCodeByMobile(String mobile) {
return (String) redisUtil.get(GoblinRedisConst.VALID_SMS_CODE_MOBILE + mobile);
}
/* ---------------------------------------- 预约相关 ---------------------------------------- */
/**
......@@ -2614,7 +2634,30 @@ public class GoblinRedisUtils {
}
}
/* ---------------------------------------- NFT用户安全配置 ---------------------------------------- */
public boolean setUserSafeConfigDto(String uid, GoblinUserSafeConfigDto dto) {
return redisUtil.set(GoblinRedisConst.USER_SAFE_CONFIG.concat(uid), dto);
}
public GoblinUserSafeConfigDto getUserSafeConfigDto(String uid) {
return (GoblinUserSafeConfigDto) redisUtil.get(GoblinRedisConst.USER_SAFE_CONFIG.concat(uid));
}
/* ---------------------------------------- NFT转赠约束时间 ---------------------------------------- */
/**
* NFT转赠约束时间
* redis未配置默认返回24小时对应86400秒
* @return long(秒)
*/
public long getUserDigitalArtworkTransferTimeLimit() {
Object o = redisUtil.get(GoblinRedisConst.NFT_TRANSFER_TIME_LIMIT);
return Objects.isNull(o) ? 86400L : (long) o;
}
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
/* ---------------------------------------- ---------------------------------------- */
}
......@@ -4,8 +4,11 @@
# ------------------------ 4\u5F00\u5934\u9519\u8BEF\u7801\u4F5C\u7CFB\u7EDF\u4FDD\u7559
140000=\u64CD\u4F5C\u8FC7\u4E8E\u9891\u7E41\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5
140001=
140002=
140001=\u975E\u6CD5\u8BF7\u6C42
140002=\u64CD\u4F5C\u5931\u8D25
......@@ -17,6 +20,10 @@
140014=\u8EAB\u4EFD\u8BC1\u53F7\u7801\u4E0D\u5408\u89C4
140015=\u8D26\u53F7\u5F00\u901A\u5931\u8D25\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D
140016=\u8BC1\u4EF6\u4FE1\u606F\u6216\u624B\u673A\u53F7\u4E0D\u4E00\u81F4
140017=\u9A8C\u8BC1\u7801\u53D1\u9001\u5931\u8D25
140018=\u9A8C\u8BC1\u7801\u5DF2\u5931\u6548
140019=\u9A8C\u8BC1\u7801\u4E0D\u6B63\u786E
140020=\u60A8\u5DF2\u8BBE\u7F6E\u8FC7\u5B89\u5168\u5BC6\u7801
......
......@@ -155,3 +155,10 @@ goblin_mix_insert=INSERT INTO goblin_mix (`mix_id`,`uid`,`name`,`time_start`,`ti
goblin_mix_details_insert=INSERT INTO goblin_mix_details (`mix_id`,`position`,`spu_id`,`sku_id`,`price`,`price_v`,`product_id`,`count`,`created_at`) VALUES (?,?,?,?,?,?,?,?,?)
goblin_mix_status_update=UPDATE goblin_mix SET status = ? , updated_at = ? WHERE mix_id = ?
goblin_mix_update=UPDATE goblin_mix SET show_position = ? , `limit`=?,white_type=?,white_url=? , updated_at = ?,shelves_time = ?,reserve = ? WHERE mix_id = ?
#---- \u7528\u6237\u5B89\u5168\u8BBE\u7F6E
goblin_user_safe_config.add_passwd=INSERT INTO goblin_user_safe_config (uid,passwd,created_at)VALUES(?,?,?)
#----
#----
#----
#----
#----
\ No newline at end of file
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