|
@@ -10,8 +10,8 @@ namespace MySystem
|
|
|
{
|
|
|
public class AliyunPush
|
|
|
{
|
|
|
- private static string AccessKeyID = "LTAImYRe25JQ5nr8";
|
|
|
- private static string AccessKeySecret = "znOWxVGLnKl8KHlPSIKruYC3C1HYIy";
|
|
|
+ private static string AccessKeyID = "LTAI5tGH621tQ3FVd3jXYUEx";
|
|
|
+ private static string AccessKeySecret = "SDjL74Lk9FUp8VPKl4YYcsbY7MIkRr";
|
|
|
|
|
|
/**
|
|
|
* 使用AK&SK初始化账号Client
|
|
@@ -25,16 +25,16 @@ namespace MySystem
|
|
|
AlibabaCloud.OpenApiClient.Models.Config config = new AlibabaCloud.OpenApiClient.Models.Config
|
|
|
{
|
|
|
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
|
|
|
- AccessKeyId = Environment.GetEnvironmentVariable(AccessKeyID),
|
|
|
+ AccessKeyId = AccessKeyID, //Environment.GetEnvironmentVariable(AccessKeyID),
|
|
|
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
|
|
|
- AccessKeySecret = Environment.GetEnvironmentVariable(AccessKeySecret),
|
|
|
+ AccessKeySecret = AccessKeySecret, //Environment.GetEnvironmentVariable(AccessKeySecret),
|
|
|
};
|
|
|
// Endpoint 请参考 https://api.aliyun.com/product/Push
|
|
|
config.Endpoint = "cloudpush.aliyuncs.com";
|
|
|
return new AlibabaCloud.SDK.Push20160801.Client(config);
|
|
|
}
|
|
|
|
|
|
- public static string Push(string Title, string Body)
|
|
|
+ public static string Push(string Account, string Title, string Body)
|
|
|
{
|
|
|
AlibabaCloud.SDK.Push20160801.Client client = CreateClient();
|
|
|
AlibabaCloud.SDK.Push20160801.Models.PushRequest request = new AlibabaCloud.SDK.Push20160801.Models.PushRequest
|
|
@@ -46,7 +46,7 @@ namespace MySystem
|
|
|
IOSRemind = true,
|
|
|
AndroidRemind = true,
|
|
|
Target = "ACCOUNT",
|
|
|
- TargetValue = "14781419364",
|
|
|
+ TargetValue = Account,
|
|
|
Title = Title,
|
|
|
Body = Body,
|
|
|
IOSRemindBody = Body,
|
|
@@ -57,5 +57,22 @@ namespace MySystem
|
|
|
AlibabaCloud.SDK.Push20160801.Models.PushResponse response = client.Push(request);
|
|
|
return AlibabaCloud.TeaUtil.Common.ToJSONString(response.Body.ToMap());
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static string IosPush(string Account, string Title, string Body)
|
|
|
+ {
|
|
|
+ AlibabaCloud.SDK.Push20160801.Client client = CreateClient();
|
|
|
+ AlibabaCloud.SDK.Push20160801.Models.PushNoticeToiOSRequest request = new AlibabaCloud.SDK.Push20160801.Models.PushNoticeToiOSRequest
|
|
|
+ {
|
|
|
+ AppKey = 333673916,
|
|
|
+ Target = "ACCOUNT",
|
|
|
+ TargetValue = Account,
|
|
|
+ Title = Title,
|
|
|
+ Body = Body,
|
|
|
+ ApnsEnv = Library.ConfigurationManager.EnvironmentFlag == 2 ? "DEV" : "PRODUCTION",
|
|
|
+ };
|
|
|
+ AlibabaCloud.SDK.Push20160801.Models.PushNoticeToiOSResponse response = client.PushNoticeToiOS(request);
|
|
|
+ return AlibabaCloud.TeaUtil.Common.ToJSONString(response.Body.ToMap());
|
|
|
+ }
|
|
|
}
|
|
|
}
|