Merge remote-tracking branch 'origin/develop' into develop

master
luoyang 6 years ago
commit 6988fa9d0e

@ -0,0 +1,9 @@
package au.com.royalpay.payment.manage.posters.core;
/**
* create by todking at 2019-6-3
*/
public interface PosterService {
void updatePoster(String imgUrl);
}

@ -0,0 +1,35 @@
package au.com.royalpay.payment.manage.posters.core.impls;
import au.com.royalpay.payment.manage.posters.core.PosterService;
import cn.yixblog.platform.http.HttpRequestGenerator;
import com.alibaba.fastjson.JSONObject;
import com.yeepay.shade.org.apache.http.protocol.HTTP;
import org.apache.http.entity.StringEntity;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMethod;
import java.net.URISyntaxException;
/**
* create by todking at 2019-6-3
*/
@Service
public class PosterServiceImpl implements PosterService {
@Value("${app.cms.host}")
private String cmsHost;
@Override
public void updatePoster(String imgUrl) {
String url = cmsHost + "/api/statistics/count";
try {
new HttpRequestGenerator(url, RequestMethod.PUT).addQueryString("imgUrl", imgUrl).execute();
}catch (URISyntaxException e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,25 @@
package au.com.royalpay.payment.manage.posters.web;
import au.com.royalpay.payment.manage.permission.manager.ManagerMapping;
import au.com.royalpay.payment.manage.posters.core.PosterService;
import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* create by todking at 2019-6-3
*/
@RestController
@RequestMapping(value = "/app/poster")
public class posterController {
@Resource
private PosterService posterService;
@RequestMapping(method = RequestMethod.PUT)
public void updatePoster(@RequestBody JSONObject img ){
posterService.updatePoster(img.getString("imgUrl"));
}
}

@ -112,3 +112,20 @@ $(function () {
});
});
//点击广告统计次数
function timesCount(imgUrl,linkUrl){
$.ajax({
data:JSON.stringify({imgUrl:imgUrl}),
contentType: 'application/json',
url:"/app/poster",
method:'PUT',
dataType:'text',
success: function (data) {
window.location.href = linkUrl;
},
error: function (data) {
window.location.href = linkUrl;
}
});
}

Loading…
Cancel
Save