|
@@ -25,6 +25,7 @@ import com.github.zuihou.business.spe.service.SpeService;
|
|
|
import com.github.zuihou.business.util.CommonUtil;
|
|
|
import com.github.zuihou.business.wxpay.CipherDto;
|
|
|
import com.github.zuihou.cfg.WxPayCfg;
|
|
|
+import com.github.zuihou.common.util.StringUtil;
|
|
|
import com.github.zuihou.context.BaseContextHandler;
|
|
|
import com.github.zuihou.database.mybatis.conditions.Wraps;
|
|
|
import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
|
|
@@ -148,24 +149,47 @@ public class AndroidApi {
|
|
|
|
|
|
// 小程序码
|
|
|
Object accessToken = redisTemplate.opsForValue().get("access_token");
|
|
|
+ if (null != accessToken) {
|
|
|
+ System.out.println("从redis里获取小程序token==" + accessToken.toString());
|
|
|
+ token = accessToken.toString();
|
|
|
|
|
|
- if (accessToken == null) {
|
|
|
-
|
|
|
- token = goodsService.getToken(accessTokenUrl, appId, secret);
|
|
|
- redisTemplate.opsForValue().set("access_token", token, 7000, TimeUnit.SECONDS);
|
|
|
} else {
|
|
|
- token = (String) accessToken;
|
|
|
- }
|
|
|
+ System.out.println("从redis里获取小程序token失败,准备从接口获取");
|
|
|
+ token = goodsService.getToken(accessTokenUrl, appId, secret);
|
|
|
+ if (StringUtil.isNotEmpty(token)) {
|
|
|
+ System.out.println("通过接口获取小程序token==" + token);
|
|
|
+ redisTemplate.opsForValue().set("access_token", token, 7000, TimeUnit.SECONDS);
|
|
|
+ } else {
|
|
|
+ return R.fail("生成小程序码失败");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
+ }
|
|
|
+//
|
|
|
+//
|
|
|
+// if (accessToken == null && accessToken.equals("")) {
|
|
|
+//
|
|
|
+// token = goodsService.getToken(accessTokenUrl, appId, secret);
|
|
|
+// if (StringUtil.isNotEmpty(token)) {
|
|
|
+// redisTemplate.opsForValue().set("access_token", token, 7000, TimeUnit.SECONDS);
|
|
|
+// } else {
|
|
|
+// return R.fail("生成小程序码失败");
|
|
|
+// }
|
|
|
+//
|
|
|
+// } else {
|
|
|
+// token = (String) accessToken;
|
|
|
+// }
|
|
|
+
|
|
|
+ System.out.println("开始生成" + System.currentTimeMillis());
|
|
|
String qrCode = goodsService.getQrCode(response, token, preOrder.getId());
|
|
|
+ System.out.println("开始生成1" + System.currentTimeMillis());
|
|
|
|
|
|
HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
resultMap.put("orderId", preOrder.getId());
|
|
|
// resultMap.put("productCfg", productConfig);
|
|
|
+
|
|
|
resultMap.put("qrCode", qrCode);
|
|
|
System.out.println("安卓端下单返回orderId=" + preOrder.getId());
|
|
|
-
|
|
|
return R.success(resultMap);
|
|
|
}
|
|
|
|