|
@@ -5,6 +5,9 @@ import com.miaxis.ZzjsApplication;
|
|
import com.miaxis.feign.dto.AddTemplate;
|
|
import com.miaxis.feign.dto.AddTemplate;
|
|
import com.miaxis.feign.dto.WxSend;
|
|
import com.miaxis.feign.dto.WxSend;
|
|
import com.miaxis.feign.service.IWxSendService;
|
|
import com.miaxis.feign.service.IWxSendService;
|
|
|
|
+import com.miaxis.wx.domain.WxOrder;
|
|
|
|
+import com.miaxis.wx.service.IWxOrderService;
|
|
|
|
+import com.miaxis.wx.service.IWxXcxMessageService;
|
|
import org.junit.Test;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.junit.runner.RunWith;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -12,6 +15,9 @@ import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.Date;
|
|
|
|
+
|
|
@SpringBootTest(classes = ZzjsApplication.class)
|
|
@SpringBootTest(classes = ZzjsApplication.class)
|
|
@RunWith(SpringRunner.class)
|
|
@RunWith(SpringRunner.class)
|
|
public class WxTest {
|
|
public class WxTest {
|
|
@@ -23,7 +29,8 @@ public class WxTest {
|
|
@Autowired
|
|
@Autowired
|
|
private IWxSendService wxSendService;
|
|
private IWxSendService wxSendService;
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IWxXcxMessageService wxXcxMessageService;
|
|
|
|
|
|
@Value("${app.appid}")
|
|
@Value("${app.appid}")
|
|
private String appid;
|
|
private String appid;
|
|
@@ -72,5 +79,43 @@ public class WxTest {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ @Test
|
|
|
|
+ public void getWxSendService2(){
|
|
|
|
+// WxOrder wxOrder = wxOrderService.getByOutTradeNo("");
|
|
|
|
+ WxSend wxSend = new WxSend();
|
|
|
|
+ wxSend.setAccess_token(wxXcxMessageService.getXcxMessageToken());
|
|
|
|
+ wxSend.setTouser("oO7PJ5FlradAM7tqw3TM2zvEj4O4");
|
|
|
|
+ wxSend.setTemplate_id("Q4-tQrDwtzFUSLt_PR2kuTxBJ3d62V4Yp2iwx4PAcIE");
|
|
|
|
+ wxSend.setPage("/pages/cinema/orderdes?outTradeNo="+"12021053117040103901269463601171");
|
|
|
|
+
|
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
|
+ JSONObject jsonObject1 = new JSONObject();
|
|
|
|
+ JSONObject jsonObject2 = new JSONObject();
|
|
|
|
+ JSONObject jsonObject3 = new JSONObject();
|
|
|
|
+ JSONObject jsonObject4 = new JSONObject();
|
|
|
|
+ JSONObject jsonObject5 = new JSONObject();
|
|
|
|
+
|
|
|
|
+ jsonObject1.put("value","12021053117040103901269463601171");
|
|
|
|
+ jsonObject2.put("value","¥"+"250");
|
|
|
|
+ jsonObject3.put("value",new SimpleDateFormat("yyyy年MM月dd日 HH:mm").format(new Date()));
|
|
|
|
+ jsonObject4.put("value","电影票");
|
|
|
|
+ jsonObject5.put("value","点击查看取票二维码");
|
|
|
|
+
|
|
|
|
+ jsonObject.put("character_string1",jsonObject1);
|
|
|
|
+ jsonObject.put("amount3",jsonObject2);
|
|
|
|
+ jsonObject.put("date4",jsonObject3);
|
|
|
|
+ jsonObject.put("thing6",jsonObject4);
|
|
|
|
+ jsonObject.put("thing5",jsonObject5);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ wxSend.setData(jsonObject);
|
|
|
|
+ wxSend.setMiniprogram_state("developer");
|
|
|
|
+ wxSend.setLang("zh_CN");
|
|
|
|
+
|
|
|
|
+ String result = wxSendService.sendMessage(wxXcxMessageService.getXcxMessageToken(),wxSend);
|
|
|
|
+ System.out.println(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|