SourceCode/jiouosdp/Areas/Api/Models/IResponseMessage.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using JiouSDP.Models;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Web;
using System.Web.Script.Serialization;
namespace JiouSDP
{
/// <summary>
/// 响应客户端的消息
/// </summary>
public abstract class IResponseMessage
{
protected Uri Url;
protected CommonModel commonModel;
protected NameValueCollection param;
/// <summary>
/// 处理相应的逻辑
/// </summary>
/// <param name="commonModel">公共参数集合</param>
/// <param name="param">请求的所有参数集合</param>
/// <returns>返回消息给客户端</returns>
public abstract HttpResponseMessage Api(CommonModel commonModel, NameValueCollection param);
public HttpResponseMessage CallApi(Uri url, CommonModel commonModel, NameValueCollection param)
{
try
{
this.commonModel = commonModel;
this.param = param;
this.Url = url;
HttpResponseMessage rm = Api(commonModel, param);
return rm;
}
catch (Exception ex)
{
return ToResponseMessage(ex.Message, this.Url, this.commonModel, this.param);
}
}
/// <summary>
/// 转HttpResponseMessage消息
/// </summary>
/// <param name="obj">返回的类型</param>
/// <returns></returns>
public HttpResponseMessage ToResponseMessage(object obj)
{
return ToResponseMessage(obj, this.Url, this.commonModel, this.param);
}
/// <summary>
/// 转HttpResponseMessage消息
/// </summary>
/// <param name="obj">返回的类型</param>
/// <returns></returns>
后面还有 32 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。