From 94c1d0649733adc0eaabae3fe19942026362898a Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 11 Sep 2018 20:11:12 +0800 Subject: [PATCH] fix asd --- .../manage/appclient/core/RetailAppService.java | 4 ++-- .../core/impls/RetailAppServiceImp.java | 9 ++------- .../appclient/web/RetailAppController.java | 13 ------------- .../web/RetailValidationController.java | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java index b0138c63c..4a76e15e6 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/RetailAppService.java @@ -120,9 +120,9 @@ public interface RetailAppService { void useCoupon(JSONObject device, String coupon_log_id); - JSONObject getAd(JSONObject device); + JSONObject getAd(); - JSONObject getAdDetail(JSONObject device, String article_id); + JSONObject getAdDetail(String article_id); JSONObject getCheckClientInfo(JSONObject device); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 4227c5cdc..2fdb163d8 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -1765,13 +1765,10 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public JSONObject getAd(JSONObject device) { - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); + public JSONObject getAd() { JSONObject res = royalPayCMSSupport.listArticles("app_ad", false, true, 1, 10); JSONArray acts = res.getJSONArray("data"); if (acts.size() > 0) { - int selectNo = RandomUtils.nextInt(0, acts.size()); JSONObject getActs = acts.getJSONObject(selectNo); getActs.put("ad_cover", getActs.getString("page_desc")); @@ -1793,9 +1790,7 @@ public class RetailAppServiceImp implements RetailAppService { } @Override - public JSONObject getAdDetail(JSONObject device, String article_id) { - String clientType = device.getString("client_type"); - deviceSupport.findRegister(clientType); + public JSONObject getAdDetail(String article_id) { JSONObject res = royalPayCMSSupport.getArticle("app_ad", article_id); Document doc = Jsoup.parse(res.getString("content")); String father = "
"; diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java index 003e7b8ca..ac2e2f325 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailAppController.java @@ -395,19 +395,6 @@ public class RetailAppController { } /* 优惠券End */ - /** - * 广告位 - */ - @RequestMapping(value = "/ads", method = RequestMethod.GET) - public JSONObject getAd(@ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getAd(device); - } - - @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) - public JSONObject getAdDetail(@PathVariable String article_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { - return retailAppService.getAdDetail(device, article_id); - } - @RequestMapping(value = "/bills/{bill_id}", method = RequestMethod.GET) public JSONObject getBill(@PathVariable("bill_id") String bill_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { return billService.getBillDetail(bill_id, device.getIntValue("client_id")); diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java index d00114502..5194f557a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/web/RetailValidationController.java @@ -1,7 +1,9 @@ package au.com.royalpay.payment.manage.appclient.web; import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo; +import au.com.royalpay.payment.manage.appclient.core.RetailAppService; import au.com.royalpay.payment.manage.signin.core.SignInStatusManager; +import au.com.royalpay.payment.tools.CommonConsts; import au.com.royalpay.payment.tools.device.DeviceSupport; import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.http.HttpUtils; @@ -32,6 +34,8 @@ public class RetailValidationController { private SignInStatusManager signInStatusManager; @Resource private DeviceSupport deviceSupport; + @Resource + private RetailAppService retailAppService; @RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST) public JSONObject register(@RequestBody String registeration, @PathVariable String devType) { @@ -91,4 +95,17 @@ public class RetailValidationController { } return res; } + + /** + * 广告位 + */ + @RequestMapping(value = "/ads", method = RequestMethod.GET) + public JSONObject getAd() { + return retailAppService.getAd(); + } + + @RequestMapping(value = "/ads/{article_id}", method = RequestMethod.GET) + public JSONObject getAdDetail(@PathVariable String article_id) { + return retailAppService.getAdDetail( article_id); + } }