com.xd.sdk.report 0.0.1 → 0.0.11-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Runtime/Internal/EvidenceInfo.cs +4 -7
- package/Runtime/Internal/EvidenceInfo.cs.meta +10 -2
- package/Runtime/Internal/ReportParamsInternal.cs +12 -11
- package/Runtime/Internal/ReportParamsInternal.cs.meta +10 -2
- package/Runtime/Internal/ReportSubmitResult.cs +2 -3
- package/Runtime/Internal/ReportSubmitResult.cs.meta +10 -2
- package/Runtime/Internal/SignedUrlResponse.cs +1 -1
- package/Runtime/Internal/SignedUrlResponse.cs.meta +10 -2
- package/Runtime/Internal/UploadEvidenceResponse.cs +1 -2
- package/Runtime/Internal/UploadEvidenceResponse.cs.meta +10 -2
- package/Runtime/{Public → Internal}/XDReportImpl.cs +29 -22
- package/Runtime/Internal/XDReportImpl.cs.meta +11 -0
- package/Runtime/Internal.meta +7 -2
- package/Runtime/XD.SDK.Report.asmdef +3 -5
- package/Runtime/XD.SDK.Report.asmdef.meta +1 -1
- package/Runtime/{Public/XDGReport.cs → XDGReport.cs} +8 -0
- package/Runtime/XDGReport.cs.meta +11 -0
- package/Runtime.meta +7 -2
- package/package.json +6 -5
- package/package.json.meta +6 -2
- package/Editor/XD.SDK.Report.Editor.asmdef +0 -18
- package/Editor/XD.SDK.Report.Editor.asmdef.meta +0 -7
- package/Editor/XDReportProcessBuild.cs +0 -19
- package/Editor/XDReportProcessBuild.cs.meta +0 -3
- package/Editor.meta +0 -3
- package/Runtime/Internal/IReport.cs +0 -9
- package/Runtime/Internal/IReport.cs.meta +0 -3
- package/Runtime/Public/ReportParams.cs +0 -131
- package/Runtime/Public/ReportParams.cs.meta +0 -3
- package/Runtime/Public/ReportResult.cs +0 -24
- package/Runtime/Public/ReportResult.cs.meta +0 -3
- package/Runtime/Public/XDGReport.cs.meta +0 -3
- package/Runtime/Public/XDReportImpl.cs.meta +0 -3
- package/Runtime/Public.meta +0 -3
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
using
|
|
1
|
+
using Newtonsoft.Json;
|
|
2
2
|
|
|
3
3
|
namespace XD.SDK.Report.Internal
|
|
4
4
|
{
|
|
5
5
|
public class EvidenceInfo
|
|
6
6
|
{
|
|
7
|
-
[JsonProperty("name")]
|
|
8
|
-
public string
|
|
9
|
-
[JsonProperty("
|
|
10
|
-
public string Uri { get; }
|
|
11
|
-
[JsonProperty("size")]
|
|
12
|
-
public long Size { get; }
|
|
7
|
+
[JsonProperty("name")] public string Name { get; }
|
|
8
|
+
[JsonProperty("uri")] public string Uri { get; }
|
|
9
|
+
[JsonProperty("size")] public long Size { get; }
|
|
13
10
|
|
|
14
11
|
public EvidenceInfo(string name, string uri, long size)
|
|
15
12
|
{
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
|
|
2
|
+
guid: ec853e58dacf4f07971efb0038c7cde4
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
using System.Collections.Generic;
|
|
2
|
-
using
|
|
2
|
+
using Newtonsoft.Json;
|
|
3
3
|
|
|
4
4
|
namespace XD.SDK.Report.Internal
|
|
5
5
|
{
|
|
6
6
|
public class ReportParamsInternal
|
|
7
7
|
{
|
|
8
|
-
[JsonProperty("reporter")]
|
|
9
|
-
public UserInfo
|
|
10
|
-
[JsonProperty("
|
|
11
|
-
|
|
12
|
-
[JsonProperty("reasons")]
|
|
13
|
-
public List<ReasonParam> ReasonParams;
|
|
8
|
+
[JsonProperty("reporter")] public UserInfo Reporter;
|
|
9
|
+
[JsonProperty("reportee")] public UserInfo Reportee;
|
|
10
|
+
[JsonProperty("reasons")] public List<ReasonParam> ReasonParams;
|
|
11
|
+
|
|
14
12
|
[JsonProperty("user_description", NullValueHandling = NullValueHandling.Ignore)]
|
|
15
13
|
public string UserDescription;
|
|
14
|
+
|
|
16
15
|
[JsonProperty("evidence", NullValueHandling = NullValueHandling.Ignore)]
|
|
17
16
|
public List<EvidenceInfo> Evidence;
|
|
17
|
+
|
|
18
18
|
[JsonProperty("extras", NullValueHandling = NullValueHandling.Ignore)]
|
|
19
19
|
public string Extras;
|
|
20
20
|
|
|
21
21
|
public class UserInfo
|
|
22
22
|
{
|
|
23
|
-
[JsonProperty("xdid")]
|
|
24
|
-
|
|
23
|
+
[JsonProperty("xdid")] public string XdId { get; }
|
|
24
|
+
|
|
25
25
|
[JsonProperty("extras", NullValueHandling = NullValueHandling.Ignore)]
|
|
26
26
|
public string Extras { get; }
|
|
27
27
|
|
|
@@ -34,10 +34,11 @@ namespace XD.SDK.Report.Internal
|
|
|
34
34
|
|
|
35
35
|
public class ReasonParam
|
|
36
36
|
{
|
|
37
|
-
[JsonProperty("id")]
|
|
38
|
-
|
|
37
|
+
[JsonProperty("id")] public long ID;
|
|
38
|
+
|
|
39
39
|
[JsonProperty("title", NullValueHandling = NullValueHandling.Ignore)]
|
|
40
40
|
public string Title;
|
|
41
|
+
|
|
41
42
|
[JsonProperty("extras", NullValueHandling = NullValueHandling.Ignore)]
|
|
42
43
|
public string Extras;
|
|
43
44
|
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
|
|
2
|
+
guid: 2210304e933446c8a57172ce100d084a
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
using
|
|
1
|
+
using Newtonsoft.Json;
|
|
2
2
|
using XD.SDK.Common.Internal;
|
|
3
3
|
|
|
4
4
|
namespace XD.SDK.Report.Internal
|
|
5
5
|
{
|
|
6
6
|
public class ReportSubmitResult : BaseResponse
|
|
7
7
|
{
|
|
8
|
-
[JsonProperty("data")]
|
|
9
|
-
public ReportSubmitBean ReportSubmitData;
|
|
8
|
+
[JsonProperty("data")] public ReportSubmitBean ReportSubmitData;
|
|
10
9
|
|
|
11
10
|
public class ReportSubmitBean
|
|
12
11
|
{
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
|
|
2
|
+
guid: 7fb2205340a7477c91591bc5c99c5c10
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
|
|
2
|
+
guid: 8ff43297daf443149c6b4575ad2a4855
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
|
-
guid:
|
|
3
|
-
|
|
2
|
+
guid: 42a6a082fdf04f92b9eb9f44b957ab22
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -6,14 +6,13 @@ using System.Net;
|
|
|
6
6
|
using System.Net.Http;
|
|
7
7
|
using System.Threading;
|
|
8
8
|
using System.Threading.Tasks;
|
|
9
|
-
using
|
|
9
|
+
using Newtonsoft.Json;
|
|
10
10
|
using XD.SDK.Account;
|
|
11
11
|
using XD.SDK.Common;
|
|
12
12
|
using XD.SDK.Common.Internal;
|
|
13
|
-
using XD.SDK.
|
|
14
|
-
using XDException = XD.SDK.Common.Internal.XDException;
|
|
13
|
+
using XD.SDK.Common.Internal.Http;
|
|
15
14
|
|
|
16
|
-
namespace XD.SDK.Report
|
|
15
|
+
namespace XD.SDK.Report.Internal
|
|
17
16
|
{
|
|
18
17
|
public class XDReportImpl
|
|
19
18
|
{
|
|
@@ -24,6 +23,13 @@ namespace XD.SDK.Report
|
|
|
24
23
|
private static volatile XDReportImpl _instance;
|
|
25
24
|
private static readonly object Locker = new object();
|
|
26
25
|
|
|
26
|
+
private static readonly Lazy<IHttpClient> DefaultClient = new Lazy<IHttpClient>(() =>
|
|
27
|
+
XDHttpClientFactory.GetClient(nameof(XDGReport),
|
|
28
|
+
() => XDHttpClientFactory.CreateBasicClient(XDGHost.CreateBaseHost(XDGCommonInternal.IsCn())))
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
private static IHttpClient HttpClient => DefaultClient.Value;
|
|
32
|
+
|
|
27
33
|
private XDReportImpl()
|
|
28
34
|
{
|
|
29
35
|
}
|
|
@@ -44,25 +50,27 @@ namespace XD.SDK.Report
|
|
|
44
50
|
|
|
45
51
|
public void Report(ReportParams reportParams, Action<ReportResult> resultCallback)
|
|
46
52
|
{
|
|
47
|
-
var currentUserId =
|
|
53
|
+
var currentUserId = XDGAccount.GetCurrentUser()?.UserId;
|
|
48
54
|
if (string.IsNullOrEmpty(currentUserId))
|
|
49
55
|
{
|
|
50
56
|
resultCallback.Invoke(new ReportResult(false,
|
|
51
|
-
new
|
|
57
|
+
new XDGError(ReportResult.CodeUserNotLoggedIn, "user is null, please login first!")));
|
|
52
58
|
return;
|
|
53
59
|
}
|
|
60
|
+
|
|
54
61
|
if (reportParams.Reportee == null || reportParams.Reportee.XdId.Length <= 0
|
|
55
62
|
|| reportParams.Reasons == null || reportParams.Reasons.Count <= 0)
|
|
56
63
|
{
|
|
57
64
|
resultCallback.Invoke(new ReportResult(false,
|
|
58
|
-
new
|
|
65
|
+
new XDGError(ReportResult.CodeParamInvalid, "invalid report params , please check.")));
|
|
59
66
|
return;
|
|
60
67
|
}
|
|
61
68
|
|
|
62
69
|
ReportAsync(currentUserId, reportParams, resultCallback).ConfigureAwait(false);
|
|
63
70
|
}
|
|
64
71
|
|
|
65
|
-
private static async Task ReportAsync(string currentUserId, ReportParams reportParams,
|
|
72
|
+
private static async Task ReportAsync(string currentUserId, ReportParams reportParams,
|
|
73
|
+
Action<ReportResult> resultCallback)
|
|
66
74
|
{
|
|
67
75
|
var requestParams = new ReportParamsInternal
|
|
68
76
|
{
|
|
@@ -100,7 +108,7 @@ namespace XD.SDK.Report
|
|
|
100
108
|
|
|
101
109
|
requestParams.Evidence = evidenceList;
|
|
102
110
|
}
|
|
103
|
-
catch (
|
|
111
|
+
catch (XDGError ex)
|
|
104
112
|
{
|
|
105
113
|
XDGLogger.Error("Report failed, upload evidence error:" + ex);
|
|
106
114
|
cts.Cancel();
|
|
@@ -117,19 +125,18 @@ namespace XD.SDK.Report
|
|
|
117
125
|
XDGLogger.Error("Report failed, upload evidence Unexpected exception:" + e.Message);
|
|
118
126
|
cts.Cancel();
|
|
119
127
|
resultCallback.Invoke(new ReportResult(false,
|
|
120
|
-
new
|
|
128
|
+
new XDGError(ResponseCode.Common.Failed, e.Message)));
|
|
121
129
|
return;
|
|
122
130
|
}
|
|
123
131
|
}
|
|
124
132
|
|
|
125
133
|
try
|
|
126
134
|
{
|
|
127
|
-
var reportSubmitResult = await
|
|
128
|
-
.Post<ReportSubmitResult>(ReportEndpoint, data: requestParams);
|
|
135
|
+
var reportSubmitResult = await HttpClient.PostAsync<ReportSubmitResult>(ReportEndpoint, data: requestParams, cancellationToken: token);
|
|
129
136
|
resultCallback.Invoke(new ReportResult(reportSubmitResult.ReportSubmitData.Success,
|
|
130
|
-
new
|
|
137
|
+
new XDGError(reportSubmitResult.Code, reportSubmitResult.Message)));
|
|
131
138
|
}
|
|
132
|
-
catch (
|
|
139
|
+
catch (XDGError e)
|
|
133
140
|
{
|
|
134
141
|
XDGLogger.Error("Report failed: " + e);
|
|
135
142
|
resultCallback.Invoke(new ReportResult(false, e));
|
|
@@ -137,7 +144,7 @@ namespace XD.SDK.Report
|
|
|
137
144
|
catch (Exception e)
|
|
138
145
|
{
|
|
139
146
|
XDGLogger.Error("Report failed: Unexpected exception:" + e.Message);
|
|
140
|
-
resultCallback.Invoke(new ReportResult(false, new
|
|
147
|
+
resultCallback.Invoke(new ReportResult(false, new XDGError(ResponseCode.Common.Failed, e.Message)));
|
|
141
148
|
}
|
|
142
149
|
}
|
|
143
150
|
|
|
@@ -147,7 +154,7 @@ namespace XD.SDK.Report
|
|
|
147
154
|
if (!File.Exists(filePath))
|
|
148
155
|
{
|
|
149
156
|
XDGLogger.Error($"report failed, file: {filePath} dose not exist");
|
|
150
|
-
throw new
|
|
157
|
+
throw new XDGError(ReportResult.CodeFileNotExist, $"file: {filePath} does not exist");
|
|
151
158
|
}
|
|
152
159
|
|
|
153
160
|
var fileInfo = new FileInfo(filePath);
|
|
@@ -160,8 +167,8 @@ namespace XD.SDK.Report
|
|
|
160
167
|
SignedUrlResponse signedUrlResponse;
|
|
161
168
|
try
|
|
162
169
|
{
|
|
163
|
-
signedUrlResponse = await
|
|
164
|
-
.
|
|
170
|
+
signedUrlResponse = await HttpClient
|
|
171
|
+
.GetAsync<SignedUrlResponse>(GetSignedUrlEndpoint, queryParams: queryParams, cancellationToken: token);
|
|
165
172
|
}
|
|
166
173
|
catch (OperationCanceledException ex)
|
|
167
174
|
{
|
|
@@ -174,13 +181,13 @@ namespace XD.SDK.Report
|
|
|
174
181
|
cancellationTokenSource.Cancel();
|
|
175
182
|
throw;
|
|
176
183
|
}
|
|
177
|
-
|
|
184
|
+
|
|
178
185
|
var fullUrl = signedUrlResponse?.SignedUrlData?.SignedUrl;
|
|
179
186
|
if (string.IsNullOrEmpty(fullUrl))
|
|
180
187
|
{
|
|
181
188
|
XDGLogger.Error("upload evidence error: couldn't get signed url.");
|
|
182
189
|
cancellationTokenSource.Cancel();
|
|
183
|
-
throw new
|
|
190
|
+
throw new XDGError(ResponseCode.Common.Failed, "Couldn't get signed url");
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
try
|
|
@@ -203,7 +210,7 @@ namespace XD.SDK.Report
|
|
|
203
210
|
}
|
|
204
211
|
|
|
205
212
|
var errorContent = await uploadEvidenceResponse.Content.ReadAsStringAsync();
|
|
206
|
-
var ex = new
|
|
213
|
+
var ex = new XDGError((int)uploadEvidenceResponse.StatusCode, errorContent);
|
|
207
214
|
XDGLogger.Error("Report upload evidences failed: " + ex);
|
|
208
215
|
throw ex;
|
|
209
216
|
}
|
|
@@ -238,7 +245,7 @@ namespace XD.SDK.Report
|
|
|
238
245
|
XDGLogger.Warn("UploadEvidenceBySignedOssUrl upload evidence canceled:" + ex);
|
|
239
246
|
if (!token.IsCancellationRequested)
|
|
240
247
|
{
|
|
241
|
-
throw new TimeoutException("UploadEvidenceBySignedOssUrl upload evidence timeout");
|
|
248
|
+
throw new TimeoutException("UploadEvidenceBySignedOssUrl upload evidence timeout");
|
|
242
249
|
}
|
|
243
250
|
|
|
244
251
|
throw;
|
package/Runtime/Internal.meta
CHANGED
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
"name": "XD.SDK.Report",
|
|
3
3
|
"rootNamespace": "",
|
|
4
4
|
"references": [
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"XD.SDK.Foundation",
|
|
6
|
+
"XD.SDK.Common",
|
|
7
|
+
"XD.SDK.Account"
|
|
8
8
|
],
|
|
9
|
-
"includePlatforms": [],
|
|
10
|
-
"excludePlatforms": [],
|
|
11
9
|
"allowUnsafeCode": false,
|
|
12
10
|
"overrideReferences": false,
|
|
13
11
|
"precompiledReferences": [],
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
using System;
|
|
2
|
+
using XD.SDK.Report.Internal;
|
|
2
3
|
|
|
3
4
|
namespace XD.SDK.Report
|
|
4
5
|
{
|
|
5
6
|
public class XDGReport
|
|
6
7
|
{
|
|
8
|
+
/// <summary>
|
|
9
|
+
/// 举报
|
|
10
|
+
///
|
|
11
|
+
/// Tips: PNSDK 下不可用
|
|
12
|
+
/// </summary>
|
|
13
|
+
/// <param name="reportParams">举报参数</param>
|
|
14
|
+
/// <param name="resultCallback">举报结果</param>
|
|
7
15
|
public static void Report(ReportParams reportParams, Action<ReportResult> resultCallback)
|
|
8
16
|
{
|
|
9
17
|
XDReportImpl.GetInstance().Report(reportParams, resultCallback);
|
package/Runtime.meta
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "com.xd.sdk.report",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"displayName": "XDGSDK Report",
|
|
4
|
+
"version": "0.0.11-alpha",
|
|
5
|
+
"description": "XDGSDK",
|
|
6
|
+
"unity": "2019.3",
|
|
6
7
|
"license": "MIT",
|
|
7
8
|
"dependencies": {
|
|
8
|
-
"com.xd.sdk.
|
|
9
|
-
"com.xd.
|
|
9
|
+
"com.xd.sdk.account": "0.0.11-alpha",
|
|
10
|
+
"com.xd.sdk.common": "0.0.11-alpha"
|
|
10
11
|
}
|
|
11
12
|
}
|
package/package.json.meta
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "XD.SDK.Report.Editor",
|
|
3
|
-
"references": [
|
|
4
|
-
"GUID:616cea76def2d4f059b94440fc8cc03d",
|
|
5
|
-
"GUID:747e53b1749584bae9386571797e5eb5"
|
|
6
|
-
],
|
|
7
|
-
"includePlatforms": [
|
|
8
|
-
"Editor"
|
|
9
|
-
],
|
|
10
|
-
"excludePlatforms": [],
|
|
11
|
-
"allowUnsafeCode": false,
|
|
12
|
-
"overrideReferences": false,
|
|
13
|
-
"precompiledReferences": [],
|
|
14
|
-
"autoReferenced": true,
|
|
15
|
-
"defineConstraints": [],
|
|
16
|
-
"versionDefines": [],
|
|
17
|
-
"noEngineReferences": false
|
|
18
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
using System;
|
|
2
|
-
using TapTap.Common.Editor;
|
|
3
|
-
using UnityEditor.Build.Reporting;
|
|
4
|
-
|
|
5
|
-
namespace XD.SDK.Report.Editor
|
|
6
|
-
{
|
|
7
|
-
public class XDReportProcessBuild : SDKLinkProcessBuild
|
|
8
|
-
{
|
|
9
|
-
public override int callbackOrder => 9;
|
|
10
|
-
public override string LinkPath => "XDSDK/Gen/Report/link.xml";
|
|
11
|
-
|
|
12
|
-
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[]
|
|
13
|
-
{
|
|
14
|
-
new LinkedAssembly { Fullname = "XD.SDK.Report" }
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
public override Func<BuildReport, bool> IsTargetPlatform => (report) => true;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/Editor.meta
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
using System.Collections.Generic;
|
|
2
|
-
|
|
3
|
-
namespace XD.SDK.Report
|
|
4
|
-
{
|
|
5
|
-
public class ReportParams
|
|
6
|
-
{
|
|
7
|
-
public ReporterInfo Reporter { get; } // 举报人
|
|
8
|
-
public ReporteeInfo Reportee { get; } // 被举报人
|
|
9
|
-
public List<ReasonInfo> Reasons { get; } // 举报原因
|
|
10
|
-
public string UserDescription { get; } // 玩家描述
|
|
11
|
-
public List<string> EvidenceList { get; } // 玩家添加的附件
|
|
12
|
-
public Dictionary<string, object> Extras { get; } // 附加信息补充玩家信息,透传给使用方
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
private ReportParams(ReporterInfo reporter, ReporteeInfo reportee, List<ReasonInfo> reasons, string userDescription, List<string> evidenceList, Dictionary<string, object> extras)
|
|
16
|
-
{
|
|
17
|
-
Reporter = reporter;
|
|
18
|
-
Reportee = reportee;
|
|
19
|
-
Reasons = reasons;
|
|
20
|
-
UserDescription = userDescription;
|
|
21
|
-
EvidenceList = evidenceList;
|
|
22
|
-
Extras = extras;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
public class ReporterInfo
|
|
26
|
-
{
|
|
27
|
-
public Dictionary<string, object> Extras { get; }
|
|
28
|
-
|
|
29
|
-
public ReporterInfo(Dictionary<string, object> extras)
|
|
30
|
-
{
|
|
31
|
-
Extras = extras;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
public override string ToString()
|
|
35
|
-
{
|
|
36
|
-
return $"ReporterInfo: Extras={string.Join(",", Extras)}";
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public class ReporteeInfo
|
|
41
|
-
{
|
|
42
|
-
public string XdId { get; }
|
|
43
|
-
public Dictionary<string, object> Extras { get; }
|
|
44
|
-
|
|
45
|
-
public ReporteeInfo(string xdId, Dictionary<string, object> extras)
|
|
46
|
-
{
|
|
47
|
-
XdId = xdId;
|
|
48
|
-
Extras = extras;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
public override string ToString()
|
|
52
|
-
{
|
|
53
|
-
return $"ReporteeInfo: XdId={XdId}, Extras={string.Join(",", Extras)}";
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public class ReasonInfo
|
|
58
|
-
{
|
|
59
|
-
public long ID { get; } // 举报原因 ID,后台配置
|
|
60
|
-
public string Title { get; } // 原因名称
|
|
61
|
-
public Dictionary<string, object> Extras { get; } // 附加信息补充玩家信息,透传给使用方
|
|
62
|
-
|
|
63
|
-
public ReasonInfo(long id, string title, Dictionary<string, object> extras)
|
|
64
|
-
{
|
|
65
|
-
ID = id;
|
|
66
|
-
Title = title;
|
|
67
|
-
Extras = extras;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public override string ToString()
|
|
71
|
-
{
|
|
72
|
-
return $"ReasonInfo: ID={ID}, Title={Title}, Extras={string.Join(",", Extras)}";
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
public class Builder
|
|
77
|
-
{
|
|
78
|
-
private ReporterInfo _reporter;
|
|
79
|
-
private ReporteeInfo _reportee;
|
|
80
|
-
private List<ReasonInfo> _reasons;
|
|
81
|
-
private string _userDescription;
|
|
82
|
-
private List<string> _evidenceList;
|
|
83
|
-
private Dictionary<string, object> _extras;
|
|
84
|
-
public Builder SetReporter(ReporterInfo reporter)
|
|
85
|
-
{
|
|
86
|
-
_reporter = reporter;
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
public Builder SetReportee(ReporteeInfo reportee)
|
|
91
|
-
{
|
|
92
|
-
_reportee = reportee;
|
|
93
|
-
return this;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
public Builder SetReasons(List<ReasonInfo> reasons)
|
|
97
|
-
{
|
|
98
|
-
_reasons = reasons;
|
|
99
|
-
return this;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
public Builder SetUserDescription(string userDescription)
|
|
103
|
-
{
|
|
104
|
-
_userDescription = userDescription;
|
|
105
|
-
return this;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public Builder SetEvidenceList(List<string> evidenceList)
|
|
109
|
-
{
|
|
110
|
-
_evidenceList = evidenceList;
|
|
111
|
-
return this;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
public Builder SetExtras(Dictionary<string, object> extras)
|
|
115
|
-
{
|
|
116
|
-
_extras = extras;
|
|
117
|
-
return this;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public ReportParams Build()
|
|
121
|
-
{
|
|
122
|
-
return new ReportParams(_reporter, _reportee, _reasons, _userDescription, _evidenceList, _extras);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
public override string ToString()
|
|
127
|
-
{
|
|
128
|
-
return $"ReportParams: {Reporter}, {Reportee}, {Reasons}, UserDescription={UserDescription}, EvidenceList={string.Join(",", EvidenceList)}, Extras={string.Join(",", Extras)}";
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
using XD.SDK.Common.Internal;
|
|
2
|
-
|
|
3
|
-
namespace XD.SDK.Report
|
|
4
|
-
{
|
|
5
|
-
public class ReportResult
|
|
6
|
-
{
|
|
7
|
-
public const int CodeParamInvalid = -1; // 无效参数
|
|
8
|
-
public const int CodeUserNotLoggedIn = -2; // 用户未登录
|
|
9
|
-
public const int CodeFileNotExist = -3; // 文件不存在
|
|
10
|
-
public bool Success { get; }
|
|
11
|
-
public XDException XdException { get; }
|
|
12
|
-
|
|
13
|
-
public ReportResult(bool success, XDException exception)
|
|
14
|
-
{
|
|
15
|
-
Success = success;
|
|
16
|
-
XdException = exception;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public override string ToString()
|
|
20
|
-
{
|
|
21
|
-
return $"ReportResult: Success={Success} XdException={XdException}";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
package/Runtime/Public.meta
DELETED