|
@@ -1,11 +1,8 @@
|
|
|
package org.jeecg.modules.adweb.dmp.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
-
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.constant.CommonConstant;
|
|
@@ -34,11 +31,16 @@ import java.util.Objects;
|
|
|
@RequestMapping("/gtm")
|
|
|
@Slf4j
|
|
|
public class GTMController {
|
|
|
- @Autowired private IAdwebSiteService adwebSiteService;
|
|
|
- @Autowired private IGoogleGTMService googleGTMService;
|
|
|
- @Autowired private GTMAdminService gtmAdminService;
|
|
|
-
|
|
|
- /** 获取站点绑定的GTM snippets */
|
|
|
+ @Autowired
|
|
|
+ private IAdwebSiteService adwebSiteService;
|
|
|
+ @Autowired
|
|
|
+ private IGoogleGTMService googleGTMService;
|
|
|
+ @Autowired
|
|
|
+ private GTMAdminService gtmAdminService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取站点绑定的GTM snippets
|
|
|
+ */
|
|
|
@RequestMapping(value = "/get", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
public Result<AdwebSite> getGTMSnippets(String siteCode) {
|
|
@@ -59,7 +61,9 @@ public class GTMController {
|
|
|
return Result.ok(adwebSite);
|
|
|
}
|
|
|
|
|
|
- /** 为站点添加GTM snippets */
|
|
|
+ /**
|
|
|
+ * 为站点添加GTM snippets
|
|
|
+ */
|
|
|
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
|
public Result<AdwebSite> addGTMSnippets(String siteCode, String gaAccountId) {
|
|
@@ -80,15 +84,14 @@ public class GTMController {
|
|
|
return Result.ok(adwebSite);
|
|
|
}
|
|
|
|
|
|
- /** 获取所有可用的GA帐号 */
|
|
|
+ /**
|
|
|
+ * 获取所有可用的GA帐号
|
|
|
+ */
|
|
|
@RequestMapping(value = "/listGAAccounts", method = RequestMethod.GET)
|
|
|
@ResponseBody
|
|
|
- public Result<List<Pair<String, String>>> listGAAccounts() {
|
|
|
+ public Result<List<GAAccountDTO>> listGAAccounts() {
|
|
|
List<GAAccountDTO> gaAccounts = gtmAdminService.listGAAccounts();
|
|
|
|
|
|
- return Result.ok(
|
|
|
- gaAccounts.stream()
|
|
|
- .map(gaAccount -> Pair.of(gaAccount.getDisplayName(), gaAccount.getId()))
|
|
|
- .toList());
|
|
|
+ return Result.ok(gaAccounts);
|
|
|
}
|
|
|
}
|