TRX 1 سال پیش
والد
کامیت
68eea52136

+ 0 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/config/ProjectUserConfigController.java

@@ -4,7 +4,6 @@ import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.net.ResultContent;
 import com.zhongshu.card.client.model.config.ProjectUserConfigParam;
-import com.zhongshu.card.server.core.service.config.CommonConfigService;
 import com.zhongshu.card.server.core.service.config.ProjectUserConfigService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -25,9 +24,6 @@ import javax.validation.Valid;
 @Tag(name = "项目用户配置")
 public class ProjectUserConfigController {
 
-    @Autowired
-    private CommonConfigService commonConfigService;
-
     @Autowired
     private ProjectUserConfigService projectUserConfigService;
 

+ 15 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/config/ProjectUserConfigService.java

@@ -24,6 +24,12 @@ public class ProjectUserConfigService extends SuperService {
     @Autowired
     private ProjectUserConfigDao projectUserConfigDao;
 
+    /**
+     * 保存小程序用户配置
+     *
+     * @param param
+     * @return
+     */
     public ResultContent xcxSaveUserConfig(ProjectUserConfigParam param) {
         if (StringUtils.isEmpty(param.getUserId())) {
             param.setUserId(getCurrentUserId());
@@ -56,6 +62,12 @@ public class ProjectUserConfigService extends SuperService {
         return ResultContent.buildSuccess();
     }
 
+    /**
+     * 得到小程序配置 (主要是从header得到当前用户、项目oid信息)
+     *
+     * @param param
+     * @return
+     */
     public ResultContent<ProjectUserConfigModel> xcxGetUserConfig(ProjectUserConfigParam param) {
         if (StringUtils.isEmpty(param.getUserId())) {
             param.setUserId(getCurrentUserId());
@@ -79,6 +91,9 @@ public class ProjectUserConfigService extends SuperService {
         ProjectUserConfig entity = projectUserConfigDao.findTopByProjectOidAndUserIdAndKey(param.getProjectOid(), param.getUserId(), param.getKey());
         ProjectUserConfigModel model = toModel(entity);
         if (StringUtils.isEmpty(model.getKey())) {
+            if (ObjectUtils.isEmpty(model)) {
+                model = new ProjectUserConfigModel();
+            }
             model.setKey(param.getKey());
         }
         return ResultContent.buildSuccess(model);