|
|
|
@ -9,8 +9,6 @@ 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; |
|
|
|
|
import com.lq.wechat.util.CheckUtil; |
|
|
|
|
import com.lq.wechat.util.ConstantSet; |
|
|
|
@ -26,8 +24,6 @@ import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -92,6 +88,7 @@ public class WechatController extends BaseController { |
|
|
|
|
//微信公众号详情
|
|
|
|
|
WechatInfo wechatInfo = wechatInfoService.getByOpenId(wechatOpenId); |
|
|
|
|
|
|
|
|
|
if (wechatInfo!=null) { |
|
|
|
|
TextMessage text = new TextMessage(); |
|
|
|
|
text.setFromUserName(wechatOpenId); |
|
|
|
|
text.setToUserName(openId); |
|
|
|
@ -107,28 +104,6 @@ public class WechatController extends BaseController { |
|
|
|
|
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: |
|
|
|
|
|
|
|
|
@ -186,6 +161,7 @@ public class WechatController extends BaseController { |
|
|
|
|
message = MessageUtil.MessageToXml(text); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|