mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 12:29:36 +08:00
公众号推送跳转小程序
This commit is contained in:
parent
3468062706
commit
1efc36e6dc
@ -3,7 +3,6 @@ package com.ics.controller.mobile;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ics.admin.service.IIcsCustomerStaffService;
|
||||
import com.ics.common.utils.StringUtils;
|
||||
import com.ics.service.RepairRemindPushService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
@ -45,10 +44,6 @@ public class WxBindController {
|
||||
@Autowired
|
||||
private IIcsCustomerStaffService customerStaffService;
|
||||
|
||||
@Autowired
|
||||
private RepairRemindPushService repairRemindPushService;
|
||||
|
||||
|
||||
//微信公众号网页授权地址
|
||||
private final static String OAUTH2_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=sh0907#wechat_redirect";
|
||||
|
||||
@ -98,14 +93,6 @@ public class WxBindController {
|
||||
return String.format(resultHtml, row > 0 ? "绑定成功" : "绑定失败");
|
||||
}
|
||||
|
||||
|
||||
@Ignore
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/send", produces = "text/html;charset=utf-8")
|
||||
public String send() {
|
||||
return repairRemindPushService.pushWxTemplateMsg()+"";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定页面
|
||||
*/
|
||||
|
@ -89,16 +89,19 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
String openid = customerStaff.getGzhOpenid();
|
||||
String time = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, repairRemind.getCreateTime());
|
||||
String content = repairRemind.getContent();
|
||||
if (StringUtils.isNotBlank(content) && content.length() > 20) {
|
||||
content = content.substring(0, 19);
|
||||
}
|
||||
|
||||
Map<String, Object> param = new HashMap<>();
|
||||
param.put("touser", openid);
|
||||
param.put("template_id", templateId);
|
||||
param.put("touser", openid);
|
||||
|
||||
// JSONObject miniprogram = new JSONObject();
|
||||
// miniprogram.put("appid", WX_SMALL_APP_ID);
|
||||
// miniprogram.put("pagepath", WX_SMALL_APP_PAGE);
|
||||
// param.put("miniprogram", miniprogram);
|
||||
JSONObject miniprogram = new JSONObject();
|
||||
miniprogram.put("appid", WX_SMALL_APP_ID);
|
||||
miniprogram.put("pagepath", WX_SMALL_APP_PAGE);
|
||||
param.put("miniprogram", miniprogram);
|
||||
|
||||
|
||||
JSONObject dataTime = new JSONObject();
|
||||
@ -111,6 +114,7 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
data.put("thing37", msg);
|
||||
param.put("data", data);
|
||||
JSONObject result = send(url, JSON.toJSONString(param));
|
||||
System.out.println(result.toString());
|
||||
if (result == null || result.getInteger("errcode") == null || result.getInteger("errcode") != 0) {
|
||||
failed.add(repairRemind.getId());
|
||||
} else {
|
||||
@ -132,7 +136,6 @@ public class RepairRemindPushServiceImpl implements RepairRemindPushService {
|
||||
try {
|
||||
Response response = call.execute();
|
||||
String resultStr = response.body().string();
|
||||
System.out.println(resultStr);
|
||||
return JSON.parseObject(resultStr);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
Loading…
x
Reference in New Issue
Block a user