|
@@ -1,11 +1,8 @@
|
|
package com.miaxis.system.controller.test;
|
|
package com.miaxis.system.controller.test;
|
|
|
|
|
|
-import cn.hutool.core.io.FileUtil;
|
|
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.miaxis.common.constant.Constants;
|
|
import com.miaxis.common.constant.Constants;
|
|
import com.miaxis.common.core.domain.Response;
|
|
import com.miaxis.common.core.domain.Response;
|
|
-import com.miaxis.feign.dto.WxTicket;
|
|
|
|
import com.miaxis.feign.service.IWxMpService;
|
|
import com.miaxis.feign.service.IWxMpService;
|
|
import com.miaxis.feign.service.IWxSendService;
|
|
import com.miaxis.feign.service.IWxSendService;
|
|
import com.miaxis.wx.service.IWxGzhService;
|
|
import com.miaxis.wx.service.IWxGzhService;
|
|
@@ -66,35 +63,11 @@ public class TestController {
|
|
@Value("${cos.preffix}")
|
|
@Value("${cos.preffix}")
|
|
private String preffix;
|
|
private String preffix;
|
|
|
|
|
|
|
|
+ @Value("${file.ticketPath}")
|
|
|
|
+ private String ticketPath;
|
|
|
|
|
|
- /**
|
|
|
|
- * 生成带参数的二维码
|
|
|
|
- */
|
|
|
|
- @GetMapping(value = "/generateTicket")
|
|
|
|
- @ApiOperation("生成带参数的二维码")
|
|
|
|
- public Response generateTicket() throws Exception{
|
|
|
|
- String token = wxGzhService.getGzhToken();
|
|
|
|
- WxTicket wxTicket = new WxTicket();
|
|
|
|
- wxTicket.setExpire_seconds(2592000);//30天
|
|
|
|
- wxTicket.setAction_name("QR_SCENE");
|
|
|
|
- JSONObject jsonObject1 = new JSONObject();
|
|
|
|
- JSONObject jsonObject2 = new JSONObject();
|
|
|
|
- jsonObject1.put("scene_id","123");
|
|
|
|
- jsonObject2.put("scene",jsonObject1);
|
|
|
|
- wxTicket.setAction_info(jsonObject2);
|
|
|
|
- String result = wxSendService.generateTicket(token,wxTicket);
|
|
|
|
- System.out.println("生成ticket:" + result);
|
|
|
|
- JSONObject jsonStr = JSONObject.parseObject(result);
|
|
|
|
-
|
|
|
|
- QrCodeUtil.generate(
|
|
|
|
- jsonStr.getString("url"), //二维码内容
|
|
|
|
- 300, 300,
|
|
|
|
- //QrConfig.create().setImg("C:\\Users\\wwl\\Desktop\\二维码\\微信图片_20211021120216.jpg")
|
|
|
|
- FileUtil.file("/data/test/qrimg.jpg")//写出到的文件
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- return Response.success();
|
|
|
|
- }
|
|
|
|
|
|
+ @Value("${wxgzh.materialUrl}")
|
|
|
|
+ private String materialUrl;
|
|
|
|
|
|
|
|
|
|
|
|
|