|
@@ -1,48 +1,48 @@
|
|
|
-package com.cdf.controller.api;
|
|
|
-
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.cdf.common.ResultData;
|
|
|
-import com.cdf.httpClient.client.CdfClient;
|
|
|
-import com.cdf.httpClient.request.CdfInCatRequest;
|
|
|
-import com.cdf.httpClient.response.cdf.CdfProductVo;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.web.bind.annotation.*;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-
|
|
|
-@RestController
|
|
|
-@RequestMapping("/api")
|
|
|
-public class CdfProductApiController {
|
|
|
-
|
|
|
- @Resource
|
|
|
- private CdfClient cdfClient;
|
|
|
-
|
|
|
- @GetMapping("/getCatNum")
|
|
|
- public ResultData getCatNum(@RequestParam(required = false) String AccessToken){
|
|
|
- JSONObject catNum = cdfClient.getCatNum(AccessToken);
|
|
|
- return ResultData.ok(catNum);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/inCat")
|
|
|
- public ResultData inCat(@RequestParam(required = false) String AccessToken,
|
|
|
- @RequestParam(required = false) String skuId,
|
|
|
- @RequestParam(required = false) Integer num){
|
|
|
- JSONObject jsonObject = cdfClient.inCat(AccessToken, new CdfInCatRequest(skuId, num));
|
|
|
- if(jsonObject.get("success")!=null && !jsonObject.getBoolean("success")){
|
|
|
- return ResultData.error(jsonObject.getString("msg"));
|
|
|
- }
|
|
|
- if(jsonObject.get("status")!=null ){
|
|
|
- return ResultData.error(401,jsonObject.getString("msg"));
|
|
|
- }
|
|
|
- return ResultData.ok(jsonObject);
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/getProductInfo")
|
|
|
- public ResultData getProductInfo(@RequestParam(required = false) String productId){
|
|
|
- if(StringUtils.isBlank(productId)){
|
|
|
- return ResultData.ok();
|
|
|
- }
|
|
|
- CdfProductVo productById = cdfClient.getProductById(productId);
|
|
|
- return ResultData.ok(productById);
|
|
|
- }
|
|
|
-}
|
|
|
+//package com.cdf.controller.api;
|
|
|
+//
|
|
|
+//import com.alibaba.fastjson.JSONObject;
|
|
|
+//import com.cdf.common.ResultData;
|
|
|
+//import com.cdf.httpClient.client.CdfClient;
|
|
|
+//import com.cdf.httpClient.request.CdfInCatRequest;
|
|
|
+//import com.cdf.httpClient.response.cdf.CdfProductVo;
|
|
|
+//import org.apache.commons.lang3.StringUtils;
|
|
|
+//import org.springframework.web.bind.annotation.*;
|
|
|
+//
|
|
|
+//import javax.annotation.Resource;
|
|
|
+//
|
|
|
+//@RestController
|
|
|
+//@RequestMapping("/api")
|
|
|
+//public class CdfProductApiController {
|
|
|
+//
|
|
|
+// @Resource
|
|
|
+// private CdfClient cdfClient;
|
|
|
+//
|
|
|
+// @GetMapping("/getCatNum")
|
|
|
+// public ResultData getCatNum(@RequestParam(required = false) String AccessToken){
|
|
|
+// JSONObject catNum = cdfClient.getCatNum(AccessToken);
|
|
|
+// return ResultData.ok(catNum);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/inCat")
|
|
|
+// public ResultData inCat(@RequestParam(required = false) String AccessToken,
|
|
|
+// @RequestParam(required = false) String skuId,
|
|
|
+// @RequestParam(required = false) Integer num){
|
|
|
+// JSONObject jsonObject = cdfClient.inCat(AccessToken, new CdfInCatRequest(skuId, num));
|
|
|
+// if(jsonObject.get("success")!=null && !jsonObject.getBoolean("success")){
|
|
|
+// return ResultData.error(jsonObject.getString("msg"));
|
|
|
+// }
|
|
|
+// if(jsonObject.get("status")!=null ){
|
|
|
+// return ResultData.error(401,jsonObject.getString("msg"));
|
|
|
+// }
|
|
|
+// return ResultData.ok(jsonObject);
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/getProductInfo")
|
|
|
+// public ResultData getProductInfo(@RequestParam(required = false) String productId){
|
|
|
+// if(StringUtils.isBlank(productId)){
|
|
|
+// return ResultData.ok();
|
|
|
+// }
|
|
|
+// CdfProductVo productById = cdfClient.getProductById(productId);
|
|
|
+// return ResultData.ok(productById);
|
|
|
+// }
|
|
|
+//}
|