| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 | 
							- using Microsoft.Owin;
 
- using Newtonsoft.Json;
 
- using System;
 
- using System.Collections.Generic;
 
- using System.Configuration;
 
- using System.Diagnostics;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Net.Http;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Web;
 
- using System.Web.Http;
 
- namespace XdCxRhDW.WebApi
 
- {
 
-     /// <summary>
 
-     /// 
 
-     /// </summary>
 
-     [RoutePrefix("")]
 
-     public class BaseController : ApiController
 
-     {
 
-         private readonly string uploadFolder;
 
-         /// <summary>
 
-         /// 
 
-         /// </summary>
 
-         public BaseController()
 
-         {
 
-             this.uploadFolder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot");
 
-         }
 
-         /// <summary>
 
-         /// 返回本地文件
 
-         /// </summary>
 
-         /// <param name="fileName"></param>
 
-         /// <returns></returns>
 
-         protected string GetLocalFile(string fileName)
 
-         {
 
-             return Path.Combine(this.uploadFolder, fileName);
 
-         }
 
-         /// <summary>
 
-         /// 获取客户端IP地址
 
-         /// </summary>
 
-         protected string RemoteIp
 
-         {
 
-             get
 
-             {
 
-                 var context = (OwinContext)Request.Properties.First().Value;
 
-                 return context.Request.RemoteIpAddress;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 返回成功
 
-         /// </summary>
 
-         /// <param name="data">返回的数据</param>
 
-         /// <returns></returns>
 
-         protected AjaxResult Success(object data = null)
 
-         {
 
-             AjaxResult res = new AjaxResult
 
-             {
 
-                 code = 200,
 
-                 msg = "请求成功!",
 
-                 data = data
 
-             };
 
-             return res;
 
-         }
 
-         /// <summary>
 
-         /// 返回成功
 
-         /// </summary>
 
-         /// <param name="msg">返回的消息</param>
 
-         /// <param name="data">返回的数据</param>
 
-         /// <returns></returns>
 
-         protected AjaxResult Success(object data, string msg = "请求成功!")
 
-         {
 
-             AjaxResult res = new AjaxResult
 
-             {
 
-                 code = 200,
 
-                 msg = msg,
 
-                 data = data
 
-             };
 
-             return res;
 
-         }
 
-         /// <summary>
 
-         /// 返回成功
 
-         /// </summary>
 
-         /// <param name="msg">返回的消息</param>
 
-         /// <param name="data">返回的数据</param>
 
-         /// <returns></returns>
 
-         protected AjaxResult<T> Success<T>(T data, string msg = "请求成功!")
 
-         {
 
-             AjaxResult<T> res = new AjaxResult<T>
 
-             {
 
-                 code = 200,
 
-                 msg = msg,
 
-                 data = data
 
-             };
 
-             return res;
 
-         }
 
-         /// <summary>
 
-         /// 返回错误
 
-         /// </summary>
 
-         /// <param name="msg">错误提示</param>
 
-         /// <returns></returns>
 
-         protected AjaxResult Error(string msg)
 
-         {
 
-             AjaxResult res = new AjaxResult
 
-             {
 
-                 code = 0,
 
-                 msg = msg,
 
-                 data = null
 
-             };
 
-             return res;
 
-         }
 
-         /// <summary>
 
-         /// 返回错误
 
-         /// </summary>
 
-         /// <param name="msg">错误提示</param>
 
-         /// <returns></returns>
 
-         protected AjaxResult<T> Error<T>(string msg)
 
-         {
 
-             AjaxResult<T> res = new AjaxResult<T>
 
-             {
 
-                 code = 0,
 
-                 msg = msg,
 
-                 data = default
 
-             };
 
-             return res;
 
-         }
 
-     }
 
- }
 
 
  |