数据
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.cai.auth;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@Data
|
||||
public class RegisterCodeV2 {
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
@NotEmpty(message = "腾讯验证码参数[ticket]")
|
||||
private String ticket;
|
||||
@NotEmpty(message = "腾讯验证码所属参数[randStr]")
|
||||
private String randStr;
|
||||
@NotEmpty(message = "腾讯验证码所属参数[客户端IP]")
|
||||
private String userIp;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.cai.config;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Data
|
||||
@ToString(exclude={"secretKey","appSecretKey"})
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "tencent.captcha")
|
||||
public class VerCodeConfig {
|
||||
|
||||
private String secretId = "IKIDMabOxIPJ0QgiW5RZr9IGD3jDVdnnZEj4";
|
||||
private String secretKey = "KUQFsJXYM0ShhWBi363rX2LTN3WnsjMt";
|
||||
|
||||
private Long captchaAppId = 189912059L;
|
||||
private String appSecretKey = "QB0m1JCZjuu0c2fK33wL2HwYg";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.ruoyi.cai.dto.app.vo.anchor;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AnchorStatusDTO {
|
||||
private Long userId;
|
||||
private Long anchorId;
|
||||
@Schema(description = "0=离线 1=空闲/在线 2=忙碌中 3=勿扰")
|
||||
private Integer anchorStatus;
|
||||
}
|
||||
@@ -15,6 +15,8 @@ public class RankNodeLove {
|
||||
private String nickname;
|
||||
@Schema(description = "魅力值")
|
||||
private Long value;
|
||||
@Schema(description = "0=离线 1=空闲/在线 2=忙碌中 3=勿扰")
|
||||
private Integer anchorStatus;
|
||||
@Schema(description = "距离上一名差距")
|
||||
private Long diffLastValue;
|
||||
@Schema(description = "是否开启隐身模式")
|
||||
|
||||
@@ -102,6 +102,7 @@ public enum SystemConfigEnum {
|
||||
SYSTEM_CUSTOMER_SERVICE("2,4", "系统客服",SystemConfigGroupEnum.SYSTEM),
|
||||
PRIVACY_AGREEMENT("/#/agreement/privacy", "隐私协议地址",SystemConfigGroupEnum.SYSTEM),
|
||||
USER_AGREEMENT("/#/agreement/user", "用户协议地址",SystemConfigGroupEnum.SYSTEM),
|
||||
OPEN_OLD_REGISTER_CODE("1", "是否开启无验证码注册接口",SystemConfigGroupEnum.SYSTEM, new BooleanSystemConfigCheck()),
|
||||
ANCHOR_JOIN_AGREEMENT("/#/agreement/anchor-join", "主播入驻协议地址",SystemConfigGroupEnum.SYSTEM),
|
||||
WS_SOCKET_URL("ws://localhost:8080/ws?token=%s&room_id=%s", "ws通讯地址",SystemConfigGroupEnum.SYSTEM),
|
||||
;
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.cai.kit;
|
||||
|
||||
import com.ruoyi.cai.config.VerCodeConfig;
|
||||
import com.tencentcloudapi.captcha.v20190722.CaptchaClient;
|
||||
import com.tencentcloudapi.captcha.v20190722.models.DescribeCaptchaResultRequest;
|
||||
import com.tencentcloudapi.captcha.v20190722.models.DescribeCaptchaResultResponse;
|
||||
import com.tencentcloudapi.common.Credential;
|
||||
import com.tencentcloudapi.common.profile.ClientProfile;
|
||||
import com.tencentcloudapi.common.profile.HttpProfile;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class VerificationCodeCheck {
|
||||
|
||||
@Autowired
|
||||
private VerCodeConfig verCodeConfig;
|
||||
|
||||
public boolean check(String ticket,String userIp,String randStr){
|
||||
if(StringUtils.isEmpty(ticket) || StringUtils.isEmpty(ticket) || StringUtils.isEmpty(ticket)){
|
||||
log.warn("验证码校验参数为空:");
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
|
||||
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
|
||||
Credential cred = new Credential(verCodeConfig.getSecretId(), verCodeConfig.getSecretKey());
|
||||
// 实例化一个http选项,可选的,没有特殊需求可以跳过
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
httpProfile.setEndpoint("captcha.tencentcloudapi.com");
|
||||
// 实例化一个client选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
clientProfile.setHttpProfile(httpProfile);
|
||||
// 实例化要请求产品的client对象,clientProfile是可选的
|
||||
CaptchaClient client = new CaptchaClient(cred, "", clientProfile);
|
||||
// 实例化一个请求对象,每个接口都会对应一个request对象
|
||||
DescribeCaptchaResultRequest req = new DescribeCaptchaResultRequest();
|
||||
req.setCaptchaType(9L);
|
||||
req.setTicket(ticket);
|
||||
req.setUserIp(userIp);
|
||||
req.setRandstr(randStr);
|
||||
req.setCaptchaAppId(verCodeConfig.getCaptchaAppId());
|
||||
req.setAppSecretKey(verCodeConfig.getAppSecretKey());
|
||||
// 返回的resp是一个DescribeCaptchaResultResponse的实例,与请求对象对应
|
||||
DescribeCaptchaResultResponse resp = client.DescribeCaptchaResult(req);
|
||||
if(resp.getCaptchaCode() != null && resp.getCaptchaCode() == 1){
|
||||
return true;
|
||||
}
|
||||
// 输出json格式的字符串回包
|
||||
log.warn("验证码校验失败:{}",DescribeCaptchaResultResponse.toJsonString(resp));
|
||||
return false;
|
||||
}catch (Exception e){
|
||||
log.error("验证码获取失败",e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,15 @@ package com.ruoyi.cai.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.cai.domain.Anchor;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
import com.ruoyi.cai.dto.admin.vo.AnchorAdminVo;
|
||||
import com.ruoyi.cai.dto.app.query.index.AnchorListQuery;
|
||||
import com.ruoyi.cai.dto.app.vo.AnchorListVo;
|
||||
import com.ruoyi.cai.dto.app.vo.anchor.AnchorStatusDTO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 女神列表Mapper接口
|
||||
*
|
||||
@@ -23,4 +27,6 @@ public interface AnchorMapper extends BaseMapper<Anchor> {
|
||||
Page<AnchorListVo> pageAppV2(@Param("build") Page<Object> build, @Param("query") AnchorListQuery query);
|
||||
|
||||
boolean incsServiceTimeAndCount(@Param("toUid") Long toUid, @Param("callTime") Long callTime, @Param("count") int count);
|
||||
|
||||
List<AnchorStatusDTO> anchorStatus(@Param("userList") List<User> userList);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user