From efd2185622c6c27d67569e01112504468c5d738c Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 11 Sep 2018 18:44:06 +0800 Subject: [PATCH 1/6] add asd --- .../core/impls/RetailAppServiceImp.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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 f8f3a01a9..4227c5cdc 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 @@ -1771,8 +1771,22 @@ public class RetailAppServiceImp implements RetailAppService { 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()); - return acts.getJSONObject(selectNo); + JSONObject getActs = acts.getJSONObject(selectNo); + getActs.put("ad_cover", getActs.getString("page_desc")); + getActs.put("ad_mode", getActs.getString("page_keywords")); + getActs.put("ad_link", getActs.getString("summery")); + getActs.put("publish_date", getActs.getString("publish_time")); + getActs.put("ad_type", (getActs.getJSONObject("reference")).getString("ad_type")); + getActs.put("expire_date", (getActs.getJSONObject("reference")).getString("expire_date")); + getActs.put("duration_time", (getActs.getJSONObject("reference")).getString("duration_time")); + getActs.remove("reference"); + getActs.remove("page_desc"); + getActs.remove("page_keywords"); + getActs.remove("summery"); + getActs.remove("publish_time"); + return getActs; } return null; From 94c1d0649733adc0eaabae3fe19942026362898a Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 11 Sep 2018 20:11:12 +0800 Subject: [PATCH 2/6] 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); + } } From 9d05bcd948402bf2c0d2c3ac3a45a84874085ff1 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 11 Sep 2018 20:26:23 +0800 Subject: [PATCH 3/6] fix asd --- .../manage/appclient/core/impls/RetailAppServiceImp.java | 3 +++ 1 file changed, 3 insertions(+) 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 2fdb163d8..a2511d5df 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 @@ -1767,6 +1767,9 @@ public class RetailAppServiceImp implements RetailAppService { @Override public JSONObject getAd() { JSONObject res = royalPayCMSSupport.listArticles("app_ad", false, true, 1, 10); + logger.debug("ddddddddddddddddasda " + res.toJSONString()); + System.out.println("ddddddddddddddddasda " + res.toJSONString()); + JSONArray acts = res.getJSONArray("data"); if (acts.size() > 0) { int selectNo = RandomUtils.nextInt(0, acts.size()); From 01dcc58ccb6ad65ad430a75fbc3c7a2b5f0b2e27 Mon Sep 17 00:00:00 2001 From: luoyang Date: Tue, 11 Sep 2018 20:58:41 +0800 Subject: [PATCH 4/6] fix asd --- .../appclient/core/impls/RetailAppServiceImp.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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 a2511d5df..904b60c3a 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 @@ -1767,9 +1767,6 @@ public class RetailAppServiceImp implements RetailAppService { @Override public JSONObject getAd() { JSONObject res = royalPayCMSSupport.listArticles("app_ad", false, true, 1, 10); - logger.debug("ddddddddddddddddasda " + res.toJSONString()); - System.out.println("ddddddddddddddddasda " + res.toJSONString()); - JSONArray acts = res.getJSONArray("data"); if (acts.size() > 0) { int selectNo = RandomUtils.nextInt(0, acts.size()); @@ -1778,9 +1775,11 @@ public class RetailAppServiceImp implements RetailAppService { getActs.put("ad_mode", getActs.getString("page_keywords")); getActs.put("ad_link", getActs.getString("summery")); getActs.put("publish_date", getActs.getString("publish_time")); - getActs.put("ad_type", (getActs.getJSONObject("reference")).getString("ad_type")); - getActs.put("expire_date", (getActs.getJSONObject("reference")).getString("expire_date")); - getActs.put("duration_time", (getActs.getJSONObject("reference")).getString("duration_time")); + String reference = getActs.getString("reference"); + JSONObject referenceObj = JSONObject.parseObject(reference); + getActs.put("ad_type", referenceObj.getString("ad_type")); + getActs.put("expire_date", referenceObj.getString("expire_date")); + getActs.put("duration_time", referenceObj.getString("duration_time")); getActs.remove("reference"); getActs.remove("page_desc"); getActs.remove("page_keywords"); From 823fe881a8c59917da28877fcef41c919bd66e8c Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 12 Sep 2018 09:41:15 +0800 Subject: [PATCH 5/6] fix asd --- .../manage/appclient/core/impls/RetailAppServiceImp.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 904b60c3a..8245ab78b 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 @@ -1774,7 +1774,7 @@ public class RetailAppServiceImp implements RetailAppService { getActs.put("ad_cover", getActs.getString("page_desc")); getActs.put("ad_mode", getActs.getString("page_keywords")); getActs.put("ad_link", getActs.getString("summery")); - getActs.put("publish_date", getActs.getString("publish_time")); + getActs.put("publish_date", DateFormatUtils.format(getActs.getDate("publish_time"),"yyyy/MM/dd HH:mm:ss")); String reference = getActs.getString("reference"); JSONObject referenceObj = JSONObject.parseObject(reference); getActs.put("ad_type", referenceObj.getString("ad_type")); From 1af0a9890ee2b30ac14f234e56f6aa898bbd8543 Mon Sep 17 00:00:00 2001 From: luoyang Date: Wed, 12 Sep 2018 13:57:07 +0800 Subject: [PATCH 6/6] add cms reference --- src/main/ui/static/cms/cms.js | 4 ++++ .../static/cms/templates/article_editor.html | 24 +++++++++++++++++-- .../ui/static/cms/templates/articles.html | 6 ++--- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/main/ui/static/cms/cms.js b/src/main/ui/static/cms/cms.js index 2c6363284..09a9e5eae 100644 --- a/src/main/ui/static/cms/cms.js +++ b/src/main/ui/static/cms/cms.js @@ -109,6 +109,7 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) { $scope.saveArticle = function () { + $scope.article.reference =$scope.reference; $http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) { $state.go('^.article_view', {articleId: resp.data.article_id}); }, function (resp) { @@ -119,7 +120,10 @@ define(['angular', 'uiRouter', 'static/commons/angular-ueditor'], function (angu app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) { $scope.article = article.data; + $scope.reference = JSON.parse($scope.article.reference); + $scope.saveArticle = function () { + $scope.article.reference =$scope.reference; $http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) { $state.go('^.article_view', {articleId: $stateParams.articleId}); }, function (resp) { diff --git a/src/main/ui/static/cms/templates/article_editor.html b/src/main/ui/static/cms/templates/article_editor.html index 0ead12acb..7c9cd1bf5 100644 --- a/src/main/ui/static/cms/templates/article_editor.html +++ b/src/main/ui/static/cms/templates/article_editor.html @@ -20,7 +20,7 @@
-

(重要!!!0:不允许跳转 1:跳转编辑内容 2:跳转到外链)

+

(重要!!!0:不允许跳转 1:跳转到外链)

@@ -40,7 +40,27 @@

(若有外链,则填,否则留空)

- +
+ +
+ +

(广告封面 type=0时 为图片地址 type=1时 为视频地址)

+
+
+
+ +
+ +

(广告过期时间 格式为: 2018/10/01 00:00:00)

+
+
+
+ +
+ +

(广告展示时间(s))

+
+
diff --git a/src/main/ui/static/cms/templates/articles.html b/src/main/ui/static/cms/templates/articles.html index bb4489ce7..046393f0a 100644 --- a/src/main/ui/static/cms/templates/articles.html +++ b/src/main/ui/static/cms/templates/articles.html @@ -31,7 +31,7 @@ Title Add Time Published - Recommended + Operation @@ -44,11 +44,11 @@ - +