更新代码

master
星期八 5 years ago
parent dd2d440845
commit 4206b6ca3e
  1. 1
      pom.xml
  2. 2
      src/main/java/com/lq/dao/WechatRuleMessageDao.java
  3. 1
      src/main/java/com/lq/entity/SysUser.java
  4. 37
      src/main/java/com/lq/entity/WechatInfoSetting.java
  5. 51
      src/main/java/com/lq/wechat/web/WechatController.java

@ -520,7 +520,6 @@
<version>2.6.2</version>
</dependency>
</dependencies>
<build>

@ -13,4 +13,6 @@ public interface WechatRuleMessageDao extends BaseDao<WechatRuleMessage> {
List<WechatRuleMessage> findByWechatRuleId(@Param("wechatRuleId")Long wechatRuleId);
List<WechatRuleMessage> findByWechatRuleIds(@Param("wechatRuleIds")List<Long> wechatRuleIds);
}

@ -12,7 +12,6 @@ public class SysUser extends IdEntity {
/**
* 登陆名称
*/
private String loginName;
/**
* 密码

@ -11,7 +11,18 @@ public class WechatInfoSetting extends IdEntity {
* 微信公众号ID
*/
private Long wechatInfoId;
/**
* 是否回复
*/
private Integer openReply;
/**
* 默认回复类型
*/
private Integer defaultMessageType;
/**
* 关注回复类型
*/
private Integer followMessageType;
public Long getWechatInfoId() {
return wechatInfoId;
@ -20,4 +31,28 @@ public class WechatInfoSetting extends IdEntity {
public void setWechatInfoId(Long wechatInfoId) {
this.wechatInfoId = wechatInfoId;
}
public Integer getOpenReply() {
return openReply;
}
public void setOpenReply(Integer openReply) {
this.openReply = openReply;
}
public Integer getDefaultMessageType() {
return defaultMessageType;
}
public void setDefaultMessageType(Integer defaultMessageType) {
this.defaultMessageType = defaultMessageType;
}
public Integer getFollowMessageType() {
return followMessageType;
}
public void setFollowMessageType(Integer followMessageType) {
this.followMessageType = followMessageType;
}
}

@ -8,6 +8,7 @@ import com.lq.code.util.StringUtil;
import com.lq.code.web.BaseController;
import com.lq.entity.WechatInfo;
import com.lq.entity.WechatUser;
import com.lq.wechat.mode.message.BaseMessage;
import com.lq.wechat.mode.message.ItemMessage;
import com.lq.wechat.mode.message.NewsMessage;
import com.lq.wechat.mode.message.TextMessage;
@ -101,29 +102,33 @@ public class WechatController extends BaseController {
switch (msgType) {
case ConstantSet.MESSAGE_TYPE_TEXT:
String content = map.get(WECHAT_CONTENT_KEY);
message = MessageUtil.MessageToXml(wechatRuleService.getByKeyworkdAndWechatInfoId(content,wechatInfo));
if("1".equals(content)){
NewsMessage newsMessage=new NewsMessage();
List<ItemMessage> items=new ArrayList<>();
ItemMessage item=new ItemMessage();
item.setTitle("六弄咖啡馆");
item.setDescription("两个人在爱在距离面前是否禁受考验?");
String path = req.getContextPath();
String basePath = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+path+"/";
item.setPicUrl("https://img3.doubanio.com/view/photo/l/public/p2367455902.webp");
item.setUrl("http://www.iqiyi.com/v_19rr95j3vc.html?vfm=2008_aldbd");
items.add(item);
newsMessage.setArticles(items);
newsMessage.setArticleCount(1);
newsMessage.setCreateTime(System.currentTimeMillis());
newsMessage.setFromUserName(wechatOpenId);
newsMessage.setMsgType(ConstantSet.MESSAGE_TYPE_NEW);
newsMessage.setToUserName(openId);
message = MessageUtil.MessageToXml(newsMessage);
} else{
text.setContent("您发送的消息是:" + content);
message = MessageUtil.MessageToXml(text);
}
BaseMessage baseMessage = wechatRuleService.getByKeyworkdAndWechatInfoId(content,wechatInfo);
baseMessage.setCreateTime(System.currentTimeMillis());
baseMessage.setFromUserName(wechatOpenId);
baseMessage.setToUserName(openId);
message = MessageUtil.MessageToXml(baseMessage);
// if("1".equals(content)){
// NewsMessage newsMessage=new NewsMessage();
// List<ItemMessage> items=new ArrayList<>();
// ItemMessage item=new ItemMessage();
// item.setTitle("六弄咖啡馆");
// item.setDescription("两个人在爱在距离面前是否禁受考验?");
// String path = req.getContextPath();
// String basePath = req.getScheme()+"://"+req.getServerName()+":"+req.getServerPort()+path+"/";
// item.setPicUrl("https://img3.doubanio.com/view/photo/l/public/p2367455902.webp");
// item.setUrl("http://www.iqiyi.com/v_19rr95j3vc.html?vfm=2008_aldbd");
// items.add(item);
// newsMessage.setArticles(items);
// newsMessage.setArticleCount(1);
// newsMessage.setCreateTime(System.currentTimeMillis());
// newsMessage.setFromUserName(wechatOpenId);
// newsMessage.setMsgType(ConstantSet.MESSAGE_TYPE_NEW);
// newsMessage.setToUserName(openId);
// message = MessageUtil.MessageToXml(newsMessage);
// } else{
// text.setContent("您发送的消息是:" + content);
// message = MessageUtil.MessageToXml(text);
// }
break;
case ConstantSet.MESSAGE_TYPE_IMAGE:

Loading…
Cancel
Save