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.
Files changed (34) hide show
  1. package/Runtime/Internal/EvidenceInfo.cs +4 -7
  2. package/Runtime/Internal/EvidenceInfo.cs.meta +10 -2
  3. package/Runtime/Internal/ReportParamsInternal.cs +12 -11
  4. package/Runtime/Internal/ReportParamsInternal.cs.meta +10 -2
  5. package/Runtime/Internal/ReportSubmitResult.cs +2 -3
  6. package/Runtime/Internal/ReportSubmitResult.cs.meta +10 -2
  7. package/Runtime/Internal/SignedUrlResponse.cs +1 -1
  8. package/Runtime/Internal/SignedUrlResponse.cs.meta +10 -2
  9. package/Runtime/Internal/UploadEvidenceResponse.cs +1 -2
  10. package/Runtime/Internal/UploadEvidenceResponse.cs.meta +10 -2
  11. package/Runtime/{Public → Internal}/XDReportImpl.cs +29 -22
  12. package/Runtime/Internal/XDReportImpl.cs.meta +11 -0
  13. package/Runtime/Internal.meta +7 -2
  14. package/Runtime/XD.SDK.Report.asmdef +3 -5
  15. package/Runtime/XD.SDK.Report.asmdef.meta +1 -1
  16. package/Runtime/{Public/XDGReport.cs → XDGReport.cs} +8 -0
  17. package/Runtime/XDGReport.cs.meta +11 -0
  18. package/Runtime.meta +7 -2
  19. package/package.json +6 -5
  20. package/package.json.meta +6 -2
  21. package/Editor/XD.SDK.Report.Editor.asmdef +0 -18
  22. package/Editor/XD.SDK.Report.Editor.asmdef.meta +0 -7
  23. package/Editor/XDReportProcessBuild.cs +0 -19
  24. package/Editor/XDReportProcessBuild.cs.meta +0 -3
  25. package/Editor.meta +0 -3
  26. package/Runtime/Internal/IReport.cs +0 -9
  27. package/Runtime/Internal/IReport.cs.meta +0 -3
  28. package/Runtime/Public/ReportParams.cs +0 -131
  29. package/Runtime/Public/ReportParams.cs.meta +0 -3
  30. package/Runtime/Public/ReportResult.cs +0 -24
  31. package/Runtime/Public/ReportResult.cs.meta +0 -3
  32. package/Runtime/Public/XDGReport.cs.meta +0 -3
  33. package/Runtime/Public/XDReportImpl.cs.meta +0 -3
  34. package/Runtime/Public.meta +0 -3
@@ -1,15 +1,12 @@
1
- using LC.Newtonsoft.Json;
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 Name { get; }
9
- [JsonProperty("uri")]
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: 31caaf981ad3439a8319e6f31bd9ffa6
3
- timeCreated: 1716176408
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 LC.Newtonsoft.Json;
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 Reporter;
10
- [JsonProperty("reportee")]
11
- public UserInfo Reportee;
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
- public string XdId { get; }
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
- public long ID;
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: b967b5d16e0840ed883df2be72237487
3
- timeCreated: 1716177475
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 LC.Newtonsoft.Json;
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: cbad667fef1547d9a8cebb44ff733ff7
3
- timeCreated: 1715652010
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,4 +1,4 @@
1
- using LC.Newtonsoft.Json;
1
+ using Newtonsoft.Json;
2
2
  using XD.SDK.Common.Internal;
3
3
 
4
4
  namespace XD.SDK.Report.Internal
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
- guid: aded07794dfa4b669cc0c01c021014c3
3
- timeCreated: 1715649927
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:
@@ -2,8 +2,7 @@ using XD.SDK.Common.Internal;
2
2
 
3
3
  namespace XD.SDK.Report.Internal
4
4
  {
5
- public class UploadEvidenceResponse: BaseResponse
5
+ public class UploadEvidenceResponse : BaseResponse
6
6
  {
7
-
8
7
  }
9
8
  }
@@ -1,3 +1,11 @@
1
1
  fileFormatVersion: 2
2
- guid: 8d84456af1d34b96b1e37e7d3c0a6f5e
3
- timeCreated: 1715739257
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 LC.Newtonsoft.Json;
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.Report.Internal;
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 = UserManager.GetCurrentUser()?.userId;
53
+ var currentUserId = XDGAccount.GetCurrentUser()?.UserId;
48
54
  if (string.IsNullOrEmpty(currentUserId))
49
55
  {
50
56
  resultCallback.Invoke(new ReportResult(false,
51
- new XDException(ReportResult.CodeUserNotLoggedIn, "user is null, please login first!")));
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 XDException(ReportResult.CodeParamInvalid, "invalid report params , please check.")));
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, Action<ReportResult> resultCallback)
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 (XDException ex)
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 XDException(XDException.DEFAULT_CODE, e.Message)));
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 XDHttpClientFactory.GetDefaultXdHttpClient()
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 XDException(reportSubmitResult.Code, reportSubmitResult.Message)));
137
+ new XDGError(reportSubmitResult.Code, reportSubmitResult.Message)));
131
138
  }
132
- catch (XDException e)
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 XDException(XDException.DEFAULT_CODE, e.Message)));
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 XDException(ReportResult.CodeFileNotExist, $"file: {filePath} does not exist");
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 XDHttpClientFactory.GetDefaultXdHttpClient()
164
- .Get<SignedUrlResponse>(GetSignedUrlEndpoint, queryParams: queryParams);
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 XDException(XDException.DEFAULT_CODE, "Couldn't get signed url");
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 XDException((int)uploadEvidenceResponse.StatusCode, errorContent);
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;
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 16c03b70a3b7462da762564a4a107840
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,8 @@
1
1
  fileFormatVersion: 2
2
- guid: 70c800d9be714ee682adff2e338f0194
3
- timeCreated: 1715590590
2
+ guid: 062329d17f8346a7825e13c6c15617cb
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -2,12 +2,10 @@
2
2
  "name": "XD.SDK.Report",
3
3
  "rootNamespace": "",
4
4
  "references": [
5
- "GUID:271a06ab0780d4a5ea46c9c3be2ab5dc",
6
- "GUID:8b2e8a99ce9ab457da469f8744959bc2",
7
- "GUID:c72576b1c89c54ea0a0d748ee92b35c2"
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,5 +1,5 @@
1
1
  fileFormatVersion: 2
2
- guid: df292eb1ae1fe42fb908e90459182fd1
2
+ guid: 2e5383b3ca2e499793960c16044cc5de
3
3
  AssemblyDefinitionImporter:
4
4
  externalObjects: {}
5
5
  userData:
@@ -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);
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 53bb34d5f2c246dfbdb09435eae901af
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/Runtime.meta CHANGED
@@ -1,3 +1,8 @@
1
1
  fileFormatVersion: 2
2
- guid: 861f533b37904f6ba0281f90334240e5
3
- timeCreated: 1715590568
2
+ guid: 31974071b6a34750bb0b7216994320ea
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "com.xd.sdk.report",
3
- "version": "0.0.1",
4
- "description": "XDSDK",
5
- "unity": "2018.3",
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.common": "0.0.1",
9
- "com.xd.tds.common": "3.27.1-xd.1"
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,3 +1,7 @@
1
1
  fileFormatVersion: 2
2
- guid: 9085c62777ce4df387fa9add5c2f8ac1
3
- timeCreated: 1716287109
2
+ guid: 30ca57d72e7c48f0bfd7a6ce1964fca8
3
+ PackageManifestImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
@@ -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,7 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: eeec22ce273654fd3a76e1135ab8647b
3
- AssemblyDefinitionImporter:
4
- externalObjects: {}
5
- userData:
6
- assetBundleName:
7
- assetBundleVariant:
@@ -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
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: fe95b03b21994758b60af59e1159592a
3
- timeCreated: 1715590618
package/Editor.meta DELETED
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 1699939c34e140d89ef4ef277899ba35
3
- timeCreated: 1715590554
@@ -1,9 +0,0 @@
1
- using System;
2
-
3
- namespace XD.SDK.Report.Internal
4
- {
5
- public interface IReport
6
- {
7
- void Report(Action<bool> resultAction);
8
- }
9
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: d32421600e0c4193bd75c6b02cfae53c
3
- timeCreated: 1715592228
@@ -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,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 938fb21d03044ea38c0ecca51e84da87
3
- timeCreated: 1715652473
@@ -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
- }
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 0162e2273cd1465990acdb00e76979ce
3
- timeCreated: 1716186590
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: a22be58d53464c9ea695c10e9a015a7e
3
- timeCreated: 1715590796
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: e7861bf22d7b447ba07dbe03870edbd3
3
- timeCreated: 1715592452
@@ -1,3 +0,0 @@
1
- fileFormatVersion: 2
2
- guid: 75fec9f95a0645f8af57bd8228b3df0f
3
- timeCreated: 1715590596