|
@@ -1,44 +1,58 @@
|
|
|
package org.jeecg.modules.adweb.api.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+
|
|
|
import jakarta.annotation.Resource;
|
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
|
+
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.config.shiro.IgnoreAuth;
|
|
|
import org.jeecg.modules.adweb.api.vo.APIRequestVO;
|
|
|
+import org.jeecg.modules.adweb.api.vo.EnquiryPageVO;
|
|
|
import org.jeecg.modules.adweb.api.vo.ProductInfoVO;
|
|
|
import org.jeecg.modules.adweb.common.mapper.CommonMapper;
|
|
|
import org.jeecg.modules.adweb.site.entity.AdwebSite;
|
|
|
import org.jeecg.modules.adweb.site.service.IAdwebSiteService;
|
|
|
-import org.springframework.http.HttpHeaders;
|
|
|
import org.springframework.security.oauth2.server.resource.InvalidBearerTokenException;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
@RestController
|
|
|
-@RequestMapping("/open-api")
|
|
|
+@RequestMapping("/openapi")
|
|
|
@Slf4j
|
|
|
public class OpenAPIController {
|
|
|
|
|
|
+ private static final String BEARER_TOKEN_HEADER = "AdWeb-Authorization";
|
|
|
private static final String STATIC_BEARER_TOKEN = "Bearer uxl9Wpzh65vXNUyDvynJDjBo";
|
|
|
|
|
|
- @Resource
|
|
|
- private CommonMapper commonMapper;
|
|
|
+ @Resource private CommonMapper commonMapper;
|
|
|
|
|
|
- @Resource
|
|
|
- private IAdwebSiteService adwebSiteService;
|
|
|
+ @Resource private IAdwebSiteService adwebSiteService;
|
|
|
|
|
|
+ @IgnoreAuth
|
|
|
@PostMapping("/product/list")
|
|
|
@ResponseBody
|
|
|
- public List<ProductInfoVO> listProducts(
|
|
|
- @RequestHeader(value = HttpHeaders.AUTHORIZATION, required = true) String authToken,
|
|
|
+ public Result<List<ProductInfoVO>> listProducts(
|
|
|
+ @RequestHeader(value = BEARER_TOKEN_HEADER, required = true) String authToken,
|
|
|
+ @RequestParam APIRequestVO apiRequest) {
|
|
|
+ this.validateAuthToken(authToken);
|
|
|
+
|
|
|
+ return Result.ok(Collections.EMPTY_LIST);
|
|
|
+ }
|
|
|
+
|
|
|
+ @IgnoreAuth
|
|
|
+ @PostMapping("/enquiry/list")
|
|
|
+ @ResponseBody
|
|
|
+ public Result<EnquiryPageVO> listEnquires(
|
|
|
+ @RequestHeader(value = BEARER_TOKEN_HEADER, required = true) String authToken,
|
|
|
@RequestParam APIRequestVO apiRequest) {
|
|
|
this.validateAuthToken(authToken);
|
|
|
|
|
|
- return Collections.EMPTY_LIST;
|
|
|
+ return Result.ok(new EnquiryPageVO());
|
|
|
}
|
|
|
|
|
|
@IgnoreAuth
|
|
@@ -51,7 +65,7 @@ public class OpenAPIController {
|
|
|
}
|
|
|
|
|
|
log.info("request from domain: {}", domain);
|
|
|
- //获取站点
|
|
|
+ // 获取站点
|
|
|
QueryWrapper<AdwebSite> adwebSiteQueryWrapper = new QueryWrapper<>();
|
|
|
adwebSiteQueryWrapper.like("domain", domain);
|
|
|
AdwebSite adwebsite = adwebSiteService.getOne(adwebSiteQueryWrapper);
|
|
@@ -70,7 +84,9 @@ public class OpenAPIController {
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
|
|
|
result.put("maxTime", maxTime);
|
|
|
- result.put("wordpress_setting", adwebsite.getWordpressSetting()); // 指定wordpress 传输的产品类型是来自adwebpro还是woocommerce
|
|
|
+ result.put(
|
|
|
+ "wordpress_setting",
|
|
|
+ adwebsite.getWordpressSetting()); // 指定wordpress 传输的产品类型是来自adwebpro还是woocommerce
|
|
|
return Result.ok(result);
|
|
|
}
|
|
|
|