Commit a39cce4a authored by 黄奎's avatar 黄奎

页面修改

parent 1412e63b
using Mall.Model.Entity.User;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Enum.User;
using Mall.Model.Entity.User;
namespace Mall.Model.Extend.User
{
......@@ -10,6 +8,29 @@ namespace Mall.Model.Extend.User
/// </summary>
public class RB_Miniprogram_Admin_Extend: RB_Miniprogram_Admin
{
/// <summary>
/// 头像
/// </summary>
public string Photo { get; set; }
/// <summary>
/// 手机号码
/// </summary>
public string Moblie { get; set; }
/// <summary>
/// 昵称
/// </summary>
public string Name { get; set; }
/// <summary>
/// OpenId
/// </summary>
public string OpenId { get; set; }
/// <summary>
/// 来源
/// </summary>
public UserSourceEnum Source { get; set; }
}
}
......@@ -4,6 +4,8 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Mall.Common.Enum;
using VT.FW.DB.Dapper;
namespace Mall.Repository.User
{
......@@ -22,12 +24,14 @@ namespace Mall.Repository.User
/// <returns></returns>
public List<RB_Miniprogram_Admin_Extend> GetMiniprogramAdminPageRepository(int pageIndex, int pageSize, out long rowsCount, RB_Miniprogram_Admin_Extend query)
{
DynamicParameters parameters = new DynamicParameters();
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM rb_miniprogram_admin AS A
SELECT A.*,B.Photo,B.Moblie,B.`Name`,B.OpenId,B.Source
FROM rb_miniprogram_admin AS A LEFT JOIN rb_member_user AS B ON A.UserId=B.Id
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Miniprogram_Admin_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
......@@ -38,8 +42,17 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Miniprogram_Admin_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.Name))
{
builder.AppendFormat($@" and B.{nameof(RB_Miniprogram_Admin_Extend.Name)} like @Name ");
parameters.Add("Name", "%" + query.Name.Trim() + "%");
}
if (query.Source > 0)
{
builder.AppendFormat(" AND B.{0}={1} ", nameof(RB_Miniprogram_Admin_Extend.Source), (int)query.Source);
}
}
return GetPage<RB_Miniprogram_Admin_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString()).ToList();
return GetPage<RB_Miniprogram_Admin_Extend>(pageIndex, pageSize, out rowsCount, builder.ToString(), parameters).ToList();
}
}
}
......@@ -40,8 +40,16 @@ namespace Mall.WebApi.Controllers.User
_accessor = accessor;
}
/// <summary>
/// 小程序用户处理类
/// </summary>
private readonly UserModule userModule = new UserModule();
/// <summary>
/// 小程序管理员处理类
/// </summary>
private readonly MiniprogramAdminModule adminModule = new MiniprogramAdminModule();
#region 用户管理
/// <summary>
/// 获取用户分页列表
......@@ -876,6 +884,100 @@ namespace Mall.WebApi.Controllers.User
#endregion
#region 小程序管理员
/// <summary>
/// 获取小程序管理员分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMiniprogramAdminPage()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_Miniprogram_Admin_Extend demodel = new RB_Miniprogram_Admin_Extend()
{
UserId = parms.GetInt("UserId"),
Name=parms.GetStringValue("Name"),
Source=(UserSourceEnum)parms.GetInt("Source"),
};
demodel.TenantId = Convert.ToInt32(RequestParm.uid);
demodel.MallBaseId = RequestParm.MallBaseId;
var list = adminModule.GetMiniprogramAdminPageModule(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.AdminId,
x.UserId,
x.Photo,
x.Name,
x.Moblie,
x.OpenId,
x.Source,
SourceName=x.Source.GetEnumName(),
CreateDate= Common.ConvertHelper.FormatTime(x.CreateDate),
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 新增修改小程序管理员
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMiniprogramAdmin()
{
var parms = JObject.Parse(RequestParm.msg.ToString());
RB_Miniprogram_Admin_Extend demodel = new RB_Miniprogram_Admin_Extend()
{
AdminId = parms.GetInt("AdminId"),
CreateDate = DateTime.Now,
MallBaseId = RequestParm.MallBaseId,
TenantId = RequestParm.TenantId,
Status = Common.Enum.DateStateEnum.Normal,
UpdateDate = DateTime.Now,
UserId = parms.GetInt("UserId"),
};
if (demodel.UserId <= 0)
{
return ApiResult.ParamIsNull(message:"请选择小程序用户!");
}
bool flag = adminModule.SetMiniprogramAdminModule(demodel);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
/// <summary>
/// 删除小程序管理员
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DeleteMiniprogramAdmin()
{
var parms = JObject.Parse(RequestParm.msg.ToString());
var AdminId = parms.GetInt("AdminId");
if (AdminId <= 0)
{
return ApiResult.ParamIsNull(message: "请选择小程序用户!");
}
bool flag = adminModule.RemoveMiniprogramAdminModule(AdminId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#region 分销商基础
/// <summary>
......
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