From dcb96821f905f3fd93c059d8703517bdcac4d336 Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期二, 29 九月 2026 20:02:02 +0800
Subject: [PATCH] 排序问题及门店手机号展示问题
---
cloud-server-other/src/main/java/com/dsh/other/controller/AppGuideController.java | 70 +++++++++++++++++++++++++---------
1 files changed, 51 insertions(+), 19 deletions(-)
diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/AppGuideController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/AppGuideController.java
index 323a539..83af6e9 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/controller/AppGuideController.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/controller/AppGuideController.java
@@ -15,26 +15,36 @@
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
-import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-
-import javax.annotation.Resource;
-import java.util.*;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
/** 对外下载引导页与 App 扫码解析接口。 */
@RestController
@Api(tags = "APP下载引导与场地二维码")
public class AppGuideController {
- @Autowired private AppGuideConfigMapper appGuideConfigMapper;
- @Autowired private AppGuideBannerMapper appGuideBannerMapper;
- @Autowired private QrLinkMapper qrLinkMapper;
- @Autowired private TokenUtil tokenUtil;
+ @Autowired
+ private AppGuideConfigMapper appGuideConfigMapper;
+
+ @Autowired
+ private AppGuideBannerMapper appGuideBannerMapper;
+
+ @Autowired
+ private QrLinkMapper qrLinkMapper;
+
+ @Autowired
+ private TokenUtil tokenUtil;
// @GetMapping("/q/{shortCode}")
// public void guidePage(@PathVariable String shortCode, HttpServletRequest request,
@@ -48,10 +58,16 @@
@ApiOperation("获取下载引导页配置(无需登录)")
public ResultUtil<Map<String, Object>> guideConfig(String code) {
AppGuideConfig config = appGuideConfigMapper.selectOne(new QueryWrapper<AppGuideConfig>()
- .eq("enabled", EnableStatusEnum.ENABLED.getCode()).orderByDesc("updateTime").last("limit 1"));
- if (config == null) return ResultUtil.error("下载引导页尚未配置");
+ .eq("enabled", EnableStatusEnum.ENABLED.getCode())
+ .orderByDesc("updateTime")
+ .last("limit 1"));
+ if (config == null) {
+ return ResultUtil.error("下载引导页尚未配置");
+ }
QrLink link = validLink(code);
- if (code != null && !code.isEmpty() && link == null) return ResultUtil.error("二维码无效或已失效");
+ if (code != null && !code.isEmpty() && link == null) {
+ return ResultUtil.error("二维码无效或已失效");
+ }
Map<String, Object> data = new HashMap<>();
data.put("appName", StringUtils.isNotBlank(config.getAppName()) ? config.getAppName() : "玩湃生活");
data.put("androidPackage", StringUtils.isNotBlank(config.getAndroidPackage()) ? config.getAndroidPackage() : "com.sinata.wepark");
@@ -59,9 +75,11 @@
data.put("iosStoreUrl", config.getIosStoreUrl());
data.put("apkUrl", config.getApkUrl());
data.put("androidDeepLink", config.getAndroidDeepLink() + (StringUtils.isNotBlank(code) ? "?route=" + code : ""));
- data.put("iosDeepLink", config.getIosDeepLink() + (StringUtils.isNotBlank(code) ? "/" + code : ""));
+ data.put("iosDeepLink", "weparklife://app" + (StringUtils.isNotBlank(code) ? "?code=" + code : ""));
data.put("banners", appGuideBannerMapper.selectList(new QueryWrapper<AppGuideBanner>()
- .eq("enabled", EnableStatusEnum.ENABLED.getCode()).orderByAsc("sort").orderByDesc("id")));
+ .eq("enabled", EnableStatusEnum.ENABLED.getCode())
+ .orderByAsc("sort")
+ .orderByDesc("id")));
// if (link != null) data.put("target", target(link));
return ResultUtil.success(data);
}
@@ -70,15 +88,23 @@
@ApiOperation("App扫码解析二维码")
public ResultUtil<Map<String, Object>> resolve(String code) {
QrLink link = validLink(code);
- if (link == null) return ResultUtil.error("二维码无效或已失效");
+ if (link == null) {
+ return ResultUtil.error("二维码无效或已失效");
+ }
return ResultUtil.success(target(link));
}
private QrLink validLink(String code) {
- if (code == null || !code.matches("[A-Za-z0-9]{6,32}")) return null;
- QrLink link = qrLinkMapper.selectOne(new QueryWrapper<QrLink>().eq("shortCode", code).last("limit 1"));
+ if (code == null || !code.matches("[A-Za-z0-9]{6,32}")) {
+ return null;
+ }
+ QrLink link = qrLinkMapper.selectOne(new QueryWrapper<QrLink>()
+ .eq("shortCode", code)
+ .last("limit 1"));
if (link == null || !Integer.valueOf(1).equals(link.getEnabled())
- || (link.getExpiresAt() != null && link.getExpiresAt().before(new Date()))) return null;
+ || (link.getExpiresAt() != null && link.getExpiresAt().before(new Date()))) {
+ return null;
+ }
return link;
}
@@ -92,7 +118,13 @@
}
private Object parseJson(String text) {
- if (text == null || text.trim().isEmpty()) return Collections.emptyMap();
- try { return JSON.parseObject(text); } catch (Exception ignored) { return Collections.emptyMap(); }
+ if (text == null || text.trim().isEmpty()) {
+ return Collections.emptyMap();
+ }
+ try {
+ return JSON.parseObject(text);
+ } catch (Exception ignored) {
+ return Collections.emptyMap();
+ }
}
}
--
Gitblit v1.7.1