Просмотр исходного кода

订阅消息

release_toaliyun_real
xhxu 4 лет назад
Родитель
Сommit
de8542f4b6
7 измененных файлов: 39 добавлений и 0 удалений
  1. +1
    -0
      mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java
  2. +11
    -0
      mallinkAdmin/src/main/resources/db/migration/V202107120001__sendMSG.sql
  3. +1
    -0
      mallinkCApi/src/main/java/com/iformall/controller/WxMsgController.java
  4. +1
    -0
      mallinkService/src/main/java/com/iformall/enums/EnumTemplateType.java
  5. +13
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxMsgServiceImpl.java
  6. +11
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxTemplateMsgServiceImpl.java
  7. +1
    -0
      mallinkTTAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java

+ 1
- 0
mallinkAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java Просмотреть файл

@@ -94,6 +94,7 @@ public class WxMsgController extends BaseController {
types.add(EnumTemplateType.ACTIVITY_REMIND.getCode());
types.add(EnumTemplateType.LIVE_REMIND.getCode());
types.add(EnumTemplateType.CREDIT_UPD_REMIND.getCode());
types.add(EnumTemplateType.SEND_COUPON_REMIND.getCode());
wxTemplateMsg.setTypes(types);
final PageInfo<WxTemplateMsg> page = wxTemplateMsgService.listAsPageForMiniApp(wxTemplateMsg, pageNum, pageSize);
return new ResultData(page);


+ 11
- 0
mallinkAdmin/src/main/resources/db/migration/V202107120001__sendMSG.sql Просмотреть файл

@@ -0,0 +1,11 @@


INSERT INTO `wx_template_msg`(`id`, `tenant_id`, `parent_tenant_id`, `template_id`, `type`, `custom_param`, `create_date`, `update_date`)
select CEILING(RAND()*90000000000+10000000000) ,tenant_id,parent_tenant_id,'',51,'{\"index\": [\"thing1\", \"time3\", \"time4\", \"thing5\"], \"emphasis\": \"\"}',now(),now()
from wx_mall
where id != 1 and id != 10011 and id != 10071 and id != 10141 ;


INSERT INTO `wx_template_msg`(`id`, `tenant_id`, `parent_tenant_id`, `template_id`, `type`, `custom_param`, `create_date`, `update_date`, `on_off`) VALUES (CEILING(RAND()*90000000000+10000000000), '1001', NULL, '', 51, '{\"index\": [\"character_string1\", \"character_string2\", \"time4\", \"thing3\"], \"emphasis\": \"\"}', '2021-07-12 17:00:00', '2021-07-12 17:00:00', 0);
INSERT INTO `wx_template_msg`(`id`, `tenant_id`, `parent_tenant_id`, `template_id`, `type`, `custom_param`, `create_date`, `update_date`, `on_off`) VALUES (CEILING(RAND()*90000000000+10000000000), '1007', NULL, '', 51, '{\"index\": [\"character_string1\", \"character_string2\", \"time4\", \"thing3\"], \"emphasis\": \"\"}', '2021-07-12 17:00:00', '2021-07-12 17:00:00', 0);
INSERT INTO `wx_template_msg`(`id`, `tenant_id`, `parent_tenant_id`, `template_id`, `type`, `custom_param`, `create_date`, `update_date`, `on_off`) VALUES (CEILING(RAND()*90000000000+10000000000), '1014', NULL, '', 51, '{\"index\": [\"character_string1\", \"character_string2\", \"time4\", \"thing3\"], \"emphasis\": \"\"}', '2021-07-12 17:00:00', '2021-07-12 17:00:00', 0);

+ 1
- 0
mallinkCApi/src/main/java/com/iformall/controller/WxMsgController.java Просмотреть файл

@@ -41,6 +41,7 @@ public class WxMsgController extends BaseController {
types.add(EnumTemplateType.ACTIVITY_REMIND.getCode());
types.add(EnumTemplateType.LIVE_REMIND.getCode());
types.add(EnumTemplateType.CREDIT_UPD_REMIND.getCode());
types.add(EnumTemplateType.SEND_COUPON_REMIND.getCode());
wxTemplateMsg.setTypes(types);
final PageInfo<WxTemplateMsg> page = wxTemplateMsgService.listAsPageForMiniApp(wxTemplateMsg, pageNum, pageSize);
return new ResultData(page);


+ 1
- 0
mallinkService/src/main/java/com/iformall/enums/EnumTemplateType.java Просмотреть файл

@@ -17,6 +17,7 @@ public enum EnumTemplateType {
ACTIVITY_REMIND(4, "活动开始提醒","386"), // 小程序
LIVE_REMIND(5, "直播开播提醒","8501"), // 小程序
CREDIT_UPD_REMIND(50, "积分变更提醒","310"), // 小程序
SEND_COUPON_REMIND(51, "优惠券到账提醒","3209"), // 小程序

AUDIT_MESSAGE(101, "公众号审核结果通知",""), // 公众号
VERIFY_RESULT(102, "公众号卡券核销通知",""), // 公众号


+ 13
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxMsgServiceImpl.java Просмотреть файл

@@ -431,6 +431,19 @@ public class WxMsgServiceImpl implements WxMsgService {
customParam.getString("time4"),
customParam.getString("thing3")
));
}else if(wxTemplateMsg.getType() == EnumTemplateType.SEND_COUPON_REMIND.getCode()){
/**
* 券名称{{thing1.DATA}}
* 获取时间{{time3.DATA}}
* 过期日期{{time4.DATA}}
* 备注{{thing5.DATA}}
*/
smartAppMsg.setDataList(Lists.newArrayList(
customParam.getString("thing1"),
customParam.getString("time3"),
customParam.getString("time4"),
customParam.getString("thing5")
));
}else{
return;
}


+ 11
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxTemplateMsgServiceImpl.java Просмотреть файл

@@ -61,6 +61,10 @@ public class WxTemplateMsgServiceImpl implements WxTemplateMsgService {
wxTemplateMsg.setType(EnumTemplateType.CREDIT_UPD_REMIND.getCode());
wxTemplateMsg.setCustomParam("{\"index\": [\"character_string1\", \"character_string2\", \"time4\", \"thing3\"], \"emphasis\": \"\"}");
wxTemplateMsgMapper.insert(wxTemplateMsg);
wxTemplateMsg.setId(null);
wxTemplateMsg.setType(EnumTemplateType.SEND_COUPON_REMIND.getCode());
wxTemplateMsg.setCustomParam("{\"index\": [\"thing1\", \"time3\", \"time4\", \"thing5\"], \"emphasis\": \"\"}");
wxTemplateMsgMapper.insert(wxTemplateMsg);
}

@Override
@@ -142,6 +146,13 @@ public class WxTemplateMsgServiceImpl implements WxTemplateMsgService {
} catch (WxErrorException e) {
return new ResultData(ErrorCode.TEMPLATE_ADD_ERROR);
}
}else if(byId.getType() == EnumTemplateType.SEND_COUPON_REMIND.getCode()){
try {
s = wxMaService.getSubscribeService().addTemplate(EnumTemplateType.SEND_COUPON_REMIND.getTid(),
Lists.newArrayList(1, 3, 4, 5),EnumTemplateType.SEND_COUPON_REMIND.getMessage());
} catch (WxErrorException e) {
return new ResultData(ErrorCode.TEMPLATE_ADD_ERROR);
}
}else{
return new ResultData(ErrorCode.TEMPLATE_NOT_FOUND);
}


+ 1
- 0
mallinkTTAdmin/src/main/java/com/iformall/controller/msg/WxMsgController.java Просмотреть файл

@@ -94,6 +94,7 @@ public class WxMsgController extends BaseController {
types.add(EnumTemplateType.ACTIVITY_REMIND.getCode());
types.add(EnumTemplateType.LIVE_REMIND.getCode());
types.add(EnumTemplateType.CREDIT_UPD_REMIND.getCode());
types.add(EnumTemplateType.SEND_COUPON_REMIND.getCode());
wxTemplateMsg.setTypes(types);
final PageInfo<WxTemplateMsg> page = wxTemplateMsgService.listAsPageForMiniApp(wxTemplateMsg, pageNum, pageSize);
return new ResultData(page);


Загрузка…
Отмена
Сохранить