Commit 5241cfc4 authored by 吴春's avatar 吴春

提交代码

parent 57293efa
......@@ -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; }
}
}
......@@ -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;
}
......
......@@ -124,7 +124,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)
{
......
......@@ -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)
......
......@@ -653,55 +653,6 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
/// <summary>
/// 生肖
/// </summary>
/// <param name="birthday"></param>
/// <returns></returns>
public 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 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;
}
public ApiResult GetMiAiBaseIfo()
......@@ -752,8 +703,8 @@ namespace Mall.WebApi.Controllers.MallBase
SexStr = oldBaseInfo.Sex == 1 ? "男" : "女",
oldBaseInfo.Birthday,
Age = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : StringHelper.GetAge(oldBaseInfo.Birthday),//年纪
ShenXiao = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : GetShengXiao(Convert.ToDateTime((oldBaseInfo.Birthday))),//生肖
ConoldBaseInfostellation = string.IsNullOrWhiteSpace(oldBaseInfo.Birthday) ? "" : GetAtomFromBirthday(Convert.ToDateTime((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) : "",
......
......@@ -445,6 +445,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