新增推送测试接口给前端测试用途
This commit is contained in:
parent
db591b9ecd
commit
30f14e0dbf
@ -11,6 +11,7 @@ import com.suisung.mall.common.constant.AuthConstant;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.constant.RedisConstant;
|
||||
import com.suisung.mall.common.pojo.req.WxUserInfoReq;
|
||||
import com.suisung.mall.common.service.GeTuiPushService;
|
||||
import com.suisung.mall.common.service.impl.BaseControllerImpl;
|
||||
import com.suisung.mall.common.utils.I18nUtil;
|
||||
import com.suisung.mall.common.utils.UserInfoService;
|
||||
@ -47,9 +48,33 @@ public class LoginController extends BaseControllerImpl {
|
||||
@Autowired
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Autowired
|
||||
private GeTuiPushService geTuiPushService;
|
||||
|
||||
/**
|
||||
* 移动端登录
|
||||
* 推送测试
|
||||
*/
|
||||
@PostMapping(value = "/push/testcase")
|
||||
public Object testcase(@RequestBody JSONObject paramsJSON) {
|
||||
|
||||
String title = paramsJSON.getStr("title");
|
||||
if (StrUtil.isBlank(title)) {
|
||||
title = "小发同城";
|
||||
}
|
||||
|
||||
String clickType = paramsJSON.getStr("clickType");
|
||||
if (StrUtil.isBlank(clickType)) {
|
||||
clickType = "none";
|
||||
}
|
||||
|
||||
String clinkContent = paramsJSON.getStr("clickContent");
|
||||
if (StrUtil.isBlank(clinkContent)) {
|
||||
clinkContent = "";
|
||||
}
|
||||
|
||||
return geTuiPushService.pushMessageToSingleByCid(paramsJSON.getStr("cid"), title, paramsJSON.getStr("message"), clickType, clinkContent);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/testcase", method = RequestMethod.GET)
|
||||
public Object testcase() {
|
||||
Map<String, Object> arg = new HashMap<String, Object>();
|
||||
|
||||
@ -19,7 +19,7 @@ public interface GeTuiPushService {
|
||||
* @param transmission 透传消息 txt json 格式
|
||||
* @return
|
||||
*/
|
||||
Pair<Boolean, String> pushTransmissionToSingleByCid(String cid, String transmission);
|
||||
Pair<Boolean, Object> pushTransmissionToSingleByCid(String cid, String transmission);
|
||||
|
||||
/**
|
||||
* 单个用户推送消息(支持H5、安卓、苹果系统)
|
||||
@ -40,5 +40,5 @@ public interface GeTuiPushService {
|
||||
* @param clickContent
|
||||
* @return
|
||||
*/
|
||||
Pair<Boolean, String> pushMessageToSingleByCid(String cid, String title, String content, String clickType, String clickContent);
|
||||
Pair<Boolean, Object> pushMessageToSingleByCid(String cid, String title, String content, String clickType, String clickContent);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ package com.suisung.mall.common.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.getui.push.v2.sdk.ApiHelper;
|
||||
import com.getui.push.v2.sdk.GtApiConfiguration;
|
||||
import com.getui.push.v2.sdk.api.PushApi;
|
||||
@ -69,7 +70,7 @@ public class GeTuiPushServiceImpl implements GeTuiPushService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> pushTransmissionToSingleByCid(String cid, String transmission) {
|
||||
public Pair<Boolean, Object> pushTransmissionToSingleByCid(String cid, String transmission) {
|
||||
PushDTO pushDTO = new PushDTO<Audience>();
|
||||
// 设置推送参数
|
||||
pushDTO.setRequestId(System.currentTimeMillis() + "");
|
||||
@ -142,7 +143,7 @@ public class GeTuiPushServiceImpl implements GeTuiPushService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> pushMessageToSingleByCid(String cid, String title, String content, String clickType, String clickContent) {
|
||||
public Pair<Boolean, Object> pushMessageToSingleByCid(String cid, String title, String content, String clickType, String clickContent) {
|
||||
//根据cid进行单推
|
||||
PushDTO pushDTO = new PushDTO<Audience>();
|
||||
// 设置推送参数
|
||||
@ -239,11 +240,11 @@ public class GeTuiPushServiceImpl implements GeTuiPushService {
|
||||
ApiResult<JSONObject> apiResult = creatPushApi().pushToSingleByCid(pushDTO);
|
||||
if (!apiResult.isSuccess()) {
|
||||
log.error("个推推送失败:{}", apiResult);
|
||||
return Pair.of(false, "个推推送失败:" + apiResult.getMsg());
|
||||
return Pair.of(false, "个推推送失败:" + JSONUtil.toJsonStr(apiResult));
|
||||
}
|
||||
|
||||
log.debug("推送返回数据:{}", apiResult);
|
||||
|
||||
return Pair.of(true, "推送成功");
|
||||
|
||||
return Pair.of(true, "推送成功,返回数据:" + JSONUtil.toJsonStr(apiResult));
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,6 +92,7 @@ secure:
|
||||
- "/esProduct/**"
|
||||
- "/admin/oss/upload/**"
|
||||
- "/mobile/**/**/test/case"
|
||||
- "/**/**/testcase"
|
||||
universal:
|
||||
urls:
|
||||
- "/admin/account/account-user-base/info"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user