init
This commit is contained in:
@@ -0,0 +1,473 @@
|
|||||||
|
package com.ruoyi.cai.notice;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.ruoyi.cai.domain.User;
|
||||||
|
import com.ruoyi.cai.notice.data.*;
|
||||||
|
import com.ruoyi.cai.notice.data.child.*;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import com.ruoyi.cai.util.CaiDateUtil;
|
||||||
|
import com.ruoyi.yunxin.YunExecutor;
|
||||||
|
import com.ruoyi.yunxin.Yunxin;
|
||||||
|
import com.ruoyi.yunxin.resp.SendMsgResp;
|
||||||
|
import com.ruoyi.yunxin.resp.YxDataR;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class YunxinHttpService {
|
||||||
|
|
||||||
|
private final static Long SYS_NOTICE_ID = 2L;
|
||||||
|
@Autowired
|
||||||
|
private Yunxin yunxin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册赠送消息
|
||||||
|
*/
|
||||||
|
public void registerRewardCoin(Long toUid,Long rewardCoin,Long totalCoin){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("系统奖励");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.setTxt1("陌生人交友需谨慎,添加陌生人微信,QQ失去平台监管有极大被骗风险,凡是诱导加微信,QQ引导到其他平台或以色情为由索取礼物的行为,请大家及时举报,一经查明直接永久封号,良好的交友氛围需大家共同维护,希望大家提高自我警惕性杜绝被骗");
|
||||||
|
data.addFields("注册奖励",rewardCoin+"云贝");
|
||||||
|
data.addFields("注册奖励",totalCoin+"云贝");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 充值云贝成功消息
|
||||||
|
*/
|
||||||
|
public void rechargeCoinSendMessage(Long toUid,Long rewardCoin,Long totalCoin){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("购买成功");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("购买云贝",rewardCoin+"云贝");
|
||||||
|
data.addFields("总云贝",totalCoin+"云贝");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到礼物发送消息
|
||||||
|
*/
|
||||||
|
public void getGiftSendMessage(Long toUid,String giftName,Long giftPrice,Long incomeCoin,Long totalCoin){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("收到礼物");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("礼物名称",giftName);
|
||||||
|
data.addFields("礼物单价",giftPrice+"云贝");
|
||||||
|
data.addFields("收入云贝",incomeCoin+"云贝");
|
||||||
|
data.addFields("总云贝",totalCoin+"云贝");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请奖励
|
||||||
|
*/
|
||||||
|
public void inviteRewardSendMessage(Long toUid,String type,String sourceNickname,String sourceUsercode,Long incomeCoin){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
String str = "";
|
||||||
|
if("recharge".equals(type)){
|
||||||
|
str = "用户充值奖励";
|
||||||
|
}else if("reward".equals(type)){
|
||||||
|
str = "奖励分成";
|
||||||
|
}
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("邀请奖励");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("用户昵称",sourceNickname);
|
||||||
|
data.addFields("用户蜜瓜号",sourceUsercode);
|
||||||
|
data.addFields(str,incomeCoin+"云贝");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户充值,邀请人返现
|
||||||
|
*/
|
||||||
|
public void inviteCashbackSendMessage(Long toUid,String sourceNickname,String sourceUsercode,Long payCoin,Long incomeCoin){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("充值分成");
|
||||||
|
data.setTxt1("充值分成:每一笔账户充值将给其邀请账户额外赠送{}%的云贝");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("充值用户",sourceNickname);
|
||||||
|
data.addFields("蜜瓜号",sourceUsercode);
|
||||||
|
data.addFields("充值金额",payCoin+"云贝");
|
||||||
|
data.addFields("充值分成",incomeCoin+"云贝");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现审核转账发送消息【提现审核成功】
|
||||||
|
*/
|
||||||
|
public void cashSuccessSendMessage(Long toUid, LocalDateTime cashTime, BigDecimal cashMoney, BigDecimal realCashMonty,
|
||||||
|
String cardAccount,LocalDateTime verifyTime){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("提现成功");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("提现时间", CaiDateUtil.localDateTimeToString(cashTime));
|
||||||
|
data.addFields("提现金额",cashMoney.toString()+"元");
|
||||||
|
data.addFields("提现方式","支付宝");
|
||||||
|
data.addFields("到账金额",realCashMonty.toString()+"元");
|
||||||
|
data.addFields("到账账户","支付宝("+cardAccount+")");
|
||||||
|
data.addFields("审核时间",CaiDateUtil.localDateTimeToString(verifyTime));
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提现审核转账发送消息【提现审核失败】
|
||||||
|
*/
|
||||||
|
public void cashFailSendMessage(Long toUid, LocalDateTime cashTime, BigDecimal cashMoney, String remark){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("提现失败");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("提现时间", CaiDateUtil.localDateTimeToString(cashTime));
|
||||||
|
data.addFields("提现金额",cashMoney.toString()+"元");
|
||||||
|
data.addFields("提现方式","支付宝");
|
||||||
|
data.setTxt2(remark);
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 举报发送消息
|
||||||
|
*/
|
||||||
|
public void reportSendMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("已收到你的举报信息");
|
||||||
|
data.setTxt1("感谢您提交的举报信息,拒绝不良风气,良好的氛围需要大家共同维护。");
|
||||||
|
data.setCurrentDate();
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关注发送消息
|
||||||
|
* @param toUid
|
||||||
|
*/
|
||||||
|
public void followedSendMessage(Long toUid,
|
||||||
|
Long followUserId,
|
||||||
|
String followNickname,
|
||||||
|
String followAvatar,
|
||||||
|
Integer followAge,
|
||||||
|
String followCity,
|
||||||
|
LocalDateTime followTime,
|
||||||
|
Integer gender){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageSendFollowNew messageExtNew = new MessageSendFollowNew(MessageBaseTypeEnum.SEND_FOLLOW);
|
||||||
|
MessageSendFollowData data = new MessageSendFollowData();
|
||||||
|
data.setUserid(followUserId);
|
||||||
|
data.setNickname(followNickname);
|
||||||
|
data.setAvatar(followAvatar);
|
||||||
|
data.setAge(followAge);
|
||||||
|
data.setCity(followCity);
|
||||||
|
data.setTime(CaiDateUtil.localDateTimeToString(followTime));
|
||||||
|
data.setSex(gender);
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过女神认证发送消息
|
||||||
|
*/
|
||||||
|
public void passAnchorSendMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("恭喜你通过自拍认证,成为平台女神");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("设置服务价格","请到“我的-->女神设置”处设置");
|
||||||
|
data.addFields("找男生聊聊","首页右上角点击“男生”按钮查找在线男生");
|
||||||
|
data.addFields("赚钱小秘密一","多给在线男生打招呼");
|
||||||
|
data.addFields("赚钱小秘密二","照片越好看,男生越喜欢");
|
||||||
|
data.addFields("赚钱小秘密三","勤发动态,让他感受到你的美");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更改女神邀请比例
|
||||||
|
*/
|
||||||
|
public void changeInviteConfigSendMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("恭喜成为邀请女神");
|
||||||
|
data.setCurrentDate();
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送礼物自定义消息
|
||||||
|
*/
|
||||||
|
public void sendGiftMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageSendGiftMessageNew messageExtNew = new MessageSendGiftMessageNew(MessageBaseTypeEnum.SEND_GIFT_MESSAGE);
|
||||||
|
MessageSendGiftMessageData data = new MessageSendGiftMessageData();
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收到守护符通知
|
||||||
|
*/
|
||||||
|
public void getGuardMessage(Long toUid,Integer num,Long price,BigDecimal incomeCoin,BigDecimal totalCoin){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("收到守护符");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.addFields("守护类型",num+"个守护符");
|
||||||
|
data.addFields("守护单价",price+"云贝");
|
||||||
|
data.addFields("收入云贝",incomeCoin+"云贝");
|
||||||
|
data.addFields("总云贝",totalCoin+"云贝");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送上线了批量自定义消息
|
||||||
|
*/
|
||||||
|
public void sendOnlineAttentionNotice(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageSendOnlineAttentionNew messageExtNew = new MessageSendOnlineAttentionNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageSendOnlineAttentionData data = new MessageSendOnlineAttentionData();
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消女神通知
|
||||||
|
*/
|
||||||
|
public void cancelAnchorMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("取消女神通知");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.setTxt1("因多次违规或被投诉,已被取消女神资格!");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态审核通知
|
||||||
|
*/
|
||||||
|
public void dynamicAuditMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("动态审核通知");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.setTxt1("您的动态因不符合规范,已被删除,多次违规会被取消大咖资格或封号处理");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相册审核通知
|
||||||
|
*/
|
||||||
|
public void albumAuditMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("相册审核通知");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.setTxt1("您上传的照片不符合要求,已被删除,多次违规会被取消大咖资格或封号处理,请按照指引上传符合要求的照片");
|
||||||
|
data.setLink_type(1);
|
||||||
|
data.setLink_url("/index/about/album_rule.html");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称重置审核通知
|
||||||
|
*/
|
||||||
|
public void nickAuditMessage(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageExtNew messageExtNew = new MessageExtNew(MessageBaseTypeEnum.TXT);
|
||||||
|
MessageExtData data = new MessageExtData();
|
||||||
|
data.setAction(1);
|
||||||
|
data.setTitle("重置昵称通知");
|
||||||
|
data.setCurrentDate();
|
||||||
|
data.setTxt1("您的昵称不合格,已被重置,多次违规会被封号!");
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送充值飘窗提醒
|
||||||
|
*/
|
||||||
|
public void sendRechargeWindowsAmount(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageSendRechargeWindowsAmountNew messageExtNew = new MessageSendRechargeWindowsAmountNew(MessageBaseTypeEnum.SEND_GIFTWINDOWS_AMOUNT);
|
||||||
|
MessageSendRechargeWindowsAmountData data = new MessageSendRechargeWindowsAmountData();
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送礼物飘窗提醒
|
||||||
|
*/
|
||||||
|
public void sendGiftWindowsAmount(Long toUid){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageSendGiftWindowsAmountNew messageExtNew = new MessageSendGiftWindowsAmountNew(MessageBaseTypeEnum.SEND_GIFTWINDOWS_AMOUNT);
|
||||||
|
MessageSendGiftWindowsAmountData data = new MessageSendGiftWindowsAmountData();
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态通知
|
||||||
|
*/
|
||||||
|
public void sendFollowDynamicBath(Long toUid, User user,String image,String content){
|
||||||
|
YunExecutor.YUN_EXECUTOR.execute(() -> {
|
||||||
|
MessageSendFollowDynamicNew messageExtNew = new MessageSendFollowDynamicNew(MessageBaseTypeEnum.SEND_FOLLOW_DYNAMIC);
|
||||||
|
MessageSendFollowDynamicData data = new MessageSendFollowDynamicData();
|
||||||
|
data.setUserid(user.getId());
|
||||||
|
data.setNickname(user.getNickname());
|
||||||
|
data.setAvatar(user.getAvatar());
|
||||||
|
data.setAge(user.getAge().intValue());
|
||||||
|
data.setCity(user.getCity());
|
||||||
|
data.setTime(CaiDateUtil.getCurrentTimeStr());
|
||||||
|
data.setImage(image);
|
||||||
|
data.setTitle(content);
|
||||||
|
messageExtNew.setData(data);
|
||||||
|
YxDataR<SendMsgResp> r = yunxin.sendTo(toUid, SYS_NOTICE_ID, messageExtNew);
|
||||||
|
if(r == null || !r.isSuccess()){
|
||||||
|
log.error("云信发送失败【sendCallAsync】r={}", JSON.toJSONString(r));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageBaseData {
|
||||||
|
private Integer type;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageExtData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageExtNew extends MessageBaseData {
|
||||||
|
|
||||||
|
private MessageExtData data;
|
||||||
|
|
||||||
|
public MessageExtNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageExtNew() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendFollowData;
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendFollowDynamicData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendFollowDynamicNew extends MessageBaseData{
|
||||||
|
|
||||||
|
private MessageSendFollowDynamicData data;
|
||||||
|
|
||||||
|
public MessageSendFollowDynamicNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageSendFollowDynamicNew() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendFollowData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendFollowNew extends MessageBaseData{
|
||||||
|
|
||||||
|
private MessageSendFollowData data;
|
||||||
|
|
||||||
|
public MessageSendFollowNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageSendFollowNew() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendGiftMessageData;
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendRechargeWindowsAmountData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendGiftMessageNew extends MessageBaseData{
|
||||||
|
|
||||||
|
private MessageSendGiftMessageData data;
|
||||||
|
|
||||||
|
public MessageSendGiftMessageNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageSendGiftMessageNew() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendFollowData;
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendGiftWindowsAmountData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendGiftWindowsAmountNew extends MessageBaseData{
|
||||||
|
|
||||||
|
private MessageSendGiftWindowsAmountData data;
|
||||||
|
|
||||||
|
public MessageSendGiftWindowsAmountNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageSendGiftWindowsAmountNew() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendOnlineAttentionData;
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendRechargeWindowsAmountData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendOnlineAttentionNew extends MessageBaseData{
|
||||||
|
|
||||||
|
private MessageSendOnlineAttentionData data;
|
||||||
|
|
||||||
|
public MessageSendOnlineAttentionNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageSendOnlineAttentionNew() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cai.notice.data;
|
||||||
|
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendGiftWindowsAmountData;
|
||||||
|
import com.ruoyi.cai.notice.data.child.MessageSendRechargeWindowsAmountData;
|
||||||
|
import com.ruoyi.cai.notice.enums.MessageBaseTypeEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendRechargeWindowsAmountNew extends MessageBaseData{
|
||||||
|
|
||||||
|
private MessageSendRechargeWindowsAmountData data;
|
||||||
|
|
||||||
|
public MessageSendRechargeWindowsAmountNew(MessageBaseTypeEnum typeEnum) {
|
||||||
|
this.setType(typeEnum.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageSendRechargeWindowsAmountNew() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageExtData {
|
||||||
|
private Integer action;
|
||||||
|
private String title = "";
|
||||||
|
private String date;
|
||||||
|
private String txt1 = "";
|
||||||
|
private List<MessageExtDataList> fields = new ArrayList<>();
|
||||||
|
private String txt2 = "";
|
||||||
|
private Integer link_type = 0;
|
||||||
|
private String link_url = "";
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class MessageExtDataList {
|
||||||
|
private String n;
|
||||||
|
private String v;
|
||||||
|
|
||||||
|
public MessageExtDataList(String n, String v) {
|
||||||
|
this.n = n;
|
||||||
|
this.v = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MessageExtDataList() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentDate(){
|
||||||
|
this.date = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addFields(String n,String v){
|
||||||
|
fields.add(new MessageExtDataList(n,v));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendFollowData {
|
||||||
|
private Long userid;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private Integer age;
|
||||||
|
private String city;
|
||||||
|
private String time;
|
||||||
|
private Integer sex;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendFollowDynamicData {
|
||||||
|
private Long userid;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private Integer age;
|
||||||
|
private String city;
|
||||||
|
private String time;
|
||||||
|
private String image;
|
||||||
|
private String title;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendGiftMessageData {
|
||||||
|
private Long gift_id;
|
||||||
|
private String gift_name;
|
||||||
|
private String gift_url;
|
||||||
|
private Long gift_count;
|
||||||
|
private Long from_uid;
|
||||||
|
private Long to_uid;
|
||||||
|
private Integer link_type = 0;
|
||||||
|
private String link_url = "";
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendGiftWindowsAmountData {
|
||||||
|
private Long id;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private Long toid;
|
||||||
|
private String tonickname;
|
||||||
|
private String toavatar;
|
||||||
|
private String amount;
|
||||||
|
private String giftname;
|
||||||
|
private String giftimg;
|
||||||
|
private String gifttotal;
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendOnlineAttentionData {
|
||||||
|
private Long userid;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private Long age;
|
||||||
|
private String city;
|
||||||
|
private String time;
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.cai.notice.data.child;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class MessageSendRechargeWindowsAmountData {
|
||||||
|
private Long id;
|
||||||
|
private String nickname;
|
||||||
|
private String avatar;
|
||||||
|
private String amount;
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.ruoyi.cai.notice.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum MessageBaseTypeEnum {
|
||||||
|
/**
|
||||||
|
* 发送文本消息
|
||||||
|
* 使用地方:
|
||||||
|
* 付费图片分成、系统奖励、注册奖励云贝、充值云贝发消息、收到礼物发送消息
|
||||||
|
* 提现审核失败、提现审核成功、邀请奖励、举报发送消息、未通过女神认证发送消息
|
||||||
|
* 通过女神认证发送消息、更改女神邀请比例、收到守护符通知、收到一级vip充值奖励通知
|
||||||
|
* 收到男用户购买微信/QQ分成通知、后台视频审核被拒绝的时候,发一个被拒绝的系统通知
|
||||||
|
* 用户充值,邀请人返现, 群打招呼审核失败
|
||||||
|
*/
|
||||||
|
TXT(11,"文本消息"),
|
||||||
|
SEND_FOLLOW(16,"自定义被关注消息"),
|
||||||
|
SEND_FOLLOW_DYNAMIC(17,"关注动态"),
|
||||||
|
SEND_GIFTWINDOWS_AMOUNT(17,"关注动态"),
|
||||||
|
RECHARGE_WINDOWS_AMOUNT(17,"关注动态"),
|
||||||
|
SEND_GIFT_MESSAGE(17,"关注动态"),
|
||||||
|
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
MessageBaseTypeEnum(Integer code, String name) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.ruoyi.cai.util;
|
|||||||
|
|
||||||
import java.time.DayOfWeek;
|
import java.time.DayOfWeek;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.TemporalAdjusters;
|
import java.time.temporal.TemporalAdjusters;
|
||||||
|
|
||||||
@@ -14,9 +15,17 @@ public class CaiDateUtil {
|
|||||||
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String localDateTimeToString(LocalDateTime localDateTime){
|
||||||
|
return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
LocalDate one = getLastWeekOne(LocalDate.now());
|
LocalDate one = getLastWeekOne(LocalDate.now());
|
||||||
System.out.println(one.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
System.out.println(one.format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getCurrentTimeStr() {
|
||||||
|
return localDateTimeToString(LocalDateTime.now());
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.ruoyi.yunxin.util;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
|
||||||
|
public class YunDateUtils {
|
||||||
|
public static String localDateTimeToString(LocalDateTime localDateTime){
|
||||||
|
return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user