Commit 1533f968 authored by 吴春's avatar 吴春

提交代码

parent a61a6db9
...@@ -15,6 +15,8 @@ namespace Mall.Model.Extend.Miai ...@@ -15,6 +15,8 @@ namespace Mall.Model.Extend.Miai
public string Name { get; set; } public string Name { get; set; }
public int Age { get; set; }
/// <summary> /// <summary>
/// 头像 /// 头像
/// </summary> /// </summary>
......
...@@ -1034,6 +1034,22 @@ namespace Mall.Module.Miai ...@@ -1034,6 +1034,22 @@ namespace Mall.Module.Miai
{ {
return miai_BaseInfoRepository.GetFirstBaseInfoList( where); return miai_BaseInfoRepository.GetFirstBaseInfoList( where);
} }
/// <summary>
/// 首页插件匹配分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiAi_BaseInfo_Extend where, int Top)
{
return miai_BaseInfoRepository.GetMatchingBaseInfoList(where, Top);
}
#endregion #endregion
#region 我的粉丝/我的关注 #region 我的粉丝/我的关注
......
...@@ -104,7 +104,7 @@ namespace Mall.Repository.Miai ...@@ -104,7 +104,7 @@ namespace Mall.Repository.Miai
public List<RB_MiAi_BaseInfo_Extend> GetFirstBaseInfoPageList(int pageIndex, int pageSize, out long rowsCount, RB_MiAi_BaseInfo_Extend where) public List<RB_MiAi_BaseInfo_Extend> GetFirstBaseInfoPageList(int pageIndex, int pageSize, out long rowsCount, RB_MiAi_BaseInfo_Extend where)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name`,b.Photo from RB_MiAi_BaseInfo as a 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 "); LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ");
if (where != null) if (where != null)
{ {
...@@ -122,9 +122,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -122,9 +122,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
} }
if (where.UserId > 0) if (where.UserId > 0)
{ {
sb.AppendFormat(" and a.UserId={0}", where.UserId); sb.AppendFormat(" and a.UserId !={0}", where.UserId);
}
if (where.Sex > 0)
{
sb.AppendFormat(" and a.Sex !={0}", where.Sex);
} }
if (!string.IsNullOrWhiteSpace(where.UserIds)) if (!string.IsNullOrWhiteSpace(where.UserIds))
{ {
sb.AppendFormat(" and a.UserId in({0})", where.UserIds); sb.AppendFormat(" and a.UserId in({0})", where.UserIds);
...@@ -139,7 +142,7 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -139,7 +142,7 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
sb.AppendFormat($@" ORDER BY (((a.FollowNum* {where.FollowRate})+(a.BrowseNum*{where.BrowseRate}))) desc"); sb.AppendFormat($@" ORDER BY (((a.FollowNum* {where.FollowRate})+(a.BrowseNum*{where.BrowseRate}))) desc");
} }
else if (where.Sort ==3) else if (where.Sort == 3)
{ {
sb.AppendFormat(" ORDER BY b.CreateDate desc "); sb.AppendFormat(" ORDER BY b.CreateDate desc ");
} }
...@@ -149,6 +152,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -149,6 +152,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
/// <summary> /// <summary>
/// 分页列表 /// 分页列表
/// </summary> /// </summary>
...@@ -160,7 +169,7 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -160,7 +169,7 @@ 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> GetFirstBaseInfoList(RB_MiAi_BaseInfo_Extend where) public List<RB_MiAi_BaseInfo_Extend> GetFirstBaseInfoList(RB_MiAi_BaseInfo_Extend where)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name`,b.Photo from RB_MiAi_BaseInfo as a 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 "); LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklist!=1 ");
if (where != null) if (where != null)
{ {
...@@ -178,7 +187,11 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -178,7 +187,11 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
} }
if (where.UserId > 0) if (where.UserId > 0)
{ {
sb.AppendFormat(" and a.UserId={0}", where.UserId); sb.AppendFormat(" and a.UserId !={0}", where.UserId);
}
if (where.Sex > 0)
{
sb.AppendFormat(" and a.Sex !={0}", where.Sex);
} }
if (!string.IsNullOrWhiteSpace(where.UserIds)) if (!string.IsNullOrWhiteSpace(where.UserIds))
...@@ -200,7 +213,69 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -200,7 +213,69 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
sb.AppendFormat(" ORDER BY b.CreateDate desc "); sb.AppendFormat(" ORDER BY b.CreateDate desc ");
} }
} }
return Get<RB_MiAi_BaseInfo_Extend>( sb.ToString()).ToList(); return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
}
/// <summary>
/// 首页插件匹配分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiAi_BaseInfo_Extend where,int Top)
{
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
JOIN (
SELECT
ROUND(
RAND() * (
(SELECT MAX(id) FROM `RB_MiAi_BaseInfo`) - (SELECT MIN(id) FROM `RB_MiAi_BaseInfo`)
) + (SELECT MIN(id) FROM `RB_MiAi_BaseInfo`)
) AS id
) AS t2
LEFT JOIN rb_member_user as b on a.UserId=b.Id
WHERE
a.id >= t2.id and a.Status=0 and b.Blacklist!=1
ORDER BY
a.id
LIMIT {Top} ");
if (where != null)
{
if (where.TenantId > 0)
{
sb.AppendFormat(" and a.TenantId={0}", where.TenantId);
}
if (where.MallBaseId > 0)
{
sb.AppendFormat(" and a.MallBaseId={0}", where.MallBaseId);
}
if (where.Id > 0)
{
sb.AppendFormat(" and a.Id={0}", where.Id);
}
if (where.UserId > 0)
{
sb.AppendFormat(" and a.UserId!={0}", where.UserId);
}
if (where.Sex > 0)
{
sb.AppendFormat(" and a.Sex!={0}", where.Sex);
}
if (!string.IsNullOrWhiteSpace(where.UserIds))
{
sb.AppendFormat(" and a.UserId in({0})", where.UserIds);
}
}
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
} }
} }
} }
...@@ -101,6 +101,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -101,6 +101,10 @@ namespace Mall.WebApi.Controllers.MallBase
//店铺id //店铺id
int storeId = parms.GetInt("StoreId", 0); int storeId = parms.GetInt("StoreId", 0);
//用户id
int userId = RequestParm.UserId;
//用户性别
int sex = parms.GetInt("Sex", 0);
//首页数据 //首页数据
var homePage = new object(); var homePage = new object();
//底部导航 //底部导航
...@@ -177,7 +181,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -177,7 +181,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
foreach (var subItem in templateModel.ComponentDataList) foreach (var subItem in templateModel.ComponentDataList)
{ {
templateData.data.Add(MallHelper.PlusDataToObject(subItem, (miniProgram?.TenantId ?? 0), miniProgram.MallBaseId, RequestParm.SmallShopsId, isOpenSchool, storeId)); templateData.data.Add(MallHelper.PlusDataToObject(subItem, (miniProgram?.TenantId ?? 0), miniProgram.MallBaseId, RequestParm.SmallShopsId, isOpenSchool, sex, storeId,userId));
} }
} }
var tempObj = new var tempObj = new
...@@ -250,7 +254,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -250,7 +254,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
foreach (var subItem in templateModel.ComponentDataList) foreach (var subItem in templateModel.ComponentDataList)
{ {
templateData.data.Add(MallHelper.PlusDataToObject(subItem, (miniProgram?.TenantId ?? 0), miniProgram.MallBaseId, RequestParm.SmallShopsId, isOpenSchool, storeId)); templateData.data.Add(MallHelper.PlusDataToObject(subItem, (miniProgram?.TenantId ?? 0), miniProgram.MallBaseId, RequestParm.SmallShopsId, isOpenSchool, storeId, userId));
} }
} }
var tempObj = new var tempObj = new
......
This diff is collapsed.
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