master
kira 6 years ago
commit 6bf31521bf

@ -120,9 +120,9 @@ public interface RetailAppService {
void useCoupon(JSONObject device, String coupon_log_id); 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); JSONObject getCheckClientInfo(JSONObject device);

@ -1770,23 +1770,34 @@ public class RetailAppServiceImp implements RetailAppService {
} }
@Override @Override
public JSONObject getAd(JSONObject device) { public JSONObject getAd() {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject res = royalPayCMSSupport.listArticles("app_ad", false, true, 1, 10); JSONObject res = royalPayCMSSupport.listArticles("app_ad", false, true, 1, 10);
JSONArray acts = res.getJSONArray("data"); JSONArray acts = res.getJSONArray("data");
if (acts.size() > 0) { if (acts.size() > 0) {
int selectNo = RandomUtils.nextInt(0, acts.size()); 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", 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"));
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");
getActs.remove("summery");
getActs.remove("publish_time");
return getActs;
} }
return null; return null;
} }
@Override @Override
public JSONObject getAdDetail(JSONObject device, String article_id) { public JSONObject getAdDetail(String article_id) {
String clientType = device.getString("client_type");
deviceSupport.findRegister(clientType);
JSONObject res = royalPayCMSSupport.getArticle("app_ad", article_id); JSONObject res = royalPayCMSSupport.getArticle("app_ad", article_id);
Document doc = Jsoup.parse(res.getString("content")); Document doc = Jsoup.parse(res.getString("content"));
String father = "<div style=\"padding:0 10px\"></div>"; String father = "<div style=\"padding:0 10px\"></div>";

@ -395,19 +395,6 @@ public class RetailAppController {
} }
/* 优惠券End */ /* 优惠券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) @RequestMapping(value = "/bills/{bill_id}", method = RequestMethod.GET)
public JSONObject getBill(@PathVariable("bill_id") String bill_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) { public JSONObject getBill(@PathVariable("bill_id") String bill_id, @ModelAttribute(CommonConsts.RETAIL_DEVICE) JSONObject device) {
return billService.getBillDetail(bill_id, device.getIntValue("client_id")); return billService.getBillDetail(bill_id, device.getIntValue("client_id"));

@ -1,7 +1,9 @@
package au.com.royalpay.payment.manage.appclient.web; package au.com.royalpay.payment.manage.appclient.web;
import au.com.royalpay.payment.manage.appclient.beans.RetailLoginInfo; 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.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.device.DeviceSupport;
import au.com.royalpay.payment.tools.exceptions.BadRequestException; import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils; import au.com.royalpay.payment.tools.http.HttpUtils;
@ -32,6 +34,8 @@ public class RetailValidationController {
private SignInStatusManager signInStatusManager; private SignInStatusManager signInStatusManager;
@Resource @Resource
private DeviceSupport deviceSupport; private DeviceSupport deviceSupport;
@Resource
private RetailAppService retailAppService;
@RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST) @RequestMapping(value = "/devices/{devType}/register", method = RequestMethod.POST)
public JSONObject register(@RequestBody String registeration, @PathVariable String devType) { public JSONObject register(@RequestBody String registeration, @PathVariable String devType) {
@ -91,4 +95,17 @@ public class RetailValidationController {
} }
return res; 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);
}
} }

@ -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) { app.controller('cmsAddArticleCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', function ($scope, $http, $state, $stateParams, commonDialog) {
$scope.saveArticle = function () { $scope.saveArticle = function () {
$scope.article.reference =$scope.reference;
$http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) { $http.post('/app/cms/categories/' + $stateParams.catId + '/articles', $scope.article).then(function (resp) {
$state.go('^.article_view', {articleId: resp.data.article_id}); $state.go('^.article_view', {articleId: resp.data.article_id});
}, function (resp) { }, 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) { app.controller('cmsArticleEditCtrl', ['$scope', '$http', '$state', '$stateParams', 'commonDialog', 'article', function ($scope, $http, $state, $stateParams, commonDialog, article) {
$scope.article = article.data; $scope.article = article.data;
$scope.reference = JSON.parse($scope.article.reference);
$scope.saveArticle = function () { $scope.saveArticle = function () {
$scope.article.reference =$scope.reference;
$http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) { $http.put('/app/cms/categories/' + $stateParams.catId + '/articles/' + $stateParams.articleId, $scope.article).then(function (resp) {
$state.go('^.article_view', {articleId: $stateParams.articleId}); $state.go('^.article_view', {articleId: $stateParams.articleId});
}, function (resp) { }, function (resp) {

@ -20,7 +20,7 @@
<label class="col-md-2 control-label" for="kw-input">HTML Keywords</label> <label class="col-md-2 control-label" for="kw-input">HTML Keywords</label>
<div class="col-md-10"> <div class="col-md-10">
<input ng-model="article.page_keywords" type="text" name="title" id="kw-input" class="form-control"> <input ng-model="article.page_keywords" type="text" name="title" id="kw-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(重要0不允许跳转 1跳转编辑内容 2跳转到外链)</p> <p ng-if="catId=='app_ad'"class="small text-warning">(重要0不允许跳转 1跳转到外链)</p>
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
@ -40,7 +40,27 @@
<p ng-if="catId=='app_ad'"class="small text-warning">(若有外链,则填,否则留空)</p> <p ng-if="catId=='app_ad'"class="small text-warning">(若有外链,则填,否则留空)</p>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Type</label>
<div class="col-md-10">
<input ng-model="reference.ad_type" type="text" name="title" id="type-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(广告封面 type=0时 为图片地址 type=1时 为视频地址)</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Mode</label>
<div class="col-md-10">
<input ng-model="reference.expire_date" type="text" name="title" id="expire_date-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(广告过期时间 格式为: 2018/10/01 00:00:00)</p>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label" for="kw-input">Duration time</label>
<div class="col-md-10">
<input ng-model="reference.duration_time" type="text" name="title" id="duration_time-input" class="form-control">
<p ng-if="catId=='app_ad'"class="small text-warning">(广告展示时间(s))</p>
</div>
</div>
</form> </form>
<div class="form-group"> <div class="form-group">
<label class="control-label">Content</label> <label class="control-label">Content</label>

@ -31,7 +31,7 @@
<th>Title</th> <th>Title</th>
<th>Add Time</th> <th>Add Time</th>
<th>Published</th> <th>Published</th>
<th>Recommended</th> <!-- <th>Recommended</th>-->
<th>Operation</th> <th>Operation</th>
</tr> </tr>
</thead> </thead>
@ -44,11 +44,11 @@
<i class="fa" ng-class="{'fa-check text-success':article.publish_status,'fa-remove text-danger':!article.publish_status}"></i> <i class="fa" ng-class="{'fa-check text-success':article.publish_status,'fa-remove text-danger':!article.publish_status}"></i>
</a> </a>
</td> </td>
<td> <!-- <td>
<a role="button" ng-click="toggleArticleRecommended(article)" title="Toggle recommended"> <a role="button" ng-click="toggleArticleRecommended(article)" title="Toggle recommended">
<i class="fa" ng-class="{'fa-check text-success':article.recommended,'fa-remove text-danger':!article.recommended}"></i> <i class="fa" ng-class="{'fa-check text-success':article.recommended,'fa-remove text-danger':!article.recommended}"></i>
</a> </a>
</td> </td>-->
<td> <td>
<a ui-sref=".edit_article({articleId:article.article_id})" title="edit"><i class="fa fa-edit"></i></a> <a ui-sref=".edit_article({articleId:article.article_id})" title="edit"><i class="fa fa-edit"></i></a>
<a ui-sref=".article_view({articleId:article.article_id})" title="preview"><i class="fa fa-eye"></i></a> <a ui-sref=".article_view({articleId:article.article_id})" title="preview"><i class="fa fa-eye"></i></a>

Loading…
Cancel
Save