123
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.ruoyi.cai.notice;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.ruoyi.cai.domain.Account;
|
||||
import com.ruoyi.cai.domain.Gift;
|
||||
import com.ruoyi.cai.domain.User;
|
||||
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.Yunxin;
|
||||
import com.ruoyi.yunxin.resp.SendMsgResp;
|
||||
import com.ruoyi.yunxin.resp.YxCommonR;
|
||||
import com.ruoyi.yunxin.resp.YxDataR;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -28,7 +28,6 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class YunxinHttpService {
|
||||
|
||||
private final static Long SYS_NOTICE_ID = 2L;
|
||||
/**
|
||||
* 网易云信的 "动态通知" id
|
||||
*/
|
||||
@@ -53,7 +52,7 @@ public class YunxinHttpService {
|
||||
data.addFields("注册奖励",rewardCoin+"云贝");
|
||||
data.addFields("注册奖励",totalCoin+"云贝");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -72,7 +71,7 @@ public class YunxinHttpService {
|
||||
data.addFields("购买云贝",rewardCoin+"云贝");
|
||||
data.addFields("总云贝",totalCoin+"云贝");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -97,7 +96,7 @@ public class YunxinHttpService {
|
||||
data.addFields("收入云贝",incomeCoin+"云贝");
|
||||
data.addFields("总云贝",totalCoin+"云贝");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -124,7 +123,7 @@ public class YunxinHttpService {
|
||||
data.addFields("用户蜜瓜号",sourceUsercode);
|
||||
data.addFields(str,incomeCoin+"云贝");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -150,7 +149,7 @@ public class YunxinHttpService {
|
||||
data.addFields("充值金额",payCoin+"云贝");
|
||||
data.addFields("充值分成",incomeCoin+"云贝");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -174,7 +173,7 @@ public class YunxinHttpService {
|
||||
data.addFields("到账账户","支付宝("+cardAccount+")");
|
||||
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(verifyTime));
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -195,7 +194,7 @@ public class YunxinHttpService {
|
||||
data.addFields("到账账户","支付宝("+dto.getCardAccount()+")");
|
||||
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(dto.getVerifyTime()));
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -218,7 +217,7 @@ public class YunxinHttpService {
|
||||
data.addFields("提现方式","支付宝");
|
||||
data.setTxt2(remark);
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -236,7 +235,7 @@ public class YunxinHttpService {
|
||||
data.setTxt1("感谢您提交的举报信息,拒绝不良风气,良好的氛围需要大家共同维护。");
|
||||
data.setCurrentDate();
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -248,24 +247,19 @@ public class YunxinHttpService {
|
||||
* @param toUid
|
||||
*/
|
||||
public void followedSendMessage(Long toUid,
|
||||
Long followUserId,
|
||||
String followNickname,
|
||||
String followAvatar,
|
||||
Integer followAge,
|
||||
String followCity,
|
||||
LocalDateTime followTime,
|
||||
Integer gender){
|
||||
User followUser,
|
||||
LocalDateTime followTime){
|
||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||
SendFollowNoticeData data = new SendFollowNoticeData();
|
||||
data.setUserid(followUserId);
|
||||
data.setNickname(followNickname);
|
||||
data.setAvatar(followAvatar);
|
||||
data.setAge(followAge);
|
||||
data.setCity(followCity);
|
||||
data.setUserid(followUser.getId());
|
||||
data.setNickname(followUser.getNickname());
|
||||
data.setAvatar(followUser.getAvatar());
|
||||
data.setAge(followUser.getAge());
|
||||
data.setCity(followUser.getCity());
|
||||
data.setTime(CaiDateUtil.localDateTimeToString(followTime));
|
||||
data.setSex(gender);
|
||||
data.setSex(followUser.getGender());
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -287,7 +281,7 @@ public class YunxinHttpService {
|
||||
data.addFields("赚钱小秘密二","照片越好看,男生越喜欢");
|
||||
data.addFields("赚钱小秘密三","勤发动态,让他感受到你的美");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -298,6 +292,7 @@ public class YunxinHttpService {
|
||||
/**
|
||||
* 更改女神邀请比例
|
||||
*/
|
||||
@Deprecated
|
||||
public void changeInviteConfigSendMessage(Long toUid){
|
||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||
ExtNoticeData data = new ExtNoticeData();
|
||||
@@ -305,7 +300,7 @@ public class YunxinHttpService {
|
||||
data.setTitle("恭喜成为邀请女神");
|
||||
data.setCurrentDate();
|
||||
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()){
|
||||
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(() -> {
|
||||
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);
|
||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
||||
YxDataR<SendMsgResp> r = yunxin.sendToUserNotice(toUid, fromUid, notice);
|
||||
if(r == null || !r.isSuccess()){
|
||||
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(() -> {
|
||||
ExtNoticeData data = new ExtNoticeData();
|
||||
data.setAction(1);
|
||||
@@ -341,7 +342,7 @@ public class YunxinHttpService {
|
||||
data.addFields("收入云贝",incomeCoin+"云贝");
|
||||
data.addFields("总云贝",totalCoin+"云贝");
|
||||
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()){
|
||||
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(() -> {
|
||||
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);
|
||||
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, notice);
|
||||
YxDataR<YxCommonR> r = yunxin.batchSendToNotice(toUid, notice);
|
||||
if(r == null || !r.isSuccess()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -374,7 +382,7 @@ public class YunxinHttpService {
|
||||
data.setCurrentDate();
|
||||
data.setTxt1("因多次违规或被投诉,已被取消女神资格!");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -393,7 +401,7 @@ public class YunxinHttpService {
|
||||
data.setCurrentDate();
|
||||
data.setTxt1("您的动态因不符合规范,已被删除,多次违规会被取消大咖资格或封号处理");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -414,7 +422,7 @@ public class YunxinHttpService {
|
||||
data.setLink_type(1);
|
||||
data.setLink_url("/index/about/album_rule.html");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -433,7 +441,7 @@ public class YunxinHttpService {
|
||||
data.setCurrentDate();
|
||||
data.setTxt1("您的昵称不合格,已被重置,多次违规会被封号!");
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -448,7 +456,7 @@ public class YunxinHttpService {
|
||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||
SendRechargeWindowsAmountNoticeData data = new SendRechargeWindowsAmountNoticeData();
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -463,7 +471,7 @@ public class YunxinHttpService {
|
||||
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||
SendGiftWindowsAmountNoticeData data = new SendGiftWindowsAmountNoticeData();
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
@@ -486,7 +494,7 @@ public class YunxinHttpService {
|
||||
data.setImage(image);
|
||||
data.setTitle(content);
|
||||
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()){
|
||||
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ public class SendFollowNoticeData {
|
||||
private Long userid;
|
||||
private String nickname;
|
||||
private String avatar;
|
||||
private Integer age;
|
||||
private Long age;
|
||||
private String city;
|
||||
private String time;
|
||||
private Integer sex;
|
||||
|
||||
@@ -7,7 +7,7 @@ public class SendGiftMessageNoticeData {
|
||||
private Long gift_id;
|
||||
private String gift_name;
|
||||
private String gift_url;
|
||||
private Long gift_count;
|
||||
private Integer gift_count;
|
||||
private Long from_uid;
|
||||
private Long to_uid;
|
||||
private Integer link_type = 0;
|
||||
|
||||
Reference in New Issue
Block a user