Commit 3047a285 authored by 黄奎's avatar 黄奎

页面修改

parent 52ef1c45
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Entity.User
{
/// <summary>
/// 小程序实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_MiniProgram
{
/// <summary>
/// 小程序主键Id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// 商户号
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 商城名称
/// </summary>
public string MallName
{
get;
set;
}
/// <summary>
/// 是否永久有效(1-永久有效)
/// </summary>
public int? IsEffective
{
get;
set;
}
/// <summary>
/// 商城有效期
/// </summary>
public DateTime? MallValidate
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 状态(0-正常,1-禁用)
/// </summary>
public int Status { get; set; }
}
}
using Mall.Common.AOP;
using System;
using System.Collections.Generic;
using System.Text;
namespace Mall.Model.Extend.User
{
/// <summary>
/// 小程序扩展实体类
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_MiniProgram_Extend : Model.Entity.User.RB_MiniProgram
{
/// <summary>
/// 账号
/// </summary>
public string Account { get; set; }
/// <summary>
/// 手机号码
/// </summary>
public string MobilePhone { get; set; }
/// <summary>
/// 小程序有效期
/// </summary>
public string EffectiveDateStr
{
get
{
string str = "";
if (this.IsEffective != null && this.IsEffective == 1)
{
str = "永久有效";
}
else
{
if (this.MallValidate != null)
{
str = Convert.ToDateTime(this.MallValidate).ToString("yyyy-MM-dd");
}
}
return str;
}
}
/// <summary>
/// 状态字符串
/// </summary>
public string StatusStr
{
get
{
string str = "正常";
if (this.Status == 1)
{
str = "禁用";
}
return str;
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Extend.User;
using Mall.Repository;
namespace Mall.Module.User
{
/// <summary>
/// 小程序处理类
/// </summary>
public class MiniProgramModule
{
/// <summary>
/// 商户仓储层对象
/// </summary>
private Mall.Repository.User.RB_MiniProgramRepository programRepository = new Repository.User.RB_MiniProgramRepository();
/// <summary>
/// 根据查询条件获取小程序列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_MiniProgram_Extend> GetTenantListModule(RB_MiniProgram_Extend query)
{
return programRepository.GetListRepository(query);
}
/// <summary>
/// 获取小程序分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_MiniProgram_Extend> GetMiniProgramPageListModule(int pageIndex, int pageSize, out long rowCount, RB_MiniProgram_Extend query)
{
return programRepository.GetPageListRepository(pageIndex, pageSize, out rowCount, query);
}
/// <summary>
/// 判断用户是否存在
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool CheckMiniProgramModule(RB_MiniProgram_Extend extModel)
{
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_MiniProgram_Extend.MallName),extModel.MallName.Trim())
};
return programRepository.Exists(wheres);
}
/// <summary>
/// 添加修改小程序
/// </summary>
/// <param name="extModel"></param>
/// <returns></returns>
public bool SetMiniProgramModule(RB_MiniProgram_Extend extModel)
{
bool flag = false;
if (extModel.IsEffective == 1)
{
extModel.MallValidate = null;
}
if (extModel.MallBaseId > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_MiniProgram_Extend.MallName),extModel.MallName.Trim()},
{ nameof(RB_MiniProgram_Extend.IsEffective),extModel.IsEffective},
{ nameof(RB_MiniProgram_Extend.MallValidate),extModel.MallValidate},
};
flag = programRepository.Update(fileds, new WhereHelper(nameof(RB_Tenant_Extend.TenantId), extModel.TenantId));
}
else
{
extModel.MallName = extModel.MallName.Trim();
extModel.CreateDate = DateTime.Now;
int NewId = programRepository.Insert(extModel);
extModel.MallBaseId = NewId;
flag = NewId > 0;
}
return flag;
}
/// <summary>
/// 根据编号获取小程序信息
/// </summary>
/// <param name="MallBaseId">小程序Id</param>
/// <returns></returns>
public RB_MiniProgram_Extend GetMiniProgramModule(object MallBaseId)
{
RB_MiniProgram_Extend extModel = programRepository.GetEntity<RB_MiniProgram_Extend>(MallBaseId);
if (extModel == null)
{
extModel = new RB_MiniProgram_Extend();
}
return extModel;
}
/// <summary>
/// 更新小程序状态
/// </summary>
/// <param name="MallBaseId">小程序Id</param>
/// <param name="Status">小程序状态</param>
/// <returns></returns>
public bool SetTenantStatusModule(object MallBaseId, int AccountStatus)
{
bool flag = false;
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{ nameof(RB_MiniProgram_Extend.Status),AccountStatus},
};
flag = programRepository.Update(fileds, new WhereHelper(nameof(RB_MiniProgram_Extend.MallBaseId), MallBaseId));
return flag;
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.User;
using Mall.Model.Extend.User;
using System.Linq;
namespace Mall.Repository.User
{
/// <summary>
/// 小程序仓储层
/// </summary>
public class RB_MiniProgramRepository : RepositoryBase<RB_MiniProgram>
{
/// <summary>
/// 根据查询条件获取小程序列表
/// </summary>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_MiniProgram_Extend> GetListRepository(RB_MiniProgram_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(" SELECT * FROM RB_MiniProgram WHERE 1=1 ");
if (query != null)
{
if (query.TenantId != null && query.TenantId > 0)
{
builder.AppendFormat(" AND TenantId='{0}' ", query.TenantId);
}
}
return Get<RB_MiniProgram_Extend>(builder.ToString()).ToList();
}
/// <summary>
/// 获取小程序分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="query">查询条件</param>
/// <returns></returns>
public List<RB_MiniProgram_Extend> GetPageListRepository(int pageIndex, int pageSize, out long rowCount, RB_MiniProgram_Extend query)
{
StringBuilder builder = new StringBuilder();
builder.Append(@"
SELECT A.*,B.Account,B.MobilePhone
FROM RB_MiniProgram AS A LEFT JOIN RB_Tenant AS B ON A.TenantId=B.TenantId
WHERE 1=1 ");
if (query != null)
{
if (query.TenantId != null && query.TenantId > 0)
{
builder.AppendFormat(" AND A.TenantId='{0}' ", query.TenantId);
}
if (query.MallName != null && !string.IsNullOrEmpty(query.MallName.Trim()))
{
builder.AppendFormat(" AND A.MallName LIKE '%{0}%' ", query.MallName.Trim());
}
}
return GetPage<RB_MiniProgram_Extend>(pageIndex, pageSize, out rowCount, builder.ToString()).ToList();
}
}
}
<?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