每日自动提交 2026-04-14 18:30
This commit is contained in:
@@ -126,6 +126,16 @@ namespace Assets.MyGame.Scripts.Net
|
||||
dic_API[APIType.User_ReadEmailMore] = "/api/User/ReadEmailMore";
|
||||
dic_API[APIType.User_GetNoReadCount] = "/api/User/GetNoReadCount";
|
||||
dic_API[APIType.User_GetEmailByPage] = "/api/User/GetEmailByPage";
|
||||
|
||||
// ---------------- Customer ----------------
|
||||
dic_API[APIType.Customer_Start] = "/customerapi/Customer/start";
|
||||
dic_API[APIType.Customer_Message] = "/customerapi/Customer/message";
|
||||
dic_API[APIType.Customer_Messages] = "/customerapi/Customer/messages/{conversationId}";
|
||||
dic_API[APIType.Customer_Conversations] = "/customerapi/Customer/conversations";
|
||||
dic_API[APIType.Customer_End] = "/customerapi/Customer/end";
|
||||
dic_API[APIType.Customer_Online] = "/customerapi/Customer/online";
|
||||
dic_API[APIType.Customer_Status] = "/customerapi/Customer/status";
|
||||
dic_API[APIType.Customer_ChatLog] = "/customerapi/Customer/chatlog/{conversationId}";
|
||||
}
|
||||
|
||||
// ---------------- GET ----------------
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net.APIRequest.Objs
|
||||
{
|
||||
/// <summary>
|
||||
/// 发起会话请求对象(POST)
|
||||
/// </summary>
|
||||
public class StartConversationObj : RequestObjBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public string userId;
|
||||
|
||||
/// <summary>
|
||||
/// 用户名称
|
||||
/// </summary>
|
||||
public string userName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送消息请求对象(POST)
|
||||
/// </summary>
|
||||
public class SendMessageObj : RequestObjBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话ID
|
||||
/// </summary>
|
||||
public string conversationId;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者类型(1:用户 2:客服)
|
||||
/// </summary>
|
||||
public int senderType;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者ID
|
||||
/// </summary>
|
||||
public string senderId;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者名称
|
||||
/// </summary>
|
||||
public string senderName;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者头像
|
||||
/// </summary>
|
||||
public string senderAvatar;
|
||||
|
||||
/// <summary>
|
||||
/// 内容类型(1:文字 2:图片)
|
||||
/// </summary>
|
||||
public int contentType;
|
||||
|
||||
/// <summary>
|
||||
/// 消息内容(文字内容或图片URL)
|
||||
/// </summary>
|
||||
public string content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结束会话请求对象(POST)
|
||||
/// </summary>
|
||||
public class EndConversationObj : RequestObjBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话ID
|
||||
/// </summary>
|
||||
public string conversationId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新客服状态请求对象(POST)
|
||||
/// </summary>
|
||||
public class UpdateCustomerStatusObj : RequestObjBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 客服用户ID
|
||||
/// </summary>
|
||||
public string userId;
|
||||
|
||||
/// <summary>
|
||||
/// 状态(0:离线 1:在线)
|
||||
/// </summary>
|
||||
public int status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 068e63fe851e0524a98e54d4246c6541
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net.APIRequest.Params
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取会话列表参数(GET)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class GetConversationsParam : RequestParamBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 客服ID(可选)
|
||||
/// </summary>
|
||||
public string customerId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取消息列表参数(GET)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class GetMessagesParam : RequestParamBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话ID
|
||||
/// </summary>
|
||||
public string conversationId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d88d23486653804688ff33c51c1dbb3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,125 @@
|
||||
using Assets.MyGame.Scripts.Net.API;
|
||||
using Assets.MyGame.Scripts.Net.APIRequest.Objs;
|
||||
using Assets.MyGame.Scripts.Net.APIRequest.Params;
|
||||
using Assets.MyGame.Scripts.Net.APIResponses.Customer_SubClass;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net
|
||||
{
|
||||
public static partial class APIRequestList
|
||||
{
|
||||
#region Customer
|
||||
|
||||
/// <summary>
|
||||
/// 发起会话(POST)
|
||||
/// 参数:userId、userName
|
||||
/// 返回:ConversationInfo(会话信息)
|
||||
/// </summary>
|
||||
public static void StartConversation(StartConversationObj req, Action<ConversationInfo> callback)
|
||||
{
|
||||
APIManager.Response<ConversationInfo>(APIType.Customer_Start, req, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送消息(POST)
|
||||
/// 参数:conversationId、senderType、senderId、senderName、senderAvatar、contentType、content
|
||||
/// 返回:CustomerMessageInfo(消息信息)
|
||||
/// </summary>
|
||||
public static void SendMessage(SendMessageObj req, Action<CustomerMessageInfo> callback)
|
||||
{
|
||||
APIManager.Response<CustomerMessageInfo>(APIType.Customer_Message, req, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取消息列表(GET)
|
||||
/// 参数:conversationId
|
||||
/// 返回:List<CustomerMessageInfo>(消息列表)
|
||||
/// </summary>
|
||||
public static void GetMessages(string conversationId, Action<List<CustomerMessageInfo>> callback)
|
||||
{
|
||||
APIManager.Response<List<CustomerMessageInfo>>(APIType.Customer_Messages, new GetMessagesParam
|
||||
{
|
||||
conversationId = conversationId
|
||||
}, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取会话列表(GET)
|
||||
/// 参数:customerId(可选)
|
||||
/// 返回:List<ConversationInfo>(会话列表)
|
||||
/// </summary>
|
||||
public static void GetConversations(Action<List<ConversationInfo>> callback)
|
||||
{
|
||||
APIManager.Response<List<ConversationInfo>>(APIType.Customer_Conversations, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取会话列表(GET,带客服ID筛选)
|
||||
/// 参数:customerId
|
||||
/// 返回:List<ConversationInfo>(会话列表)
|
||||
/// </summary>
|
||||
public static void GetConversations(string customerId, Action<List<ConversationInfo>> callback)
|
||||
{
|
||||
APIManager.Response<List<ConversationInfo>>(APIType.Customer_Conversations, new GetConversationsParam
|
||||
{
|
||||
customerId = customerId
|
||||
}, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 结束会话(POST)
|
||||
/// 参数:conversationId
|
||||
/// 返回:string(结果提示)
|
||||
/// </summary>
|
||||
public static void EndConversation(EndConversationObj req, Action<JObject> callback)
|
||||
{
|
||||
APIManager.Response<JObject>(APIType.Customer_End, req, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取在线客服列表(GET)
|
||||
/// 返回:List<CustomerOnlineInfo>(在线客服列表)
|
||||
/// </summary>
|
||||
public static void GetOnlineCustomers(Action<List<CustomerOnlineInfo>> callback)
|
||||
{
|
||||
APIManager.Response<List<CustomerOnlineInfo>>(APIType.Customer_Online, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新客服状态(POST)
|
||||
/// 参数:userId、status(0:离线 1:在线)
|
||||
/// 返回:string(结果提示)
|
||||
/// </summary>
|
||||
public static void UpdateCustomerStatus(UpdateCustomerStatusObj req, Action<JObject> callback)
|
||||
{
|
||||
APIManager.Response<JObject>(APIType.Customer_Status, req, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取聊天记录(GET)
|
||||
/// 参数:conversationId
|
||||
/// 返回:List<CustomerMessageInfo>(聊天记录列表)
|
||||
/// </summary>
|
||||
public static void GetChatLog(string conversationId, Action<List<CustomerMessageInfo>> callback)
|
||||
{
|
||||
APIManager.Response<List<CustomerMessageInfo>>(APIType.Customer_ChatLog, new GetMessagesParam
|
||||
{
|
||||
conversationId = conversationId
|
||||
}, callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传客服图片(POST,multipart/form-data)
|
||||
/// 参数:file(文件二进制)
|
||||
/// 返回:string(图片URL)
|
||||
/// </summary>
|
||||
public static void UploadCustomerImage(string filePath, Action<JObject> callback)
|
||||
{
|
||||
APIManager.Response<JObject>(APIType.ImageUpload_Upload, callback);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e45b4c1d33670b4390ab6ebe49f39b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22daf7fc589d73841957277b9fc22653
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net.APIResponses.Customer_SubClass
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话信息
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ConversationInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话ID
|
||||
/// </summary>
|
||||
public string id;
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public string userId;
|
||||
|
||||
/// <summary>
|
||||
/// 用户昵称
|
||||
/// </summary>
|
||||
public string userName;
|
||||
|
||||
/// <summary>
|
||||
/// 客服ID
|
||||
/// </summary>
|
||||
public string customerId;
|
||||
|
||||
/// <summary>
|
||||
/// 客服昵称
|
||||
/// </summary>
|
||||
public string customerName;
|
||||
|
||||
/// <summary>
|
||||
/// 会话状态
|
||||
/// </summary>
|
||||
public int status;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public string createTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息信息
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CustomerMessageInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话ID
|
||||
/// </summary>
|
||||
public string conversationId;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者类型(1:用户 2:客服)
|
||||
/// </summary>
|
||||
public int senderType;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者ID
|
||||
/// </summary>
|
||||
public string senderId;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者昵称
|
||||
/// </summary>
|
||||
public string senderName;
|
||||
|
||||
/// <summary>
|
||||
/// 发送者头像
|
||||
/// </summary>
|
||||
public string senderAvatar;
|
||||
|
||||
/// <summary>
|
||||
/// 内容类型(1:文字 2:图片)
|
||||
/// </summary>
|
||||
public int contentType;
|
||||
|
||||
/// <summary>
|
||||
/// 消息内容
|
||||
/// </summary>
|
||||
public string content;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public string createTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在线客服信息
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class CustomerOnlineInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 客服用户ID
|
||||
/// </summary>
|
||||
public string userId;
|
||||
|
||||
/// <summary>
|
||||
/// 客服名称
|
||||
/// </summary>
|
||||
public string userName;
|
||||
|
||||
/// <summary>
|
||||
/// 客服头像
|
||||
/// </summary>
|
||||
public string avatar;
|
||||
|
||||
/// <summary>
|
||||
/// 状态(0:离线 1:在线)
|
||||
/// </summary>
|
||||
public int status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发起会话结果(WebSocket 回调)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class StartConversationResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否成功
|
||||
/// </summary>
|
||||
public bool isOk;
|
||||
|
||||
/// <summary>
|
||||
/// 提示信息
|
||||
/// </summary>
|
||||
public string msg;
|
||||
|
||||
/// <summary>
|
||||
/// 会话信息
|
||||
/// </summary>
|
||||
public ConversationInfo conversation;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 新会话通知(WebSocket 回调,客服端)
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class NewConversationNotice
|
||||
{
|
||||
/// <summary>
|
||||
/// 会话ID
|
||||
/// </summary>
|
||||
public string conversationId;
|
||||
|
||||
/// <summary>
|
||||
/// 客服ID
|
||||
/// </summary>
|
||||
public string customerId;
|
||||
|
||||
/// <summary>
|
||||
/// 客服昵称
|
||||
/// </summary>
|
||||
public string customerName;
|
||||
|
||||
/// <summary>
|
||||
/// 用户ID
|
||||
/// </summary>
|
||||
public string userId;
|
||||
|
||||
/// <summary>
|
||||
/// 用户昵称
|
||||
/// </summary>
|
||||
public string userName;
|
||||
|
||||
/// <summary>
|
||||
/// 会话状态
|
||||
/// </summary>
|
||||
public int status;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public string createTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cf22438ff743a8849bf5a34f266d8b89
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Assets.MyGame.Scripts.Net.APIResponses.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 客服消息内容类型枚举
|
||||
/// </summary>
|
||||
public enum CustomerContentTypeEnum
|
||||
{
|
||||
文字=1,
|
||||
图片=2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 客服发送者类型枚举
|
||||
/// </summary>
|
||||
public enum CustomerSenderTypeEnum
|
||||
{
|
||||
用户=1,
|
||||
客服=2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 客服状态枚举
|
||||
/// </summary>
|
||||
public enum CustomerStatusEnum
|
||||
{
|
||||
离线=0,
|
||||
在线=1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f77543a314d6007428bf28ab4236bcd3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -270,5 +270,31 @@
|
||||
|
||||
/// <summary>获取邮件列表(POST)</summary>
|
||||
User_GetEmailByPage,
|
||||
|
||||
|
||||
// ---------------- Customer ----------------
|
||||
/// <summary>发起会话(POST)</summary>
|
||||
Customer_Start,
|
||||
|
||||
/// <summary>发送消息(POST)</summary>
|
||||
Customer_Message,
|
||||
|
||||
/// <summary>获取消息列表(GET)</summary>
|
||||
Customer_Messages,
|
||||
|
||||
/// <summary>获取会话列表(GET)</summary>
|
||||
Customer_Conversations,
|
||||
|
||||
/// <summary>结束会话(POST)</summary>
|
||||
Customer_End,
|
||||
|
||||
/// <summary>获取在线客服列表(GET)</summary>
|
||||
Customer_Online,
|
||||
|
||||
/// <summary>更新客服状态(POST)</summary>
|
||||
Customer_Status,
|
||||
|
||||
/// <summary>获取聊天记录(GET)</summary>
|
||||
Customer_ChatLog,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user