Commit 2811e6e3 by giaogiao

友盟推送相关,添加或修改推送token

parent 78a5c302
......@@ -20,7 +20,12 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* APP用户 控制器
......@@ -42,26 +47,13 @@ public class AppUserController extends BaseController {
private AppUserApiService appUserApiService;
/**
* ios-添加或修改推送token
* 添加或修改推送token
*/
@PostMapping("/iosDeviceToken")
@OperationLog(name = "ios-添加或修改推送token", type = OperationLogType.ADD)
@ApiOperation(value = "ios-添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
public ApiResult<Boolean> addIosAppDeviceToken(@RequestBody DeviceTokenParam deviceTokenParam) throws Exception {
boolean flag = appUserService.updateDeviceToken(deviceTokenParam, 2);
return ApiResult.result(flag);
}
/**
* android-添加或修改推送token
*/
@PostMapping("/androidDeviceToken")
@OperationLog(name = "android-添加或修改推送token", type = OperationLogType.ADD)
@ApiOperation(value = "android-添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
public ApiResult<Boolean> addAppDeviceToken(@RequestBody DeviceTokenParam deviceTokenParam) throws Exception {
boolean flag = appUserService.updateDeviceToken(deviceTokenParam, 1);
@PostMapping("/addDeviceToken")
@OperationLog(name = "添加或修改推送token", type = OperationLogType.ADD)
@ApiOperation(value = "添加或修改推送token", notes = "添加和修改都调用此接口", response = ApiResult.class)
public ApiResult<Boolean> addDeviceToken(@RequestBody DeviceTokenParam deviceTokenParam) throws Exception {
boolean flag = appUserService.updateDeviceToken(deviceTokenParam, deviceTokenParam.getDeviceType());
return ApiResult.result(flag);
}
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019-2029 geekidea(https://github.com/geekidea)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
......@@ -35,6 +20,7 @@
<groupId>io.geekidea.springbootplus</groupId>
<artifactId>framework</artifactId>
</dependency>
<!-- 友盟 start -->
<dependency>
<groupId>org.json</groupId>
......@@ -47,6 +33,17 @@
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<!-- 友盟 end -->
<!-- 极光 start -->
<dependency>
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
<version>3.4.7</version>
</dependency>
<!-- 极光 end -->
</dependencies>
</project>
\ No newline at end of file
......@@ -144,7 +144,7 @@ public class Stroke extends BaseEntity {
private String choosePlainType;
@NotNull(message = "付款状态不能为空")
@ApiModelProperty("付款状态,0-未付款,1-付款中,2-已付款,3-退款中,99-已退款")
@ApiModelProperty("付款状态,0-未付款,1-用户已付款,待审核,2-用户已付款,审核通过,3-退款中,99-已退款")
private Integer paymentStatus;
@NotNull(message = "审核状态不能为空")
......
package com.jumeirah.common.param.app;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
......@@ -7,4 +8,8 @@ import java.io.Serializable;
@Data
public class DeviceTokenParam implements Serializable {
private String deviceToken;
@ApiModelProperty("ios=2, android=1")
private int deviceType;
}
......@@ -43,7 +43,7 @@ public class Demo {
// Demo demo = new Demo("your appkey", "your master secret");
Demo demo = new Demo("5f963f3ea1491772a2aef713", "ti5gomxtvmkgehmwgtbq9rtsfhy0khsi");
try {
demo.sendAndroidUnicast();
demo.sendAndroidUnicast("As3YYnUpKwDLFVzc35_syVTNSctGjkDNfFLwPHGbXtm_");
//demo.sendIOSUnicast();
/* TODO these methods are all available, just fill in some fields and do the test
* demo.sendAndroidCustomizedcastFile();
......@@ -81,10 +81,15 @@ public class Demo {
client.send(broadcast);
}
public void sendAndroidUnicast() throws Exception {
/**
* 发送安卓单推
*
* @throws Exception
*/
public void sendAndroidUnicast(String token) throws Exception {
AndroidUnicast unicast = new AndroidUnicast(appkey, appMasterSecret);
// TODO Set your device token
unicast.setDeviceToken("AszgEnfwpKppOH8Up1EiyXMJ1ParFCPkqYkqIrCpL9ph");
unicast.setDeviceToken(token);
unicast.setTicker("Android unicast ticker");
unicast.setTitle("api 中文的title");
unicast.setText("Android unicast text");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment