Commit 88f9e7d9 authored by liudong1993's avatar liudong1993

1

parents 63d56a9c eabd135a
......@@ -52,6 +52,11 @@ namespace Mall.Common.Enum.MiAi
/// </summary>
[EnumField("违规通知")]
ViolationNotice = 9,
/// <summary>
/// 关注会员
/// </summary>
[EnumField("关注会员")]
FollowMember = 10,
}
}
......@@ -18,6 +18,9 @@ namespace Mall.Model.Extend.Education
/// </summary>
public string TalkContent { get; set; }
public string Ids { get; set; }
#region 扩展字段
/// <summary>
/// 操作人
......
......@@ -15,6 +15,8 @@ namespace Mall.Model.Extend.Miai
public string Name { get; set; }
public int Age { get; set; }
/// <summary>
/// 头像
/// </summary>
......
......@@ -21,6 +21,11 @@ namespace Mall.Module.Education
private readonly Rb_Education_DynamicMessageRepository messageRepository = new Rb_Education_DynamicMessageRepository();
private readonly Rb_Education_TalkRepository education_TalkRepository = new Rb_Education_TalkRepository();
/// <summary>
/// 消息
/// </summary>
private readonly Repository.Miai.RB_Miai_MessageRepository miai_MessageRepository = new Repository.Miai.RB_Miai_MessageRepository();
/// <summary>
/// 获取消息未读数
/// </summary>
......@@ -319,6 +324,22 @@ namespace Mall.Module.Education
MallBaseId = article.MallBaseId
};
messageRepository.Insert(message, trans);
//设置消息推送
miai_MessageRepository.Insert(new Model.Extend.Miai.RB_Miai_Message_Extend()
{
Id = 0,
Type = Common.Enum.MiAi.MessageTypeEnum.CircleLike,
UserId = article.CreateBy ?? 0,
SourceId = model.ArticleId,
Content = "又有新用户点赞了您的动态",
Status = 0,
TenantId = model.TenantId,
MallBaseId = model.MallBaseId,
CreateBy = model.UserId,
CreateDate = DateTime.Now,
UpdateDate = DateTime.Now
}, trans);
}
likeRepository.DBSession.Commit();
return true;
......@@ -419,6 +440,21 @@ namespace Mall.Module.Education
MallBaseId = article.MallBaseId
};
messageRepository.Insert(message);
//设置消息推送
miai_MessageRepository.Insert(new Model.Extend.Miai.RB_Miai_Message_Extend()
{
Id = 0,
Type = Common.Enum.MiAi.MessageTypeEnum.CircleReply,
UserId = article.CreateBy ?? 0,
SourceId = comment.ArticleId,
Content = Common.Plugin.StringHelper.FromUnicodeString( comment.Content),
Status = 0,
TenantId = comment.TenantId,
MallBaseId = comment.MallBaseId,
CreateBy = comment.UserId,
CreateDate = DateTime.Now,
UpdateDate = DateTime.Now
});
}
return true;
}
......@@ -501,6 +537,25 @@ namespace Mall.Module.Education
/// <summary>
/// 详情我的动态列表
/// </summary>
/// <param name="empId">员工id</param>
/// <param name="groupId">集团id</param>
/// <param name="pageIndex">当前页</param>
/// <param name="pageSize">分页大小</param>
/// <param name="count">总条数</param>
/// <returns></returns>
public List<Rb_Education_Dynamic_Extend> GetMiAiAllDynamicList(Rb_Education_Dynamic_Extend model)
{
List<Rb_Education_Dynamic_Extend> articleList = new List<Rb_Education_Dynamic_Extend>();
articleList = articleRepository.GetMiAiAllDynamicList( model);
DecoratorDynameicArticle(articleList);
return articleList;
}
/// <summary>
/// 动态详情
/// </summary>
......
......@@ -52,6 +52,10 @@ namespace Mall.Module.Education
private readonly RB_Education_CouponSelfMotionRepository selfMotionRepository = new RB_Education_CouponSelfMotionRepository();
/// <summary>
/// 消息
/// </summary>
private readonly Repository.Miai.RB_Miai_MessageRepository miai_MessageRepository = new Repository.Miai.RB_Miai_MessageRepository();
/// <summary>
/// 课程
/// </summary>
......@@ -3298,6 +3302,21 @@ namespace Mall.Module.Education
/// <returns></returns>
public bool SetEducationViolationLog(RB_Education_ViolationLog model)
{
//设置消息推送
miai_MessageRepository.Insert(new Model.Extend.Miai.RB_Miai_Message_Extend()
{
Id = 0,
Type = Common.Enum.MiAi.MessageTypeEnum.ViolationNotice,
UserId = model.UserId ?? 0,
SourceId =0,
Content = "您评论内容出现违规文字",
Status = 0,
TenantId = model.TenantId,
MallBaseId = model.MallBaseId,
CreateBy = model.UserId ?? 0,
CreateDate = DateTime.Now,
UpdateDate = DateTime.Now
});
return educationViolationLogRepository.Insert(model) > 0;
}
......
......@@ -229,7 +229,8 @@ namespace Mall.Module.Miai
public List<RB_Miai_Message_Extend> GetMiaiMessagePageList(int pageIndex, int pageSize, out long count, RB_Miai_Message_Extend demodel)
{
var list = miaiCommonModule.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) {
if (list.Any())
{
//每种类型 额外返回数据
//拼拼活动
var activityList = list.Where(x => x.Type == Common.Enum.MiAi.MessageTypeEnum.SpellEnroll || x.Type == Common.Enum.MiAi.MessageTypeEnum.SpellEnrollCancel
......@@ -281,7 +282,8 @@ namespace Mall.Module.Miai
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public bool DelMiaiMessageInfo(int Id) {
public bool DelMiaiMessageInfo(int Id)
{
return miaiCommonModule.DelMessage(Id);
}
......@@ -340,7 +342,8 @@ namespace Mall.Module.Miai
};
return miai_DatingRepository.Update(keyValues, wheres);
}
else {
else
{
return miai_DatingRepository.Insert(demodel) > 0;
}
}
......@@ -821,7 +824,8 @@ namespace Mall.Module.Miai
else
{
bool flag = miai_ActivityDiscussRepository.Insert(demodel) > 0;
if (flag) {
if (flag)
{
var model = miai_ActivityRepository.GetEntity(demodel.ActivityId);
if (model != null && model.UserId != demodel.UserId)
{
......@@ -998,11 +1002,13 @@ namespace Mall.Module.Miai
int WoManPeopleNum = miai_ActivityEnrollRepository.GetActivityEnrollNum(demodel.Id, 2);
if (model.WoManNum <= WoManPeopleNum) { return "已报满,无法报名"; }
}
else {
else
{
return "性别未维护,无法报名";
}
bool flag = miai_ActivityEnrollRepository.Insert(demodel) > 0;
if (flag) {
if (flag)
{
if (model.UserId != demodel.UserId)
{
//设置消息推送
......@@ -1056,7 +1062,8 @@ namespace Mall.Module.Miai
};
bool flag = miai_ActivityEnrollRepository.Update(keyValues, wheres);
if (flag) {
if (flag)
{
if (amodel.UserId != model.UserId)
{
//设置消息推送
......@@ -1220,7 +1227,23 @@ namespace Mall.Module.Miai
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetFirstBaseInfoList(RB_MiAi_BaseInfo_Extend where)
{
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
......@@ -1235,13 +1258,18 @@ namespace Mall.Module.Miai
bool flag = false;
try
{
int Id = 0;
bool isFollowNum = false;
if (model.ID == 0)
{
flag = miai_FollowMemberRepository.Insert(model) > 0;
Id = miai_FollowMemberRepository.Insert(model);
flag = Id > 0;
baseInfo.FollowNum += 1;
isFollowNum = true;
}
else
{
Id = model.ID;
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Education_FollowTeacher.UpdateDate),System.DateTime.Now},
{ nameof(RB_Education_FollowTeacher.Status),model.Status}
......@@ -1260,6 +1288,7 @@ namespace Mall.Module.Miai
else
{
baseInfo.FollowNum += 1;
isFollowNum = true;
}
flag = miai_FollowMemberRepository.Update(keyValues, wheres);
}
......@@ -1277,6 +1306,25 @@ namespace Mall.Module.Miai
}
};
miai_BaseInfoRepository.Update(keyValues, wheres);
if (isFollowNum && Id > 0)
{
//设置消息推送
miaiCommonModule.SetMessage(new RB_Miai_Message_Extend()
{
Id = 0,
Type = Common.Enum.MiAi.MessageTypeEnum.FollowMember,
UserId = model.UserId,
SourceId = Id,
Content = "又有新用户偷偷关注你了您",
Status = 0,
TenantId = model.TenantId,
MallBaseId = model.MallBaseId,
CreateBy = model.CreateBy,
CreateDate = DateTime.Now,
UpdateDate = DateTime.Now
});
}
}
}
catch (Exception ex)
......
......@@ -359,6 +359,52 @@ LEFT JOIN rb_education_talk as talk on talk.id=t.tid and talk.`Status`= 0 where
/// <summary>
/// 详情我的动态列表
/// </summary>
/// <param name="empId">员工id</param>
/// <param name="groupId">集团id</param>
/// <param name="pageIndex">当前页</param>
/// <param name="pageSize">分页大小</param>
/// <param name="count">总条数</param>
/// <returns></returns>
public List<Rb_Education_Dynamic_Extend> GetMiAiAllDynamicList(Rb_Education_Dynamic_Extend model)
{
string where = " where a.`Status`=0 ";
if (model != null)
{
if (model.TenantId > 0)
{
where += $@" and a.TenantId = {model.TenantId} ";
}
if (model.MallBaseId > 0)
{
where += $@" and a.MallBaseId = {model.MallBaseId} ";
}
if (model.Id > 0)
{
where += $@" and a.Id = {model.Id} ";
}
if (model.CreateBy > 0)
{
where += $@" and a.CreateBy = {model.CreateBy} ";
}
if (!string.IsNullOrWhiteSpace(model.Ids))
{
where += $@" and a.Id in({model.Ids}) ";
}
}
string sql = $@"SELECT e.`Name` as CreateByName,e.Photo as CrearteByPhoto,a.TenantId,a.MallBaseId,a.CreateBy,a.id,a.UserTeacher,a.Content,a.Files,a.LatAndLong,a.Address,a.CreateTime,a.CoverPhoto,a.FileType,a.IsOpen,a.`Status`,a.TalkId as tid from
Rb_Education_Dynamic a
LEFT JOIN rb_member_user e on e.Id = a.CreateBy {where}";
return Get<Rb_Education_Dynamic_Extend>(sql).ToList();
}
/// <summary>
/// 动态详情
/// </summary>
......
......@@ -108,7 +108,7 @@ 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 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 ");
if (where != null)
{
......@@ -126,9 +126,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
}
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))
{
sb.AppendFormat(" and a.UserId in({0})", where.UserIds);
......@@ -143,7 +146,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");
}
else if (where.Sort ==3)
else if (where.Sort == 3)
{
sb.AppendFormat(" ORDER BY b.CreateDate desc ");
}
......@@ -153,6 +156,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
/// <summary>
/// 分页列表
/// </summary>
......@@ -164,7 +173,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)
{
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 ");
if (where != null)
{
......@@ -182,7 +191,11 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
}
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))
......@@ -204,7 +217,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 ");
}
}
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();
}
}
}
......@@ -1614,6 +1614,8 @@ namespace Mall.WebApi.Controllers.Education
};
CacheManager.User.UserReidsCache.AppletUserInfoSet(CacheKey.UserModuleCacheKeyConfig.Applet_Blacklist_Info + uInfo.UserId, userInfo, Config.JwtExpirTime);
educationModule.UpdateUserBlacklist(userInfo.TenantId, userInfo.MallBaseId, userInfo.UserId);
}
educationModule.SetEducationViolationLog(new RB_Education_ViolationLog { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, UserId = userInfo.UserId, ViolationType = 2, CreateDate = System.DateTime.Now });
return ApiResult.Failed("评论存在违规内容,若多次发布违规内容将被拉黑");
......
......@@ -101,6 +101,10 @@ namespace Mall.WebApi.Controllers.MallBase
//店铺id
int storeId = parms.GetInt("StoreId", 0);
//用户id
int userId = RequestParm.UserId;
//用户性别
int sex = parms.GetInt("Sex", 0);
//首页数据
var homePage = new object();
//底部导航
......@@ -177,7 +181,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
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
......@@ -250,7 +254,7 @@ namespace Mall.WebApi.Controllers.MallBase
{
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
......
......@@ -88,6 +88,7 @@ namespace Mall.WebApi.Controllers
/// </summary>
private static ReserveModule reserveModule = new ReserveModule();
/// <summary>
/// 模板处理类
/// </summary>
......@@ -105,7 +106,7 @@ namespace Mall.WebApi.Controllers
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public static object PlusDataToObject(ComponentItem subItem, int TenantId, int MallBaseId, int SmallShopsId, int IsOpenSchool, int StoreId)
public static object PlusDataToObject(ComponentItem subItem, int TenantId, int MallBaseId, int SmallShopsId, int IsOpenSchool, int StoreId, int SexInfo, int UserId = 0)
{
var obj = new object();
switch (subItem.Id)
......@@ -1288,17 +1289,48 @@ namespace Mall.WebApi.Controllers
if (miAiUserItem != null)
{
int Sex = 0;
int Age = 0;
if (UserId > 0)//说明用户登录了的
{
//查看用户的
var baseInfo = miaiModule.GetBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend { TenantId = TenantId, MallBaseId = MallBaseId, UserId = UserId }).FirstOrDefault();
if (baseInfo != null)
{
Sex = baseInfo.Sex;
if (!string.IsNullOrWhiteSpace(baseInfo.Birthday))
{
try
{
Age = Convert.ToInt32(Common.Plugin.StringHelper.GetAge(baseInfo.Birthday));
}
catch (Exception)
{
Age = 0;
}
}
}
if (SexInfo > 0)
{
Sex = SexInfo == 1 ? 2 : (SexInfo == 2 ? 1 : 0);
}
}
//自定义商品
if (miAiUserItem.addUserType == 0)
{
if (miAiUserItem.list != null && miAiUserItem.list.Count > 0)
{
var Ids = "0," + string.Join(",", miAiUserItem.list.Select(qitem => qitem.id));
var tempGoodsList = miaiModule.GetFirstBaseInfoList( new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend
var tempGoodsList = miaiModule.GetFirstBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend
{
TenantId = TenantId,
MallBaseId = MallBaseId,
UserIds = Ids
UserIds = Ids,
Sex = Sex,
UserId = UserId
});
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var goodItem in miAiUserItem.list)
......@@ -1311,11 +1343,33 @@ namespace Mall.WebApi.Controllers
lastItem.name = tempGood.Name;
lastItem.Photo = tempGood.Photo;
lastItem.SexStr = tempGood.Sex == 1 ? "男" : "女";
lastItem.Age = Common.Plugin.StringHelper.GetAge(tempGood.Birthday);
lastItem.Age = tempGood.Age.ToString(); //Common.Plugin.StringHelper.GetAge(tempGood.Birthday);
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : "";
lastItem.Education = (tempGood.EducationType.HasValue && tempGood.EducationType.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.EducationType) : "";
if (UserId > 0 && Age > 0)
{
if (Age == tempGood.Age)
{
lastItem.MatchingRate = 90;
}
else if (Age > tempGood.Age)
{
lastItem.MatchingRate = ((Age - tempGood.Age) + 90) > 100 ? 100 : ((Age - tempGood.Age) + 90);
}
else if (Age < tempGood.Age)
{
lastItem.MatchingRate = (90 - (tempGood.Age - Age)) < 0 ? 0 : (90 - (tempGood.Age - Age));
}
else
{
lastItem.MatchingRate = 0;
}
}
else
{
lastItem.MatchingRate = 0;
}
lastItem.Score = 0;
lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album))
......@@ -1331,6 +1385,60 @@ namespace Mall.WebApi.Controllers
else if (miAiUserItem.addUserType == 1)//匹配度暂无规则
{
var tempGoodsList = miaiModule.GetMatchingBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend
{
TenantId = TenantId,
MallBaseId = MallBaseId,
UserId = UserId,
Sex = Sex
}, miAiUserItem.goodsLength);
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var goodItem in miAiUserItem.list)
{
var lastItem = new miaiUserDetail();
var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0)
{
lastItem.id = tempGood.UserId;
lastItem.name = tempGood.Name;
lastItem.Photo = tempGood.Photo;
lastItem.SexStr = tempGood.Sex == 1 ? "男" : "女";
lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : "";
lastItem.Education = (tempGood.EducationType.HasValue && tempGood.EducationType.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.EducationType) : "";
if (UserId > 0 && Age > 0)
{
if (Age == tempGood.Age)
{
lastItem.MatchingRate = 90;
}
else if (Age > tempGood.Age)
{
lastItem.MatchingRate = ((Age - tempGood.Age) + 90) > 100 ? 100 : ((Age - tempGood.Age) + 90);
}
else if (Age < tempGood.Age)
{
lastItem.MatchingRate = (90 - (tempGood.Age - Age)) < 0 ? 0 : (90 - (tempGood.Age - Age));
}
else
{
lastItem.MatchingRate = 0;
}
}
else
{
lastItem.MatchingRate = 0;
}
lastItem.Score = 0;
lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album))
{
lastItem.AlbumList = JsonConvert.DeserializeObject<List<string>>(lastItem.Album);
}
newGoodsList.Add(lastItem);
}
}
miAiUserItem.list = newGoodsList;
}
else if (miAiUserItem.addUserType == 2)
{
......@@ -1342,6 +1450,8 @@ namespace Mall.WebApi.Controllers
TenantId = TenantId,
MallBaseId = MallBaseId,
Sort = 2,
Sex = Sex,
UserId = UserId,
FollowRate = miAiUserItem.FollowRate == 0 ? 1 : miAiUserItem.FollowRate,
BrowseRate = miAiUserItem.BrowseRate == 0 ? 1 : miAiUserItem.BrowseRate,
});
......@@ -1356,11 +1466,33 @@ namespace Mall.WebApi.Controllers
lastItem.name = tempGood.Name;
lastItem.Photo = tempGood.Photo;
lastItem.SexStr = tempGood.Sex == 1 ? "男" : "女";
lastItem.Age = Common.Plugin.StringHelper.GetAge(tempGood.Birthday);
lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : "";
lastItem.Education = (tempGood.EducationType.HasValue && tempGood.EducationType.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.EducationType) : "";
if (UserId > 0 && Age > 0)
{
if (Age == tempGood.Age)
{
lastItem.MatchingRate = 90;
}
else if (Age > tempGood.Age)
{
lastItem.MatchingRate = ((Age - tempGood.Age) + 90) > 100 ? 100 : ((Age - tempGood.Age) + 90);
}
else if (Age < tempGood.Age)
{
lastItem.MatchingRate = (90 - (tempGood.Age - Age)) < 0 ? 0 : (90 - (tempGood.Age - Age));
}
else
{
lastItem.MatchingRate = 0;
}
}
else
{
lastItem.MatchingRate = 0;
}
lastItem.Score = 0;
lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album))
......@@ -1382,7 +1514,9 @@ namespace Mall.WebApi.Controllers
{
TenantId = TenantId,
MallBaseId = MallBaseId,
Sort = 3
Sort = 3,
Sex = Sex,
UserId = UserId
});
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var goodItem in miAiUserItem.list)
......@@ -1395,11 +1529,33 @@ namespace Mall.WebApi.Controllers
lastItem.name = tempGood.Name;
lastItem.Photo = tempGood.Photo;
lastItem.SexStr = tempGood.Sex == 1 ? "男" : "女";
lastItem.Age = Common.Plugin.StringHelper.GetAge(tempGood.Birthday);
lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : "";
lastItem.Education = (tempGood.EducationType.HasValue && tempGood.EducationType.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.EducationType) : "";
if (UserId > 0 && Age > 0)
{
if (Age == tempGood.Age)
{
lastItem.MatchingRate = 90;
}
else if (Age > tempGood.Age)
{
lastItem.MatchingRate = ((Age - tempGood.Age) + 90) > 100 ? 100 : ((Age - tempGood.Age) + 90);
}
else if (Age < tempGood.Age)
{
lastItem.MatchingRate = (90 - (tempGood.Age - Age)) < 0 ? 0 : (90 - (tempGood.Age - Age));
}
else
{
lastItem.MatchingRate = 0;
}
}
else
{
lastItem.MatchingRate = 0;
}
lastItem.Score = 0;
lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album))
......@@ -2744,7 +2900,7 @@ namespace Mall.WebApi.Controllers
is_show_cart = mallBaseModel?.ListShopCar,
is_show_sales_num = mallBaseModel?.ListBuyCount,
is_show_goods_name = mallBaseModel?.ListName,
is_show_korea= miniProgram?.IsKorea??0,//是否是韩国馆(1-是)
is_show_korea = miniProgram?.IsKorea ?? 0,//是否是韩国馆(1-是)
is_underline_price = mallBaseModel?.DetailsLineationPrice,
is_express = mallBaseModel?.DeatilsExpress,
is_not_share_show = mallBaseModel?.OtherNoShare,
......
......@@ -30,7 +30,11 @@ namespace Mall.WebApi.Controllers.MallBase
private readonly Module.Education.DynamicModule dynamicModule = new Module.Education.DynamicModule();
private readonly MiniProgramModule programModule = new MiniProgramModule();
private readonly MiniProgramMsgModule programMsgModule = new MiniProgramMsgModule();
private readonly Module.Education.EducationModule educationModule = new Module.Education.EducationModule();
/// <summary>
/// 通用方法
/// </summary>
private readonly MiaiCommonModule miaiCommonModule = new MiaiCommonModule();
#region 活动版块
/// <summary>
......@@ -679,10 +683,12 @@ namespace Mall.WebApi.Controllers.MallBase
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelMiaiMessageInfo() {
public ApiResult DelMiaiMessageInfo()
{
JObject parms = JObject.Parse(RequestParm.msg.ToString());
int MessageId = parms.GetInt("MessageId", 0);
if (MessageId <= 0) {
if (MessageId <= 0)
{
return ApiResult.Failed();
}
bool flag = miaiModule.DelMiaiMessageInfo(MessageId);
......@@ -722,7 +728,8 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
if (demodel.UserId <= 0) {
if (demodel.UserId <= 0)
{
return ApiResult.ParamIsNull();
}
var list = miaiModule.GetMiaiDatingPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
......@@ -849,6 +856,9 @@ namespace Mall.WebApi.Controllers.MallBase
var oldList = miaiModule.GetFollowMemberList(new RB_MiAi_FollowMember_Extend { Status = 0, UserId = userId, CreateBy = userInfo.UserId, MallBaseId = userInfo.MallBaseId, TenantId = userInfo.TenantId });
var oldOtherList = miaiModule.GetFollowMemberList(new RB_MiAi_FollowMember_Extend { Status = 0, UserId = userInfo.UserId, CreateBy = userId, MallBaseId = userInfo.MallBaseId, TenantId = userInfo.TenantId });
var oldUserInfo = miaiModule.GetMemberUserInfo(userId);
var oldBaseInfo = miaiModule.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend { UserId = userId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId }).FirstOrDefault();
if (userId != userInfo.UserId)
{
if (oldList != null && oldList.Any() && oldOtherList != null && oldOtherList.Any())
......@@ -871,9 +881,25 @@ namespace Mall.WebApi.Controllers.MallBase
{
isFollow = 0;
}
//设置消息推送
miaiCommonModule.SetMessage(new RB_Miai_Message_Extend()
{
Id = 0,
Type = Common.Enum.MiAi.MessageTypeEnum.Look,
UserId = userId,
SourceId = userId,
Content = "用户访问了您的自画像",
Status = 0,
TenantId = oldUserInfo.TenantId,
MallBaseId = oldUserInfo.MallBaseId,
CreateBy = userInfo.UserId,
CreateDate = DateTime.Now,
UpdateDate = DateTime.Now
});
}
var oldUserInfo = miaiModule.GetMemberUserInfo(userId);
var oldBaseInfo = miaiModule.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend { UserId = userId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId }).FirstOrDefault();
if (oldUserInfo != null && oldUserInfo.Id > 0)
......@@ -1042,7 +1068,7 @@ namespace Mall.WebApi.Controllers.MallBase
/// <summary>
/// 关注老师
/// 关注会员
/// </summary>
/// <returns></returns>
[HttpPost]
......@@ -1159,6 +1185,47 @@ namespace Mall.WebApi.Controllers.MallBase
{
return ApiResult.Failed("文字和文件不能同时为空");
}
#region 内容是否违规
if (!string.IsNullOrWhiteSpace(article.Content))
{
try
{ //获取订阅消息
var miniModel = programModule.GetMiniProgramModule(new Model.Extend.User.RB_MiniProgram_Extend { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId });
int violationNum = new MiniProgramMsgModule().CheckViolation(miniModel, article.Content);
if (violationNum == 0)
{
return ApiResult.Failed("发布内容检测失败,请稍后再试");
}
else if (violationNum == 1)
{
var violationLogList = educationModule.GetViolationLogList(new RB_Education_ViolationLog { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, UserId = userInfo.UserId });
if (violationLogList != null && violationLogList.Any() && (violationLogList.Count() + 1) >= miniModel.ViolationNum)
{
userInfo = new AppletUserInfo
{
MallBaseId = userInfo.MallBaseId,
UserId = userInfo.UserId,
TenantId = userInfo.TenantId,
Name = userInfo.Name,
SuperiorId = userInfo.SuperiorId,
Blacklist = 1
};
CacheManager.User.UserReidsCache.AppletUserInfoSet(CacheKey.UserModuleCacheKeyConfig.Applet_Blacklist_Info + userInfo.UserId, userInfo, Config.JwtExpirTime);
educationModule.UpdateUserBlacklist(userInfo.TenantId, userInfo.MallBaseId, userInfo.UserId);
}
educationModule.SetEducationViolationLog(new RB_Education_ViolationLog { TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId, UserId = userInfo.UserId, ViolationType = 1, CreateDate = System.DateTime.Now });
return ApiResult.Failed("发布内容存在违规信息,若多次发布违规内容将被拉黑");
}
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "InsertOrderPayInfo");
return ApiResult.Failed("发布内容检测失败,请稍后再试");
}
}
#endregion
article.CreateTime = DateTime.Now;
article.CreateBy = userInfo.UserId;
article.TenantId = userInfo.TenantId;
......
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