新增:生成订单核销小程序码
This commit is contained in:
@@ -280,12 +280,12 @@ public class WxLoginController extends BaseController {
|
||||
return success("获取成功",jsonObject);
|
||||
}
|
||||
|
||||
@ApiOperation("获取微信小程序码")
|
||||
@GetMapping("/getQRCode")
|
||||
@ApiOperation("获取微信小程序码-用户ID")
|
||||
@GetMapping("/getUserQRCode")
|
||||
public ApiResult<?> getQRCode() {
|
||||
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken();
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("path","pages/flash/index?user_id="+getLoginUserId());
|
||||
map.put("path","/package/user/qrcode?user_id="+getLoginUserId());
|
||||
// map.put("env_version","trial");
|
||||
// 获取图片 Buffer
|
||||
byte[] qrCode = HttpRequest.post(apiUrl)
|
||||
@@ -321,12 +321,38 @@ public class WxLoginController extends BaseController {
|
||||
String filePath = getUploadDir().concat("qrcode/") + fileName;
|
||||
File file = FileUtil.writeBytes(qrCode, filePath);
|
||||
if(file != null){
|
||||
config.setFileServer("https://file.gxwebsoft.com");
|
||||
return success(config.getFileServer().concat("/qrcode/").concat(fileName));
|
||||
}
|
||||
return fail("获取失败",null);
|
||||
}
|
||||
|
||||
@ApiOperation("获取微信小程序码-订单核销码-数量极多的业务场景")
|
||||
@GetMapping("/getOrderQRCodeUnlimited/{orderNo}")
|
||||
public ApiResult<?> getOrderQRCodeUnlimited(@PathVariable("orderNo") String orderNo) {
|
||||
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + getAccessToken();
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("scene","orderNo=".concat(orderNo));
|
||||
map.put("page","package/admin/order-scan");
|
||||
map.put("env_version","trial");
|
||||
// 获取图片 Buffer
|
||||
byte[] qrCode = HttpRequest.post(apiUrl)
|
||||
.body(JSON.toJSONString(map))
|
||||
.execute().bodyBytes();
|
||||
System.out.println("qrCode = " + qrCode);
|
||||
|
||||
// 保存的文件名称
|
||||
final String fileName = CommonUtil.randomUUID8().concat(".png");
|
||||
// 保存路径
|
||||
String filePath = getUploadDir().concat("qrcode/") + fileName;
|
||||
File file = FileUtil.writeBytes(qrCode, filePath);
|
||||
if(file != null){
|
||||
return success(config.getFileServer().concat("/qrcode/").concat(fileName));
|
||||
}
|
||||
return fail("获取失败",null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传位置(服务器)
|
||||
*/
|
||||
|
||||
@@ -88,7 +88,7 @@ config:
|
||||
swagger-version: 1.0
|
||||
token-key: WLgNsWJ8rPjRtnjzX/Gx2RGS80Kwnm/ZeLbvIL+NrBs=
|
||||
server-url: https://server.gxwebsoft.com/api
|
||||
file-server: https://file.wsdns.cn
|
||||
file-server: https://file.gxwebsoft.com
|
||||
upload-path: /Users/gxwebsoft/Documents/uploads/
|
||||
local-upload-path: /Users/gxwebsoft/Documents/uploads/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user