Kaynağa Gözat

Merge branch 'develop' of gitadmin/tuoheng_freeway into release

pull/393/head
wanjing 10 ay önce
ebeveyn
işleme
a5a33a4844
7 değiştirilmiş dosya ile 14 ekleme ve 11 silme
  1. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/SubscribeTimesEnum.java
  2. +1
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/param/WxSendMessageParam.java
  3. +8
    -9
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java
  4. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml
  5. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml
  6. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml
  7. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml

+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/SubscribeTimesEnum.java Dosyayı Görüntüle

@@ -6,7 +6,7 @@ import lombok.Getter;
* 任务状态枚举
*/
public enum SubscribeTimesEnum {
//1未授权 2授权
SUBSCRIBE_TIMES_ONE(1,"订阅一次"),
SUBSCRIBE_TIMES_NO_ONE(2,"非一次订阅");


+ 1
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/param/WxSendMessageParam.java Dosyayı Görüntüle

@@ -30,7 +30,7 @@ public class WxSendMessageParam {
/**
* 跳转小程序类型 developer为开发版;trial为体验版;formal为正式版;默认为正式版
*/
//private String miniprogram_state;
private String miniprogram_state;

/**
* 填充信息

+ 8
- 9
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WxServiceImpl.java Dosyayı Görüntüle

@@ -23,6 +23,7 @@ import com.tuoheng.miniprogram.utils.GetOpenIdUtil;
import com.tuoheng.miniprogram.vo.WxAuthorizeVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestClientException;
@@ -51,6 +52,9 @@ public class WxServiceImpl implements IWxService {

private static long expiresTime;

@Value("${wx.miniprogramState:}")
private String miniprogramState;

public JsonResult checkAuthorize(String code) {
log.info("进入判断用户是否授权接口, code={}", code);
User user = CurrentUserUtil.getUserInfo();
@@ -195,8 +199,7 @@ public class WxServiceImpl implements IWxService {
//本次结束,进入下次循环
continue;
}
if (user.getAuthorize() == AuthorizeStatusEnum.AUTHORIZE_ON.getCode()
&& user.getSubscribeTimes() == SubscribeTimesEnum.SUBSCRIBE_TIMES_NO_ONE.getCode()) {
if (user.getAuthorize() == AuthorizeStatusEnum.AUTHORIZE_ON.getCode() && user.getSubscribeTimes() == SubscribeTimesEnum.SUBSCRIBE_TIMES_NO_ONE.getCode()) {
continue;
}
//获取当前登录openId
@@ -214,18 +217,17 @@ public class WxServiceImpl implements IWxService {
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + getAccessToken();
WxSendMessageParam param = new WxSendMessageParam();
param.setPage("/package_question/pages/taskList/taskList");
//param.setMiniprogram_state("formal");
param.setMiniprogram_state(miniprogramState);
param.setTouser(openId);
param.setTemplate_id(CommonConfig.templateId);
Map<String, TemplateMinDto> data = new HashMap<>(3);
//消息模板{{time12.DATA}} {{thing4.DATA}} {{thing13.DATA}} 时间格式一定是这样的2022-01-13 02:31:36
ResponseEntity<String> responseEntity = null;
ResponseEntity<String> responseEntity;
try {
data.put("time12", new TemplateMinDto(wxMessageRequest.getCreateTime()));
data.put("thing4", new TemplateMinDto(wxMessageRequest.getQuestionName()));
data.put("thing13", new TemplateMinDto(wxMessageRequest.getQuestionDesc()));
param.setData(data);

responseEntity = restTemplate.postForEntity(url, param, String.class);
String messageBody = responseEntity.getBody();
Integer errcode = JSONObject.parseObject(messageBody).getInteger("errcode").intValue();
@@ -243,18 +245,15 @@ public class WxServiceImpl implements IWxService {
}
JSONObject jsonObject = JSON.parseObject(messageBody);
if (Objects.nonNull(jsonObject)) {
log.info("openId:" + openId + "发送消息返回内容:" + jsonObject.toJSONString());
log.info("发送消息:userId={}, openId={},返回内容={}", userId, openId, jsonObject.toJSONString());
}
isSend = true;
} catch (RestClientException e) {
log.info("openId:" + openId + "发送消息异常报错:" + e);
e.printStackTrace();
}

}

return JsonResult.success(isSend);

}

/**

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-dev.yml Dosyayı Görüntüle

@@ -97,6 +97,7 @@ wx:
appId: wxfa4ec86caec22034
appSecret: dd8411aaa8fcfb251518d5021adb059d
templateId: tOewJK9MXIbfXovwCb72KLpCdBp1spL6pQ2F3LTQkSI
miniprogramState: developer

xxl:
enable: true

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-local.yml Dosyayı Görüntüle

@@ -97,6 +97,7 @@ wx:
appId: wxfa4ec86caec22034
appSecret: dd8411aaa8fcfb251518d5021adb059d
templateId: tOewJK9MXIbfXovwCb72KLpCdBp1spL6pQ2F3LTQkSI
miniprogramState: developer

xxl:
enable: true

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-prod.yml Dosyayı Görüntüle

@@ -97,6 +97,7 @@ wx:
appId: wxfa4ec86caec22034
appSecret: dd8411aaa8fcfb251518d5021adb059d
templateId: tOewJK9MXIbfXovwCb72KLpCdBp1spL6pQ2F3LTQkSI
miniprogramState: formal

## 配置feign熔断
#feign:

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/resources/application-test.yml Dosyayı Görüntüle

@@ -97,6 +97,7 @@ wx:
appId: wxfa4ec86caec22034
appSecret: dd8411aaa8fcfb251518d5021adb059d
templateId: tOewJK9MXIbfXovwCb72KLpCdBp1spL6pQ2F3LTQkSI
miniprogramState: trial

## 配置feign熔断
#feign:

Yükleniyor…
İptal
Kaydet