Commit 9fb081ff authored by 吴春's avatar 吴春

提交代码

parent 0708810d
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Plugin;
namespace Mall.Common.Enum.MiAi
{
public enum CarInfoEnum
{
/// <summary>
/// 有车
/// </summary>
[EnumField("有车")]
Yes = 1,
/// <summary>
/// 无车
/// </summary>
[EnumField("无车")]
No = 2
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Plugin;
namespace Mall.Common.Enum.MiAi
{
public enum HouseInfoEnum
{
/// <summary>
/// 有房
/// </summary>
[EnumField("有房")]
Yes = 1,
/// <summary>
/// 多套房
/// </summary>
[EnumField("多套房")]
More =2,
/// <summary>
/// 无房
/// </summary>
[EnumField("无房")]
No = 3
}
}
using Mall.Common.Plugin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Mall.Common.Enum.User
{
/// <summary>
/// 用户导出选项枚举
/// </summary>
public enum MiAiUserExportEnum
{
/// <summary>
/// 所属平台
/// </summary>
[EnumField("所属平台")]
SSPT = 1,
/// <summary>
/// 用户ID
/// </summary>
[EnumField("用户ID")]
YHID = 2,
/// <summary>
/// 平台标识ID
/// </summary>
[EnumField("平台标识ID")]
PTBSID = 3,
/// <summary>
/// 昵称
/// </summary>
[EnumField("昵称")]
NC = 4,
/// <summary>
/// 绑定手机号
/// </summary>
[EnumField("绑定手机号")]
BDSJH = 5,
/// <summary>
/// 联系方式
/// </summary>
[EnumField("联系方式")]
LXFS = 6,
/// <summary>
/// 备注
/// </summary>
[EnumField("备注")]
BZ = 7,
/// <summary>
/// 加入时间
/// </summary>
[EnumField("加入时间")]
JRSJ = 8,
/// <summary>
/// 会员等级
/// </summary>
[EnumField("会员等级")]
HYDJ = 9,
/// <summary>
/// 年龄
/// </summary>
[EnumField("年龄")]
AGE = 10,
/// <summary>
/// 身高
/// </summary>
[EnumField("身高")]
SG = 11,
/// <summary>
/// 体重
/// </summary>
[EnumField("体重")]
TZ = 12,
/// <summary>
/// 年收入
/// </summary>
[EnumField("年收入")]
YEARMONEY = 13,
/// <summary>
/// 车辆信息
/// </summary>
[EnumField("车辆信息")]
CARINFO = 14,
/// <summary>
/// 房屋信息
/// </summary>
[EnumField("房屋信息")]
HOUSERINFO = 15,
/// <summary>
/// 学历
/// </summary>
[EnumField("学历")]
XL = 16,
/// <summary>
/// 婚姻
/// </summary>
[EnumField("婚姻")]
HY = 17
}
}
...@@ -26,6 +26,23 @@ namespace Mall.Model.Entity.Miai ...@@ -26,6 +26,23 @@ namespace Mall.Model.Entity.Miai
/// </summary> /// </summary>
public int UserId { get; set; } public int UserId { get; set; }
/// <summary>
/// 身份证正面
/// </summary>
public string IDCard { get; set; }
/// <summary>
/// 身份证背面
/// </summary>
public string IDCardBack { get; set; }
public string IDCardNo { get; set; }
/// <summary>
/// 活动区域
/// </summary>
public string ActivityRegion { get; set; }
/// <summary> /// <summary>
/// 性别1-男,2-女 /// 性别1-男,2-女
/// </summary> /// </summary>
...@@ -72,7 +89,7 @@ namespace Mall.Model.Entity.Miai ...@@ -72,7 +89,7 @@ namespace Mall.Model.Entity.Miai
/// <summary> /// <summary>
/// 年收入 /// 年收入
/// </summary> /// </summary>
public string YearMoney { get; set; } public decimal YearMoney { get; set; }
/// <summary> /// <summary>
...@@ -110,10 +127,7 @@ namespace Mall.Model.Entity.Miai ...@@ -110,10 +127,7 @@ namespace Mall.Model.Entity.Miai
/// <summary>
/// 资产
/// </summary>
public string HouseInfo { get; set; }
/// <summary> /// <summary>
/// 家庭背景 /// 家庭背景
...@@ -190,11 +204,20 @@ namespace Mall.Model.Entity.Miai ...@@ -190,11 +204,20 @@ namespace Mall.Model.Entity.Miai
/// </summary> /// </summary>
public string AppointmentAddress { get; set; } public string AppointmentAddress { get; set; }
/// <summary>
/// 车
/// </summary>
public CarInfoEnum? CarInfo { get; set; }
/// <summary>
/// 资产
/// </summary>
public string OtherInfo { get; set; }
/// <summary>
/// 房屋信息
/// </summary>
public HouseInfoEnum? HouseInfo { get; set; }
/// <summary> /// <summary>
/// 浏览数 /// 浏览数
/// </summary> /// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Enum.MiAi;
using VT.FW.DB;
namespace Mall.Model.Entity.Miai
{
/// <summary>
/// 查询相亲会员基础资料
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_MiAi_BaseInfoQuery
{
/// <summary>
/// 编号
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 会员id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 商户号Id
/// </summary>
public int? TenantId
{
get;
set;
}
/// <summary>
/// 小程序Id
/// </summary>
public int? MallBaseId
{
get;
set;
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? CreateDate
{
get;
set;
}
/// <summary>
/// 删除状态
/// </summary>
public int? Status
{
get;
set;
}
/// <summary>
/// 性别1-男,2-女
/// </summary>
public int Sex { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int EndAge { get; set; }
/// <summary>
/// 身高
/// </summary>
public decimal Height { get; set; }
/// <summary>
/// 身高
/// </summary>
public decimal EndHeight { get; set; }
/// <summary>
/// 体重
/// </summary>
public decimal Weight { get; set; }
/// <summary>
/// 体重
/// </summary>
public decimal EndWeight { get; set; }
/// <summary>
/// 年收入
/// </summary>
public decimal YearMoney { get; set; }
/// <summary>
/// 年收入
/// </summary>
public decimal EndYearMoney { get; set; }
/// <summary>
/// 车
/// </summary>
public CarInfoEnum? CarInfo { get; set; }
/// <summary>
/// 房屋信息
/// </summary>
public HouseInfoEnum? HouseInfo { get; set; }
/// <summary>
/// 学历
/// </summary>
public EducationTypeEnum? EducationType { get; set; }
/// <summary>
/// 婚姻
/// </summary>
public MarriageEnum? Marriage { get; set; }
}
}
...@@ -3158,7 +3158,7 @@ namespace Mall.Model.Extend.MarketingCenter ...@@ -3158,7 +3158,7 @@ namespace Mall.Model.Extend.MarketingCenter
/// <summary> /// <summary>
/// 匹配度 /// 匹配度
/// </summary> /// </summary>
public int MatchingRate { get; set; } // public int MatchingRate { get; set; }
/// <summary> /// <summary>
/// 分数 /// 分数
......
...@@ -12,6 +12,7 @@ namespace Mall.Model.Extend.Miai ...@@ -12,6 +12,7 @@ namespace Mall.Model.Extend.Miai
/// </summary> /// </summary>
public List<string> AlbumList { get; set; } public List<string> AlbumList { get; set; }
public string Name { get; set; } public string Name { get; set; }
...@@ -57,5 +58,55 @@ namespace Mall.Model.Extend.Miai ...@@ -57,5 +58,55 @@ namespace Mall.Model.Extend.Miai
/// </summary> /// </summary>
public string DName { get; set; } public string DName { get; set; }
/// <summary>
/// 车
/// </summary>
public string CarInfoStr { get; set; }
/// <summary>
/// 房信息
/// </summary>
public string HouseInfoStr { get; set; }
}
public class RB_MiaiMember_Extend : RB_MiAi_BaseInfo
{
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int EndAge { get; set; }
/// <summary>
/// 身高
/// </summary>
public decimal EndHeight { get; set; }
/// <summary>
/// 体重
/// </summary>
public decimal EndWeight { get; set; }
/// <summary>
/// 年收入
/// </summary>
public decimal EndYearMoney { get; set; }
public string UserIds { get; set; }
/// <summary>
/// 查询条件的id
/// </summary>
public int QueryId { get; set; }
} }
} }
...@@ -66,5 +66,11 @@ namespace Mall.Model.Extend.Miai ...@@ -66,5 +66,11 @@ namespace Mall.Model.Extend.Miai
/// 版块图标 /// 版块图标
/// </summary> /// </summary>
public string ForumIcon { get; set; } public string ForumIcon { get; set; }
/// <summary>
/// 标签
/// </summary>
public List<string> LabelList { get; set; }
} }
} }
...@@ -3,6 +3,7 @@ using System; ...@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using Mall.Model.Entity.User; using Mall.Model.Entity.User;
using Mall.Common.Enum.MiAi;
namespace Mall.Model.Extend.User namespace Mall.Model.Extend.User
{ {
...@@ -181,6 +182,92 @@ namespace Mall.Model.Extend.User ...@@ -181,6 +182,92 @@ namespace Mall.Model.Extend.User
} }
public class RB_Member_MiaiUser_Extend : RB_Member_User
{
/// <summary>
/// 导出枚举ids
/// </summary>
public List<int> ExcelEnumIds { get; set; }
public string Birthday { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int Age { get; set; }
/// <summary>
/// 年龄
/// </summary>
public int EndAge { get; set; }
/// <summary>
/// 身高
/// </summary>
public decimal Height { get; set; }
/// <summary>
/// 身高
/// </summary>
public decimal EndHeight { get; set; }
/// <summary>
/// 体重
/// </summary>
public decimal Weight { get; set; }
/// <summary>
/// 体重
/// </summary>
public decimal EndWeight { get; set; }
/// <summary>
/// 年收入
/// </summary>
public decimal YearMoney { get; set; }
/// <summary>
/// 年收入
/// </summary>
public decimal EndYearMoney { get; set; }
/// <summary>
/// 车
/// </summary>
public CarInfoEnum? CarInfo { get; set; }
/// <summary>
/// 房屋信息
/// </summary>
public HouseInfoEnum? HouseInfo { get; set; }
/// <summary>
/// 学历
/// </summary>
public EducationTypeEnum? EducationType { get; set; }
/// <summary>
/// 婚姻
/// </summary>
public MarriageEnum? Marriage { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public string EndTime { get; set; }
/// <summary>
/// 会员等级名称
/// </summary>
public string MemberGradeName { get; set; }
}
/// <summary> /// <summary>
/// 抖音客户实体类 /// 抖音客户实体类
/// </summary> /// </summary>
......
using Mall.Common.Plugin; using System;
using Mall.Model.Entity.MarketingCenter; using System.Collections.Generic;
using Mall.Model.Entity.User; using System.Linq;
using Mall.Common.Plugin;
using Mall.Model.Extend.MarketingCenter; using Mall.Model.Extend.MarketingCenter;
using Mall.Model.Extend.User;
using Mall.Model.Query;
using Mall.Repository;
using Mall.Repository.MarketingCenter; using Mall.Repository.MarketingCenter;
using MySqlX.XDevAPI.Relational;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Org.BouncyCastle.Crypto.Tls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VT.FW.DB; using VT.FW.DB;
namespace Mall.Module.MarketingCenter namespace Mall.Module.MarketingCenter
...@@ -28,6 +20,7 @@ namespace Mall.Module.MarketingCenter ...@@ -28,6 +20,7 @@ namespace Mall.Module.MarketingCenter
/// </summary> /// </summary>
private readonly RB_Miniprogram_TemplateRepository miniprogram_TemplateRepository = new RB_Miniprogram_TemplateRepository(); private readonly RB_Miniprogram_TemplateRepository miniprogram_TemplateRepository = new RB_Miniprogram_TemplateRepository();
private readonly Repository.Miai.RB_MiAi_BaseInfoRepository miai_BaseInfoRepository = new Repository.Miai.RB_MiAi_BaseInfoRepository(); private readonly Repository.Miai.RB_MiAi_BaseInfoRepository miai_BaseInfoRepository = new Repository.Miai.RB_MiAi_BaseInfoRepository();
private readonly Repository.Miai.RB_MiAi_BaseInfoQueryRepository miai_BaseInfoQueryRepository = new Repository.Miai.RB_MiAi_BaseInfoQueryRepository();
/// <summary> /// <summary>
/// 小程序模板分页列表 /// 小程序模板分页列表
/// </summary> /// </summary>
...@@ -62,7 +55,7 @@ namespace Mall.Module.MarketingCenter ...@@ -62,7 +55,7 @@ namespace Mall.Module.MarketingCenter
{ {
foreach (var subItem in item.ComponentDataList) foreach (var subItem in item.ComponentDataList)
{ {
AnalyzePlusModule(subItem, TenantId,MallBaseId,UserId); AnalyzePlusModule(subItem, TenantId, MallBaseId, UserId);
} }
} }
} }
...@@ -128,7 +121,7 @@ namespace Mall.Module.MarketingCenter ...@@ -128,7 +121,7 @@ namespace Mall.Module.MarketingCenter
/// 解析插件 /// 解析插件
/// </summary> /// </summary>
/// <param name="item"></param> /// <param name="item"></param>
public void AnalyzePlusModule(ComponentItem item, int TenantId=0, int MallBaseId=0, int UserId = 0) public void AnalyzePlusModule(ComponentItem item, int TenantId = 0, int MallBaseId = 0, int UserId = 0)
{ {
switch (item.Id) switch (item.Id)
{ {
...@@ -643,6 +636,7 @@ namespace Mall.Module.MarketingCenter ...@@ -643,6 +636,7 @@ namespace Mall.Module.MarketingCenter
miaiUserItem.SearchFilletPX = driveData?.SearchFilletPX ?? 0; miaiUserItem.SearchFilletPX = driveData?.SearchFilletPX ?? 0;
miaiUserItem.goodsLength = driveData.goodsLength; miaiUserItem.goodsLength = driveData.goodsLength;
miaiUserItem.sexType = driveData?.sexType ?? 0; miaiUserItem.sexType = driveData?.sexType ?? 0;
miaiUserItem.addUserType = driveData?.addUserType ?? 0;
miaiUserItem.BrowseRate = miaiUserItem.addUserType == 2 ? (miaiUserItem.BrowseRate == 0 ? 1 : miaiUserItem.BrowseRate) : 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.FollowRate = miaiUserItem.addUserType == 2 ? (miaiUserItem.FollowRate == 0 ? 1 : miaiUserItem.FollowRate) : 0;
miaiUserItem.list = new List<miaiUserDetail>(); miaiUserItem.list = new List<miaiUserDetail>();
...@@ -703,30 +697,6 @@ namespace Mall.Module.MarketingCenter ...@@ -703,30 +697,6 @@ namespace Mall.Module.MarketingCenter
lastItem.Age = tempGood.Age.ToString(); //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.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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -741,19 +711,48 @@ namespace Mall.Module.MarketingCenter ...@@ -741,19 +711,48 @@ namespace Mall.Module.MarketingCenter
} }
else if (miaiUserItem.addUserType == 1)//匹配度暂无规则 else if (miaiUserItem.addUserType == 1)//匹配度暂无规则
{ {
var miaiBaseIfoQuery = new Model.Extend.Miai.RB_MiaiMember_Extend
var tempGoodsList = miai_BaseInfoRepository.GetMatchingBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend
{ {
TenantId = TenantId, TenantId = TenantId,
MallBaseId = MallBaseId, MallBaseId = MallBaseId,
UserId = UserId, UserId = UserId,
Sex = Sex Sex = Sex
}, miaiUserItem.goodsLength); };
if (Sex > 0)
{
var queryBaseInfoModel = miai_BaseInfoQueryRepository.GetBaseInfoQueryList(new Model.Entity.Miai.RB_MiAi_BaseInfoQuery
{
TenantId = TenantId,
MallBaseId = MallBaseId,
UserId = UserId,
Sex = Sex == 1 ? 2 : (Sex == 2 ? 1 : 0)
}).FirstOrDefault();
if (queryBaseInfoModel != null && queryBaseInfoModel.Id > 0)
{
miaiBaseIfoQuery.Age = queryBaseInfoModel.Age;
miaiBaseIfoQuery.EndAge = queryBaseInfoModel.EndAge;
miaiBaseIfoQuery.Weight = queryBaseInfoModel.Weight;
miaiBaseIfoQuery.EndWeight = queryBaseInfoModel.EndWeight;
miaiBaseIfoQuery.Height = queryBaseInfoModel.Height;
miaiBaseIfoQuery.EndHeight = queryBaseInfoModel.EndHeight;
miaiBaseIfoQuery.YearMoney = queryBaseInfoModel.YearMoney;
miaiBaseIfoQuery.EndYearMoney = queryBaseInfoModel.EndYearMoney;
miaiBaseIfoQuery.EducationType = queryBaseInfoModel.EducationType;
miaiBaseIfoQuery.CarInfo = queryBaseInfoModel.CarInfo;
miaiBaseIfoQuery.HouseInfo = queryBaseInfoModel.HouseInfo;
miaiBaseIfoQuery.Marriage = queryBaseInfoModel.Marriage;
}
}
var tempGoodsList = miai_BaseInfoRepository.GetMatchingBaseInfoList(miaiBaseIfoQuery, miaiUserItem.goodsLength);
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>(); List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var tempGood in tempGoodsList) foreach (var tempGood in tempGoodsList)
{ {
var lastItem = new miaiUserDetail(); var lastItem = new miaiUserDetail();
// var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault(); // var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0) if (tempGood != null && tempGood.Id > 0)
{ {
lastItem.id = tempGood.UserId; lastItem.id = tempGood.UserId;
...@@ -763,29 +762,7 @@ namespace Mall.Module.MarketingCenter ...@@ -763,29 +762,7 @@ namespace Mall.Module.MarketingCenter
lastItem.Age = tempGood.Age.ToString(); lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -816,7 +793,7 @@ namespace Mall.Module.MarketingCenter ...@@ -816,7 +793,7 @@ namespace Mall.Module.MarketingCenter
foreach (var tempGood in tempGoodsList) foreach (var tempGood in tempGoodsList)
{ {
var lastItem = new miaiUserDetail(); var lastItem = new miaiUserDetail();
// var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault(); // var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0) if (tempGood != null && tempGood.Id > 0)
{ {
lastItem.id = tempGood.UserId; lastItem.id = tempGood.UserId;
...@@ -827,29 +804,7 @@ namespace Mall.Module.MarketingCenter ...@@ -827,29 +804,7 @@ namespace Mall.Module.MarketingCenter
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -879,7 +834,7 @@ namespace Mall.Module.MarketingCenter ...@@ -879,7 +834,7 @@ namespace Mall.Module.MarketingCenter
foreach (var tempGood in tempGoodsList) foreach (var tempGood in tempGoodsList)
{ {
var lastItem = new miaiUserDetail(); var lastItem = new miaiUserDetail();
// var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault(); // var tempGood = tempGoodsList?.Where(qitem => qitem.UserId == goodItem.id)?.FirstOrDefault();
if (tempGood != null && tempGood.Id > 0) if (tempGood != null && tempGood.Id > 0)
{ {
lastItem.id = tempGood.UserId; lastItem.id = tempGood.UserId;
...@@ -889,30 +844,6 @@ namespace Mall.Module.MarketingCenter ...@@ -889,30 +844,6 @@ namespace Mall.Module.MarketingCenter
lastItem.Age = tempGood.Age.ToString(); lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -926,7 +857,8 @@ namespace Mall.Module.MarketingCenter ...@@ -926,7 +857,8 @@ namespace Mall.Module.MarketingCenter
} }
} }
else { else
{
miaiUserItem.listStyle = driveData?.listStyle ?? 1; miaiUserItem.listStyle = driveData?.listStyle ?? 1;
miaiUserItem.backgroundColor = driveData?.backgroundColor ?? ""; miaiUserItem.backgroundColor = driveData?.backgroundColor ?? "";
miaiUserItem.PaddingTop = driveData?.PaddingTop ?? "0"; miaiUserItem.PaddingTop = driveData?.PaddingTop ?? "0";
...@@ -936,12 +868,13 @@ namespace Mall.Module.MarketingCenter ...@@ -936,12 +868,13 @@ namespace Mall.Module.MarketingCenter
miaiUserItem.SearchFilletPX = driveData?.SearchFilletPX ?? 0; miaiUserItem.SearchFilletPX = driveData?.SearchFilletPX ?? 0;
miaiUserItem.goodsLength = driveData.goodsLength; miaiUserItem.goodsLength = driveData.goodsLength;
miaiUserItem.sexType = driveData?.sexType ?? 0; miaiUserItem.sexType = driveData?.sexType ?? 0;
miaiUserItem.addUserType = driveData?.addUserType ?? 0;
miaiUserItem.BrowseRate = miaiUserItem.addUserType == 2 ? (miaiUserItem.BrowseRate == 0 ? 1 : miaiUserItem.BrowseRate) : 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.FollowRate = miaiUserItem.addUserType == 2 ? (miaiUserItem.FollowRate == 0 ? 1 : miaiUserItem.FollowRate) : 0;
miaiUserItem.list = new List<miaiUserDetail>(); miaiUserItem.list = new List<miaiUserDetail>();
miaiUserItem.list = driveData.list; miaiUserItem.list = driveData.list;
} }
} }
} }
catch (Exception ex) catch (Exception ex)
......
...@@ -13,6 +13,7 @@ using Mall.Model.Extend.Miai; ...@@ -13,6 +13,7 @@ using Mall.Model.Extend.Miai;
using Mall.Model.Entity.Education; using Mall.Model.Entity.Education;
using Mall.Repository.TradePavilion; using Mall.Repository.TradePavilion;
using Mall.Repository.Education; using Mall.Repository.Education;
using Mall.Model.Entity.Miai;
namespace Mall.Module.Miai namespace Mall.Module.Miai
{ {
...@@ -69,11 +70,19 @@ namespace Mall.Module.Miai ...@@ -69,11 +70,19 @@ namespace Mall.Module.Miai
/// </summary> /// </summary>
private readonly Repository.User.RB_Member_UserRepository member_UserRepository = new Repository.User.RB_Member_UserRepository(); private readonly Repository.User.RB_Member_UserRepository member_UserRepository = new Repository.User.RB_Member_UserRepository();
/// <summary>
/// 会员等级
/// </summary>
private readonly Repository.User.RB_Member_GradeRepository member_GradeRepository = new Repository.User.RB_Member_GradeRepository();
/// <summary> /// <summary>
/// 区域 /// 区域
/// </summary> /// </summary>
private readonly Repository.BaseSetUp.Rb_destinationRepository destinationRepository = new Repository.BaseSetUp.Rb_destinationRepository(); private readonly Repository.BaseSetUp.Rb_destinationRepository destinationRepository = new Repository.BaseSetUp.Rb_destinationRepository();
private readonly RB_MiAi_BaseInfoQueryRepository miAiBaseInfoQueryRepository = new RB_MiAi_BaseInfoQueryRepository();
#region 会员信息 #region 会员信息
/// <summary> /// <summary>
/// 获取用户信息 /// 获取用户信息
...@@ -238,7 +247,7 @@ namespace Mall.Module.Miai ...@@ -238,7 +247,7 @@ namespace Mall.Module.Miai
var list = miaiCommonModule.GetPageList(pageIndex, pageSize, out count, demodel); var list = miaiCommonModule.GetPageList(pageIndex, pageSize, out count, demodel);
if (list.Any()) if (list.Any())
{ {
//每种类型 额外返回数据 //每种类型 额外返回数据
#region 拼拼活动 #region 拼拼活动
var activityList = list.Where(x => x.Type == Common.Enum.MiAi.MessageTypeEnum.SpellEnroll || x.Type == Common.Enum.MiAi.MessageTypeEnum.SpellEnrollCancel var activityList = list.Where(x => x.Type == Common.Enum.MiAi.MessageTypeEnum.SpellEnroll || x.Type == Common.Enum.MiAi.MessageTypeEnum.SpellEnrollCancel
...@@ -316,9 +325,9 @@ namespace Mall.Module.Miai ...@@ -316,9 +325,9 @@ namespace Mall.Module.Miai
}); });
} }
var bmodel = blist.Where(x => x.UserId == item.CreateBy ).FirstOrDefault(); var bmodel = blist.Where(x => x.UserId == item.CreateBy).FirstOrDefault();
var userModel= userList.Where(x => x.Id == item.CreateBy ).FirstOrDefault(); var userModel = userList.Where(x => x.Id == item.CreateBy).FirstOrDefault();
item.Name = userModel?.Name ?? ""; item.Name = userModel?.Name ?? "";
item.Photo = userModel?.Photo ?? ""; item.Photo = userModel?.Photo ?? "";
item.Sex = bmodel?.Sex ?? 0; item.Sex = bmodel?.Sex ?? 0;
...@@ -603,6 +612,7 @@ namespace Mall.Module.Miai ...@@ -603,6 +612,7 @@ namespace Mall.Module.Miai
model.ActivityTitle, model.ActivityTitle,
model.Content, model.Content,
ImageList = !string.IsNullOrEmpty(model.Images) ? JsonConvert.DeserializeObject<List<string>>(model.Images) : new List<string>() { }, ImageList = !string.IsNullOrEmpty(model.Images) ? JsonConvert.DeserializeObject<List<string>>(model.Images) : new List<string>() { },
LabelList = !string.IsNullOrEmpty(model.Label) ? JsonConvert.DeserializeObject<List<string>>(model.Label) : new List<string>() { },
model.UserId, model.UserId,
UserName = umodel.Name, UserName = umodel.Name,
umodel.Photo, umodel.Photo,
...@@ -845,15 +855,15 @@ namespace Mall.Module.Miai ...@@ -845,15 +855,15 @@ namespace Mall.Module.Miai
return miai_ActivityDiscussRepository.GetList(dmodel); return miai_ActivityDiscussRepository.GetList(dmodel);
} }
/// <summary> /// <summary>
/// 获取评论回复分页列表 /// 获取评论回复分页列表
/// </summary> /// </summary>
/// <param name="pageIndex"></param> /// <param name="pageIndex"></param>
/// <param name="pageSize"></param> /// <param name="pageSize"></param>
/// <param name="count"></param> /// <param name="count"></param>
/// <param name="demodel"></param> /// <param name="demodel"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_Miai_ActivityDiscuss_Extend> GetActivityReplyPageList(int pageIndex, int pageSize, out long count, RB_Miai_ActivityDiscuss_Extend demodel) public List<RB_Miai_ActivityDiscuss_Extend> GetActivityReplyPageList(int pageIndex, int pageSize, out long count, RB_Miai_ActivityDiscuss_Extend demodel)
{ {
var list = miai_ActivityDiscussRepository.GetPageList(pageIndex, pageSize, out count, demodel); var list = miai_ActivityDiscussRepository.GetPageList(pageIndex, pageSize, out count, demodel);
foreach (var qitem in list) foreach (var qitem in list)
...@@ -1262,7 +1272,7 @@ namespace Mall.Module.Miai ...@@ -1262,7 +1272,7 @@ namespace Mall.Module.Miai
model.CName = (model.City.HasValue && model.City.Value > 0) ? (arealist.Where(x => x.ID == model.City).FirstOrDefault()?.Name ?? "") : ""; model.CName = (model.City.HasValue && model.City.Value > 0) ? (arealist.Where(x => x.ID == model.City).FirstOrDefault()?.Name ?? "") : "";
model.DName = (model.District.HasValue && model.District.Value > 0) ? (arealist.Where(x => x.ID == model.District).FirstOrDefault()?.Name ?? "") : ""; model.DName = (model.District.HasValue && model.District.Value > 0) ? (arealist.Where(x => x.ID == model.District).FirstOrDefault()?.Name ?? "") : "";
} }
return model; return model;
} }
...@@ -1296,7 +1306,7 @@ namespace Mall.Module.Miai ...@@ -1296,7 +1306,7 @@ namespace Mall.Module.Miai
else else
{ {
Dictionary<string, object> keyValues = new Dictionary<string, object>() { Dictionary<string, object> keyValues = new Dictionary<string, object>() {
//{ nameof(RB_MiAi_BaseInfo_Extend.Sex),model.Sex}, { nameof(RB_MiAi_BaseInfo_Extend.Sex),model.Sex},
{ nameof(RB_MiAi_BaseInfo_Extend.Weight),model.Weight}, { nameof(RB_MiAi_BaseInfo_Extend.Weight),model.Weight},
{ nameof(RB_MiAi_BaseInfo_Extend.Height),model.Height}, { nameof(RB_MiAi_BaseInfo_Extend.Height),model.Height},
{ nameof(RB_MiAi_BaseInfo_Extend.EducationType),model.EducationType}, { nameof(RB_MiAi_BaseInfo_Extend.EducationType),model.EducationType},
...@@ -1309,6 +1319,8 @@ namespace Mall.Module.Miai ...@@ -1309,6 +1319,8 @@ namespace Mall.Module.Miai
{ nameof(RB_MiAi_BaseInfo_Extend.WorkUnit),model.WorkUnit}, { nameof(RB_MiAi_BaseInfo_Extend.WorkUnit),model.WorkUnit},
{ nameof(RB_MiAi_BaseInfo_Extend.YearMoney),model.YearMoney}, { nameof(RB_MiAi_BaseInfo_Extend.YearMoney),model.YearMoney},
{ nameof(RB_MiAi_BaseInfo_Extend.HouseInfo),model.HouseInfo}, { nameof(RB_MiAi_BaseInfo_Extend.HouseInfo),model.HouseInfo},
{ nameof(RB_MiAi_BaseInfo_Extend.OtherInfo),model.OtherInfo},
{ nameof(RB_MiAi_BaseInfo_Extend.CarInfo),model.CarInfo},
{ nameof(RB_MiAi_BaseInfo_Extend.FamilyInfo),model.FamilyInfo}, { nameof(RB_MiAi_BaseInfo_Extend.FamilyInfo),model.FamilyInfo},
{ nameof(RB_MiAi_BaseInfo_Extend.Hobby),model.Hobby}, { nameof(RB_MiAi_BaseInfo_Extend.Hobby),model.Hobby},
{ nameof(RB_MiAi_BaseInfo_Extend.LikeFood),model.LikeFood}, { nameof(RB_MiAi_BaseInfo_Extend.LikeFood),model.LikeFood},
...@@ -1322,7 +1334,11 @@ namespace Mall.Module.Miai ...@@ -1322,7 +1334,11 @@ namespace Mall.Module.Miai
{ nameof(RB_MiAi_BaseInfo_Extend.HopeYou),model.HopeYou}, { nameof(RB_MiAi_BaseInfo_Extend.HopeYou),model.HopeYou},
{ nameof(RB_MiAi_BaseInfo_Extend.Album),model.Album}, { nameof(RB_MiAi_BaseInfo_Extend.Album),model.Album},
{ nameof(RB_MiAi_BaseInfo_Extend.Appointment),model.Appointment}, { nameof(RB_MiAi_BaseInfo_Extend.Appointment),model.Appointment},
{ nameof(RB_MiAi_BaseInfo_Extend.AppointmentAddress),model.AppointmentAddress} { nameof(RB_MiAi_BaseInfo_Extend.AppointmentAddress),model.AppointmentAddress},
{ nameof(RB_MiAi_BaseInfo_Extend.IDCard),model.IDCard},
{ nameof(RB_MiAi_BaseInfo_Extend.IDCardBack),model.IDCardBack},
{ nameof(RB_MiAi_BaseInfo_Extend.IDCardNo),model.IDCardNo},
{ nameof(RB_MiAi_BaseInfo_Extend.ActivityRegion),model.ActivityRegion}
}; };
List<WhereHelper> wheres = new List<WhereHelper>() { List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){ new WhereHelper(){
...@@ -1351,6 +1367,22 @@ namespace Mall.Module.Miai ...@@ -1351,6 +1367,22 @@ namespace Mall.Module.Miai
return miai_BaseInfoRepository.GetFirstBaseInfoPageList(pageIndex, pageSize, out rowsCount, where); return miai_BaseInfoRepository.GetFirstBaseInfoPageList(pageIndex, pageSize, out rowsCount, 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> GetFirstBaseInfoPageList_V2(int pageIndex, int pageSize, out long rowsCount, RB_MiaiMember_Extend where)
{
return miai_BaseInfoRepository.GetFirstBaseInfoPageList_V2(pageIndex, pageSize, out rowsCount, where);
}
/// <summary> /// <summary>
/// 分页列表 /// 分页列表
...@@ -1376,7 +1408,7 @@ namespace Mall.Module.Miai ...@@ -1376,7 +1408,7 @@ namespace Mall.Module.Miai
/// <param name="rowsCount"></param> /// <param name="rowsCount"></param>
/// <param name="where"></param> /// <param name="where"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiAi_BaseInfo_Extend where, int Top) public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiaiMember_Extend where, int Top)
{ {
return miai_BaseInfoRepository.GetMatchingBaseInfoList(where, Top); return miai_BaseInfoRepository.GetMatchingBaseInfoList(where, Top);
} }
...@@ -1541,5 +1573,179 @@ namespace Mall.Module.Miai ...@@ -1541,5 +1573,179 @@ namespace Mall.Module.Miai
#endregion #endregion
#region 会员信息
/// <summary>
/// 获取用户分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="dmodel"></param>
/// <returns></returns>
public List<Model.Extend.User.RB_Member_MiaiUser_Extend> GetMemberUserPageList(int pageIndex, int pageSize, out long count, Model.Extend.User.RB_Member_MiaiUser_Extend dmodel)
{
var list = member_UserRepository.GetMiAiPageList(pageIndex, pageSize, out count, dmodel);
if (list.Any())
{
List<Model.Extend.User.RB_Member_Grade_Extend> gradeList = new List<Model.Extend.User.RB_Member_Grade_Extend>();
if (list.Where(x => x.MemberGrade > 0).Any())
{
var gradeIds = string.Join(",", list.Where(x => x.MemberGrade > 0).Select(x => x.MemberGrade ?? 0));
gradeList = member_GradeRepository.GetList(new Model.Extend.User.RB_Member_Grade_Extend() { GradeIds = gradeIds, TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId });
}
foreach (var item in list)
{
if (item.MemberGrade > 0)
{
item.MemberGradeName = gradeList.Where(x => x.Id == item.MemberGrade).FirstOrDefault()?.Name ?? "";
}
else
{
item.MemberGradeName = "普通会员";
}
}
}
return list;
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<Model.Extend.User.RB_Member_MiaiUser_Extend> GetMiAiList(Model.Extend.User.RB_Member_MiaiUser_Extend dmodel)
{
var list = member_UserRepository.GetMiAiList( dmodel);
if (list.Any())
{
List<Model.Extend.User.RB_Member_Grade_Extend> gradeList = new List<Model.Extend.User.RB_Member_Grade_Extend>();
if (list.Where(x => x.MemberGrade > 0).Any())
{
var gradeIds = string.Join(",", list.Where(x => x.MemberGrade > 0).Select(x => x.MemberGrade ?? 0));
gradeList = member_GradeRepository.GetList(new Model.Extend.User.RB_Member_Grade_Extend() { GradeIds = gradeIds, TenantId = dmodel.TenantId, MallBaseId = dmodel.MallBaseId });
}
foreach (var item in list)
{
if (item.MemberGrade > 0)
{
item.MemberGradeName = gradeList.Where(x => x.Id == item.MemberGrade).FirstOrDefault()?.Name ?? "";
}
else
{
item.MemberGradeName = "普通会员";
}
}
}
return list;
}
/// <summary>
/// 后台修改用户信息
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool SetMemberUserInfoForHT(Model.Extend.User.RB_Member_User_Extend demodel)
{
Dictionary<string, object> files = new Dictionary<string, object>() {
{ nameof(Model.Entity.User.RB_Member_User.MemberGrade),demodel.MemberGrade},
{ nameof(Model.Entity.User.RB_Member_User.SuperiorId),demodel.SuperiorId},
{ nameof(Model.Entity.User.RB_Member_User.ContactWay),demodel.ContactWay},
{ nameof(Model.Entity.User.RB_Member_User.Remark),demodel.Remark},
{ nameof(Model.Entity.User.RB_Member_User.AliasName),demodel.AliasName},
{ nameof(Model.Entity.User.RB_Member_User.UpdateDate),demodel.UpdateDate},
{ nameof(Model.Entity.User.RB_Member_User.PostId),demodel.PostId},
{ nameof(Model.Entity.User.RB_Member_User.Blacklist),demodel.Blacklist},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(Model.Entity.User.RB_Member_User.Id),
FiledValue=demodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
bool flag = member_UserRepository.Update(files, wheres);
if (flag)
{
//清除黑名单缓存
var userInfo = new AppletUserInfo
{
MallBaseId = demodel.MallBaseId,
UserId = demodel.Id,
TenantId = demodel.TenantId,
Name = demodel.Name,
SuperiorId = demodel.SuperiorId ?? 0,
Blacklist = demodel.Blacklist
};
CacheManager.User.UserReidsCache.AppletUserInfoSet(CacheKey.UserModuleCacheKeyConfig.Applet_Blacklist_Info + demodel.Id, userInfo, Config.JwtExpirTime);
}
return flag;
}
#endregion
#region 会员基础查询信息
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfoQuery> GetBaseInfoQueryList(RB_MiAi_BaseInfoQuery where)
{
return miAiBaseInfoQueryRepository.GetBaseInfoQueryList(where);
}
/// <summary>
/// 新增/修改会员基础信息查询条件信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetMiAiBaseInfoQuery(RB_MiAi_BaseInfoQuery model)
{
if (model.Id == 0)
{
return miAiBaseInfoQueryRepository.Insert(model) > 0;
}
else
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_MiAi_BaseInfoQuery.Age),model.Age},
{ nameof(RB_MiAi_BaseInfoQuery.EndAge),model.EndAge},
{ nameof(RB_MiAi_BaseInfoQuery.Weight),model.Weight},
{ nameof(RB_MiAi_BaseInfoQuery.EndWeight),model.EndWeight},
{ nameof(RB_MiAi_BaseInfoQuery.Height),model.Height},
{ nameof(RB_MiAi_BaseInfoQuery.EndHeight),model.EndHeight},
{ nameof(RB_MiAi_BaseInfoQuery.YearMoney),model.YearMoney},
{ nameof(RB_MiAi_BaseInfoQuery.EndYearMoney),model.EndYearMoney},
{ nameof(RB_MiAi_BaseInfoQuery.EducationType),model.EducationType},
{ nameof(RB_MiAi_BaseInfoQuery.CarInfo),model.CarInfo},
{ nameof(RB_MiAi_BaseInfoQuery.Marriage),model.Marriage},
{ nameof(RB_MiAi_BaseInfoQuery.HouseInfo),model.HouseInfo},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_MiAi_BaseInfoQuery.Id),
FiledValue=model.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return miAiBaseInfoQueryRepository.Update(keyValues, wheres);
}
}
#endregion
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Model.Entity.Miai;
namespace Mall.Repository.Miai
{
public class RB_MiAi_BaseInfoQueryRepository:BaseRepository<RB_MiAi_BaseInfoQuery>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_MiAi_BaseInfoQuery); } }
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfoQuery> GetBaseInfoQueryList(RB_MiAi_BaseInfoQuery where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from RB_MiAi_BaseInfoQuery where Status=0");
if (where != null)
{
if (where.TenantId > 0)
{
sb.AppendFormat(" and TenantId={0}", where.TenantId);
}
if (where.MallBaseId > 0)
{
sb.AppendFormat(" and MallBaseId={0}", where.MallBaseId);
}
if (where.Id > 0)
{
sb.AppendFormat(" and Id={0}", where.Id);
}
if (where.UserId > 0)
{
sb.AppendFormat(" and UserId={0}", where.UserId);
}
if (where.Sex > 0)
{
sb.AppendFormat(" and Sex={0}", where.Sex);
}
}
return Get<RB_MiAi_BaseInfoQuery>(sb.ToString()).ToList();
}
}
}
...@@ -78,7 +78,7 @@ namespace Mall.Repository.Miai ...@@ -78,7 +78,7 @@ namespace Mall.Repository.Miai
{ {
sb.AppendFormat(" and a.UserId={0}", where.UserId); sb.AppendFormat(" and a.UserId={0}", where.UserId);
} }
if (!string.IsNullOrWhiteSpace(where.Name)) if (!string.IsNullOrWhiteSpace(where.Name))
{ {
sb.AppendFormat(" and b.Name like'%{0}%'", where.Name); sb.AppendFormat(" and b.Name like'%{0}%'", where.Name);
...@@ -155,6 +155,107 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -155,6 +155,107 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
/// <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> GetFirstBaseInfoPageList_V2(int pageIndex, int pageSize, out long rowsCount, RB_MiaiMember_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from (SELECT c.*,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( c.Birthday )- 1+ (DATE_FORMAT( c.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age from RB_MiAi_BaseInfo as c
LEFT JOIN rb_member_user as b on c.UserId=b.Id where c.Status=0 and b.Blacklist!=1
) as a where 1=1");
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);
}
if (where.Age > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Age)} >={where.Age}");
}
if (where.EndAge > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Age)} <={where.EndAge}");
}
if (where.Height > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Height)} >={where.Height}");
}
if (where.EndHeight > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Height)} <={where.EndHeight}");
}
if (where.Weight > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Weight)} >={where.Weight}");
}
if (where.EndWeight > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Weight)} <={where.EndWeight}");
}
if (where.YearMoney > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.YearMoney)} >={where.YearMoney}");
}
if (where.EndYearMoney > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.YearMoney)} <={where.EndYearMoney}");
}
if (where.CarInfo.HasValue && where.CarInfo.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.CarInfo)} ={(int)where.CarInfo}");
}
if (where.HouseInfo.HasValue && where.HouseInfo.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.HouseInfo)} ={(int)where.HouseInfo}");
}
if (where.Marriage.HasValue && where.Marriage.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Marriage)} ={(int)where.Marriage}");
}
if (where.EducationType.HasValue && where.EducationType.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.EducationType)} ={(int)where.EducationType}");
}
sb.AppendFormat(" ORDER BY a.CreateDate desc ");
}
return GetPage<RB_MiAi_BaseInfo_Extend>(pageIndex, pageSize, out rowsCount, sb.ToString()).ToList();
}
...@@ -228,27 +329,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis ...@@ -228,27 +329,12 @@ LEFT JOIN rb_member_user as b on a.UserId=b.Id where a.Status=0 and b.Blacklis
/// <param name="rowsCount"></param> /// <param name="rowsCount"></param>
/// <param name="where"></param> /// <param name="where"></param>
/// <returns></returns> /// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiAi_BaseInfo_Extend where,int Top) public List<RB_MiAi_BaseInfo_Extend> GetMatchingBaseInfoList(RB_MiaiMember_Extend where, int Top)
{ {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT 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 a. *,b.`Name`,b.Photo ,(YEAR (curdate())- YEAR ( a.Birthday )- 1+ (DATE_FORMAT( a.Birthday, '%m%d' )<=(DATE_FORMAT( curdate(), '%m%d' )))) Age FROM
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");
`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 != null)
{ {
if (where.TenantId > 0) if (where.TenantId > 0)
...@@ -275,7 +361,64 @@ LIMIT {Top} "); ...@@ -275,7 +361,64 @@ LIMIT {Top} ");
{ {
sb.AppendFormat(" and a.UserId in({0})", where.UserIds); sb.AppendFormat(" and a.UserId in({0})", where.UserIds);
} }
if (where.Age > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Age)} >={where.Age}");
}
if (where.EndAge > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Age)} <={where.EndAge}");
}
if (where.Height > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Height)} >={where.Height}");
}
if (where.EndHeight > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Height)} <={where.EndHeight}");
}
if (where.Weight > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Weight)} >={where.Weight}");
}
if (where.EndWeight > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Weight)} <={where.EndWeight}");
}
if (where.YearMoney > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.YearMoney)} >={where.YearMoney}");
}
if (where.EndYearMoney > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.YearMoney)} <={where.EndYearMoney}");
}
if (where.CarInfo.HasValue && where.CarInfo.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.CarInfo)} ={(int)where.CarInfo}");
}
if (where.HouseInfo.HasValue && where.HouseInfo.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.HouseInfo)} ={(int)where.HouseInfo}");
}
if (where.Marriage.HasValue && where.Marriage.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.Marriage)} ={(int)where.Marriage}");
}
if (where.EducationType.HasValue && where.EducationType.Value > 0)
{
sb.AppendFormat($@" and a.{nameof(RB_MiaiMember_Extend.EducationType)} ={(int)where.EducationType}");
}
} }
sb.AppendFormat($@" ORDER BY a.id LIMIT {Top}");
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList(); return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
} }
} }
......
...@@ -283,14 +283,14 @@ select * from RB_Member_User where {where} order by CreateDate desc ...@@ -283,14 +283,14 @@ select * from RB_Member_User where {where} order by CreateDate desc
//查找直属下级 //查找直属下级
where += $@" and u.{nameof(RB_Member_User.SuperiorId)}={dmodel.Id}"; where += $@" and u.{nameof(RB_Member_User.SuperiorId)}={dmodel.Id}";
} }
else else
{ {
if (!string.IsNullOrEmpty(dmodel.UserIds)) if (!string.IsNullOrEmpty(dmodel.UserIds))
{ {
where += $@" and u.{nameof(RB_Member_User.Id)} in({dmodel.UserIds})"; where += $@" and u.{nameof(RB_Member_User.Id)} in({dmodel.UserIds})";
} }
} }
if (dmodel.FXGradeId > 0) if (dmodel.FXGradeId > 0)
{ {
where += $@" and d.{nameof(RB_Distributor_Info.FXGradeId)}={dmodel.FXGradeId}"; where += $@" and d.{nameof(RB_Distributor_Info.FXGradeId)}={dmodel.FXGradeId}";
...@@ -1240,5 +1240,292 @@ FROM ...@@ -1240,5 +1240,292 @@ FROM
string sql = $@"select Id,Name,AliasName from RB_Member_User where {where} order by CreateDate desc"; string sql = $@"select Id,Name,AliasName from RB_Member_User where {where} order by CreateDate desc";
return GetPage<RB_Member_User_Extend>(pageIndex, pageSize, out count, sql).ToList(); return GetPage<RB_Member_User_Extend>(pageIndex, pageSize, out count, sql).ToList();
} }
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_MiaiUser_Extend> GetMiAiPageList(int pageIndex, int pageSize, out long rowCount, RB_Member_MiaiUser_Extend dmodel)
{
string where = " 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and t.{nameof(RB_Member_User.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and t.{nameof(RB_Member_User.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and t.{nameof(RB_Member_User.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and t.{nameof(RB_Member_User.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.AliasName))
{
where += $@" and t.{nameof(RB_Member_User.AliasName)} like '%{dmodel.AliasName}%'";
}
if (dmodel.Source > 0)
{
where += $@" and t.{nameof(RB_Member_User.Source)} ={(int)dmodel.Source}";
}
if (!string.IsNullOrEmpty(dmodel.Moblie))
{
where += $@" and t.{nameof(RB_Member_User.Moblie)} like '%{dmodel.Moblie}%'";
}
if (dmodel.MemberGrade > 0)
{
where += $@" and t.{nameof(RB_Member_User.MemberGrade)}={dmodel.MemberGrade}";
}
if (dmodel.SuperiorId > 0)
{
where += $@" and t.{nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
if (dmodel.IsDistributor > 0)
{
where += $@" and t.{nameof(RB_Member_User.IsDistributor)}={dmodel.IsDistributor}";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and t.{nameof(RB_Member_User.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and t.{nameof(RB_Member_User.CreateDate)} <='{dmodel.EndTime} 23:59:59'";
}
if (dmodel.Age > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Age)} >={dmodel.Age}";
}
if (dmodel.EndAge > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Age)} <={dmodel.EndAge}";
}
if (dmodel.Height > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Height)} >={dmodel.Height}";
}
if (dmodel.EndHeight > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Height)} <={dmodel.EndHeight}";
}
if (dmodel.Weight > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Weight)} >={dmodel.Weight}";
}
if (dmodel.EndWeight > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Weight)} <={dmodel.EndWeight}";
}
if (dmodel.YearMoney > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.YearMoney)} >={dmodel.YearMoney}";
}
if (dmodel.EndYearMoney > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.YearMoney)} <={dmodel.EndYearMoney}";
}
if (dmodel.CarInfo.HasValue && dmodel.CarInfo.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.CarInfo)} ={(int)dmodel.CarInfo}";
}
if (dmodel.HouseInfo.HasValue && dmodel.HouseInfo.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.HouseInfo)} ={(int)dmodel.HouseInfo}";
}
if (dmodel.Marriage.HasValue && dmodel.Marriage.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Marriage)} ={(int)dmodel.Marriage}";
}
if (dmodel.EducationType.HasValue && dmodel.EducationType.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.EducationType)} ={(int)dmodel.EducationType}";
}
//if (dmodel.IsEmptyUserPhoto == 1)
//{
// where += $@" and IFNULL(a.{nameof(RB_Member_User.Photo)},'')=''";
//}
//HK06-01新增查询条件
if (dmodel.OpenId != null && !string.IsNullOrWhiteSpace(dmodel.OpenId))
{
where += $@" and t.{nameof(RB_Member_User.OpenId)} = '%{dmodel.OpenId}%'";
}
//if (dmodel.IsSelectCommpany == 1)
//{
// where += $@" and a.{nameof(RB_Member_User.Id)} between 5 and 100 ";
//}
string orderBy = "t.CreateDate desc";
//if (dmodel.MinUserId > 0)
//{
// where += $@" and a.{nameof(RB_Member_User.Id)}>{dmodel.MinUserId}";
// orderBy = "a.Id asc";
//}
string sql = $@"
SELECT * from (SELECT a.*, b.Album,b.Birthday,b.Height,b.Weight,b.YearMoney,b.EducationType,b.Marriage,b.CarInfo,b.HouseInfo,(YEAR (curdate()) - YEAR (b.Birthday) - 1 + ( DATE_FORMAT(b.Birthday, '%m%d') <= ( DATE_FORMAT(curdate(), '%m%d') ) )) Age
FROM RB_Member_User AS a LEFT JOIN rb_miai_baseinfo AS b ON a.Id = b.UserId) as t where {where} order by {orderBy}
";
return GetPage<RB_Member_MiaiUser_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Member_MiaiUser_Extend> GetMiAiList(RB_Member_MiaiUser_Extend dmodel)
{
string where = " 1=1 ";
if (dmodel.TenantId > 0)
{
where += $@" and t.{nameof(RB_Member_User.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and t.{nameof(RB_Member_User.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.Id > 0)
{
where += $@" and t.{nameof(RB_Member_User.Id)}={dmodel.Id}";
}
if (!string.IsNullOrEmpty(dmodel.Name))
{
where += $@" and t.{nameof(RB_Member_User.Name)} like '%{dmodel.Name}%'";
}
if (!string.IsNullOrEmpty(dmodel.AliasName))
{
where += $@" and t.{nameof(RB_Member_User.AliasName)} like '%{dmodel.AliasName}%'";
}
if (dmodel.Source > 0)
{
where += $@" and t.{nameof(RB_Member_User.Source)} ={(int)dmodel.Source}";
}
if (!string.IsNullOrEmpty(dmodel.Moblie))
{
where += $@" and t.{nameof(RB_Member_User.Moblie)} like '%{dmodel.Moblie}%'";
}
if (dmodel.MemberGrade > 0)
{
where += $@" and t.{nameof(RB_Member_User.MemberGrade)}={dmodel.MemberGrade}";
}
if (dmodel.SuperiorId > 0)
{
where += $@" and t.{nameof(RB_Member_User.SuperiorId)}={dmodel.SuperiorId}";
}
if (dmodel.IsDistributor > 0)
{
where += $@" and t.{nameof(RB_Member_User.IsDistributor)}={dmodel.IsDistributor}";
}
if (!string.IsNullOrEmpty(dmodel.StartTime))
{
where += $@" and t.{nameof(RB_Member_User.CreateDate)} >='{dmodel.StartTime}'";
}
if (!string.IsNullOrEmpty(dmodel.EndTime))
{
where += $@" and t.{nameof(RB_Member_User.CreateDate)} <='{dmodel.EndTime} 23:59:59'";
}
if (dmodel.Age > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Age)} >={dmodel.Age}";
}
if (dmodel.EndAge > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Age)} <={dmodel.EndAge}";
}
if (dmodel.Height > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Height)} >={dmodel.Height}";
}
if (dmodel.EndHeight > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Height)} <={dmodel.EndHeight}";
}
if (dmodel.Weight > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Weight)} >={dmodel.Weight}";
}
if (dmodel.EndWeight > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Weight)} <={dmodel.EndWeight}";
}
if (dmodel.YearMoney > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.YearMoney)} >={dmodel.YearMoney}";
}
if (dmodel.EndYearMoney > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.YearMoney)} <={dmodel.EndYearMoney}";
}
if (dmodel.CarInfo.HasValue && dmodel.CarInfo.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.CarInfo)} ={(int)dmodel.CarInfo}";
}
if (dmodel.HouseInfo.HasValue && dmodel.HouseInfo.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.HouseInfo)} ={(int)dmodel.HouseInfo}";
}
if (dmodel.Marriage.HasValue && dmodel.Marriage.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.Marriage)} ={(int)dmodel.Marriage}";
}
if (dmodel.EducationType.HasValue && dmodel.EducationType.Value > 0)
{
where += $@" and t.{nameof(RB_Member_MiaiUser_Extend.EducationType)} ={(int)dmodel.EducationType}";
}
//if (dmodel.IsEmptyUserPhoto == 1)
//{
// where += $@" and IFNULL(a.{nameof(RB_Member_User.Photo)},'')=''";
//}
//HK06-01新增查询条件
if (dmodel.OpenId != null && !string.IsNullOrWhiteSpace(dmodel.OpenId))
{
where += $@" and t.{nameof(RB_Member_User.OpenId)} = '%{dmodel.OpenId}%'";
}
//if (dmodel.IsSelectCommpany == 1)
//{
// where += $@" and a.{nameof(RB_Member_User.Id)} between 5 and 100 ";
//}
string orderBy = "t.CreateDate desc";
//if (dmodel.MinUserId > 0)
//{
// where += $@" and a.{nameof(RB_Member_User.Id)}>{dmodel.MinUserId}";
// orderBy = "a.Id asc";
//}
string sql = $@"
SELECT * from (SELECT a.*, b.Album,b.Birthday,b.Height,b.Weight,b.YearMoney,b.EducationType,b.Marriage,b.CarInfo,b.HouseInfo,(YEAR (curdate()) - YEAR (b.Birthday) - 1 + ( DATE_FORMAT(b.Birthday, '%m%d') <= ( DATE_FORMAT(curdate(), '%m%d') ) )) Age
FROM RB_Member_User AS a LEFT JOIN rb_miai_baseinfo AS b ON a.Id = b.UserId) as t where {where} order by {orderBy}
";
return Get<RB_Member_MiaiUser_Extend>(sql).ToList();
}
} }
} }
...@@ -1345,30 +1345,7 @@ namespace Mall.WebApi.Controllers ...@@ -1345,30 +1345,7 @@ namespace Mall.WebApi.Controllers
lastItem.Age = tempGood.Age.ToString(); //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.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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -1383,14 +1360,42 @@ namespace Mall.WebApi.Controllers ...@@ -1383,14 +1360,42 @@ namespace Mall.WebApi.Controllers
} }
else if (miAiUserItem.addUserType == 1)//匹配度暂无规则 else if (miAiUserItem.addUserType == 1)//匹配度暂无规则
{ {
var miaiBaseIfoQuery = new Model.Extend.Miai.RB_MiaiMember_Extend
var tempGoodsList = miaiModule.GetMatchingBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend
{ {
TenantId = TenantId, TenantId = TenantId,
MallBaseId = MallBaseId, MallBaseId = MallBaseId,
UserId = UserId, UserId = UserId,
Sex = Sex Sex = Sex
}, miAiUserItem.goodsLength); };
if (Sex > 0)
{
var queryBaseInfoModel = miaiModule.GetBaseInfoQueryList(new Model.Entity.Miai.RB_MiAi_BaseInfoQuery
{
TenantId = TenantId,
MallBaseId = MallBaseId,
UserId = UserId,
Sex = Sex == 1 ? 2 : (Sex == 2 ? 1 : 0)
}).FirstOrDefault();
if (queryBaseInfoModel != null && queryBaseInfoModel.Id > 0)
{
miaiBaseIfoQuery.Age = queryBaseInfoModel.Age;
miaiBaseIfoQuery.EndAge = queryBaseInfoModel.EndAge;
miaiBaseIfoQuery.Weight = queryBaseInfoModel.Weight;
miaiBaseIfoQuery.EndWeight = queryBaseInfoModel.EndWeight;
miaiBaseIfoQuery.Height = queryBaseInfoModel.Height;
miaiBaseIfoQuery.EndHeight = queryBaseInfoModel.EndHeight;
miaiBaseIfoQuery.YearMoney = queryBaseInfoModel.YearMoney;
miaiBaseIfoQuery.EndYearMoney = queryBaseInfoModel.EndYearMoney;
miaiBaseIfoQuery.EducationType = queryBaseInfoModel.EducationType;
miaiBaseIfoQuery.CarInfo = queryBaseInfoModel.CarInfo;
miaiBaseIfoQuery.HouseInfo = queryBaseInfoModel.HouseInfo;
miaiBaseIfoQuery.Marriage = queryBaseInfoModel.Marriage;
}
}
var tempGoodsList = miaiModule.GetMatchingBaseInfoList(miaiBaseIfoQuery, miAiUserItem.goodsLength);
List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>(); List<miaiUserDetail> newGoodsList = new List<miaiUserDetail>();
foreach (var tempGood in tempGoodsList) foreach (var tempGood in tempGoodsList)
{ {
...@@ -1405,29 +1410,6 @@ namespace Mall.WebApi.Controllers ...@@ -1405,29 +1410,6 @@ namespace Mall.WebApi.Controllers
lastItem.Age = tempGood.Age.ToString(); lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -1466,30 +1448,6 @@ namespace Mall.WebApi.Controllers ...@@ -1466,30 +1448,6 @@ namespace Mall.WebApi.Controllers
lastItem.Age = tempGood.Age.ToString(); lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -1530,29 +1488,6 @@ namespace Mall.WebApi.Controllers ...@@ -1530,29 +1488,6 @@ namespace Mall.WebApi.Controllers
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; 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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
......
...@@ -18,6 +18,7 @@ using Mall.Model.Entity.Education; ...@@ -18,6 +18,7 @@ using Mall.Model.Entity.Education;
using Mall.Model.Extend.Education; using Mall.Model.Extend.Education;
using Mall.Module.User; using Mall.Module.User;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Mall.Model.Entity.Miai;
namespace Mall.WebApi.Controllers.MallBase namespace Mall.WebApi.Controllers.MallBase
{ {
...@@ -90,6 +91,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -90,6 +91,7 @@ namespace Mall.WebApi.Controllers.MallBase
x.EnrollNum, x.EnrollNum,
x.IsOpenEnroll, x.IsOpenEnroll,
x.Label, x.Label,
LabelList = string.IsNullOrWhiteSpace(x.Label) ? new List<string>() : JsonConvert.DeserializeObject<List<string>>(x.Label),
StartTime = x.StartTime.ToString("yyyy-MM-dd HH:mm"), StartTime = x.StartTime.ToString("yyyy-MM-dd HH:mm"),
EndTime = x.EndTime.ToString("yyyy-MM-dd HH:mm"), EndTime = x.EndTime.ToString("yyyy-MM-dd HH:mm"),
x.ManNum, x.ManNum,
...@@ -146,6 +148,18 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -146,6 +148,18 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Failed("已进入黑名单,无法访问"); return ApiResult.Failed("已进入黑名单,无法访问");
} }
var oldBaseInfo = miaiModule.GetBaseInfoModel(new RB_MiAi_BaseInfo_Extend { UserId = userInfo.UserId, TenantId = userInfo.TenantId, MallBaseId = RequestParm.MallBaseId });
if (oldBaseInfo == null || oldBaseInfo.Id <= 0)
{
return ApiResult.Failed("请先实名认证");
}
if (string.IsNullOrWhiteSpace(oldBaseInfo.IDCard) || string.IsNullOrWhiteSpace(oldBaseInfo.IDCardBack))
{
return ApiResult.Failed("请上传身份证信息");
}
RB_Miai_Activity_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_Activity_Extend>(parms.msg.ToString()); RB_Miai_Activity_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_Activity_Extend>(parms.msg.ToString());
if (demodel.ForumId <= 0) if (demodel.ForumId <= 0)
{ {
...@@ -221,6 +235,21 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -221,6 +235,21 @@ namespace Mall.WebApi.Controllers.MallBase
demodel.ImageList ??= new List<string>(); demodel.ImageList ??= new List<string>();
demodel.Images = JsonConvert.SerializeObject(demodel.ImageList); demodel.Images = JsonConvert.SerializeObject(demodel.ImageList);
demodel.LabelList ??= new List<string>();
if (demodel.LabelList != null && demodel.LabelList.Any())
{
if (demodel.LabelList.Count() > 3)
{
return ApiResult.ParamIsNull("标签最多3个");
}
if (demodel.LabelList.Where(x => x.Length > 5).Count() > 0)
{
return ApiResult.ParamIsNull("标签最多5个字");
}
}
demodel.Label = JsonConvert.SerializeObject(demodel.LabelList);
demodel.TenantId = userInfo.TenantId; demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId; demodel.MallBaseId = userInfo.MallBaseId;
demodel.Status = 0; demodel.Status = 0;
...@@ -320,7 +349,6 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -320,7 +349,6 @@ namespace Mall.WebApi.Controllers.MallBase
public ApiResult GetActivityDiscussCount() public ApiResult GetActivityDiscussCount()
{ {
var parms = RequestParm; var parms = RequestParm;
RB_Miai_ActivityDiscuss_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_ActivityDiscuss_Extend>(parms.msg.ToString()); RB_Miai_ActivityDiscuss_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_ActivityDiscuss_Extend>(parms.msg.ToString());
if (demodel.ActivityId <= 0) if (demodel.ActivityId <= 0)
{ {
...@@ -879,7 +907,10 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -879,7 +907,10 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Failed("请选择身高"); return ApiResult.Failed("请选择身高");
} }
if (baseInfo.YearMoney == 0)
{
return ApiResult.Failed("请输入年收入");
}
if (!baseInfo.EducationType.HasValue || (int)baseInfo.EducationType == 0) if (!baseInfo.EducationType.HasValue || (int)baseInfo.EducationType == 0)
{ {
return ApiResult.Failed("请选择学历"); return ApiResult.Failed("请选择学历");
...@@ -888,14 +919,25 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -888,14 +919,25 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
return ApiResult.Failed("请选择婚姻状况"); return ApiResult.Failed("请选择婚姻状况");
} }
if (!baseInfo.CarInfo.HasValue || (int)baseInfo.CarInfo == 0)
{
return ApiResult.Failed("请选择车辆信息");
}
if (!baseInfo.HouseInfo.HasValue || (int)baseInfo.HouseInfo == 0)
{
return ApiResult.Failed("请选择房产信息");
}
if (baseInfo.AlbumList != null && baseInfo.AlbumList.Any()) if (baseInfo.AlbumList != null && baseInfo.AlbumList.Any())
{ {
if (baseInfo.AlbumList.Count() < 2)
{
return ApiResult.Failed("请上传照片,至少2张");
}
baseInfo.Album = JsonConvert.SerializeObject(baseInfo.AlbumList); baseInfo.Album = JsonConvert.SerializeObject(baseInfo.AlbumList);
} }
else else
{ {
baseInfo.Album = ""; return ApiResult.Failed("请上传照片,至少2张");
} }
var oldBaseInfo = miaiModule.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend { UserId = baseInfo.UserId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId }).FirstOrDefault(); var oldBaseInfo = miaiModule.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend { UserId = baseInfo.UserId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId }).FirstOrDefault();
if (oldBaseInfo != null && oldBaseInfo.Id > 0) if (oldBaseInfo != null && oldBaseInfo.Id > 0)
...@@ -999,6 +1041,8 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -999,6 +1041,8 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
oldBaseInfo.AlbumList = new List<string>(); oldBaseInfo.AlbumList = new List<string>();
} }
IsAttestation = 1;//已认证 IsAttestation = 1;//已认证
} }
else else
...@@ -1030,14 +1074,18 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1030,14 +1074,18 @@ namespace Mall.WebApi.Controllers.MallBase
Marriage = oldBaseInfo.Marriage ?? 0, Marriage = oldBaseInfo.Marriage ?? 0,
Job = oldBaseInfo.Job ?? "", Job = oldBaseInfo.Job ?? "",
WorkUnit = oldBaseInfo?.WorkUnit ?? "", WorkUnit = oldBaseInfo?.WorkUnit ?? "",
YearMoney = oldBaseInfo.YearMoney ?? "", YearMoney = oldBaseInfo?.YearMoney ?? 0,
CName = oldBaseInfo.CName ?? "", CName = oldBaseInfo.CName ?? "",
DName = oldBaseInfo.DName ?? "", DName = oldBaseInfo.DName ?? "",
PName = oldBaseInfo.PName ?? "", PName = oldBaseInfo.PName ?? "",
Province = oldBaseInfo.Province ?? 0, Province = oldBaseInfo.Province ?? 0,
City = oldBaseInfo.City ?? 0, City = oldBaseInfo.City ?? 0,
District = oldBaseInfo.District ?? 0, District = oldBaseInfo.District ?? 0,
HouseInfo = oldBaseInfo.HouseInfo ?? "", OtherInfo = oldBaseInfo.OtherInfo ?? "",
HouseInfo = oldBaseInfo.HouseInfo ?? 0,
CarInfo = oldBaseInfo.CarInfo ?? 0,
CarInfoStr = (oldBaseInfo.CarInfo.HasValue && oldBaseInfo.CarInfo.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.CarInfo) : "",
HouseInfoStr = (oldBaseInfo.HouseInfo.HasValue && oldBaseInfo.HouseInfo.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.HouseInfo) : "",
FamilyInfo = oldBaseInfo?.FamilyInfo ?? "", FamilyInfo = oldBaseInfo?.FamilyInfo ?? "",
Hobby = oldBaseInfo?.Hobby ?? "", Hobby = oldBaseInfo?.Hobby ?? "",
LikeFood = oldBaseInfo?.LikeFood ?? "", LikeFood = oldBaseInfo?.LikeFood ?? "",
...@@ -1051,7 +1099,11 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1051,7 +1099,11 @@ namespace Mall.WebApi.Controllers.MallBase
About = oldBaseInfo.About ?? "", About = oldBaseInfo.About ?? "",
Appointment = oldBaseInfo.Appointment ?? "", Appointment = oldBaseInfo.Appointment ?? "",
AppointmentAddress = oldBaseInfo.AppointmentAddress ?? "", AppointmentAddress = oldBaseInfo.AppointmentAddress ?? "",
oldBaseInfo.AlbumList oldBaseInfo.AlbumList,
IDCardBack = oldBaseInfo.IDCardBack ?? "",
IDCard = oldBaseInfo.IDCard ?? "",
IDCardNo = oldBaseInfo.IDCardNo ?? "",
ActivityRegion = oldBaseInfo.ActivityRegion ?? "",
}; };
return ApiResult.Success("", result); return ApiResult.Success("", result);
} }
...@@ -1074,39 +1126,58 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1074,39 +1126,58 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
var parms = RequestParm; var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString()); ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_MiAi_BaseInfo_Extend demodel = JsonConvert.DeserializeObject<RB_MiAi_BaseInfo_Extend>(RequestParm.msg.ToString()); RB_MiaiMember_Extend demodel = JsonConvert.DeserializeObject<RB_MiaiMember_Extend>(RequestParm.msg.ToString());
demodel.TenantId = parms.TenantId; demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId; demodel.MallBaseId = parms.MallBaseId;
demodel.UserId = parms.UserId; demodel.UserId = parms.UserId;
int Sex = 0;
int Age = 0;
if (demodel.UserId > 0)//说明用户登录了的 if (demodel.UserId > 0)//说明用户登录了的
{ {
//查看用户的 try
var baseInfo = miaiModule.GetBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend { TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, UserId = demodel.UserId }).FirstOrDefault();
if (baseInfo != null)
{ {
Sex = baseInfo.Sex; int queryId = 0;
if (!string.IsNullOrWhiteSpace(baseInfo.Birthday))
var queryBaseInfoModel = miaiModule.GetBaseInfoQueryList(new Model.Entity.Miai.RB_MiAi_BaseInfoQuery
{ {
try TenantId = demodel.TenantId,
{ MallBaseId = demodel.MallBaseId,
Age = Convert.ToInt32(Common.Plugin.StringHelper.GetAge(baseInfo.Birthday)); UserId = demodel.UserId,
} Sex = demodel.Sex
catch (Exception) }).FirstOrDefault();
{
Age = 0; queryId = queryBaseInfoModel?.Id ?? 0;
}
} var queryModel = new Model.Entity.Miai.RB_MiAi_BaseInfoQuery
{
Id = queryId,
Age = demodel.Age,
EndAge = demodel.EndAge,
Weight = demodel.Weight,
EndWeight = demodel.EndWeight,
Height = demodel.Height,
EndHeight = demodel.EndHeight,
YearMoney = demodel.YearMoney,
EndYearMoney = demodel.EndYearMoney,
EducationType = demodel.EducationType,
CarInfo = demodel.CarInfo,
HouseInfo = demodel.HouseInfo,
Marriage = demodel.Marriage,
Sex = demodel.Sex,
UserId = demodel.UserId,
TenantId = demodel.TenantId,
MallBaseId = demodel.MallBaseId,
Status = 0,
CreateDate = System.DateTime.Now
};
var queryResult = miaiModule.SetMiAiBaseInfoQuery(queryModel);
} }
if (demodel.Sex > 0) catch (Exception ex)
{ {
demodel.Sex = demodel.Sex == 1 ? 2 : (demodel.Sex == 2 ? 1 : 0);
} }
} }
var list = miaiModule.GetFirstBaseInfoPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel); var list = miaiModule.GetFirstBaseInfoPageList_V2(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
List<Model.Extend.MarketingCenter.miaiUserDetail> newGoodsList = new List<Model.Extend.MarketingCenter.miaiUserDetail>(); List<Model.Extend.MarketingCenter.miaiUserDetail> newGoodsList = new List<Model.Extend.MarketingCenter.miaiUserDetail>();
foreach (var tempGood in list) foreach (var tempGood in list)
...@@ -1122,30 +1193,6 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1122,30 +1193,6 @@ namespace Mall.WebApi.Controllers.MallBase
lastItem.Age = tempGood.Age.ToString(); lastItem.Age = tempGood.Age.ToString();
lastItem.Marriage = (tempGood.Marriage.HasValue && tempGood.Marriage.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.Marriage) : ""; 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) : ""; lastItem.Education = (tempGood.EducationType.HasValue && tempGood.EducationType.Value > 0) ? Common.Plugin.EnumHelper.GetEnumName(tempGood.EducationType) : "";
if (demodel.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.Score = 0;
lastItem.Album = tempGood.Album; lastItem.Album = tempGood.Album;
if (!string.IsNullOrWhiteSpace(lastItem.Album)) if (!string.IsNullOrWhiteSpace(lastItem.Album))
...@@ -1159,6 +1206,43 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1159,6 +1206,43 @@ namespace Mall.WebApi.Controllers.MallBase
pagelist.pageData = newGoodsList; pagelist.pageData = newGoodsList;
return ApiResult.Success("", pagelist); return ApiResult.Success("", pagelist);
} }
/// <summary>
/// 获取会员基础信息
/// </summary>
/// <returns></returns>
[AllowAnonymous]
[HttpPost]
public ApiResult GetBaseInfoQueryList()
{
var parms = RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(RequestParm.msg.ToString());
RB_MiAi_BaseInfoQuery demodel = JsonConvert.DeserializeObject<RB_MiAi_BaseInfoQuery>(RequestParm.msg.ToString());
demodel.TenantId = parms.TenantId;
demodel.MallBaseId = parms.MallBaseId;
demodel.UserId = parms.UserId;
if (demodel.UserId > 0)
{
var queryBaseInfoModel = miaiModule.GetBaseInfoQueryList(new Model.Entity.Miai.RB_MiAi_BaseInfoQuery
{
TenantId = demodel.TenantId,
MallBaseId = demodel.MallBaseId,
UserId = demodel.UserId
});
return ApiResult.Success("", queryBaseInfoModel);
}
else
{
return ApiResult.Failed("暂未登录");
}
}
/// <summary> /// <summary>
/// 获取教育枚举 /// 获取教育枚举
/// </summary> /// </summary>
...@@ -1188,6 +1272,37 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1188,6 +1272,37 @@ namespace Mall.WebApi.Controllers.MallBase
Id = Convert.ToInt32(x.Value) Id = Convert.ToInt32(x.Value)
})); }));
} }
/// <summary>
/// 获取房屋枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetHouseInfoEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MiAi.HouseInfoEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取车辆枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCarInfoEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MiAi.CarInfoEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
#endregion #endregion
...@@ -1367,6 +1482,19 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -1367,6 +1482,19 @@ namespace Mall.WebApi.Controllers.MallBase
return ApiResult.Failed("请重新登录"); return ApiResult.Failed("请重新登录");
} }
var oldBaseInfo = miaiModule.GetBaseInfoModel(new RB_MiAi_BaseInfo_Extend { UserId = userInfo.UserId, TenantId = userInfo.TenantId, MallBaseId = RequestParm.MallBaseId });
if (oldBaseInfo == null || oldBaseInfo.Id <= 0)
{
return ApiResult.Failed("请先实名认证");
}
if (string.IsNullOrWhiteSpace(oldBaseInfo.IDCard)|| string.IsNullOrWhiteSpace(oldBaseInfo.IDCardBack))
{
return ApiResult.Failed("请上传身份证信息");
}
Rb_Education_Dynamic_Extend article = JsonConvert.DeserializeObject<Rb_Education_Dynamic_Extend>(req.msg.ToString()); Rb_Education_Dynamic_Extend article = JsonConvert.DeserializeObject<Rb_Education_Dynamic_Extend>(req.msg.ToString());
article.Content = StringHelper.UrlDecode(article.Content); article.Content = StringHelper.UrlDecode(article.Content);
if (string.IsNullOrWhiteSpace(article.Content) && (article.FileList == null || !article.FileList.Any())) if (string.IsNullOrWhiteSpace(article.Content) && (article.FileList == null || !article.FileList.Any()))
......
...@@ -15,6 +15,8 @@ using Mall.AOP; ...@@ -15,6 +15,8 @@ using Mall.AOP;
using Mall.Module.Miai; using Mall.Module.Miai;
using Mall.Model.Extend.Miai; using Mall.Model.Extend.Miai;
using Mall.Model.Extend.Point; using Mall.Model.Extend.Point;
using Mall.Model.Extend.User;
using Mall.Module.User;
namespace Mall.WebApi.Controllers.MallBase namespace Mall.WebApi.Controllers.MallBase
{ {
...@@ -24,7 +26,6 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -24,7 +26,6 @@ namespace Mall.WebApi.Controllers.MallBase
[EnableCors("AllowCors")] [EnableCors("AllowCors")]
public class MiaiController : BaseController public class MiaiController : BaseController
{ {
private readonly MiaiModule miaiModule = new MiaiModule(); private readonly MiaiModule miaiModule = new MiaiModule();
private readonly Module.Education.PointModule pointModule = new Module.Education.PointModule(); private readonly Module.Education.PointModule pointModule = new Module.Education.PointModule();
#region 活动版块 #region 活动版块
...@@ -578,6 +579,7 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -578,6 +579,7 @@ namespace Mall.WebApi.Controllers.MallBase
{ {
oldBaseInfo.AlbumList = JsonConvert.DeserializeObject<List<string>>(oldBaseInfo.Album); oldBaseInfo.AlbumList = JsonConvert.DeserializeObject<List<string>>(oldBaseInfo.Album);
} }
var result = new var result = new
{ {
SexStr = (oldBaseInfo != null && oldBaseInfo.Id > 0) ? (oldBaseInfo.Sex == 1 ? "男" : "女") : "", SexStr = (oldBaseInfo != null && oldBaseInfo.Id > 0) ? (oldBaseInfo.Sex == 1 ? "男" : "女") : "",
...@@ -595,14 +597,18 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -595,14 +597,18 @@ namespace Mall.WebApi.Controllers.MallBase
Marriage = oldBaseInfo.Marriage ?? 0, Marriage = oldBaseInfo.Marriage ?? 0,
Job = oldBaseInfo.Job ?? "", Job = oldBaseInfo.Job ?? "",
WorkUnit = oldBaseInfo?.WorkUnit ?? "", WorkUnit = oldBaseInfo?.WorkUnit ?? "",
YearMoney = oldBaseInfo.YearMoney ?? "", YearMoney = oldBaseInfo?.YearMoney ?? 0,
CName = oldBaseInfo.CName ?? "", CName = oldBaseInfo.CName ?? "",
DName = oldBaseInfo.DName ?? "", DName = oldBaseInfo.DName ?? "",
PName = oldBaseInfo.PName ?? "", PName = oldBaseInfo.PName ?? "",
Province = oldBaseInfo.Province ?? 0, Province = oldBaseInfo.Province ?? 0,
City = oldBaseInfo.City ?? 0, City = oldBaseInfo.City ?? 0,
District = oldBaseInfo.District ?? 0, District = oldBaseInfo.District ?? 0,
HouseInfo = oldBaseInfo.HouseInfo ?? "", OtherInfo = oldBaseInfo.OtherInfo ?? "",
HouseInfo = oldBaseInfo.HouseInfo ?? 0,
CarInfo = oldBaseInfo.CarInfo ?? 0,
CarInfoStr = (oldBaseInfo.CarInfo.HasValue && oldBaseInfo.CarInfo.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.CarInfo) : "",
HouseInfoStr = (oldBaseInfo.HouseInfo.HasValue && oldBaseInfo.HouseInfo.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.HouseInfo) : "",
FamilyInfo = oldBaseInfo?.FamilyInfo ?? "", FamilyInfo = oldBaseInfo?.FamilyInfo ?? "",
Hobby = oldBaseInfo?.Hobby ?? "", Hobby = oldBaseInfo?.Hobby ?? "",
LikeFood = oldBaseInfo?.LikeFood ?? "", LikeFood = oldBaseInfo?.LikeFood ?? "",
...@@ -616,7 +622,11 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -616,7 +622,11 @@ namespace Mall.WebApi.Controllers.MallBase
About = oldBaseInfo.About ?? "", About = oldBaseInfo.About ?? "",
Appointment = oldBaseInfo.Appointment ?? "", Appointment = oldBaseInfo.Appointment ?? "",
AppointmentAddress = oldBaseInfo.AppointmentAddress ?? "", AppointmentAddress = oldBaseInfo.AppointmentAddress ?? "",
oldBaseInfo.AlbumList oldBaseInfo.AlbumList,
IDCardNo = oldBaseInfo.IDCardNo ?? "",
IDCard = oldBaseInfo.IDCard ?? "",
IDCardBack = oldBaseInfo.IDCardBack ?? "",
ActivityRegion = oldBaseInfo.ActivityRegion ?? "",
}; };
return ApiResult.Success("", result); return ApiResult.Success("", result);
} }
...@@ -658,5 +668,486 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -658,5 +668,486 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion #endregion
#region 会员中心
/// <summary>
/// 获取用户分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMemberUserPageList()
{
var parms = RequestParm;
JObject param = JObject.Parse(parms.msg.ToString());
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
Model.Extend.User.RB_Member_MiaiUser_Extend demodel = new Model.Extend.User.RB_Member_MiaiUser_Extend()
{
Name = param.GetStringValue("Name"),
Source = (Common.Enum.User.UserSourceEnum)param.GetInt("Source"),
MemberGrade = param.GetInt("MemberGrade"),
Id = param.GetInt("Id"),
Moblie = param.GetStringValue("Moblie"),
StartTime = param.GetStringValue("StartTime"),
EndTime = param.GetStringValue("EndTime"),
CarInfo = (Common.Enum.MiAi.CarInfoEnum)param.GetInt("CarInfo"),
HouseInfo = (Common.Enum.MiAi.HouseInfoEnum)param.GetInt("HouseInfo"),
EducationType = (Common.Enum.MiAi.EducationTypeEnum)param.GetInt("EducationType"),
Marriage = (Common.Enum.MiAi.MarriageEnum)param.GetInt("Marriage"),
Age = param.GetInt("Age"),
EndAge = param.GetInt("EndAge"),
Height = param.GetInt("Height"),
EndHeight = param.GetInt("EndHeight"),
Weight = param.GetInt("Weight"),
EndWeight = param.GetInt("EndWeight"),
YearMoney = param.GetInt("YearMoney"),
EndYearMoney = param.GetInt("EndYearMoney"),
};
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = miaiModule.GetMemberUserPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.AliasName,
Birthday = x.Birthday ?? "",
EducationType = x.EducationType ?? 0,
x.Age,
x.Height,
x.Weight,
MarriageStr = (x.Marriage.HasValue && x.Marriage.Value > 0) ? EnumHelper.GetEnumName(x.Marriage) : "",
Marriage = x.Marriage ?? 0,
YearMoney = x?.YearMoney ?? 0,
HouseInfo = x.HouseInfo ?? 0,
CarInfo = x.CarInfo ?? 0,
CarInfoStr = (x.CarInfo.HasValue && x.CarInfo.Value > 0) ? EnumHelper.GetEnumName(x.CarInfo) : "",
HouseInfoStr = (x.HouseInfo.HasValue && x.HouseInfo.Value > 0) ? EnumHelper.GetEnumName(x.HouseInfo) : "",
EducationTypeStr = (x.EducationType.HasValue && x.EducationType.Value > 0) ? EnumHelper.GetEnumName(x.EducationType) : "",
x.Balance,
x.Blacklist,
x.CardVolumeNum,
x.ContactWay,
x.CouponsNum,
x.Integral,
x.TotalConsumption,
x.MemberGrade,
x.MemberGradeName,
x.Moblie,
x.Name,
x.OpenId,
x.OrderNum,
x.Photo,
x.Remark,
x.Source,
SourceName = x.Source.GetEnumName(),
x.TenantId,
x.PostId,
PostName = (x?.PostId ?? 0) == 1 ? "领队导游" : "",
UserPageTypeStr = x.UserPageType.GetEnumName(),
CreateDate = x.CreateDate.HasValue ? x.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""
}); ;
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 获取用户下载枚举列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMiAiUserExportList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.User.MiAiUserExportEnum));
return ApiResult.Success("", list.Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 用户信息下载
/// </summary>
[HttpPost]
public FileContentResult GetMemberUserListToExcel()
{
var parms = RequestParm;
RB_Member_MiaiUser_Extend demodel = JsonConvert.DeserializeObject<RB_Member_MiaiUser_Extend>(parms.msg.ToString());
string ExcelName = "用户列表" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
List<ExcelDataSource> slist = new List<ExcelDataSource>();
if (demodel.ExcelEnumIds == null || !demodel.ExcelEnumIds.Any())
{
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
var Enumlist = EnumHelper.GetEnumList(typeof(Common.Enum.User.MiAiUserExportEnum));
ExcelDataSource header = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30)
{
new ExcelColumn(value: "序号") { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER }
}
};
foreach (var item in demodel.ExcelEnumIds)
{
var Name = Enumlist.Where(x => x.Value == item.ToString()).FirstOrDefault().Key ?? "";
header.ExcelRows.Add(new ExcelColumn(value: Name) { CellWidth = 15, HAlignmentEnum = HAlignmentEnum.CENTER, VAlignmentEnum = VAlignmentEnum.CENTER });
}
slist.Add(header);
try
{
demodel.TenantId = Convert.ToInt32(parms.uid);
demodel.MallBaseId = parms.MallBaseId;
var list = miaiModule.GetMiAiList(demodel);
#region 组装数据
int Num = 0;
foreach (var item in list)
{
Num++;
ExcelDataSource datarow = new ExcelDataSource()
{
ExcelRows = new List<ExcelColumn>(30) {
new ExcelColumn(value:Num.ToString()){ },
}
};
foreach (var qitem in demodel.ExcelEnumIds)
{
switch (qitem)
{
case 1:
datarow.ExcelRows.Add(new ExcelColumn(value: item.Source.GetEnumName()) { }); break;
case 2:
datarow.ExcelRows.Add(new ExcelColumn(value: item.Id.ToString()) { }); break;
case 3:
datarow.ExcelRows.Add(new ExcelColumn(value: item.OpenId) { }); break;
case 4:
datarow.ExcelRows.Add(new ExcelColumn(value: (item.AliasName ?? "") != "" ? item.AliasName : item.Name) { }); break;
case 5:
datarow.ExcelRows.Add(new ExcelColumn(value: item.Moblie) { }); break;
case 6:
datarow.ExcelRows.Add(new ExcelColumn(value: item.ContactWay) { }); break;
case 7:
datarow.ExcelRows.Add(new ExcelColumn(value: item.Remark) { }); break;
case 8:
datarow.ExcelRows.Add(new ExcelColumn(value: item.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss")) { }); break;
case 9:
datarow.ExcelRows.Add(new ExcelColumn(value: item.MemberGradeName) { }); break;
case 10:
datarow.ExcelRows.Add(new ExcelColumn(value: (item.Age).ToString()+"岁") { }); break;
case 11:
datarow.ExcelRows.Add(new ExcelColumn(value: (item.Height).ToString()+"CM") { }); break;
case 12:
datarow.ExcelRows.Add(new ExcelColumn(value: (item.Weight).ToString()+"KG") { }); break;
case 13:
datarow.ExcelRows.Add(new ExcelColumn(value: (item.YearMoney).ToString()+"万") { }); break;
case 14:
datarow.ExcelRows.Add(new ExcelColumn(value: ((item.CarInfo.HasValue && item.CarInfo.Value > 0) ? EnumHelper.GetEnumName(item.CarInfo) : "")) { }); break;
case 15:
datarow.ExcelRows.Add(new ExcelColumn(value: ((item.HouseInfo.HasValue && item.HouseInfo.Value > 0) ? EnumHelper.GetEnumName(item.HouseInfo) : "")) { }); break;
case 16:
datarow.ExcelRows.Add(new ExcelColumn(value: ((item.EducationType.HasValue && item.EducationType.Value > 0) ? EnumHelper.GetEnumName(item.EducationType) : "")) { }); break;
case 17:
datarow.ExcelRows.Add(new ExcelColumn(value: ((item.Marriage.HasValue && item.Marriage.Value > 0) ? EnumHelper.GetEnumName(item.Marriage) : "")) { }); break;
}
}
slist.Add(datarow);
}
#endregion
var byteData = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData, "application/octet-stream", ExcelName);
}
catch (Exception ex)
{
LogHelper.Write(ex, string.Format("GetFileFromWebApi_requestData: {0}", JsonHelper.Serialize(RequestParm)));
var byteData1 = ExcelTempLateHelper.ToExcelExtend(slist);
return File(byteData1, "application/octet-stream", ExcelName);
}
}
/// <summary>
/// 获取教育枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetEducationTypeEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MiAi.EducationTypeEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取婚姻枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMarriageEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MiAi.MarriageEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取房屋枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetHouseInfoEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MiAi.HouseInfoEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取车辆枚举
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetCarInfoEnumList()
{
var list = EnumHelper.GetEnumList(typeof(Common.Enum.MiAi.CarInfoEnum));
return ApiResult.Success("", list.OrderBy(x => Convert.ToInt32(x.Value)).Select(x => new
{
Name = x.Key,
Id = Convert.ToInt32(x.Value)
}));
}
/// <summary>
/// 获取用户信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMemberUserInfo()
{
var requestParm = RequestParm;
var parms = JObject.Parse(requestParm.msg.ToString());
int UserId = parms.GetInt("UserId", 0);
if (UserId <= 0)
{
return ApiResult.ParamIsNull();
}
var model = miaiModule.GetMemberUserInfo(UserId);
if (model.TenantId != Convert.ToInt32(requestParm.uid))
{
return ApiResult.ParamIsNull("未查询到该用户信息");
}
if (model.MallBaseId != requestParm.MallBaseId)
{
return ApiResult.ParamIsNull("未查询到该用户信息");
}
string SuperiorName = "";
if (model.SuperiorId > 0)
{
SuperiorName = miaiModule.GetMemberUserInfo(model.SuperiorId ?? 0)?.Name ?? "";
}
//先查询当前用户是否已经有基础信息
var oldBaseInfo = miaiModule.GetBaseInfoModel(new RB_MiAi_BaseInfo_Extend { UserId = model.Id, TenantId = model.TenantId, MallBaseId = model.MallBaseId });
if (oldBaseInfo != null && oldBaseInfo.Id > 0)
{
oldBaseInfo.AlbumList = new List<string>();
if (!string.IsNullOrWhiteSpace(oldBaseInfo.Album))
{
oldBaseInfo.AlbumList = JsonConvert.DeserializeObject<List<string>>(oldBaseInfo.Album);
}
}
return ApiResult.Success("", new
{
model.Id,
model.Photo,
model.Name,
model.AliasName,
model.MemberGrade,
model.SuperiorId,
SuperiorName,
model.Blacklist,
model.ContactWay,
model.Moblie,
model.Remark,
model.PostId,
CreateDate = model.CreateDate.HasValue ? model.CreateDate.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
SexStr = (oldBaseInfo != null && oldBaseInfo.Id > 0) ? (oldBaseInfo.Sex == 1 ? "男" : "女") : "",
Birthday = oldBaseInfo.Birthday ?? "",
Sex = oldBaseInfo?.Sex ?? 0,
oldBaseInfo?.Height,
oldBaseInfo?.Weight,
EducationType = oldBaseInfo.EducationType ?? 0,
EducationTypeStr = (oldBaseInfo.EducationType.HasValue && oldBaseInfo.EducationType.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.EducationType) : "",
SchoolInfo = oldBaseInfo.SchoolInfo ?? "",
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))),//星座
MarriageStr = (oldBaseInfo.Marriage.HasValue && oldBaseInfo.Marriage.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.Marriage) : "",
Marriage = oldBaseInfo.Marriage ?? 0,
Job = oldBaseInfo.Job ?? "",
WorkUnit = oldBaseInfo?.WorkUnit ?? "",
YearMoney = oldBaseInfo?.YearMoney ?? 0,
CName = oldBaseInfo.CName ?? "",
DName = oldBaseInfo.DName ?? "",
PName = oldBaseInfo.PName ?? "",
Province = oldBaseInfo.Province ?? 0,
City = oldBaseInfo.City ?? 0,
District = oldBaseInfo.District ?? 0,
OtherInfo = oldBaseInfo.OtherInfo ?? "",
HouseInfo = oldBaseInfo.HouseInfo ?? 0,
CarInfo = oldBaseInfo.CarInfo ?? 0,
CarInfoStr = (oldBaseInfo.CarInfo.HasValue && oldBaseInfo.CarInfo.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.CarInfo) : "",
HouseInfoStr = (oldBaseInfo.HouseInfo.HasValue && oldBaseInfo.HouseInfo.Value > 0) ? EnumHelper.GetEnumName(oldBaseInfo.HouseInfo) : "",
FamilyInfo = oldBaseInfo?.FamilyInfo ?? "",
Hobby = oldBaseInfo?.Hobby ?? "",
LikeFood = oldBaseInfo?.LikeFood ?? "",
LikeBook = oldBaseInfo.LikeBook ?? "",
LikeTV = oldBaseInfo.LikeTV ?? "",
LikeSong = oldBaseInfo.LikeSong ?? "",
IdealLove = oldBaseInfo.IdealLove ?? "",
LoveTalk = oldBaseInfo.LoveTalk ?? "",
SingleReason = oldBaseInfo.SingleReason ?? "",
HopeYou = oldBaseInfo.HopeYou ?? "",
About = oldBaseInfo.About ?? "",
Appointment = oldBaseInfo.Appointment ?? "",
AppointmentAddress = oldBaseInfo.AppointmentAddress ?? "",
oldBaseInfo.AlbumList,
IDCardBack = oldBaseInfo.IDCardBack ?? "",
IDCard = oldBaseInfo.IDCard ?? "",
IDCardNo = oldBaseInfo.IDCardNo ?? "",
ActivityRegion = oldBaseInfo.ActivityRegion ?? "",
});
}
/// <summary>
/// 后台更新用户信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMemberUserInfoForHT()
{
var parms = RequestParm;
RB_Member_User_Extend demodel = JsonConvert.DeserializeObject<RB_Member_User_Extend>(parms.msg.ToString());
RB_MiAi_BaseInfo_Extend baseInfo = JsonConvert.DeserializeObject<RB_MiAi_BaseInfo_Extend>(parms.msg.ToString());
if (demodel.Id <= 0)
{
return ApiResult.ParamIsNull();
}
var umodel = miaiModule.GetMemberUserInfo(demodel.Id);
if (umodel == null)
{
return ApiResult.Failed("用户不存在");
}
if (umodel.TenantId != Convert.ToInt32(parms.uid))
{
return ApiResult.ParamIsNull("未查询到该用户信息");
}
if (umodel.MallBaseId != parms.MallBaseId)
{
return ApiResult.ParamIsNull("未查询到该用户信息");
}
//先查询当前用户是否已经有基础信息
var oldBaseInfo = miaiModule.GetBaseInfoModel(new RB_MiAi_BaseInfo_Extend { UserId = umodel.Id, TenantId = umodel.TenantId, MallBaseId = umodel.MallBaseId });
if (oldBaseInfo != null && oldBaseInfo.Id > 0)
{
baseInfo.Id = oldBaseInfo.Id;
}
else
{
baseInfo.Id = 0;
baseInfo.Status = 0;
baseInfo.CreateDate = DateTime.Now;
baseInfo.UserId = umodel.Id;
baseInfo.TenantId = umodel.TenantId;
baseInfo.MallBaseId = umodel.MallBaseId;
}
if (baseInfo.Sex == 0)
{
return ApiResult.Failed("请选择性别");
}
if (string.IsNullOrWhiteSpace(baseInfo.Birthday))
{
return ApiResult.Failed("请选择生日");
}
if (baseInfo.Weight == 0)
{
return ApiResult.Failed("请选择体重");
}
if (baseInfo.Height == 0)
{
return ApiResult.Failed("请选择身高");
}
if (baseInfo.YearMoney == 0)
{
return ApiResult.Failed("请输入年收入");
}
if (!baseInfo.EducationType.HasValue || (int)baseInfo.EducationType == 0)
{
return ApiResult.Failed("请选择学历");
}
if (!baseInfo.Marriage.HasValue || (int)baseInfo.Marriage == 0)
{
return ApiResult.Failed("请选择婚姻状况");
}
if (!baseInfo.CarInfo.HasValue || (int)baseInfo.CarInfo == 0)
{
return ApiResult.Failed("请选择车辆信息");
}
if (!baseInfo.HouseInfo.HasValue || (int)baseInfo.HouseInfo == 0)
{
return ApiResult.Failed("请选择房产信息");
}
if (baseInfo.AlbumList != null && baseInfo.AlbumList.Any())
{
if (baseInfo.AlbumList.Count() < 2)
{
return ApiResult.Failed("请上传照片,至少2张");
}
baseInfo.Album = JsonConvert.SerializeObject(baseInfo.AlbumList);
}
else
{
return ApiResult.Failed("请上传照片,至少2张");
}
bool flag = miaiModule.SetMemberUserInfoForHT(demodel);
if (flag)
{
miaiModule.SetMiAiBaseInfo(baseInfo);
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
} }
} }
\ No newline at end of file
...@@ -386,6 +386,367 @@ namespace Mall.WebApi.Controllers.User ...@@ -386,6 +386,367 @@ namespace Mall.WebApi.Controllers.User
} }
/// <summary>
/// 登录注册
/// </summary>
/// <param name="requestMsg"></param>
/// <returns></returns>
[HttpPost]
public ApiResult MiAiLogin(object requestMsg)
{
var requestParm = JsonConvert.DeserializeObject<RequestParm>(requestMsg.ToString());
JObject parms = JObject.Parse(requestParm.msg.ToString());
RB_Member_User_Extend demodel = new RB_Member_User_Extend()
{
Source = (UserSourceEnum)parms.GetInt("Source"),
OpenId = parms.GetStringValue("OpenId"),
Name = parms.GetStringValue("Name"),
Photo = parms.GetStringValue("Photo"),
Moblie = parms.GetStringValue("Moblie"),
SuperiorId = parms.GetInt("SuperiorId"),
SmallShopId = parms.GetInt("SmallShopId"),
UserPageType = (Common.Enum.Goods.GoodsPageTypeEnum)parms.GetInt("UserPageType", 0),
CounponPassword = parms.GetInt("CounponPassword", 3),
KeyWord = parms.GetStringValue("KeyWord"),
};
Model.Extend.Miai.RB_MiAi_BaseInfo_Extend baseInfo = JsonConvert.DeserializeObject<Model.Extend.Miai.RB_MiAi_BaseInfo_Extend>(requestParm.msg.ToString());
if (requestParm.TenantId <= 0)
{
return ApiResult.ParamIsNull("请传递商户号");
}
if (requestParm.MallBaseId <= 0)
{
return ApiResult.ParamIsNull("请传递小程序id");
}
if (!demodel.Source.HasValue)
{
return ApiResult.ParamIsNull("请传递来源平台");
}
if (string.IsNullOrEmpty(demodel.OpenId))
{
return ApiResult.ParamIsNull("请传递唯一码");
}
baseInfo.Status = 0;
baseInfo.CreateDate = DateTime.Now;
baseInfo.TenantId = requestParm.TenantId;
baseInfo.MallBaseId = requestParm.MallBaseId;
if (baseInfo.Sex == 0)
{
return ApiResult.Failed("请选择性别");
}
if (string.IsNullOrWhiteSpace(baseInfo.Birthday))
{
return ApiResult.Failed("请选择生日");
}
if (baseInfo.Weight == 0)
{
return ApiResult.Failed("请选择体重");
}
if (baseInfo.Height == 0)
{
return ApiResult.Failed("请选择身高");
}
if (baseInfo.YearMoney == 0)
{
return ApiResult.Failed("请输入年收入");
}
if (!baseInfo.EducationType.HasValue || (int)baseInfo.EducationType == 0)
{
return ApiResult.Failed("请选择学历");
}
if (!baseInfo.Marriage.HasValue || (int)baseInfo.Marriage == 0)
{
return ApiResult.Failed("请选择婚姻状况");
}
if (!baseInfo.CarInfo.HasValue || (int)baseInfo.CarInfo == 0)
{
return ApiResult.Failed("请选择车辆信息");
}
if (!baseInfo.HouseInfo.HasValue || (int)baseInfo.HouseInfo == 0)
{
return ApiResult.Failed("请选择房产信息");
}
if (baseInfo.AlbumList != null && baseInfo.AlbumList.Any())
{
if (baseInfo.AlbumList.Count() < 2)
{
return ApiResult.Failed("请上传照片,至少2张");
}
baseInfo.Album = JsonConvert.SerializeObject(baseInfo.AlbumList);
}
else
{
return ApiResult.Failed("请上传照片,至少2张");
}
Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend couponResult = new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend();
Model.Extend.Education.RB_Education_Coupon_Extend educationCouponResult = new Model.Extend.Education.RB_Education_Coupon_Extend();
Model.Extend.Reserve.RB_Reserve_Coupon_Extend reserveCouponResult = new Model.Extend.Reserve.RB_Reserve_Coupon_Extend();
string couponName = string.Empty;
bool isGiveCoupon = false;
//验证是否新用户
if (!userModule.ValidateUserOpenId(demodel.OpenId, demodel.Source, requestParm.TenantId, requestParm.MallBaseId))
{
LogHelper.WriteInfo(demodel.OpenId + ",SuperiorId:" + (demodel.SuperiorId ?? 0));
//注册新用户
if (string.IsNullOrEmpty(demodel.Name))
{
return ApiResult.ParamIsNull("请传递用户名称");
}
if (string.IsNullOrEmpty(demodel.Photo))
{
return ApiResult.ParamIsNull("请传递用户头像");
}
#region 赋默认值
demodel.AliasName ??= "";
demodel.Moblie ??= "";
demodel.MemberGrade ??= 0;//普通会员
demodel.OrderNum ??= 0;
demodel.CouponsNum ??= 0;
demodel.CardVolumeNum ??= 0;
demodel.Balance ??= 0;
demodel.Integral ??= 0;
demodel.SuperiorId ??= 0;//0表示 总店
demodel.Blacklist ??= 0;
demodel.ContactWay ??= "";
demodel.Remark ??= "";
demodel.TotalConsumption ??= 0;
if (!demodel.UserPageType.HasValue)
{
demodel.UserPageType = Common.Enum.Goods.GoodsPageTypeEnum.Mall;
}
else
{
if (demodel.UserPageType == Common.Enum.Goods.GoodsPageTypeEnum.All)
{
demodel.UserPageType = Common.Enum.Goods.GoodsPageTypeEnum.Mall;
}
}
#endregion
var basicsModel = userModule.GetDistributorBasicsInfo(requestParm.TenantId.ToString(), requestParm.MallBaseId);
if ((basicsModel?.ReferralsCondition ?? DistrbutorReferralsEnum.SCDJ) == DistrbutorReferralsEnum.SCDJ || (basicsModel?.ReferralsCondition ?? DistrbutorReferralsEnum.SCDJ) == DistrbutorReferralsEnum.SC7SF)
{
demodel.DownlineCondition = basicsModel?.ReferralsCondition ?? DistrbutorReferralsEnum.SCDJ;
demodel.IsBeDownline = 1;
demodel.WaitSuperiorId = 0;
demodel.BeDownlineDate = DateTime.Now;
}
else
{
demodel.DownlineCondition = basicsModel?.ReferralsCondition ?? DistrbutorReferralsEnum.SCDJ;
demodel.IsBeDownline = 2;
demodel.WaitSuperiorId = demodel.SuperiorId;
demodel.SuperiorId = 0;//未成为下线 暂设为总店
}
demodel.TenantId = requestParm.TenantId;
demodel.MallBaseId = requestParm.MallBaseId;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
demodel.SecretKey = Guid.NewGuid().ToString();
int UserId = userModule.AddMemberUserInfo(demodel);
bool flag = UserId > 0;
if (flag)
{
baseInfo.UserId = UserId;
miaiModule.SetMiAiBaseInfo(baseInfo);
//自动发放新人优惠券 2020-08-04 Add By:W
couponResult = couponModule.AutoCoupon(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend { UserId = UserId, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 3 });
educationCouponResult = educationModule.AutoEducationCoupon(new Model.Extend.Education.RB_Education_Coupon_Extend { UserId = UserId, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 3 });
reserveCouponResult = reserveModule.AutoEducationCoupon(new Model.Extend.Reserve.RB_Reserve_Coupon_Extend { UserId = UserId, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 3 });
if (couponResult != null && couponResult.ID > 0)
{
couponName = couponResult.Name;
isGiveCoupon = true;
}
//自动发放新人优惠券 2020-12-31 Add By:W
if (demodel.CounponPassword == 5 && !string.IsNullOrWhiteSpace(demodel.KeyWord))
{
couponResult = couponModule.AutoCoupon(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend { UserId = UserId, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 5, KeyWord = demodel.KeyWord });
if (couponResult != null && couponResult.ID > 0)
{
couponName = couponName + "," + couponResult.Name;
isGiveCoupon = true;
}
}
#region 粉象返佣 自动注册分销商 普通会员等级
if ((basicsModel?.IsEnableFXGrade ?? 2) == 1)
{
try
{
var FXPModel = userModule.GetFXDistributorGradeList(new RB_Distributor_FXGrade_Extend() { IsGuest = 1, MallBaseId = requestParm.MallBaseId, TenantId = requestParm.TenantId }).FirstOrDefault();
userModule.SetDistributorInfoForFX(FXPModel?.Id ?? 0, UserId, requestParm.TenantId, requestParm.MallBaseId);
}
catch (Exception ex)
{
LogHelper.Write(ex, "粉象模式 自动生成分销商失败,UserId:" + UserId);
}
}
#endregion
//返回基本信息
TokenUserInfo userInfo = new TokenUserInfo { uid = UserId.ToString(), requestFrom = ApiRequestFromEnum.MiniProgram };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch+Config.JwtExpirTime},
{"mall_userInfo",userInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
string token = encoder.Encode(payload, secret);
#endregion
var mmodel = programModule.GetMiniProgramModule(new RB_MiniProgram_Extend() { MallBaseId = demodel.MallBaseId });
AppletUserInfo appletUserInfo = new AppletUserInfo()
{
MallBaseId = demodel.MallBaseId,
MallName = mmodel?.MallName ?? "",
Mobile = demodel.Moblie,
UserId = UserId,
TenantId = demodel.TenantId,
Name = demodel.Name,
OpenId = demodel.OpenId,
Photo = demodel.Photo,
MemberGradeId = demodel.MemberGrade ?? 0,
Source = demodel.Source,
SecretKey = demodel.SecretKey,
SuperiorId = demodel.SuperiorId ?? 0,
Token = token,
SmallShopId = 0,
UserSmallShopId = demodel.SmallShopId,
IsOpenSchool = mmodel.IsOpenSchool,
UserPageType = mmodel.IsOpenSchool == 1 ? demodel.UserPageType : Common.Enum.Goods.GoodsPageTypeEnum.All,
UserTeacher = 0,
IsAddBaseInfo = 0,
IsOpenMiAi = mmodel.IsOpenMiAi,
};
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + UserId, appletUserInfo, Config.JwtExpirTime);
if (isGiveCoupon)
{
return ApiResult.CouponSuccess(ResultCode.Success, 1, "", couponName, appletUserInfo);
}
else
{
return ApiResult.CouponSuccess(ResultCode.Fail, 1, "", "", appletUserInfo);
}
}
return ApiResult.CouponFailed(ResultCode.Fail, 1, "");
// return ApiResult.Failed("注册失败,请联系管理员");
}
else
{
//查询用户信息
var umodel = userModule.GetMemberUserEntityModule(new RB_Member_User_Extend() { TenantId = requestParm.TenantId, MallBaseId = requestParm.MallBaseId, Source = demodel.Source, OpenId = demodel.OpenId });
if (umodel == null)
{
return ApiResult.CouponFailed(ResultCode.Fail, 1, "");
// return ApiResult.Failed("未能查询到用户信息");
}
if (umodel.Blacklist == 1)
{
return ApiResult.Failed("账号已被冻结,请联系运营商");
}
//自动发放新人优惠券 2020-12-31 Add By:W
if (demodel.CounponPassword == 5 && !string.IsNullOrWhiteSpace(demodel.KeyWord))
{
couponResult = couponModule.AutoCoupon(new Model.Extend.MarketingCenter.RB_DiscountCoupon_Extend { UserId = umodel.Id, TenantId = demodel.TenantId, MallBaseId = demodel.MallBaseId, TriggerType = 5, KeyWord = demodel.KeyWord });
if (couponResult != null && couponResult.ID > 0)
{
couponName = couponResult.Name;
isGiveCoupon = true;
}
}
TokenUserInfo userInfo = new TokenUserInfo { uid = umodel.Id.ToString(), requestFrom = ApiRequestFromEnum.MiniProgram };
#region JWT
IDateTimeProvider provider = new UtcDateTimeProvider();
var now = provider.GetNow().AddMinutes(-1);
var unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc); // or use JwtValidator.UnixEpoch
var secondsSinceEpoch = Math.Round((now - unixEpoch).TotalSeconds);
var payload = new Dictionary<string, object>
{
{"iat",secondsSinceEpoch },
{"exp",secondsSinceEpoch + Config.JwtExpirTime},
{"mall_userInfo",userInfo }
};
IJwtAlgorithm algorithm = new HMACSHA256Algorithm();
IJsonSerializer serializer = new JsonNetSerializer();
IBase64UrlEncoder urlEncoder = new JwtBase64UrlEncoder();
IJwtEncoder encoder = new JwtEncoder(algorithm, serializer, urlEncoder);
string secret = Config.JwtSecretKey;
string token = encoder.Encode(payload, secret);
#endregion
var mmodel = programModule.GetMiniProgramModule(new RB_MiniProgram_Extend() { MallBaseId = umodel.MallBaseId });
//2020-08-12 Add By:W
var smallShopsInfoModle = userModule.GetSmallShopsInfoList(new RB_SmallShops_Info_Extend { TenantId = umodel.TenantId, MallBaseId = umodel.MallBaseId, UserId = umodel.Id }).OrderByDescending(x => x.CreateDate).FirstOrDefault();
var teacher = userModule.GetTeacherModel(new Model.Extend.Education.RB_Education_Teacher_Extend { TeacherStatus = 1, TenantId = umodel.TenantId, MallBaseId = umodel.MallBaseId, UserId = umodel.Id });
AppletUserInfo appletUserInfo = new AppletUserInfo()
{
MallBaseId = umodel.MallBaseId,
MallName = mmodel?.MallName ?? "",
Mobile = umodel.Moblie,
UserId = umodel.Id,
TenantId = umodel.TenantId,
Name = umodel.Name,
OpenId = umodel.OpenId,
Photo = umodel.Photo,
MemberGradeId = umodel.MemberGrade ?? 0,
Source = demodel.Source,
SecretKey = umodel.SecretKey,
SuperiorId = umodel.SuperiorId ?? 0,
Token = token,
SmallShopId = (smallShopsInfoModle != null && smallShopsInfoModle.AuditStatus == DistributorAuditStatusEnum.Audited) ? smallShopsInfoModle.Id : 0,
UserSmallShopId = umodel.SmallShopId,
IsOpenSchool = mmodel.IsOpenSchool,
UserPageType = mmodel.IsOpenSchool == 1 ? umodel.UserPageType : Common.Enum.Goods.GoodsPageTypeEnum.All,
UserTeacher = (teacher != null && teacher.ID > 0) ? teacher.ID : 0,
IsAddBaseInfo = 0,
IsOpenMiAi = mmodel.IsOpenMiAi,
};
var oldBaseInfo = miaiModule.GetBaseInfoList(new Model.Extend.Miai.RB_MiAi_BaseInfo_Extend { UserId = umodel.Id, TenantId = mmodel.TenantId, MallBaseId = mmodel.MallBaseId }).FirstOrDefault();
if (oldBaseInfo != null && oldBaseInfo.Id > 0)
{
appletUserInfo.IsAddBaseInfo = 1;
}
UserReidsCache.AppletUserInfoSet(UserModuleCacheKeyConfig.Applet_Login_Info + umodel.Id, appletUserInfo, Config.JwtExpirTime);
if (isGiveCoupon)
{
return ApiResult.CouponSuccess(ResultCode.Success, 1, "", couponName, appletUserInfo);
}
else
{
return ApiResult.CouponSuccess(ResultCode.Fail, 1, "", "", appletUserInfo);
}
}
}
#endregion #endregion
......
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