Commit 7f5f784c authored by 竹天卫's avatar 竹天卫

application.yml 访问链接优化

parent 8c941a2a
......@@ -3,11 +3,13 @@ package cn.wise.sc.cement.business.controller;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.cement.business.model.BaseResponse;
import cn.wise.sc.cement.business.service.impl.WeiXinService;
import cn.wise.sc.cement.business.util.weixin.Global;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -36,9 +38,9 @@ public class WeiXinController {
log.debug("=============================================");
try {
//测试服务器
return weiXinService.getTestToken(code);
// return weiXinService.getTestToken(code);
//正式服务器
// return weiXinService.getToken(code, "APP");
return weiXinService.getToken(code, "APP");
} catch (Exception e) {
log.debug("获取登录token{}", e);
}
......@@ -50,9 +52,9 @@ public class WeiXinController {
public BaseResponse getPCToken(String code) {
try {
//测试服务器
return weiXinService.getTestToken(code);
// return weiXinService.getTestToken(code);
//正式服务器
// return weiXinService.getToken(code, "PC");
return weiXinService.getToken(code, "PC");
} catch (Exception e) {
log.debug("获取登录token{}", e);
}
......@@ -129,11 +131,23 @@ public class WeiXinController {
return s;
}
@Value("${weixin.systemUrl}")
private String systemUrl;
@ApiOperation(value = "发送消息")
@GetMapping("/sendTextMessage")
public BaseResponse sendTextMessage() {
try {
weiXinService.sendTextMessage("1","hello");
//发送企业微信消息内容
String content="你好!"+"竹天卫"+"向您申请了一条委托,请前往\n" +
systemUrl+"进行评审。";
System.out.println("**************************content**********************");
System.out.println(content);
weiXinService.sendTextMessage("ZhuTianWei", content);
// weiXinService.sendTextMessage("1","hello");
return BaseResponse.okData("成功");
} catch (Exception e) {
log.debug("发送消息{}", e);
......
......@@ -215,7 +215,6 @@ public class WeiXinService {
return BaseResponse.okData(loginUser);
}
/**
* 发送消息
* @param touser 指定接收消息的成员,成员ID列表(多个接收者用‘|’分隔,最多支持1000个)。
......
package cn.wise.sc.cement.business.util.weixin;
import org.springframework.beans.factory.annotation.Value;
/**
* 功能说明:企业微信全局接口地址
* 修改说明:
......@@ -27,6 +29,9 @@ public interface Global {
public final static String systemUrl =
"<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="+corpId+"&redirect_uri="+backUrl+"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程" + "</a>,";
public final static String systemUrlTmp =
"<a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww348f91b2573c1867&redirect_uri=https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程" + "</a>,";
/**
* 微信公众平台,获取AccessToken的接口地址,Https请求方式:GET
* 接口地址示例:https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=id&corpsecret=secrect
......
......@@ -7,8 +7,8 @@ spring:
active: dev
datasource:
# 192.168.110.85 admin!@#123
url: jdbc:mysql://192.168.110.85:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
# url: jdbc:mysql://47.93.148.213:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
# url: jdbc:mysql://192.168.110.85:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
url: jdbc:mysql://47.93.148.213:3306/sinoma_tcdri?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=UTF-8&useSSL=false
username: root
password: admin!@#123
driverClassName: com.mysql.cj.jdbc.Driver
......@@ -45,7 +45,7 @@ weixin:
agentSecret: gFa_7XvXtCaoeAYERzjRwwz_OTJkJfgBb8weOKjmI3o
agentSecretPC: itCLYcwl9ggA9VfZam_iz96Ikp9StDFfVr4Adb0yY7A
backUrl: https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system
systemUrl: <a href=\"https://open.weixin.qq.com/connect/oauth2/authorize?appid="ww348f91b2573c1867"&redirect_uri="https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system"%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect\">物化检测流程</a>,
systemUrl: '<a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww348f91b2573c1867&redirect_uri=https%3a%2f%2fccdcmtl.sinoma-tianjin.com%2flab-system%2f&response_type=code&scope=snsapi_base&state=#wechat_redirect">物化检测流程</a>,'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment