Commit 9d5e0257 authored by 黄奎's avatar 黄奎

页面修改

parent f07e3761
......@@ -161,5 +161,10 @@ namespace Mall.Common
/// 后台Token
/// </summary>
public string AdminToken { get; set; }
/// <summary>
/// 用户所在群组
/// </summary>
public string UserGroupIds { get; set; }
}
}
\ No newline at end of file
......@@ -369,5 +369,10 @@ namespace Mall.Model.Entity.BaseSetUp
/// 查看微信次数
/// </summary>
public int LookWeChatTimes { get; set; }
/// <summary>
/// 是否开启引导页(1-是)
/// </summary>
public int IsOpenGuide { get; set; }
}
}
......@@ -70,5 +70,10 @@ namespace Mall.Model.Entity.User
/// 排序
/// </summary>
public int PageSort { get; set; }
/// <summary>
/// 分组
/// </summary>
public int GroupId { get; set; }
}
}
......@@ -33,6 +33,11 @@ namespace Mall.Model.Extend.Miai
/// </summary>
public string UserIds { get; set; }
/// <summary>
/// 用户所在分组
/// </summary>
public string UserGroupIds { get; set; }
/// <summary>
/// 0-指定用户,1-按照匹配度,2-按照热度,3-按照最新
/// </summary>
......@@ -132,6 +137,11 @@ namespace Mall.Model.Extend.Miai
/// 查询条件的id
/// </summary>
public int QueryId { get; set; }
/// <summary>
/// 用户所在分组
/// </summary>
public string UserGroupIds { get; set; }
}
......
......@@ -918,9 +918,8 @@ namespace Mall.Module.BaseSetUp
/// <returns></returns>
public bool AddOrUpdateFileStore(RB_File_Store model)
{
bool result = false;
int id = 0;
bool result;
int id;
if (model.ID == 0)
{
id = storeRepository.Insert(model);
......@@ -1424,9 +1423,8 @@ namespace Mall.Module.BaseSetUp
/// <returns></returns>
public bool AddOrUpdateVideoStore(RB_Video_Store model)
{
bool result = false;
int id = 0;
bool result;
int id;
if (model.ID == 0)
{
id = videoStoreRepository.Insert(model);
......
This diff is collapsed.
......@@ -806,7 +806,8 @@ namespace Mall.Module.User
z.PageSort,
z.MenuName,
z.MenuIcon,
z.MenuUrl
z.MenuUrl,
z.GroupId,
})
}));
}
......@@ -936,6 +937,7 @@ namespace Mall.Module.User
{ nameof(RB_MiniProgram_UserCenterMenu_Extend.MenuIcon),item.MenuIcon},
{ nameof(RB_MiniProgram_UserCenterMenu_Extend.MenuUrl),item.MenuUrl},
{ nameof(RB_MiniProgram_UserCenterMenu_Extend.PageSort),item.PageSort},
{ nameof(RB_MiniProgram_UserCenterMenu_Extend.GroupId),item.GroupId},
};
flag = centerMenuRepository.Update(detailesFileds, new WhereHelper(nameof(RB_MiniProgram_UserCenterMenu_Extend.DetailId), item.DetailId));
}
......
......@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using Mall.Model.Entity.Miai;
using Mall.Model.Extend.Miai;
using Mall.Repository.User;
namespace Mall.Repository.Miai
{
......@@ -14,6 +15,11 @@ namespace Mall.Repository.Miai
/// </summary>
public string TableName { get { return nameof(RB_MiAi_BaseInfo); } }
/// <summary>
/// 用户所在分组仓储层对象
/// </summary>
private readonly RB_Member_GroupRepository member_GroupRepository = new RB_Member_GroupRepository();
/// <summary>
/// 获取列表
/// </summary>
......@@ -45,9 +51,6 @@ namespace Mall.Repository.Miai
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
......@@ -105,10 +108,41 @@ namespace Mall.Repository.Miai
public List<RB_MiAi_BaseInfo_Extend> GetFirstBaseInfoPageList(int pageIndex, int pageSize, out long rowsCount, RB_MiAi_BaseInfo_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age from RB_MiAi_BaseInfo as a
LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ");
sb.Append($@"
SELECT a.*,b.`Name`,b.Photo,(YEAR (curdate())- YEAR (a.Birthday )- 1+ (DATE_FORMAT(a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age
FROM RB_MiAi_BaseInfo as a LEFT JOIN rb_member_user as b on a.UserId=b.Id
WHERE a.Status=0 AND b.Blacklist!=1 ");
//HK 2021-10-28 新增
sb.Append(" AND b.IsShow=1 ");
List<int> groupIdList = new List<int>();
if (!string.IsNullOrEmpty(where.UserGroupIds))
{
groupIdList = member_GroupRepository.GetLookGroupIdsRepository(new Model.Extend.User.RB_Member_Group_Extend()
{
TenantId = where.TenantId ?? 0,
MallBaseId = where.MallBaseId ?? 0,
Q_GroupIds = where.UserGroupIds,
});
}
if (where != null)
{
if (groupIdList != null && groupIdList.Count > 0)
{
string tempStr = "";
for (var i = 0; i < groupIdList.Count; i++)
{
if (i > 0)
{
tempStr += " OR ";
}
tempStr += string.Join(" FIND_IN_SET('{0}',b.BelongGroupIds) ", groupIdList[i]);
}
if (!string.IsNullOrEmpty(tempStr))
{
sb.AppendFormat(" and ({0})", tempStr);
}
}
if (where.TenantId > 0)
{
sb.AppendFormat(" and a.TenantId={0}", where.TenantId);
......@@ -255,11 +289,6 @@ LEFT JOIN rb_member_user as b on c.UserId=b.Id where c.Status=0 and b.Blacklist
return GetPage<RB_MiAi_BaseInfo_Extend>(pageIndex, pageSize, out rowsCount, sb.ToString()).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
......@@ -271,10 +300,40 @@ LEFT JOIN rb_member_user as b on c.UserId=b.Id where c.Status=0 and b.Blacklist
public List<RB_MiAi_BaseInfo_Extend> GetFirstBaseInfoList(RB_MiAi_BaseInfo_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age from RB_MiAi_BaseInfo as a
LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ");
sb.Append($@"
SELECT a.*,b.`Name`,b.Photo,(YEAR (curdate())- YEAR (a.Birthday)- 1+ (DATE_FORMAT(a.Birthday,'%m%d')<=(DATE_FORMAT(curdate(),'%m%d')))) Age
FROM RB_MiAi_BaseInfo as a LEFT JOIN rb_member_user as b on a.UserId=b.Id
WHERE a.Status=0 and b.Blacklist!=1 ");
//HK 2021-10-28 新增
sb.Append(" and b.IsShow=1 ");
List<int> groupIdList = new List<int>();
if (!string.IsNullOrEmpty(where.UserGroupIds))
{
groupIdList= member_GroupRepository.GetLookGroupIdsRepository(new Model.Extend.User.RB_Member_Group_Extend()
{
TenantId = where.TenantId ?? 0,
MallBaseId = where.MallBaseId ?? 0,
Q_GroupIds=where.UserGroupIds,
});
}
if (where != null)
{
if (groupIdList != null && groupIdList.Count > 0)
{
string tempStr = "";
for (var i = 0; i < groupIdList.Count; i++)
{
if (i > 0)
{
tempStr += " OR ";
}
tempStr += string.Join(" FIND_IN_SET('{0}',b.BelongGroupIds) ", groupIdList[i]);
}
if (!string.IsNullOrEmpty(tempStr))
{
sb.AppendFormat(" and ({0})", tempStr);
}
}
if (where.TenantId > 0)
{
sb.AppendFormat(" and a.TenantId={0}", where.TenantId);
......@@ -307,7 +366,6 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
}
else if (where.Sort == 2)
{
sb.AppendFormat($@" ORDER BY (((a.FollowNum* {where.FollowRate})+(a.BrowseNum*{where.BrowseRate}))) desc");
}
else if (where.Sort == 3)
......@@ -318,9 +376,6 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
}
/// <summary>
/// 首页插件匹配分页列表
/// </summary>
......@@ -332,9 +387,13 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiaiMember_Extend where, int Top)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from (SELECT
a. *,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age FROM
`RB_MiAi_BaseInfo` AS a LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ) as a where 1=1");
sb.Append($@"
SELECT * from (
SELECT a. *,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age
FROM `RB_MiAi_BaseInfo` AS a LEFT JOIN rb_member_user as b on a.UserId=b.Id
WHERE a.Status=0 and b.Blacklist!=1
) as a
where 1=1");
if (where != null)
{
if (where.TenantId > 0)
......@@ -422,8 +481,6 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
}
/// <summary>
/// 获取每日随机基础信息
/// </summary>
......@@ -432,7 +489,6 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetDailyRandomList(RB_MiaiMember_Extend where, int Top)
{
StringBuilder sb = new StringBuilder();
sb.Append($@" SELECT * FROM rb_miai_baseinfo as a where a.`Status`=0 ");
if (where != null)
......
......@@ -94,6 +94,46 @@ WHERE 1=1
return Get<RB_Member_Group_Extend>(builder.ToString(), parameters).ToList();
}
/// <summary>
/// 根据用户分组编号查询用户可查看的用户分组
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
public List<int> GetLookGroupIdsRepository(RB_Member_Group_Extend query)
{
List<int> ids = new List<int>(); ;
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*
FROM RB_Member_Group AS A
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Member_Group_Extend.Status), (int)DateStateEnum.Normal);
if (query != null)
{
if (query.TenantId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Member_Group_Extend.TenantId), query.TenantId);
}
if (query.MallBaseId > 0)
{
builder.AppendFormat(" AND A.{0}={1} ", nameof(RB_Member_Group_Extend.MallBaseId), query.MallBaseId);
}
if (!string.IsNullOrEmpty(query.Q_GroupIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ", nameof(RB_Member_Group_Extend.GroupId), query.Q_GroupIds);
}
}
var list = Get<RB_Member_Group_Extend>(builder.ToString()).ToList();
if (list != null && list.Count > 0)
{
ids = Common.ConvertHelper.StringToList(string.Join(",", list.Select(qitem => qitem.LookGroupIds))) ;
}
return ids;
}
/// <summary>
/// 修改默认分组
/// </summary>
......
......@@ -611,6 +611,7 @@ namespace Mall.WebApi.Controllers.MallBase
icon_url = qitem.MenuIcon,
name = qitem.MenuName,
link_url = qitem.MenuUrl.Trim(),
groupId = qitem.GroupId,
open_type = "navigate",
@params = "",
})
......
......@@ -1302,13 +1302,15 @@ namespace Mall.WebApi.Controllers
//详情-人物插件
case "miaiuser":
var miAiUserItem = subItem.data as MiAiUserItem;
if (miAiUserItem != null)
{
int Sex = 0;
int Age = 0;
string userGroupIds = "";//用户所在的分组
if (UserId > 0)//说明用户登录了的
{
var userInfo = userModule.GetMemberUserEntityModule(new RB_Member_User_Extend() { Id = UserId });
userGroupIds = userInfo?.BelongGroupIds;
//查看用户的
var baseInfo = miaiModule.GetBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend { TenantId = TenantId, MallBaseId = MallBaseId, UserId = UserId }).FirstOrDefault();
if (baseInfo != null)
......@@ -1322,7 +1324,6 @@ namespace Mall.WebApi.Controllers
}
catch (Exception)
{
Age = 0;
}
}
......@@ -1343,7 +1344,8 @@ namespace Mall.WebApi.Controllers
TenantId = TenantId,
MallBaseId = MallBaseId,
UserIds = Ids,
UserId = UserId
UserId = UserId,
UserGroupIds= userGroupIds,
});
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var goodItem in miAiUserItem.list)
......@@ -1399,10 +1401,9 @@ namespace Mall.WebApi.Controllers
TenantId = TenantId,
MallBaseId = MallBaseId,
UserId = UserId,
Sex = Sex
Sex = Sex,
UserGroupIds=userGroupIds,
};
if (Sex > 0)
{
var queryBaseInfoModel = miaiModule.GetBaseInfoQueryList(new Model.Entity.Miai.RB_MiAi_BaseInfoQuery
......@@ -1435,7 +1436,6 @@ namespace Mall.WebApi.Controllers
foreach (var tempGood in tempGoodsList)
{
var lastItem = new miaiUserDetail();
// var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0)
{
lastItem.id = tempGood.UserId;
......@@ -1483,6 +1483,7 @@ namespace Mall.WebApi.Controllers
Sort = 2,
Sex = Sex,
UserId = UserId,
UserGroupIds=userGroupIds,
FollowRate = miAiUserItem.FollowRate == 0 ? 1 : miAiUserItem.FollowRate,
BrowseRate = miAiUserItem.BrowseRate == 0 ? 1 : miAiUserItem.BrowseRate,
});
......@@ -1490,7 +1491,6 @@ namespace Mall.WebApi.Controllers
foreach (var tempGood in tempGoodsList)
{
var lastItem = new miaiUserDetail();
// var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0)
{
lastItem.id = tempGood.UserId;
......@@ -1537,7 +1537,8 @@ namespace Mall.WebApi.Controllers
MallBaseId = MallBaseId,
Sort = 3,
Sex = Sex,
UserId = UserId
UserId = UserId,
UserGroupIds=userGroupIds,
});
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var tempGood in tempGoodsList)
......@@ -1590,8 +1591,6 @@ namespace Mall.WebApi.Controllers
data = miAiUserItem
};
break;
case "miaiactivitytype":
var miAiActivityTypeItemInfo = subItem.data as MiAiActivityTypeItem;
if (miAiActivityTypeItemInfo != null)
......@@ -3432,6 +3431,7 @@ namespace Mall.WebApi.Controllers
IsShowRecharge = rechargeModel.IsOpenBtn,
IsDeposit = mallBaseModel?.DepositFun ?? 0,
IsOpenReserve = (miniProgram?.IsOpenReserve ?? 0),
IsOpenGuide= mallBaseModel?.IsOpenGuide??0,//是否开启引导页
};
#endregion
return setting;
......
......@@ -91,7 +91,6 @@ namespace Mall.WebApi.Controllers.MallBase
[HttpPost]
public ApiResult GetLogistics()
{
var parms = RequestParm;
var query = JsonConvert.DeserializeObject<RB_Logistics>(RequestParm.msg.ToString());
query.TenantId = UserInfo.TenantId;
var oldLogisticsModel = mallBaseModule.GetLogisticsList(query).FirstOrDefault();
......
......@@ -280,7 +280,8 @@ namespace Mall.WebApi.Controllers.User
UserTeacher = 0,
IsAddBaseInfo = 0,
IsOpenMiAi = mmodel.IsOpenMiAi,
IsAdmin = 0
IsAdmin = 0,
UserGroupIds=demodel.BelongGroupIds,
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + UserId, appletUserInfo, Config.JwtExpirTime);
if (isGiveCoupon)
......@@ -351,6 +352,7 @@ namespace Mall.WebApi.Controllers.User
IsOpenMiAi = mmodel.IsOpenMiAi,
IsAdmin = umodel.IsAdmin,
AdminId=umodel.AdminId,
UserGroupIds = umodel.BelongGroupIds,
};
if (umodel.AdminId > 0)
{
......@@ -784,9 +786,6 @@ namespace Mall.WebApi.Controllers.User
#endregion
#region 小程序获取手机号码
/// <summary>
/// 获取手机号码
......@@ -856,6 +855,5 @@ namespace Mall.WebApi.Controllers.User
return ApiResult.Success("", _telPhone);
}
#endregion
}
}
\ 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