Commit 07113b7c authored by 吴春's avatar 吴春

提交代码

parent 4f9bedc7
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Miai;
namespace Mall.Model.Extend.Miai
{
public class RB_MiAi_BaseInfo_Extend: RB_MiAi_BaseInfo
{
}
}
...@@ -20,6 +20,9 @@ namespace Mall.Module.Miai ...@@ -20,6 +20,9 @@ namespace Mall.Module.Miai
{ {
private readonly RB_Miai_ForumRepository miai_ForumRepository = new RB_Miai_ForumRepository(); private readonly RB_Miai_ForumRepository miai_ForumRepository = new RB_Miai_ForumRepository();
private readonly RB_MiAi_BaseInfoRepository miai_BaseInfoRepository = new RB_MiAi_BaseInfoRepository();
#region 活动版块 #region 活动版块
/// <summary> /// <summary>
/// 获取活动版本分页列表 /// 获取活动版本分页列表
...@@ -36,6 +39,48 @@ namespace Mall.Module.Miai ...@@ -36,6 +39,48 @@ namespace Mall.Module.Miai
#endregion #endregion
#region 会员基础信息
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetBaseInfoList(RB_MiAi_BaseInfo_Extend where)
{
return miai_BaseInfoRepository.GetBaseInfoList(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> GetBaseInfoPageList(int pageIndex, int pageSize, out long rowsCount, RB_MiAi_BaseInfo_Extend where)
{
return miai_BaseInfoRepository.GetBaseInfoPageList(pageIndex, pageSize, out rowsCount, where);
}
/// <summary>
/// 新增用户的基础信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetMiAiBaseInfo(RB_MiAi_BaseInfo_Extend model)
{
bool flag = false;
if (model.Id == 0)
{
flag = miai_BaseInfoRepository.Insert(model) > 0;
}
return flag;
}
#endregion
} }
} }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mall.Model.Entity.Miai;
using Mall.Model.Extend.Miai;
namespace Mall.Repository.Miai
{
public class RB_MiAi_BaseInfoRepository:BaseRepository<RB_MiAi_BaseInfo>
{
/// <summary>
/// 表名称
/// </summary>
public string TableName { get { return nameof(RB_MiAi_BaseInfo); } }
/// <summary>
/// 获取列表
/// </summary>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetBaseInfoList(RB_MiAi_BaseInfo_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from RB_MiAi_BaseInfo 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);
}
}
return Get<RB_MiAi_BaseInfo_Extend>(sb.ToString()).ToList();
}
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="rowsCount"></param>
/// <param name="where"></param>
/// <returns></returns>
public List<RB_MiAi_BaseInfo_Extend> GetBaseInfoPageList(int pageIndex, int pageSize, out long rowsCount, RB_MiAi_BaseInfo_Extend where)
{
StringBuilder sb = new StringBuilder();
sb.Append($@"SELECT * from RB_MiAi_BaseInfo 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);
}
}
return GetPage<RB_MiAi_BaseInfo_Extend>(pageIndex, pageSize, out rowsCount, sb.ToString()).ToList();
}
}
}
...@@ -13,6 +13,7 @@ using Newtonsoft.Json.Linq; ...@@ -13,6 +13,7 @@ using Newtonsoft.Json.Linq;
using Mall.Common; using Mall.Common;
using Mall.AOP; using Mall.AOP;
using Mall.Module.Miai; using Mall.Module.Miai;
using Mall.Model.Extend.Miai;
namespace Mall.WebApi.Controllers.MallBase namespace Mall.WebApi.Controllers.MallBase
{ {
...@@ -27,5 +28,49 @@ namespace Mall.WebApi.Controllers.MallBase ...@@ -27,5 +28,49 @@ namespace Mall.WebApi.Controllers.MallBase
#region 活动版块 #region 活动版块
#endregion #endregion
#region 基础信息
/// <summary>
/// 填写个人基础信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
public ApiResult GetSetMiAiBaseInfo()
{
var req = RequestParm;
var userInfo = AppletUserInfo;
AppletUserInfo uInfo = UserReidsCache.GetAppletUserBlacklistInfo(userInfo.UserId);
if ((uInfo?.Blacklist ?? 0) == 1)
{
return ApiResult.Failed("已进入黑名单,无法访问");
}
RB_MiAi_BaseInfo_Extend comment = JsonConvert.DeserializeObject<RB_MiAi_BaseInfo_Extend>(req.msg.ToString());
comment.Status = 0;
comment.CreateDate = DateTime.Now;
comment.UserId = userInfo.UserId;
comment.TenantId = userInfo.TenantId;
comment.MallBaseId = userInfo.MallBaseId;
var oldBaseInfo = miaiModule.GetBaseInfoList(new RB_MiAi_BaseInfo_Extend { UserId = comment.UserId, TenantId = userInfo.TenantId, MallBaseId = userInfo.MallBaseId }).FirstOrDefault();
if (oldBaseInfo == null && oldBaseInfo.Id == 0)
{
if (miaiModule.SetMiAiBaseInfo(comment))
{
return ApiResult.Success("基础资料填写成功");
}
else
{
return ApiResult.Failed("基础资料填写失败");
}
}
else
{
return ApiResult.Failed("请勿重复填写基础资料");
}
}
#endregion
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment