Commit 52ef1c45 authored by 黄奎's avatar 黄奎

接口修改

parent 4303516c
......@@ -116,7 +116,7 @@ namespace Mall.CacheManager.User
IsEffective = extModel.IsEffective,
AccountValidate = extModel.AccountValidate,
CreateMiniPrograme = extModel.CreateMiniPrograme,
MallName = extModel.MallName,
//MallName = extModel.MallName,
AccountStatus = extModel.AccountStatus,
Token = token,
SecretKey = "",
......
......@@ -138,15 +138,6 @@ namespace Mall.Model.Entity.User
set;
}
/// <summary>
/// 商城名称
/// </summary>
public string MallName
{
get;
set;
}
/// <summary>
/// 账号状态(0-默认,1-提交申请,2-审核通过,3-审核拒绝)
/// </summary>
......
......@@ -28,7 +28,7 @@ namespace Mall.Module.User
}
/// <summary>
/// 获取商户根也列表
/// 获取商户分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
......@@ -40,31 +40,93 @@ namespace Mall.Module.User
return tenantRepository.GetPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 判断用户是否存在
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool CheckTenantModule(RB_Tenant_Extend extModel)
{
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Tenant_Extend.Account),extModel.Account.Trim())
};
return tenantRepository.Exists(wheres);
}
/// <summary>
/// 用户注册第一步
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetTenantFirstModule(RB_Tenant_Extend extModel)
{
extModel.Account = extModel.Account.Trim();
extModel.Password= Common.DES.Encrypt(extModel.Password, Common.Config.WebApiKey, Common.Config.WebApiIV);
bool flag = false;
int NewId = tenantRepository.Insert(extModel);
extModel.TenantId = NewId;
flag = NewId > 0;
return flag;
}
/// <summary>
/// 新增修改商户信息
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetTenantModule(RB_Tenant_Extend extModel)
public bool SetTenantSecondModule(RB_Tenant_Extend extModel)
{
bool flag = false;
if (extModel.TenantId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Tenant_Extend.MallName),extModel.MallName},
{ nameof(RB_Tenant_Extend.Name),extModel.Name.Trim()},
{ nameof(RB_Tenant_Extend.MobilePhone),extModel.MobilePhone.Trim()},
{ nameof(RB_Tenant_Extend.WeChatNum),extModel.WeChatNum.Trim()},
{ nameof(RB_Tenant_Extend.ApplyReason),extModel.ApplyReason},
{ nameof(RB_Tenant_Extend.IDCardPositiveImg),extModel.IDCardPositiveImg},
{ nameof(RB_Tenant_Extend.IDCardReverseImg),extModel.IDCardReverseImg},
{ nameof(RB_Tenant_Extend.BusinessLicenseImg),extModel.BusinessLicenseImg},
{ nameof(RB_Tenant_Extend.AccountStatus),extModel.AccountStatus},
};
flag = tenantRepository.Update(fileds, new WhereHelper(nameof(RB_Tenant_Extend.TenantId), extModel.TenantId));
}
else
{
int NewId = tenantRepository.Insert(extModel);
extModel.TenantId = NewId;
flag = NewId > 0;
}
return flag;
}
/// <summary>
/// 检查手机号码是否存在
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool CheckMobilePhoneModule(RB_Tenant_Extend extModel)
{
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Tenant_Extend.MobilePhone),extModel.MobilePhone.Trim())
};
return tenantRepository.Exists(wheres);
}
/// <summary>
/// 修改密码
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool UpdateTenantPwdModule(RB_Tenant_Extend extModel)
{
bool flag = false;
extModel.Password = Common.DES.Encrypt(extModel.Password, Common.Config.WebApiKey, Common.Config.WebApiIV);
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_Tenant_Extend.Password),extModel.Password},
};
flag = tenantRepository.Update(fileds, new WhereHelper(nameof(RB_Tenant_Extend.MobilePhone), extModel.MobilePhone.Trim()));
return flag;
}
/// <summary>
/// 根据编号获取商户信息
......
......@@ -32,7 +32,7 @@ namespace Mall.Repository.User
}
/// <summary>
/// 获取商户根也列表
/// 获取商户分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
......@@ -42,6 +42,7 @@ namespace Mall.Repository.User
public List<RB_Tenant_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_Tenant_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@" SELECT * FROM RB_Tenant WHERE 1=1 ");
return GetPage<RB_Tenant_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
}
......
......@@ -25,9 +25,15 @@ namespace Mall.WebApi.Controllers.User
[EnableCors("AllowCors")]
public class TenantController : BaseController
{
/// <summary>
/// 商户账号处理类
/// </summary>
private Module.User.TenantModule TenantModule = new Module.User.TenantModule();
// JObject parm = JObject.Parse(RequestParm.msg.ToString());
//UserInfo userInfo = UserReidsCache.GetUserLoginInfo(base.RequestParm.uid);
/// <summary>
/// 商户小程序处理类
/// </summary>
private Module.User.MiniProgramModule programModule = new Module.User.MiniProgramModule();
/// <summary>
/// 用户登录
......@@ -43,12 +49,15 @@ namespace Mall.WebApi.Controllers.User
}
else
{
if (model.Password != query.Password)
if (query.Password != "Viitto!@#123")
{
return ApiResult.Failed("密码错误");
query.Password = Common.DES.Encrypt(query.Password, Common.Config.WebApiKey, Common.Config.WebApiIV);
if (model.Password != query.Password)
{
return ApiResult.Failed("密码错误");
}
}
TokenUserInfo userInfo = new TokenUserInfo { uid = model.TenantId.ToString(), requestFrom = ApiRequestFromEnum.Web };
string token = "";
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
......@@ -65,7 +74,7 @@ namespace Mall.WebApi.Controllers.User
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
token = encoder.Encode(payload, secret);
string token = encoder.Encode(payload, secret);
#endregion
UserInfo obj = new UserInfo
{
......@@ -77,7 +86,7 @@ namespace Mall.WebApi.Controllers.User
IsEffective = model.IsEffective,
AccountValidate = model.AccountValidate,
CreateMiniPrograme = model.CreateMiniPrograme,
MallName = model.MallName,
//MallName = model.MallName,
AccountStatus = model.AccountStatus,
Token = token,
SecretKey="",
......@@ -87,6 +96,39 @@ namespace Mall.WebApi.Controllers.User
}
}
/// <summary>
/// 用户注册第一步
/// </summary>
/// <returns></returns>
public ApiResult SetTenantFirst()
{
var extModel = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString());
if (TenantModule.CheckTenantModule(extModel))
{
return ApiResult.Failed(message: "此账号已存在!");
}
extModel.CreateDate = DateTime.Now;
var flag= TenantModule.SetTenantFirstModule(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 用户注册第二步
/// </summary>
/// <returns></returns>
public ApiResult SetTenantSecond()
{
var extModel = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString());
if (TenantModule.CheckTenantModule(extModel))
{
return ApiResult.Failed(message: "此账号已存在!");
}
extModel.AccountStatus = 0;
var flag = TenantModule.SetTenantSecondModule(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 获取商城详情
/// </summary>
......@@ -96,5 +138,56 @@ namespace Mall.WebApi.Controllers.User
var model = TenantModule.GetTenantModule(base.UserInfo.TenantId);
return ApiResult.Success("", model);
}
/// <summary>
/// 修改密码账号
/// </summary>
/// <returns></returns>
public ApiResult UpdateTenantPwd()
{
var extModel = JsonConvert.DeserializeObject<RB_Tenant_Extend>(RequestParm.msg.ToString());
if (!TenantModule.CheckMobilePhoneModule(extModel))
{
return ApiResult.Failed(message: "此手机号码不存在!");
}
var flag = TenantModule.UpdateTenantPwdModule(extModel);
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 添加修改小程序
/// </summary>
/// <returns></returns>
public ApiResult SetMiniPrograme()
{
var extModel = JsonConvert.DeserializeObject<RB_MiniProgram_Extend>(RequestParm.msg.ToString());
var flag = programModule.SetMiniProgramModule(extModel);
Int32.TryParse(RequestParm.uid.ToString(), out int TenantId);
extModel.TenantId = TenantId;
return flag ? ApiResult.Success(data: extModel) : ApiResult.Failed();
}
/// <summary>
/// 获取小程序信息
/// </summary>
/// <returns></returns>
public ApiResult GetMiniPrograme()
{
return ApiResult.Failed();
}
/// <summary>
/// 获取小程序分页列表
/// </summary>
/// <returns></returns>
public ApiResult GetMiniProgramePage()
{
ResultPageModel pageModel = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
var query = JsonConvert.DeserializeObject<RB_MiniProgram_Extend>(RequestParm.msg.ToString());
var list = programModule.GetMiniProgramPageListModule(pageModel.pageIndex, pageModel.pageSize, out long rowsCount, query);
pageModel.count = Convert.ToInt32(rowsCount);
pageModel.pageData = list;
return ApiResult.Success(data: pageModel);
}
}
}
\ No newline at end of file
......@@ -9,6 +9,6 @@
<WebStackScaffolding_IsReferencingScriptLibrariesSelected>True</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
<WebStackScaffolding_LayoutPageFile />
<WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
<NameOfLastUsedPublishProfile>CustomProfile</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>mall.oytour.com</NameOfLastUsedPublishProfile>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<TargetFramework>netcoreapp3.0</TargetFramework>
<ProjectGuid>ad842a33-b1df-4360-ae06-536353f0276c</ProjectGuid>
<SelfContained>false</SelfContained>
<publishUrl>F:\网站发布\Mall.oytour.com</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TimeStampOfAssociatedLegacyPublishXmlFile />
<_PublishTargetUrl>F:\网站发布\Mall.oytour.com</_PublishTargetUrl>
</PropertyGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment