zhangqin 1 неделя назад
Родитель
Сommit
b5e7580e6a

+ 14 - 6
fs-ad-new-api/src/main/java/com/fs/app/controller/WeChatController.java

@@ -9,14 +9,12 @@ import com.fs.app.facade.CallbackProcessingFacadeService;
 import com.fs.common.constant.SystemConstant;
 import com.fs.common.result.Result;
 import com.fs.newAdv.domain.AdvMiniConfig;
+import com.fs.newAdv.dto.req.updateNickNameReq;
 import com.fs.newAdv.service.IAdvMiniConfigService;
 import com.fs.wx.miniapp.config.WxMaProperties;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.HashMap;
@@ -67,9 +65,9 @@ public class WeChatController {
                 }
                 Map<String, Object> map = new HashMap<>();
                 Map<String, Object> map2 = new HashMap<>();
-                map2.put("path", "pages/home/productList");
+                map2.put("path", "/pages_ad/index");
                 map2.put("query", "traceId=" + traceId);
-                    map2.put("env_version", "trial");
+                map2.put("env_version", "trial");
                 map.put("jump_wxa", map2);
                 map.put("is_expire", false);
                 HttpResponse execute = HttpRequest.post("https://api.weixin.qq.com/wxa/generatescheme?access_token=" + access_token)
@@ -87,4 +85,14 @@ public class WeChatController {
         }
         return Result.success("");
     }
+
+    /**
+     * 更新用户昵称
+     * @return
+     */
+    @PostMapping("/updateNickName")
+    public Result<String> updateNickName(@RequestBody updateNickNameReq req) {
+        facadeService.updateNickName(req);
+        return Result.success("");
+    }
 }

+ 3 - 0
fs-ad-new-api/src/main/java/com/fs/app/facade/CallbackProcessingFacadeService.java

@@ -2,6 +2,7 @@ package com.fs.app.facade;
 
 import com.fs.newAdv.dto.req.QwExternalIdBindTrackReq;
 import com.fs.newAdv.dto.req.WeChatLandingIndexReq;
+import com.fs.newAdv.dto.req.updateNickNameReq;
 import com.fs.newAdv.dto.res.LandingIndexRes;
 
 import java.util.Map;
@@ -30,4 +31,6 @@ public interface CallbackProcessingFacadeService {
     LandingIndexRes getWxLandingIndexBySiteId(WeChatLandingIndexReq req);
 
     void qwExternalIdBindTrack(QwExternalIdBindTrackReq req);
+
+    void updateNickName(updateNickNameReq req);
 }

+ 15 - 3
fs-ad-new-api/src/main/java/com/fs/app/facade/CallbackProcessingFacadeServiceImpl.java

@@ -7,7 +7,6 @@ import cn.hutool.json.JSONArray;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.fs.common.exception.base.BusinessException;
 import com.fs.common.utils.RedisUtil;
 import com.fs.common.utils.SnowflakeUtil;
 import com.fs.newAdv.domain.LandingPageTemplate;
@@ -15,6 +14,7 @@ import com.fs.newAdv.domain.Lead;
 import com.fs.newAdv.domain.Site;
 import com.fs.newAdv.dto.req.QwExternalIdBindTrackReq;
 import com.fs.newAdv.dto.req.WeChatLandingIndexReq;
+import com.fs.newAdv.dto.req.updateNickNameReq;
 import com.fs.newAdv.dto.res.LandingIndexRes;
 import com.fs.newAdv.enums.AdvertiserTypeEnum;
 import com.fs.newAdv.integration.adapter.IAdvertiserAdapter;
@@ -112,7 +112,7 @@ public class CallbackProcessingFacadeServiceImpl implements CallbackProcessingFa
                 clickId = "ylrz_test";
         }
         if (StrUtil.isEmpty(clickId)) {
-            clickId = "ylrz_test"+ IdUtil.randomUUID();
+            clickId = "ylrz_test" + IdUtil.randomUUID();
         }
 
         return clickId;
@@ -120,7 +120,7 @@ public class CallbackProcessingFacadeServiceImpl implements CallbackProcessingFa
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public LandingIndexRes getLandingIndexBySiteId(String viewUrl,Map<String, String> allParams) {
+    public LandingIndexRes getLandingIndexBySiteId(String viewUrl, Map<String, String> allParams) {
         // 站点信息
         String paramsSiteId = allParams.get("siteId");
         if (ObjectUtil.isEmpty(paramsSiteId)) {
@@ -304,4 +304,16 @@ public class CallbackProcessingFacadeServiceImpl implements CallbackProcessingFa
         // 广告线索处理
         leadService.updateAddMemberLead(req.getQwExternalId(), req.getUnionid());
     }
+
+    @Override
+    public void updateNickName(updateNickNameReq req) {
+        Lead byTraceId = leadService.getByTraceId(req.getTraceId());
+        if (ObjectUtil.isEmpty(byTraceId)) {
+            log.error("更新昵称失败,未找到线索:{}", req);
+        }
+        Lead update = new Lead();
+        update.setId(byTraceId.getId());
+        update.setWeiChatName(req.getNickName());
+        leadService.updateById(update);
+    }
 }

+ 1 - 1
fs-ad-new-api/src/main/resources/application.yml

@@ -4,7 +4,7 @@ server:
 # Spring配置
 spring:
   profiles:
-    active: dev
+    active: druid-ylrz
 #    active: druid-ylrz
 
 #

+ 12 - 0
fs-service/src/main/java/com/fs/newAdv/dto/req/updateNickNameReq.java

@@ -0,0 +1,12 @@
+package com.fs.newAdv.dto.req;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class updateNickNameReq implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private String nickName;
+    private String traceId;
+}