123
This commit is contained in:
@@ -7,12 +7,16 @@ import com.ruoyi.cai.domain.User;
|
|||||||
import com.ruoyi.cai.dto.app.vo.LoginVo;
|
import com.ruoyi.cai.dto.app.vo.LoginVo;
|
||||||
import com.ruoyi.cai.enums.CodeEnum;
|
import com.ruoyi.cai.enums.CodeEnum;
|
||||||
import com.ruoyi.cai.manager.CurrentUserManager;
|
import com.ruoyi.cai.manager.CurrentUserManager;
|
||||||
|
import com.ruoyi.cai.manager.LoginAfterManager;
|
||||||
|
import com.ruoyi.cai.notice.YunxinHttpService;
|
||||||
import com.ruoyi.cai.service.SmsVerifyService;
|
import com.ruoyi.cai.service.SmsVerifyService;
|
||||||
import com.ruoyi.cai.service.UserService;
|
import com.ruoyi.cai.service.UserService;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.core.domain.R;
|
import com.ruoyi.common.core.domain.R;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
|
import com.ruoyi.yunxin.Yunxin;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -80,6 +84,9 @@ public class AuthAppController {
|
|||||||
return R.ok("发送成功");
|
return R.ok("发送成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoginAfterManager loginAfterManager;
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
@Operation(summary = "登陆")
|
@Operation(summary = "登陆")
|
||||||
@Log(title = "登陆", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "登陆", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
@@ -88,6 +95,8 @@ public class AuthAppController {
|
|||||||
String token = caiLoginManager.login(loginBody.getUsername(), loginBody.getPassword());
|
String token = caiLoginManager.login(loginBody.getUsername(), loginBody.getPassword());
|
||||||
vo.setToken(token);
|
vo.setToken(token);
|
||||||
vo.setUserInfo(currentUserManager.currentInfo());
|
vo.setUserInfo(currentUserManager.currentInfo());
|
||||||
|
// 异步调用通知
|
||||||
|
loginAfterManager.loginAfter(LoginHelper.getUserId());
|
||||||
return R.ok(vo);
|
return R.ok(vo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.ruoyi.cai.dto.app.query.order.AddRechargeOrderDto;
|
|||||||
import com.ruoyi.cai.dto.app.query.order.AddVipOrderDto;
|
import com.ruoyi.cai.dto.app.query.order.AddVipOrderDto;
|
||||||
import com.ruoyi.cai.dto.app.vo.order.OrderCreateVo;
|
import com.ruoyi.cai.dto.app.vo.order.OrderCreateVo;
|
||||||
import com.ruoyi.cai.dto.commom.consumer.GiftConsumerResp;
|
import com.ruoyi.cai.dto.commom.consumer.GiftConsumerResp;
|
||||||
|
import com.ruoyi.cai.dto.commom.consumer.GuardConsumerResp;
|
||||||
import com.ruoyi.cai.manager.ConsumerManager;
|
import com.ruoyi.cai.manager.ConsumerManager;
|
||||||
import com.ruoyi.cai.service.RechargeOrderService;
|
import com.ruoyi.cai.service.RechargeOrderService;
|
||||||
import com.ruoyi.cai.service.VipOrderService;
|
import com.ruoyi.cai.service.VipOrderService;
|
||||||
@@ -39,7 +40,7 @@ public class ConsumeController {
|
|||||||
@Operation(summary = "赠送主播守护")
|
@Operation(summary = "赠送主播守护")
|
||||||
@Log(title = "赠送主播守护", businessType = BusinessType.OTHER, isSaveDb = true)
|
@Log(title = "赠送主播守护", businessType = BusinessType.OTHER, isSaveDb = true)
|
||||||
public R<Boolean> giveGuard(@RequestBody GiveGuardReq query){
|
public R<Boolean> giveGuard(@RequestBody GiveGuardReq query){
|
||||||
ConsumeResp resp = consumerManager.sendGuard(query);
|
GuardConsumerResp resp = consumerManager.sendGuard(query);
|
||||||
return R.ok(resp.isSuccess());
|
return R.ok(resp.isSuccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ public class GiftConsumerResp {
|
|||||||
* 主播收益
|
* 主播收益
|
||||||
*/
|
*/
|
||||||
private Long anchorIncomeCoin;
|
private Long anchorIncomeCoin;
|
||||||
private Long userId;
|
private Long fromUid;
|
||||||
|
private Long toUid;
|
||||||
private Long consumeLogId;
|
private Long consumeLogId;
|
||||||
private Long traceId;
|
|
||||||
private boolean success;
|
private boolean success;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.cai.dto.commom.consumer;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class GuardConsumerResp {
|
||||||
|
/**
|
||||||
|
* 主播收益
|
||||||
|
*/
|
||||||
|
private Long anchorIncomeCoin;
|
||||||
|
private Long fromUid;
|
||||||
|
private Long toUid;
|
||||||
|
private Long consumeLogId;
|
||||||
|
private boolean success;
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.ruoyi.cai.dto.ConsumeResp;
|
|||||||
import com.ruoyi.cai.dto.app.query.GiveGiftReq;
|
import com.ruoyi.cai.dto.app.query.GiveGiftReq;
|
||||||
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
||||||
import com.ruoyi.cai.dto.commom.consumer.GiftConsumerResp;
|
import com.ruoyi.cai.dto.commom.consumer.GiftConsumerResp;
|
||||||
|
import com.ruoyi.cai.dto.commom.consumer.GuardConsumerResp;
|
||||||
import com.ruoyi.cai.dto.commom.consumer.RechargeConsumerResp;
|
import com.ruoyi.cai.dto.commom.consumer.RechargeConsumerResp;
|
||||||
import com.ruoyi.cai.dto.video.VideoSettleResp;
|
import com.ruoyi.cai.dto.video.VideoSettleResp;
|
||||||
import com.ruoyi.cai.mq.AmqpProducer;
|
import com.ruoyi.cai.mq.AmqpProducer;
|
||||||
@@ -38,14 +39,24 @@ public class ConsumerManager {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YunxinHttpService yunxinHttpService;
|
private YunxinHttpService yunxinHttpService;
|
||||||
|
|
||||||
public ConsumeResp sendGuard(GiveGuardReq query){
|
public GuardConsumerResp sendGuard(GiveGuardReq query){
|
||||||
ConsumeResp resp = guardTotalService.giveGuard(query);
|
GuardConsumerResp resp = guardTotalService.giveGuard(query);
|
||||||
if(resp.isSuccess()){
|
if(resp.isSuccess()){
|
||||||
try {
|
try {
|
||||||
amqpProducer.sendCalculateSales(resp.getConsumeLogId()+"");
|
amqpProducer.sendCalculateSales(resp.getConsumeLogId()+"");
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("RabbitMq 发送失败, 守护分销流程流转失败!",e);
|
log.error("RabbitMq 发送失败, 守护分销流程流转失败!",e);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
Account account = accountService.getByUserId(resp.getToUid());
|
||||||
|
if(account != null){
|
||||||
|
Long totalCoin = account.getCoin() + account.getIncomeCoin();
|
||||||
|
// 主播的系统收益通知
|
||||||
|
yunxinHttpService.getGuardMessage(resp.getToUid(), query.getGuardNum(), query.getGuardPrice(), resp.getAnchorIncomeCoin(), totalCoin);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("礼物赠送成功通知失败!",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
@@ -59,11 +70,14 @@ public class ConsumerManager {
|
|||||||
log.error("RabbitMq 发送失败, 礼物分销流程流转失败!",e);
|
log.error("RabbitMq 发送失败, 礼物分销流程流转失败!",e);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Account account = accountService.getByUserId(resp.getUserId());
|
Account account = accountService.getByUserId(resp.getToUid());
|
||||||
if(account != null){
|
if(account != null){
|
||||||
Long totalCoin = account.getCoin() + account.getIncomeCoin();
|
Long totalCoin = account.getCoin() + account.getIncomeCoin();
|
||||||
yunxinHttpService.getGiftSendMessage(resp.getUserId(), resp.getGift(), resp.getAnchorIncomeCoin(), totalCoin);
|
// 主播的系统收益通知
|
||||||
|
yunxinHttpService.getGiftSendMessage(resp.getToUid(), resp.getGift(), resp.getAnchorIncomeCoin(), totalCoin);
|
||||||
}
|
}
|
||||||
|
// 发送方给接收方的消息
|
||||||
|
yunxinHttpService.sendGiftMessage(resp.getFromUid(),resp.getToUid(),resp.getGift(),query.getGiftCount());
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("礼物赠送成功通知失败!",e);
|
log.error("礼物赠送成功通知失败!",e);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.ruoyi.cai.manager;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.cai.domain.UserFollow;
|
||||||
|
import com.ruoyi.cai.notice.YunxinHttpService;
|
||||||
|
import com.ruoyi.cai.service.UserFollowService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class LoginAfterManager {
|
||||||
|
@Autowired
|
||||||
|
private YunxinHttpService yunxinHttpService;
|
||||||
|
@Autowired
|
||||||
|
private UserFollowService userFollowService;
|
||||||
|
|
||||||
|
public void loginAfter(Long userId){
|
||||||
|
Page<UserFollow> page = new Page<>();
|
||||||
|
// page.setSize()
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.ruoyi.cai.notice;
|
package com.ruoyi.cai.notice;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.ruoyi.cai.domain.Account;
|
|
||||||
import com.ruoyi.cai.domain.Gift;
|
import com.ruoyi.cai.domain.Gift;
|
||||||
import com.ruoyi.cai.domain.User;
|
import com.ruoyi.cai.domain.User;
|
||||||
import com.ruoyi.cai.notice.data.NoticeR;
|
import com.ruoyi.cai.notice.data.NoticeR;
|
||||||
@@ -15,6 +14,7 @@ import com.ruoyi.cai.util.CaiNumUtil;
|
|||||||
import com.ruoyi.yunxin.YunExecutor;
|
import com.ruoyi.yunxin.YunExecutor;
|
||||||
import com.ruoyi.yunxin.Yunxin;
|
import com.ruoyi.yunxin.Yunxin;
|
||||||
import com.ruoyi.yunxin.resp.SendMsgResp;
|
import com.ruoyi.yunxin.resp.SendMsgResp;
|
||||||
|
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||||
import com.ruoyi.yunxin.resp.YxDataR;
|
import com.ruoyi.yunxin.resp.YxDataR;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -28,7 +28,6 @@ import java.util.List;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class YunxinHttpService {
|
public class YunxinHttpService {
|
||||||
|
|
||||||
private final static Long SYS_NOTICE_ID = 2L;
|
|
||||||
/**
|
/**
|
||||||
* 网易云信的 "动态通知" id
|
* 网易云信的 "动态通知" id
|
||||||
*/
|
*/
|
||||||
@@ -53,7 +52,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("注册奖励",rewardCoin+"云贝");
|
data.addFields("注册奖励",rewardCoin+"云贝");
|
||||||
data.addFields("注册奖励",totalCoin+"云贝");
|
data.addFields("注册奖励",totalCoin+"云贝");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -72,7 +71,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("购买云贝",rewardCoin+"云贝");
|
data.addFields("购买云贝",rewardCoin+"云贝");
|
||||||
data.addFields("总云贝",totalCoin+"云贝");
|
data.addFields("总云贝",totalCoin+"云贝");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -97,7 +96,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("收入云贝",incomeCoin+"云贝");
|
data.addFields("收入云贝",incomeCoin+"云贝");
|
||||||
data.addFields("总云贝",totalCoin+"云贝");
|
data.addFields("总云贝",totalCoin+"云贝");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -124,7 +123,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("用户蜜瓜号",sourceUsercode);
|
data.addFields("用户蜜瓜号",sourceUsercode);
|
||||||
data.addFields(str,incomeCoin+"云贝");
|
data.addFields(str,incomeCoin+"云贝");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -150,7 +149,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("充值金额",payCoin+"云贝");
|
data.addFields("充值金额",payCoin+"云贝");
|
||||||
data.addFields("充值分成",incomeCoin+"云贝");
|
data.addFields("充值分成",incomeCoin+"云贝");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -174,7 +173,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("到账账户","支付宝("+cardAccount+")");
|
data.addFields("到账账户","支付宝("+cardAccount+")");
|
||||||
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(verifyTime));
|
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(verifyTime));
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -195,7 +194,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("到账账户","支付宝("+dto.getCardAccount()+")");
|
data.addFields("到账账户","支付宝("+dto.getCardAccount()+")");
|
||||||
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(dto.getVerifyTime()));
|
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(dto.getVerifyTime()));
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(dto.getToUid(), SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(dto.getToUid(), notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -218,7 +217,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("提现方式","支付宝");
|
data.addFields("提现方式","支付宝");
|
||||||
data.setTxt2(remark);
|
data.setTxt2(remark);
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -236,7 +235,7 @@ public class YunxinHttpService {
|
|||||||
data.setTxt1("感谢您提交的举报信息,拒绝不良风气,良好的氛围需要大家共同维护。");
|
data.setTxt1("感谢您提交的举报信息,拒绝不良风气,良好的氛围需要大家共同维护。");
|
||||||
data.setCurrentDate();
|
data.setCurrentDate();
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -248,24 +247,19 @@ public class YunxinHttpService {
|
|||||||
* @param toUid
|
* @param toUid
|
||||||
*/
|
*/
|
||||||
public void followedSendMessage(Long toUid,
|
public void followedSendMessage(Long toUid,
|
||||||
Long followUserId,
|
User followUser,
|
||||||
String followNickname,
|
LocalDateTime followTime){
|
||||||
String followAvatar,
|
|
||||||
Integer followAge,
|
|
||||||
String followCity,
|
|
||||||
LocalDateTime followTime,
|
|
||||||
Integer gender){
|
|
||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
SendFollowNoticeData data = new SendFollowNoticeData();
|
SendFollowNoticeData data = new SendFollowNoticeData();
|
||||||
data.setUserid(followUserId);
|
data.setUserid(followUser.getId());
|
||||||
data.setNickname(followNickname);
|
data.setNickname(followUser.getNickname());
|
||||||
data.setAvatar(followAvatar);
|
data.setAvatar(followUser.getAvatar());
|
||||||
data.setAge(followAge);
|
data.setAge(followUser.getAge());
|
||||||
data.setCity(followCity);
|
data.setCity(followUser.getCity());
|
||||||
data.setTime(CaiDateUtil.localDateTimeToString(followTime));
|
data.setTime(CaiDateUtil.localDateTimeToString(followTime));
|
||||||
data.setSex(gender);
|
data.setSex(followUser.getGender());
|
||||||
NoticeR<SendFollowNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_FOLLOW, data);
|
NoticeR<SendFollowNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_FOLLOW, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -287,7 +281,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("赚钱小秘密二","照片越好看,男生越喜欢");
|
data.addFields("赚钱小秘密二","照片越好看,男生越喜欢");
|
||||||
data.addFields("赚钱小秘密三","勤发动态,让他感受到你的美");
|
data.addFields("赚钱小秘密三","勤发动态,让他感受到你的美");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -298,6 +292,7 @@ public class YunxinHttpService {
|
|||||||
/**
|
/**
|
||||||
* 更改女神邀请比例
|
* 更改女神邀请比例
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public void changeInviteConfigSendMessage(Long toUid){
|
public void changeInviteConfigSendMessage(Long toUid){
|
||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
ExtNoticeData data = new ExtNoticeData();
|
ExtNoticeData data = new ExtNoticeData();
|
||||||
@@ -305,7 +300,7 @@ public class YunxinHttpService {
|
|||||||
data.setTitle("恭喜成为邀请女神");
|
data.setTitle("恭喜成为邀请女神");
|
||||||
data.setCurrentDate();
|
data.setCurrentDate();
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -313,13 +308,19 @@ public class YunxinHttpService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送礼物自定义消息
|
* 发送礼物自定义消息 (发送方和接收方的消息)
|
||||||
*/
|
*/
|
||||||
public void sendGiftMessage(Long toUid){
|
public void sendGiftMessage(Long fromUid,Long toUid,Gift gift,Integer giftCount){
|
||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
SendGiftMessageNoticeData data = new SendGiftMessageNoticeData();
|
SendGiftMessageNoticeData data = new SendGiftMessageNoticeData();
|
||||||
|
data.setGift_id(gift.getId());
|
||||||
|
data.setGift_name(gift.getName());
|
||||||
|
data.setGift_url(gift.getImg());
|
||||||
|
data.setGift_count(giftCount);
|
||||||
|
data.setFrom_uid(fromUid);
|
||||||
|
data.setTo_uid(toUid);
|
||||||
NoticeR<SendGiftMessageNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_GIFT_MESSAGE, data);
|
NoticeR<SendGiftMessageNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_GIFT_MESSAGE, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToUserNotice(toUid, fromUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -330,7 +331,7 @@ public class YunxinHttpService {
|
|||||||
/**
|
/**
|
||||||
* 收到守护符通知
|
* 收到守护符通知
|
||||||
*/
|
*/
|
||||||
public void getGuardMessage(Long toUid,Integer num,Long price,BigDecimal incomeCoin,BigDecimal totalCoin){
|
public void getGuardMessage(Long toUid,Long num,Long price,Long incomeCoin,Long totalCoin){
|
||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
ExtNoticeData data = new ExtNoticeData();
|
ExtNoticeData data = new ExtNoticeData();
|
||||||
data.setAction(1);
|
data.setAction(1);
|
||||||
@@ -341,7 +342,7 @@ public class YunxinHttpService {
|
|||||||
data.addFields("收入云贝",incomeCoin+"云贝");
|
data.addFields("收入云贝",incomeCoin+"云贝");
|
||||||
data.addFields("总云贝",totalCoin+"云贝");
|
data.addFields("总云贝",totalCoin+"云贝");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -352,11 +353,18 @@ public class YunxinHttpService {
|
|||||||
/**
|
/**
|
||||||
* 发送上线了批量自定义消息
|
* 发送上线了批量自定义消息
|
||||||
*/
|
*/
|
||||||
public void sendOnlineAttentionNotice(Long toUid){
|
public void sendOnlineAttentionNotice(List<Long> toUid,User loginUser){
|
||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
SendOnlineAttentionNoticeData data = new SendOnlineAttentionNoticeData();
|
SendOnlineAttentionNoticeData data = new SendOnlineAttentionNoticeData();
|
||||||
|
data.setUserid(loginUser.getId());
|
||||||
|
data.setNickname(loginUser.getNickname());
|
||||||
|
data.setAvatar(loginUser.getAvatar());
|
||||||
|
data.setAge(loginUser.getAge());
|
||||||
|
data.setCity(loginUser.getCity());
|
||||||
|
data.setTime(CaiDateUtil.getCurrentTimeStr());
|
||||||
|
data.setSex(loginUser.getGender());
|
||||||
NoticeR<SendOnlineAttentionNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_ONLINE_ATTENTION, data);
|
NoticeR<SendOnlineAttentionNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_ONLINE_ATTENTION, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<YxCommonR> r = yunxin.batchSendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -374,7 +382,7 @@ public class YunxinHttpService {
|
|||||||
data.setCurrentDate();
|
data.setCurrentDate();
|
||||||
data.setTxt1("因多次违规或被投诉,已被取消女神资格!");
|
data.setTxt1("因多次违规或被投诉,已被取消女神资格!");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -393,7 +401,7 @@ public class YunxinHttpService {
|
|||||||
data.setCurrentDate();
|
data.setCurrentDate();
|
||||||
data.setTxt1("您的动态因不符合规范,已被删除,多次违规会被取消大咖资格或封号处理");
|
data.setTxt1("您的动态因不符合规范,已被删除,多次违规会被取消大咖资格或封号处理");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -414,7 +422,7 @@ public class YunxinHttpService {
|
|||||||
data.setLink_type(1);
|
data.setLink_type(1);
|
||||||
data.setLink_url("/index/about/album_rule.html");
|
data.setLink_url("/index/about/album_rule.html");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -433,7 +441,7 @@ public class YunxinHttpService {
|
|||||||
data.setCurrentDate();
|
data.setCurrentDate();
|
||||||
data.setTxt1("您的昵称不合格,已被重置,多次违规会被封号!");
|
data.setTxt1("您的昵称不合格,已被重置,多次违规会被封号!");
|
||||||
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
NoticeR<ExtNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.TXT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -448,7 +456,7 @@ public class YunxinHttpService {
|
|||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
SendRechargeWindowsAmountNoticeData data = new SendRechargeWindowsAmountNoticeData();
|
SendRechargeWindowsAmountNoticeData data = new SendRechargeWindowsAmountNoticeData();
|
||||||
NoticeR<SendRechargeWindowsAmountNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.RECHARGE_WINDOWS_AMOUNT, data);
|
NoticeR<SendRechargeWindowsAmountNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.RECHARGE_WINDOWS_AMOUNT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -463,7 +471,7 @@ public class YunxinHttpService {
|
|||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
SendGiftWindowsAmountNoticeData data = new SendGiftWindowsAmountNoticeData();
|
SendGiftWindowsAmountNoticeData data = new SendGiftWindowsAmountNoticeData();
|
||||||
NoticeR<SendGiftWindowsAmountNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_GIFT_WINDOWS_AMOUNT, data);
|
NoticeR<SendGiftWindowsAmountNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_GIFT_WINDOWS_AMOUNT, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
@@ -486,7 +494,7 @@ public class YunxinHttpService {
|
|||||||
data.setImage(image);
|
data.setImage(image);
|
||||||
data.setTitle(content);
|
data.setTitle(content);
|
||||||
NoticeR<SendFollowDynamicNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_FOLLOW_DYNAMIC, data);
|
NoticeR<SendFollowDynamicNoticeData> notice = NoticeR.ok(MessageBaseTypeEnum.SEND_FOLLOW_DYNAMIC, data);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, notice);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class SendFollowNoticeData {
|
|||||||
private Long userid;
|
private Long userid;
|
||||||
private String nickname;
|
private String nickname;
|
||||||
private String avatar;
|
private String avatar;
|
||||||
private Integer age;
|
private Long age;
|
||||||
private String city;
|
private String city;
|
||||||
private String time;
|
private String time;
|
||||||
private Integer sex;
|
private Integer sex;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ public class SendGiftMessageNoticeData {
|
|||||||
private Long gift_id;
|
private Long gift_id;
|
||||||
private String gift_name;
|
private String gift_name;
|
||||||
private String gift_url;
|
private String gift_url;
|
||||||
private Long gift_count;
|
private Integer gift_count;
|
||||||
private Long from_uid;
|
private Long from_uid;
|
||||||
private Long to_uid;
|
private Long to_uid;
|
||||||
private Integer link_type = 0;
|
private Integer link_type = 0;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.ruoyi.cai.dto.app.dto.GuardNum;
|
|||||||
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
||||||
import com.ruoyi.cai.dto.app.vo.index.GuardIndexVo;
|
import com.ruoyi.cai.dto.app.vo.index.GuardIndexVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.index.GuardListPageVo;
|
import com.ruoyi.cai.dto.app.vo.index.GuardListPageVo;
|
||||||
|
import com.ruoyi.cai.dto.commom.consumer.GuardConsumerResp;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,7 +21,7 @@ public interface GuardTotalService extends IService<GuardTotal> {
|
|||||||
|
|
||||||
GuardIndexVo guardInfoVo(Long fromUserId,Long toUserId, Integer limit);
|
GuardIndexVo guardInfoVo(Long fromUserId,Long toUserId, Integer limit);
|
||||||
|
|
||||||
ConsumeResp giveGuard(GiveGuardReq query);
|
GuardConsumerResp giveGuard(GiveGuardReq query);
|
||||||
|
|
||||||
GuardNum getGuardNum(Long fromUserId, Long toUserId);
|
GuardNum getGuardNum(Long fromUserId, Long toUserId);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import com.ruoyi.cai.enums.GenderEnum;
|
|||||||
import com.ruoyi.cai.enums.SystemConfigEnum;
|
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||||
import com.ruoyi.cai.manager.SystemConfigManager;
|
import com.ruoyi.cai.manager.SystemConfigManager;
|
||||||
import com.ruoyi.cai.mapper.AnchorApplyMapper;
|
import com.ruoyi.cai.mapper.AnchorApplyMapper;
|
||||||
|
import com.ruoyi.cai.notice.YunxinHttpService;
|
||||||
import com.ruoyi.cai.service.AnchorApplyService;
|
import com.ruoyi.cai.service.AnchorApplyService;
|
||||||
import com.ruoyi.cai.service.AnchorService;
|
import com.ruoyi.cai.service.AnchorService;
|
||||||
import com.ruoyi.cai.service.UserService;
|
import com.ruoyi.cai.service.UserService;
|
||||||
@@ -39,6 +40,8 @@ public class AnchorApplyServiceImpl extends ServiceImpl<AnchorApplyMapper, Ancho
|
|||||||
private AnchorService anchorService;
|
private AnchorService anchorService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemConfigManager systemConfigManager;
|
private SystemConfigManager systemConfigManager;
|
||||||
|
@Autowired
|
||||||
|
private YunxinHttpService yunxinHttpService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnchorApply getByUserId(Long userId){
|
public AnchorApply getByUserId(Long userId){
|
||||||
@@ -135,11 +138,16 @@ public class AnchorApplyServiceImpl extends ServiceImpl<AnchorApplyMapper, Ancho
|
|||||||
save.setGuardRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_GUARD_PRICE));
|
save.setGuardRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_GUARD_PRICE));
|
||||||
save.setGiftRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_GIFT_PRICE));
|
save.setGiftRate(systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.DEFAULT_ANCHOR_GIFT_PRICE));
|
||||||
anchorService.save(save);
|
anchorService.save(save);
|
||||||
|
yunxinHttpService.passAnchorSendMessage(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void auditAnchorFail(Long id) {
|
public void auditAnchorFail(Long id) {
|
||||||
|
AnchorApply anchorApply = this.getById(id);
|
||||||
|
if(anchorApply == null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.update(Wrappers.lambdaUpdate(AnchorApply.class)
|
this.update(Wrappers.lambdaUpdate(AnchorApply.class)
|
||||||
.eq(AnchorApply::getId,id)
|
.eq(AnchorApply::getId,id)
|
||||||
.set(AnchorApply::getAuditTime,LocalDateTime.now())
|
.set(AnchorApply::getAuditTime,LocalDateTime.now())
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.ruoyi.cai.dto.app.dto.GuardTotalDTO;
|
|||||||
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
import com.ruoyi.cai.dto.app.query.GiveGuardReq;
|
||||||
import com.ruoyi.cai.dto.app.vo.index.GuardIndexVo;
|
import com.ruoyi.cai.dto.app.vo.index.GuardIndexVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.index.GuardListPageVo;
|
import com.ruoyi.cai.dto.app.vo.index.GuardListPageVo;
|
||||||
|
import com.ruoyi.cai.dto.commom.consumer.GuardConsumerResp;
|
||||||
import com.ruoyi.cai.enums.ConsumeLogType;
|
import com.ruoyi.cai.enums.ConsumeLogType;
|
||||||
import com.ruoyi.cai.enums.SystemConfigEnum;
|
import com.ruoyi.cai.enums.SystemConfigEnum;
|
||||||
import com.ruoyi.cai.manager.IdManager;
|
import com.ruoyi.cai.manager.IdManager;
|
||||||
@@ -81,7 +82,7 @@ public class GuardTotalServiceImpl extends ServiceImpl<GuardTotalMapper, GuardTo
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ConsumeResp giveGuard(GiveGuardReq query) {
|
public GuardConsumerResp giveGuard(GiveGuardReq query) {
|
||||||
Long fromUserId = LoginHelper.getUserId();
|
Long fromUserId = LoginHelper.getUserId();
|
||||||
User fromUser = userService.getById(fromUserId);
|
User fromUser = userService.getById(fromUserId);
|
||||||
User toUser = userService.getById(query.getToUserId());
|
User toUser = userService.getById(query.getToUserId());
|
||||||
@@ -104,7 +105,7 @@ public class GuardTotalServiceImpl extends ServiceImpl<GuardTotalMapper, GuardTo
|
|||||||
if(lock.isLocked()){
|
if(lock.isLocked()){
|
||||||
throw new ServiceException("您点击太快了");
|
throw new ServiceException("您点击太快了");
|
||||||
}
|
}
|
||||||
ConsumeResp resp = new ConsumeResp();
|
GuardConsumerResp resp = new GuardConsumerResp();
|
||||||
try {
|
try {
|
||||||
lock.lock(3, TimeUnit.SECONDS);
|
lock.lock(3, TimeUnit.SECONDS);
|
||||||
Long guardValue = query.getGuardNum() * guardPrice;
|
Long guardValue = query.getGuardNum() * guardPrice;
|
||||||
@@ -117,6 +118,9 @@ public class GuardTotalServiceImpl extends ServiceImpl<GuardTotalMapper, GuardTo
|
|||||||
consumeLog.setTargetRate(anchor.getGuardRate());
|
consumeLog.setTargetRate(anchor.getGuardRate());
|
||||||
consumeLog = accountService.guardDecr(consumeLog, ConsumeLogType.GUARD);
|
consumeLog = accountService.guardDecr(consumeLog, ConsumeLogType.GUARD);
|
||||||
resp.setConsumeLogId(consumeLog.getId());
|
resp.setConsumeLogId(consumeLog.getId());
|
||||||
|
resp.setFromUid(fromUserId);
|
||||||
|
resp.setToUid(query.getToUserId());
|
||||||
|
resp.setAnchorIncomeCoin(consumeLog.getAnchorAmount());
|
||||||
GuardLog guardLog = new GuardLog();
|
GuardLog guardLog = new GuardLog();
|
||||||
guardLog.setFromUserId(fromUserId);
|
guardLog.setFromUserId(fromUserId);
|
||||||
guardLog.setFromUsercode(fromUser.getUsercode());
|
guardLog.setFromUsercode(fromUser.getUsercode());
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.cai.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.cai.domain.User;
|
||||||
import com.ruoyi.cai.domain.UserCount;
|
import com.ruoyi.cai.domain.UserCount;
|
||||||
import com.ruoyi.cai.domain.UserFollow;
|
import com.ruoyi.cai.domain.UserFollow;
|
||||||
import com.ruoyi.cai.dto.app.query.StarQuery;
|
import com.ruoyi.cai.dto.app.query.StarQuery;
|
||||||
@@ -10,9 +11,11 @@ import com.ruoyi.cai.dto.app.query.StarOrVisitorReq;
|
|||||||
import com.ruoyi.cai.dto.app.vo.user.UserBaseVo;
|
import com.ruoyi.cai.dto.app.vo.user.UserBaseVo;
|
||||||
import com.ruoyi.cai.dto.app.vo.user.UserStarOrVisitorList;
|
import com.ruoyi.cai.dto.app.vo.user.UserStarOrVisitorList;
|
||||||
import com.ruoyi.cai.mapper.UserFollowMapper;
|
import com.ruoyi.cai.mapper.UserFollowMapper;
|
||||||
|
import com.ruoyi.cai.notice.YunxinHttpService;
|
||||||
import com.ruoyi.cai.service.UserCountService;
|
import com.ruoyi.cai.service.UserCountService;
|
||||||
import com.ruoyi.cai.service.UserFollowService;
|
import com.ruoyi.cai.service.UserFollowService;
|
||||||
import com.ruoyi.cai.service.UserMemberService;
|
import com.ruoyi.cai.service.UserMemberService;
|
||||||
|
import com.ruoyi.cai.service.UserService;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
import com.ruoyi.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
@@ -22,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -40,6 +44,10 @@ public class UserFollowServiceImpl extends ServiceImpl<UserFollowMapper, UserFol
|
|||||||
private UserCountService userCountService;
|
private UserCountService userCountService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserMemberService userMemberService;
|
private UserMemberService userMemberService;
|
||||||
|
@Autowired
|
||||||
|
private YunxinHttpService yunxinHttpService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getFansNumByUserId(Long userId){
|
public Long getFansNumByUserId(Long userId){
|
||||||
@@ -58,6 +66,10 @@ public class UserFollowServiceImpl extends ServiceImpl<UserFollowMapper, UserFol
|
|||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean star(StarOrVisitorReq starOrVisitorReq) {
|
public boolean star(StarOrVisitorReq starOrVisitorReq) {
|
||||||
Long fromUserId = LoginHelper.getUserId();
|
Long fromUserId = LoginHelper.getUserId();
|
||||||
|
User user = userService.getById(fromUserId);
|
||||||
|
if(user == null){
|
||||||
|
throw new ServiceException("您的账号已被注销");
|
||||||
|
}
|
||||||
if(starOrVisitorReq.getToUserId().equals(fromUserId)){
|
if(starOrVisitorReq.getToUserId().equals(fromUserId)){
|
||||||
throw new ServiceException("不能关注自己哦");
|
throw new ServiceException("不能关注自己哦");
|
||||||
}
|
}
|
||||||
@@ -69,6 +81,7 @@ public class UserFollowServiceImpl extends ServiceImpl<UserFollowMapper, UserFol
|
|||||||
userFollow.setFollowUser(starOrVisitorReq.getToUserId());
|
userFollow.setFollowUser(starOrVisitorReq.getToUserId());
|
||||||
this.save(userFollow);
|
this.save(userFollow);
|
||||||
userCountService.star(fromUserId, starOrVisitorReq.getToUserId());
|
userCountService.star(fromUserId, starOrVisitorReq.getToUserId());
|
||||||
|
yunxinHttpService.followedSendMessage(starOrVisitorReq.getToUserId(), user, LocalDateTime.now());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,6 +85,8 @@ public class UserGiftServiceImpl extends ServiceImpl<UserGiftMapper, UserGift> i
|
|||||||
consumeLog = accountService.giftDecr(consumeLog, ConsumeLogType.GIFT, gift);
|
consumeLog = accountService.giftDecr(consumeLog, ConsumeLogType.GIFT, gift);
|
||||||
resp.setAnchorIncomeCoin(consumeLog.getAnchorAmount());
|
resp.setAnchorIncomeCoin(consumeLog.getAnchorAmount());
|
||||||
resp.setConsumeLogId(consumeLog.getId());
|
resp.setConsumeLogId(consumeLog.getId());
|
||||||
|
resp.setFromUid(fromUserId);
|
||||||
|
resp.setToUid(query.getToUserId());
|
||||||
UserGift userGift = new UserGift();
|
UserGift userGift = new UserGift();
|
||||||
userGift.setType(query.getType());
|
userGift.setType(query.getType());
|
||||||
userGift.setFromUid(fromUserId);
|
userGift.setFromUid(fromUserId);
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.ruoyi.yunxin;
|
|||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.ruoyi.yunxin.client.ImMessageClient;
|
import com.ruoyi.yunxin.client.ImMessageClient;
|
||||||
import com.ruoyi.yunxin.config.YunxinExecutorConstant;
|
|
||||||
import com.ruoyi.yunxin.config.YunxinProperties;
|
import com.ruoyi.yunxin.config.YunxinProperties;
|
||||||
import com.ruoyi.yunxin.req.Option;
|
import com.ruoyi.yunxin.req.Option;
|
||||||
import com.ruoyi.yunxin.req.SendAttachMsgReq;
|
import com.ruoyi.yunxin.req.SendAttachMsgReq;
|
||||||
@@ -22,21 +21,22 @@ import java.util.stream.Collectors;
|
|||||||
@Component
|
@Component
|
||||||
public class Yunxin {
|
public class Yunxin {
|
||||||
|
|
||||||
|
private final static String SYS_NOTICE_ID = "2";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private YunxinProperties yunxinProperties;
|
private YunxinProperties yunxinProperties;
|
||||||
@Resource
|
@Resource
|
||||||
private ImMessageClient messageClient;
|
private ImMessageClient messageClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* 发送系统消息
|
||||||
* @param toUid 接收者ID
|
* @param toUid 接收者ID
|
||||||
* @param fromUid 发送者ID
|
|
||||||
* @param data 数据
|
* @param data 数据
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public YxDataR<SendMsgResp> sendTo(Long toUid,Long fromUid,Object data){
|
public YxDataR<SendMsgResp> sendToNotice(Long toUid, Object data){
|
||||||
SendMsgReq req = new SendMsgReq();
|
SendMsgReq req = new SendMsgReq();
|
||||||
req.setFrom(fromUid == null ? yunxinProperties.getDefaultFromUid() : fromUid+"");
|
req.setFrom(SYS_NOTICE_ID);
|
||||||
req.setTo(toUid+"");
|
req.setTo(toUid+"");
|
||||||
req.setBody(JSON.toJSONString(data));
|
req.setBody(JSON.toJSONString(data));
|
||||||
req.setOption(JSON.toJSONString(new Option()));
|
req.setOption(JSON.toJSONString(new Option()));
|
||||||
@@ -44,6 +44,34 @@ public class Yunxin {
|
|||||||
return messageClient.sendMsg(req);
|
return messageClient.sendMsg(req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量发送 系统消息
|
||||||
|
* @param toUid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public YxDataR<YxCommonR> batchSendToNotice(List<Long> toUid, Object data){
|
||||||
|
SendBatchMsgReq req = new SendBatchMsgReq();
|
||||||
|
req.setFromAccid(SYS_NOTICE_ID);
|
||||||
|
req.setToAccids(toUid.stream().map(i -> String.valueOf(toUid)).collect(Collectors.toList()));
|
||||||
|
req.setBody(JSON.toJSONString(data));
|
||||||
|
req.setOption(JSON.toJSONString(new Option()));
|
||||||
|
req.setType(100);
|
||||||
|
return messageClient.sendBatchMsg(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定用户的自定义消息
|
||||||
|
*/
|
||||||
|
public YxDataR<SendMsgResp> sendToUserNotice(Long toUid, Long fromUid, Object data){
|
||||||
|
SendMsgReq req = new SendMsgReq();
|
||||||
|
req.setFrom(fromUid+"");
|
||||||
|
req.setTo(toUid+"");
|
||||||
|
req.setBody(JSON.toJSONString(data));
|
||||||
|
req.setOption(JSON.toJSONString(new Option()));
|
||||||
|
return messageClient.sendMsg(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public YxDataR<YxCommonR> batchSendToTextMessage(Long fromUid, List<Long> toUid, String data){
|
public YxDataR<YxCommonR> batchSendToTextMessage(Long fromUid, List<Long> toUid, String data){
|
||||||
SendBatchMsgReq req = new SendBatchMsgReq();
|
SendBatchMsgReq req = new SendBatchMsgReq();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class YunxinWsService {
|
|||||||
public void sendToCallNotifyAsync(Long toUid, Long fromUid, CallNoticeEnum status, Long calltime){
|
public void sendToCallNotifyAsync(Long toUid, Long fromUid, CallNoticeEnum status, Long calltime){
|
||||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
ImDataRes imDataRes = ImMsgGen.callNotice(status, fromUid, toUid, calltime);
|
ImDataRes imDataRes = ImMsgGen.callNotice(status, fromUid, toUid, calltime);
|
||||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, fromUid, imDataRes);
|
YxDataR<SendMsgResp> r = yunxin.sendToNotice(toUid, fromUid, imDataRes);
|
||||||
if(r == null || !r.isSuccess()){
|
if(r == null || !r.isSuccess()){
|
||||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user