Commit 3ef2aba9 authored by liudong1993's avatar liudong1993

解决冲突

parents 334e1e57 074fe5bf
......@@ -52,6 +52,58 @@ namespace Mall.Common.Plugin
#region "日期相关"
/// <summary>
/// 生肖
/// </summary>
/// <param name="birthday"></param>
/// <returns></returns>
public static string GetShengXiao(DateTime birthday)
{
System.Globalization.ChineseLunisolarCalendar chinseCaleander = new System.Globalization.ChineseLunisolarCalendar();
string TreeYear = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
int intYear = chinseCaleander.GetSexagenaryYear(birthday);
string Tree = TreeYear.Substring(chinseCaleander.GetTerrestrialBranch(intYear) - 1, 1);
return Tree;
}
/// <summary>
/// 获取星座
/// </summary>
/// <param name="birthday"></param>
/// <returns></returns>
public static string GetAtomFromBirthday(DateTime birthday)
{
float birthdayF = 0.00F;
if (birthday.Month == 1 && birthday.Day < 20)
{
birthdayF = float.Parse(string.Format("13.{0}", birthday.Day));
}
else
{
birthdayF = float.Parse(string.Format("{0}.{1}", birthday.Month, birthday.Day));
}
float[] atomBound = { 1.20F, 2.20F, 3.21F, 4.21F, 5.21F, 6.22F, 7.23F, 8.23F, 9.23F, 10.23F, 11.21F, 12.22F, 13.20F };
string[] atoms = { "水瓶座", "双鱼座", "白羊座", "金牛座", "双子座", "巨蟹座", "狮子座", "处女座", "天秤座", "天蝎座", "射手座", "魔羯座" };
string ret = "靠!外星人啊。";
for (int i = 0; i < atomBound.Length - 1; i++)
{
if (atomBound[i] <= birthdayF && atomBound[i + 1] > birthdayF)
{
ret = atoms[i];
break;
}
}
return ret;
}
/// <summary>
/// 年龄
/// </summary>
......
......@@ -3033,6 +3033,20 @@ namespace Mall.Model.Extend.MarketingCenter
/// </summary>
public int addUserType { get; set; }
/// <summary>
/// 浏览权重
/// </summary>
public decimal BrowseRate { get; set; }
/// <summary>
/// 关注权重
/// </summary>
public decimal FollowRate { get; set; }
/// <summary>
/// 背景颜色
/// </summary>
......
......@@ -29,5 +29,16 @@ namespace Mall.Model.Extend.Miai
/// 0-指定用户,1-按照匹配度,2-按照热度,3-按照最新
/// </summary>
public int Sort { get; set; }
/// <summary>
/// 浏览权重
/// </summary>
public decimal BrowseRate { get; set; }
/// <summary>
/// 关注权重
/// </summary>
public decimal FollowRate { get; set; }
}
}
......@@ -42,5 +42,15 @@ namespace Mall.Model.Extend.Miai
/// 活动
/// </summary>
public RB_Miai_Activity_Extend ActivityModel { get; set; }
/// <summary>
/// 我关注的id
/// </summary>
public int MyFollowId { get; set; }
/// <summary>
/// 关注我的id
/// </summary>
public int OtherFollowId { get; set; }
}
}
......@@ -152,15 +152,15 @@ namespace Mall.Module.MarketingCenter
nModel.background = (nObj["background"] != null && !string.IsNullOrEmpty(nObj["background"].ToString())) ? nObj["background"].ToString() : "#f67f79";
nModel.headerUrl = (nObj["headerUrl"] != null && !string.IsNullOrEmpty(nObj["headerUrl"].ToString())) ? nObj["headerUrl"].ToString() : "";
nModel.btnColor = (nObj["btnColor"] != null && !string.IsNullOrEmpty(nObj["btnColor"].ToString())) ? nObj["btnColor"].ToString() : "#ff4544";
Int32.TryParse(nObj["btnWidth"].ToString(), out int btnWidth);
nModel.btnWidth = btnWidth>0 ?btnWidth: 500;
nModel.btnWidth = btnWidth > 0 ? btnWidth : 500;
Int32.TryParse(nObj["btnHeight"].ToString(), out int btnHeight);
nModel.btnHeight = btnHeight>0?btnHeight: 80;
nModel.btnHeight = btnHeight > 0 ? btnHeight : 80;
Int32.TryParse(nObj["btnRadius"].ToString(), out int btnRadius);
nModel.btnRadius = btnRadius>0?btnRadius: 40;
nModel.btnRadius = btnRadius > 0 ? btnRadius : 40;
nModel.btnText = (nObj["btnText"] != null && !string.IsNullOrEmpty(nObj["btnText"].ToString())) ? nObj["btnText"].ToString() : "我知道了";
nModel.btnTextColor = (nObj["btnTextColor"] != null && !string.IsNullOrEmpty(nObj["btnTextColor"].ToString())) ? nObj["btnTextColor"].ToString() : "#ffffff";
......@@ -399,13 +399,14 @@ namespace Mall.Module.MarketingCenter
//图文插件
case "image-text":
imagetextItem imageItem = new imagetextItem();
try {
try
{
var imgData = JsonHelper.DeserializeObject<imagetextItem>(item.data.ToString());
imageItem.content = imgData.content.Replace('”', '"').Replace("”/", @"""");
}
catch
{
{
}
item.data = imageItem;
break;
......@@ -593,7 +594,7 @@ namespace Mall.Module.MarketingCenter
educationTeacherModel.TeacherList = driveData.TeacherList;
}
}
catch(Exception ex)
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "AnalyzePlusModule_educationteacher");
}
......@@ -636,6 +637,8 @@ namespace Mall.Module.MarketingCenter
miaiUserItem.PaddingLeft = driveData?.PaddingLeft ?? "0";
miaiUserItem.PaddingRight = driveData?.PaddingRight ?? "0";
miaiUserItem.SearchFilletPX = driveData?.SearchFilletPX ?? 0;
miaiUserItem.BrowseRate = miaiUserItem.addUserType == 2 ? (miaiUserItem.BrowseRate == 0 ? 1 : miaiUserItem.BrowseRate) : 0;
miaiUserItem.FollowRate = miaiUserItem.addUserType == 2 ? (miaiUserItem.FollowRate == 0 ? 1 : miaiUserItem.FollowRate) : 0;
miaiUserItem.list = new List<miaiUserDetail>();
miaiUserItem.list = driveData.list;
}
......
......@@ -31,6 +31,24 @@ namespace Mall.Module.Miai
private readonly RB_MiAi_FollowMemberRepository miai_FollowMemberRepository = new RB_MiAi_FollowMemberRepository();
/// <summary>
/// 用户管理
/// </summary>
private readonly Repository.User.RB_Member_UserRepository member_UserRepository = new Repository.User.RB_Member_UserRepository();
#region 会员信息
/// <summary>
/// 获取用户信息
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public Model.Extend.User.RB_Member_User_Extend GetMemberUserInfo(int userId)
{
return member_UserRepository.GetEntity(userId).RefMapperTo<Model.Extend.User.RB_Member_User_Extend>();
}
#endregion
#region 活动版块
/// <summary>
/// 获取活动版本分页列表
......@@ -190,9 +208,11 @@ namespace Mall.Module.Miai
//查询用户性别
int Sex = miai_BaseInfoRepository.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend() { TenantId = userInfo.TenantId, UserId = model.UserId }).FirstOrDefault()?.Sex ?? 0;
//查询当前用户是否已关注
bool IsFocus = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserId = model.UserId, CreateBy = userInfo.UserId }).Any();
var myFollowList = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserId = model.UserId, CreateBy = userInfo.UserId });
bool IsFocus = myFollowList.Any();
var otherFollowList = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserId = userInfo.UserId, CreateBy = model.UserId });
//查询是否已关注我
bool IsFocus2 = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserId = userInfo.UserId, CreateBy = model.UserId }).Any();
bool IsFocus2 = otherFollowList.Any();
return new
{
model.Id,
......@@ -204,12 +224,14 @@ namespace Mall.Module.Miai
umodel.Photo,
Sex,
model.IsOpenEnroll,
Deadline = model.IsOpenEnroll == 1? model.Deadline.Value.ToString("yyyy-MM-dd HH:mm") : "",
Deadline = model.IsOpenEnroll == 1 ? model.Deadline.Value.ToString("yyyy-MM-dd HH:mm") : "",
CreateDate = model.CreateDate.ToString("yyyy-MM-dd HH:mm:ss"),
PeopleNum,
IsEnroll,
IsFocus = IsFocus == true && IsFocus2 == true ? 2 : IsFocus == true ? 1 : 0,
ReplyNum = rlist.FirstOrDefault()?.ReplyNum ?? 0
ReplyNum = rlist.FirstOrDefault()?.ReplyNum ?? 0,
MyFollowId = (myFollowList != null && myFollowList.Any()) ? myFollowList.FirstOrDefault()?.ID : 0,
OtherFollowId = (otherFollowList != null && otherFollowList.Any()) ? otherFollowList.FirstOrDefault()?.ID : 0
};
}
......@@ -543,17 +565,22 @@ namespace Mall.Module.Miai
public List<RB_Miai_ActivityEnroll_Extend> GetActivityEnrollPageList(int pageIndex, int pageSize, out long count, RB_Miai_ActivityEnroll_Extend demodel, AppletUserInfo userInfo)
{
var list = miai_ActivityEnrollRepository.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) {
if (list.Any())
{
string UserIds = string.Join(",", list.Select(x => x.UserId).Distinct());
//查询当前用户是否已关注
var flist = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserIds= UserIds, CreateBy = userInfo.UserId });
var flist = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserIds = UserIds, CreateBy = userInfo.UserId });
//查询是否已关注我
var flist2 = miai_FollowMemberRepository.GetFollowMemberList(new RB_MiAi_FollowMember_Extend() { TenantId = userInfo.TenantId, UserId = userInfo.UserId, CreateByIds = UserIds });
foreach (var item in list) {
foreach (var item in list)
{
item.IsFocus = flist.Where(x => x.UserId == item.UserId).Any() ? 1 : 0;
if (flist2.Where(x => x.CreateBy == item.UserId).Any() && item.IsFocus == 1) {
if (flist2.Where(x => x.CreateBy == item.UserId).Any() && item.IsFocus == 1)
{
item.IsFocus = 2;
}
item.MyFollowId = (flist != null && flist.Any()) ? (flist.FirstOrDefault()?.ID ?? 0) : 0;
item.OtherFollowId = (flist2 != null && flist2.Any()) ? (flist2.FirstOrDefault()?.ID ?? 0) : 0;
}
}
return list;
......@@ -637,7 +664,8 @@ namespace Mall.Module.Miai
public List<RB_Miai_ActivityEnroll_Extend> GetMyEnrollPageList(int pageIndex, int pageSize, out long count, RB_Miai_ActivityEnroll_Extend demodel)
{
var list = miai_ActivityEnrollRepository.GetMyEnrollPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) {
if (list.Any())
{
string ActivityIds = string.Join(",", list.Select(x => x.ActivityId).Distinct());
//查询活动帖子
var alist = miai_ActivityRepository.GetList(new RB_Miai_Activity_Extend() { TenantId = demodel.TenantId, ActivityIds = ActivityIds }, true);
......@@ -652,7 +680,8 @@ namespace Mall.Module.Miai
}
item.EnrollNum = elist.Where(x => x.ActivityId == item.Id).FirstOrDefault()?.Number ?? 0;
}
foreach (var item in list) {
foreach (var item in list)
{
item.ActivityModel = alist.Where(x => x.Id == item.ActivityId).FirstOrDefault();
}
}
......@@ -699,7 +728,8 @@ namespace Mall.Module.Miai
{
flag = miai_BaseInfoRepository.Insert(model) > 0;
}
else {
else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
//{ nameof(RB_MiAi_BaseInfo_Extend.Sex),model.Sex},
{ nameof(RB_MiAi_BaseInfo_Extend.Birthday),model.Birthday},
......@@ -787,7 +817,8 @@ namespace Mall.Module.Miai
{
baseInfo.FollowNum -= 1;
}
else {
else
{
baseInfo.FollowNum += 1;
}
flag = miai_FollowMemberRepository.Update(keyValues, wheres);
......@@ -884,8 +915,8 @@ namespace Mall.Module.Miai
}
#endregion
}
#endregion
}
}
......@@ -37,6 +37,10 @@ namespace Mall.Repository.Miai
{
sb.AppendFormat(" and Id={0}", where.Id);
}
if (where.UserId > 0)
{
sb.AppendFormat(" and UserId={0}", where.UserId);
}
}
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
}
......@@ -124,7 +128,8 @@ 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+a.BrowseNum) desc");
sb.AppendFormat($@" ORDER BY (((a.FollowNum* {where.FollowRate})+(a.BrowseNum*{where.BrowseRate}))) desc");
}
else if (where.Sort ==3)
{
......
......@@ -76,7 +76,7 @@ namespace Mall.Repository.Miai
public List<RB_MiAi_FollowMember_Extend> GetFollowMemberPageList(int pageIndex, int pageSize, out long rowsCount, RB_MiAi_FollowMember_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT a.*,b.`Name`,b.Photo from RB_MiAi_FollowMember as a LEFT JOIN rb_member_user as b on a.createby=b.Id where a.`Status`=0");
sb.Append($@"SELECT a.*,b.`Name`,b.Photo from RB_MiAi_FollowMember as a LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.`Status`=0");
if (where != null)
{
if (where.TenantId > 0)
......
......@@ -24,20 +24,26 @@ namespace Mall.Repository.Miai
public List<RB_Miai_ActivityDiscuss_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Miai_ActivityDiscuss_Extend dmodel)
{
string where = $" 1=1 and d.{nameof(RB_Miai_ActivityDiscuss_Extend.Status)}=0 ";
if (dmodel.TenantId > 0) {
if (dmodel.TenantId > 0)
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.ActivityId > 0) {
if (dmodel.ActivityId > 0)
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.ActivityId)} ={dmodel.ActivityId}";
}
if (dmodel.UserId > 0)
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.UserId)} ={dmodel.UserId}";
}
if (dmodel.Id > 0)
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.Id)} ={dmodel.Id}";
}
if (dmodel.ParentId > 0)
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.ParentId)} ={dmodel.ParentId}";
......@@ -46,6 +52,7 @@ namespace Mall.Repository.Miai
{
where += $@" and d.{nameof(RB_Miai_ActivityDiscuss_Extend.ParentId)} =0";
}
string sql = $@"select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName,b.Sex from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
......@@ -74,7 +81,8 @@ where {where} order by d.Id asc";
{
where += $@" and {nameof(RB_Miai_ActivityDiscuss_Extend.ActivityId)} ={dmodel.ActivityId}";
}
if (!string.IsNullOrEmpty(dmodel.ActivityIds)) {
if (!string.IsNullOrEmpty(dmodel.ActivityIds))
{
where += $@" and {nameof(RB_Miai_ActivityDiscuss_Extend.ActivityId)} in({dmodel.ActivityIds})";
}
if (dmodel.UserId > 0)
......@@ -99,33 +107,40 @@ where {where} order by d.Id asc";
{
int count = pidsList.Count();
string sql = "";
if (count == 1) {
if (count == 1)
{
//只有一条数据
sql = $@"select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
where d.Status =0 and d.ParentId ={pidsList.FirstOrDefault()} order by d.Id asc limit {number}";
}
for (var i = 0; i < count; i++) {
if (i == count - 1)
else
{
for (var i = 0; i < count; i++)
{
//最后一条
sql += $@"(select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName from RB_Miai_ActivityDiscuss d
if (i == count - 1)
{
//最后一条
sql += $@"(select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
where d.Status =0 and d.ParentId ={pidsList[i]} order by d.Id asc limit {number})";
}
else {
sql += $@"(select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName from RB_Miai_ActivityDiscuss d
}
else
{
sql += $@"(select d.*,u.Name as UserName,u.Photo,u1.Name as ReplyUserName from RB_Miai_ActivityDiscuss d
left join rb_member_user u on d.UserId = u.Id
left join rb_member_user u1 on d.ReplyUserId = u1.Id
where d.Status =0 and d.ParentId ={pidsList[i]} order by d.Id asc limit {number})
union
";
}
}
}
return Get<RB_Miai_ActivityDiscuss_Extend>(sql).ToList();
}
/// <summary>
......
......@@ -38,6 +38,10 @@ namespace Mall.Repository.Miai
{
where += $@" and e.{nameof(RB_Miai_ActivityEnroll_Extend.UserId)} ={dmodel.UserId}";
}
if (dmodel.Id > 0)
{
where += $@" and e.{nameof(RB_Miai_ActivityEnroll_Extend.Id)} ={dmodel.Id}";
}
string sql = $@"select e.*,u.Name as UserName,u.Photo,b.Sex from RB_Miai_ActivityEnroll e
left join rb_member_user u on e.UserId = u.Id
left join rb_miai_baseinfo b on e.UserId =b.UserId
......
......@@ -1339,7 +1339,9 @@ namespace Mall.WebApi.Controllers
{
TenantId = TenantId,
MallBaseId = MallBaseId,
Sort = 2
Sort = 2,
FollowRate = miAiUserItem.FollowRate == 0 ? 1 : miAiUserItem.FollowRate,
BrowseRate = miAiUserItem.BrowseRate == 0 ? 1 : miAiUserItem.BrowseRate,
});
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var goodItem in miAiUserItem.list)
......
......@@ -446,6 +446,62 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
#region 基础信息
public ApiResult GetMiAiBaseIfo()
{
var parms = RequestParm;
JObject parm = JObject.Parse(parms.msg.ToString());
// var userInfo = AppletUserInfo;
int userId = parm.GetInt("UserId");
var oldBaseInfo = miaiModule.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend { UserId = userId, TenantId = UserInfo.TenantId, MallBaseId = UserInfo.MallBaseId }).FirstOrDefault();
if (oldBaseInfo != null && oldBaseInfo.Id > 0)
{
oldBaseInfo.AlbumList = new List<string>();
if (!string.IsNullOrWhiteSpace(oldBaseInfo.Album))
{
oldBaseInfo.AlbumList = JsonConvert.DeserializeObject<List<string>>(oldBaseInfo.Album);
}
var result = new
{
oldBaseInfo.Sex,
oldBaseInfo.IDCardNo,
oldBaseInfo.RealName,
oldBaseInfo.IDCard,
oldBaseInfo.IDCardBack,
SexStr = oldBaseInfo.Sex == 1 ? "男" : "女",
oldBaseInfo.Birthday,
Age = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetAge(oldBaseInfo.Birthday),//年纪
ShenXiao = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetShengXiao(Convert.ToDateTime((oldBaseInfo.Birthday))),//生肖
ConoldBaseInfostellation = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetAtomFromBirthday(Convert.ToDateTime((oldBaseInfo.Birthday))),//星座
oldBaseInfo.Height,
oldBaseInfo.Weight,
Marriage = (oldBaseInfo.Marriage.HasValue && oldBaseInfo.Marriage.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.Marriage) : "",
EducationType = (oldBaseInfo.EducationType.HasValue && oldBaseInfo.EducationType.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.EducationType) : "",
YearMoney = oldBaseInfo.YearMoney ?? "",
HuKou = oldBaseInfo.HuKou ?? "",
NativePlace = oldBaseInfo.NativePlace ?? "",
HouseInfo = oldBaseInfo.HouseInfo ?? "",
SchoolInfo = oldBaseInfo.SchoolInfo ?? "",
MotherInfo = oldBaseInfo.MotherInfo ?? "",
FatherInfo = oldBaseInfo.FatherInfo ?? "",
Job = oldBaseInfo.Job ?? "",
OtherPople = oldBaseInfo.OtherPople ?? "",
MajorInfo = oldBaseInfo.MajorInfo ?? "",
CarInfo = oldBaseInfo.CarInfo ?? "",
About = oldBaseInfo.About ?? "",
IdealLove = oldBaseInfo.IdealLove ?? "",
oldBaseInfo.AlbumList
};
return ApiResult.Success("", result);
}
else
{
return ApiResult.Failed("用户暂未认证");
}
}
#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