using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HighWayIot.TouchSocket.Common
{
///
/// 通用返回信息类
///
public class MessageModel
{
///
/// 状态码
///
public int status { get; set; } = 200;
///
/// 操作是否成功
///
public bool success { get; set; } = false;
///
/// 返回信息
///
public string msg { get; set; } = "";
///
/// 开发者信息
///
public string msgDev { get; set; }
///
/// 返回数据集合
///
public T data { get; set; }
///
/// 返回成功
///
/// 消息
///
public static MessageModel Success(string msg)
{
return Message(true, msg, default);
}
///
/// 返回成功
///
/// 消息
/// 数据
///
public static MessageModel Success(string msg, T data)
{
return Message(true, msg, data);
}
///
/// 返回失败
///
/// 消息
///
public static MessageModel Fail(string msg)
{
return Message(false, msg, default);
}
///
/// 返回失败
///
/// 消息
/// 数据
///
public static MessageModel Fail(string msg, T data)
{
return Message(false, msg, data);
}
///
/// 返回消息
///
/// 失败/成功
/// 消息
/// 数据
///
public static MessageModel Message(bool success, string msg, T data)
{
return new MessageModel() { msg = msg, data = data, success = success };
}
}
///
/// MessageModel
///
public class MessageModel
{
///
/// 状态码
///
public int status { get; set; } = 200;
///
/// 操作是否成功
///
public bool success { get; set; } = false;
///
/// 返回信息
///
public string msg { get; set; } = "";
///
/// 返回数据集合
///
public object data { get; set; }
}
}