Jelajahi Sumber

推送模板接口 管理員可推送所有账户

yumeng 4 tahun lalu
induk
melakukan
ee9ed1bc9a

+ 4 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -137,13 +137,11 @@ public class UserAllocationController {
         try {
 
             QueryWrapper<UserAllocation> queryWrapper = new QueryWrapper<>();
-            queryWrapper.eq("user_id", userId);
             queryWrapper.eq("project_id", projectId);
-           /*  Project project = projectService.getById(projectId);
-                if (!Check.isNull(project)) {
-                queryWrapper.eq("media_id", project.getMediaId());
-            }*/
-
+            String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+            if (!CtopRoleCodeConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
+                queryWrapper.eq("user_id", userId);
+            }
             List<UserAllocation> userAllocations = userAllocationMapper.selectList(queryWrapper);
             result.setSuccess(true);
             result.setResult(userAllocations);

+ 13 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/controller/KuaiShouCreateController.java

@@ -3,6 +3,8 @@ package cn.com.ctop.kuaishou.modules.ai.controller;
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
 import cn.com.ctop.common.module.utils.Check;
+import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import com.alibaba.fastjson.JSONObject;
 import io.swagger.annotations.Api;
@@ -24,6 +26,8 @@ public class KuaiShouCreateController {
     private ICtopOauthTokenService tokenService;
     @Autowired
     private IKuaishouInterfaceService iKuaishouInterfaceService;
+    @Autowired
+    private IKuaiShouCampaignService campaignService;
 
     /**
      * 创建计划
@@ -56,11 +60,18 @@ public class KuaiShouCreateController {
             if (code != 0) {
                 throw new Exception((String) campaignMap.get("message"));
             }
+            Long campaignId = (Long) campaignMap.get("campaignId");
+
+
             result.put("code", 0);
             result.put("message", "SUCCESS");
             JSONObject data = new JSONObject();
-            data.put("campaign_id", campaignMap.get("campaignId"));
-            data.put("account_id", requestJson.getLong("account_id"));
+            data.put("campaign_id", campaignId);
+            data.put("account_id", accountId);
+            KuaiShouCampaign campaign = campaignService.getCampaignByAccountAndCampaign(accountId, campaignId);
+            if (!Check.isNull(campaign)) {
+                data.put("campaign_create_time", campaign.getPutCreateTime());
+            }
             result.put("data", data);
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaiShouCampaignService.java

@@ -19,4 +19,6 @@ public interface IKuaiShouCampaignService extends IService<KuaiShouCampaign> {
     List<JSONArray> getJsonArrByAccount(Long accountId, int idSize);
 
     JSONArray queryCampaignIdByAccountId(Long accountId);
+
+    KuaiShouCampaign getCampaignByAccountAndCampaign(Long accountId, Long campaignId);
 }

+ 11 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouCampaignServiceImpl.java

@@ -30,7 +30,6 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
     }
 
 
-
     /**
      * 获取创意
      *
@@ -66,4 +65,15 @@ public class KuaiShouCampaignServiceImpl extends ServiceImpl<KuaiShouCampaignMap
         return campaignMapper.queryCampaignIdByAccountId(accountId);
     }
 
+    @Override
+    public KuaiShouCampaign getCampaignByAccountAndCampaign(Long accountId, Long campaignId) {
+        QueryWrapper<KuaiShouCampaign> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("account_id", accountId);
+        queryWrapper.eq("campaign_id", campaignId);
+        queryWrapper.orderByDesc("create_time");
+        queryWrapper.last("limit 1");
+        KuaiShouCampaign campaign = campaignMapper.selectOne(queryWrapper);
+        return campaign;
+    }
+
 }

+ 2 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -959,19 +959,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     returnMap.put("campaignId", campaignId);
                     returnMap.put("success", true);
                     // 创建成功 拉取广告组信息
+                    Thread.sleep(100);
+                    getCampaign(accessToken, advertiserId, campaignId);
 
-                    Thread thread = new Thread() {
-                        @Override
-                        public void run() {
-                            try {
-                                Thread.sleep(500);
-                            } catch (InterruptedException e) {
-                                e.printStackTrace();
-                            }
-                            getCampaign(accessToken, advertiserId, campaignId);
-                        }
-                    };
-                    thread.start();
 
                 } else {
                     log.error("创建广告计划失败,advertiser_id:{},返回信息:{}", advertiserId, resultJson);