增加同步物流模块
修改现有架构,改为分模块( 简易版)
This commit is contained in:
1 parent
15e11618c9
commit
fa03add754
120 files changed
+9438
-299
No files matched your search
@@ -0,0 +1,59 @@
|
||||
using KJD_Web.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using Store.Framework.Dtos;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Controllers;
|
||||
|
||||
namespace Store.Framework.Base;
|
||||
|
||||
public abstract class ApiControllerBase : ApiController
|
||||
{
|
||||
|
||||
protected bool ValidateSign(SignRequestBase request, bool isUserLogin = false)
|
||||
{
|
||||
if (request == null || string.IsNullOrEmpty(request.time) || string.IsNullOrEmpty(request.code))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int time;
|
||||
if (!int.TryParse(request.time, out time))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (request.code != EncrypUtil.Encryption(time))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!isUserLogin && string.IsNullOrWhiteSpace(request.UserName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private bool IsAllowAnonymous(HttpActionContext context)
|
||||
{
|
||||
// Action 上
|
||||
if (context.ActionDescriptor.GetCustomAttributes<AllowAnonymousAttribute>().Any())
|
||||
return true;
|
||||
// Controller 上
|
||||
if (context.ControllerContext.ControllerDescriptor.ControllerType
|
||||
.GetCustomAttributes(typeof(AllowAnonymousAttribute), true).Any())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
private async Task<HttpResponseMessage> OkResponseAsync(object content)
|
||||
{
|
||||
IHttpActionResult result = Ok(content);
|
||||
return await result.ExecuteAsync(CancellationToken.None);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user