重构:优化订单通知消息标签,支持动态显示订单类型
- 新增 OrderMessageLabelResolver 用于解析订单场景标签 - 修改微信公众号下单通知,根据下单类型(随机单/指定单/打赏/礼物)显示对应标签 - 更新 WxCustomMpService 接口,传递 placeType 和 rewardType 参数 - 完善相关单元测试和 Mock 配置
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.starry.admin.api;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.api.WxMpTemplateMsgService;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.boot.test.context.TestConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
|
||||
/**
|
||||
* Provides stubbed WeChat MP services in the apitest profile so integration tests never hit external APIs.
|
||||
*/
|
||||
@TestConfiguration
|
||||
@Profile("apitest")
|
||||
public class MockWxMpServiceConfig {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public WxMpService wxMpService() {
|
||||
WxMpService service = mock(WxMpService.class, Mockito.RETURNS_DEEP_STUBS);
|
||||
WxMpTemplateMsgService templateMsgService = mock(WxMpTemplateMsgService.class);
|
||||
when(service.getTemplateMsgService()).thenReturn(templateMsgService);
|
||||
when(service.switchoverTo(Mockito.anyString())).thenReturn(service);
|
||||
when(service.switchover(Mockito.anyString())).thenReturn(true);
|
||||
return service;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user