Commit 2dc2cc73 authored by liudong1993's avatar liudong1993

相亲记录

parent 48fac8a6
......@@ -13,34 +13,45 @@ namespace Mall.Common.Enum.MiAi
[EnumField("圈子点赞")]
CircleLike = 1,
/// <summary>
/// 圈子评论
/// </summary>
[EnumField("圈子评论")]
CircleComment = 2,
/// <summary>
/// 圈子回复
/// </summary>
[EnumField("圈子回复")]
CircleReply = 3,
CircleReply = 2,
/// <summary>
/// 拼拼报名
/// </summary>
[EnumField("拼拼报名")]
SpellEnroll = 4,
SpellEnroll = 3,
/// <summary>
/// 拼拼取消报名
/// </summary>
[EnumField("拼拼取消报名")]
SpellEnrollCancel = 5,
SpellEnrollCancel = 4,
/// <summary>
/// 拼拼评论
/// </summary>
[EnumField("拼拼评论")]
SpellComment = 6,
SpellComment = 5,
/// <summary>
/// 拼拼回复
/// </summary>
[EnumField("拼拼回复")]
SpellReply = 6,
/// <summary>
/// 谁查看了我
/// </summary>
[EnumField("谁查看了我")]
Look = 7,
/// <summary>
/// 活动报名取消
/// </summary>
[EnumField("活动报名取消")]
ActivityCancel = 8,
/// <summary>
/// 违规通知
/// </summary>
[EnumField("违规通知")]
ViolationNotice = 9,
}
}
using VT.FW.DB;
using Mall.Common.Enum.User;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Common.Enum.MiAi;
namespace Mall.Model.Entity.Miai
{
/// <summary>
/// 相亲约会记录表实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Miai_Dating
{
/// <summary>
/// Id
/// </summary>
public int Id
{
get;
set;
}
/// <summary>
/// 男方id
/// </summary>
public int ManId
{
get;
set;
}
/// <summary>
/// 女方id
/// </summary>
public int WoManId
{
get;
set;
}
/// <summary>
/// 约见时间
/// </summary>
public DateTime Time { get; set; }
/// <summary>
/// 地点
/// </summary>
public string Address { get; set; }
/// <summary>
/// 留言
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 删除状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 后台操作用户id
/// </summary>
public int EmpId { get; set; }
/// <summary>
/// 商户号
/// </summary>
public int TenantId
{
get;
set;
}
/// <summary>
/// 小程序id
/// </summary>
public int MallBaseId
{
get;
set;
}
/// <summary>
/// CreateDate
/// </summary>
public DateTime CreateDate
{
get;
set;
}
/// <summary>
/// UpdateDate
/// </summary>
public DateTime UpdateDate
{
get;
set;
}
}
}
using VT.FW.DB;
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Miai;
namespace Mall.Model.Extend.Miai
{
/// <summary>
/// 相亲约会记录扩展实体
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Miai_Dating_Extend : RB_Miai_Dating
{
/// <summary>
/// 男方姓名
/// </summary>
public string ManName { get; set; }
/// <summary>
/// 男方头像
/// </summary>
public string ManPhoto { get; set; }
/// <summary>
/// 女方姓名
/// </summary>
public string WoManName { get; set; }
/// <summary>
/// 女方头像
/// </summary>
public string WoManPhoto { get; set; }
/// <summary>
/// 用户id
/// </summary>
public int UserId { get; set; }
/// <summary>
/// 用户名称
/// </summary>
public string UserName { get; set; }
}
}
......@@ -19,12 +19,31 @@ namespace Mall.Module.Miai
/// </summary>
public class MiaiModule
{
/// <summary>
/// 帖子版块
/// </summary>
private readonly RB_Miai_ForumRepository miai_ForumRepository = new RB_Miai_ForumRepository();
/// <summary>
/// 帖子
/// </summary>
private readonly RB_Miai_ActivityRepository miai_ActivityRepository = new RB_Miai_ActivityRepository();
/// <summary>
/// 帖子报名
/// </summary>
private readonly RB_Miai_ActivityEnrollRepository miai_ActivityEnrollRepository = new RB_Miai_ActivityEnrollRepository();
/// <summary>
/// 帖子回复
/// </summary>
private readonly RB_Miai_ActivityDiscussRepository miai_ActivityDiscussRepository = new RB_Miai_ActivityDiscussRepository();
/// <summary>
/// 日志
/// </summary>
private readonly RB_Miai_LogRepository miai_LogRepository = new RB_Miai_LogRepository();
/// <summary>
/// 相亲约会
/// </summary>
private readonly RB_Miai_DatingRepository miai_DatingRepository = new RB_Miai_DatingRepository();
/// <summary>
/// 通用方法
/// </summary>
private readonly MiaiCommonModule miaiCommonModule = new MiaiCommonModule();
......@@ -40,6 +59,8 @@ namespace Mall.Module.Miai
/// </summary>
private readonly Repository.User.RB_Member_UserRepository member_UserRepository = new Repository.User.RB_Member_UserRepository();
#region 会员信息
/// <summary>
/// 获取用户信息
......@@ -89,6 +110,76 @@ namespace Mall.Module.Miai
#endregion
#region 相亲约会
/// <summary>
/// 相亲约会记录分页列表
/// </summary>
/// <param name="pageIndex"></param>
/// <param name="pageSize"></param>
/// <param name="count"></param>
/// <param name="demodel"></param>
/// <returns></returns>
public List<RB_Miai_Dating_Extend> GetMiaiDatingPageList(int pageIndex, int pageSize, out long count, RB_Miai_Dating_Extend demodel)
{
var list = miai_DatingRepository.GetPageList(pageIndex, pageSize, out count, demodel);
return list;
}
/// <summary>
/// 新增/修改相亲约会记录
/// </summary>
/// <param name="demodel"></param>
/// <returns></returns>
public bool SetMiaiDatingInfo(RB_Miai_Dating_Extend demodel)
{
if (demodel.Id > 0)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Miai_Dating_Extend.ManId),demodel.ManId},
{ nameof(RB_Miai_Dating_Extend.WoManId),demodel.WoManId},
{ nameof(RB_Miai_Dating_Extend.Time),demodel.Time},
{ nameof(RB_Miai_Dating_Extend.Address),demodel.Address},
{ nameof(RB_Miai_Dating_Extend.Remark),demodel.Remark},
{ nameof(RB_Miai_Dating_Extend.UpdateDate),demodel.UpdateDate},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Miai_Dating_Extend.Id),
FiledValue=demodel.Id,
OperatorEnum=OperatorEnum.Equal
}
};
return miai_DatingRepository.Update(keyValues, wheres);
}
else {
return miai_DatingRepository.Insert(demodel) > 0;
}
}
/// <summary>
/// 删除相亲约会记录
/// </summary>
/// <param name="datingId"></param>
/// <returns></returns>
public bool DelMiaiDatingInfo(int datingId)
{
Dictionary<string, object> keyValues = new Dictionary<string, object>() {
{ nameof(RB_Miai_Dating_Extend.Status),1},
{ nameof(RB_Miai_Dating_Extend.UpdateDate),DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>() {
new WhereHelper(){
FiledName=nameof(RB_Miai_Dating_Extend.Id),
FiledValue=datingId,
OperatorEnum=OperatorEnum.Equal
}
};
return miai_DatingRepository.Update(keyValues, wheres);
}
#endregion
#region 活动版块
/// <summary>
/// 获取活动版本分页列表
......
using System;
using System.Collections.Generic;
using System.Text;
using Mall.Model.Entity.Miai;
using Mall.Model.Extend.Miai;
using System.Linq;
namespace Mall.Repository.Miai
{
/// <summary>
/// 相亲约会记录仓储层
/// </summary>
public class RB_Miai_DatingRepository : BaseRepository<RB_Miai_Dating>
{
/// <summary>
/// 分页列表
/// </summary>
/// <param name="pageIndex">页码</param>
/// <param name="pageSize">每页显示条数</param>
/// <param name="rowCount">总条数</param>
/// <param name="dmodel">查询条件</param>
/// <returns></returns>
public List<RB_Miai_Dating_Extend> GetPageList(int pageIndex, int pageSize, out long rowCount, RB_Miai_Dating_Extend dmodel)
{
string where = $" 1=1 and d.{nameof(RB_Miai_Dating_Extend.Status)}=0";
if (dmodel.TenantId > 0) {
where += $@" and d.{nameof(RB_Miai_Dating_Extend.TenantId)}={dmodel.TenantId}";
}
if (dmodel.MallBaseId > 0)
{
where += $@" and d.{nameof(RB_Miai_Dating_Extend.MallBaseId)}={dmodel.MallBaseId}";
}
if (dmodel.UserId > 0)
{
where += $@" and (d.{nameof(RB_Miai_Dating_Extend.ManId)} ={dmodel.UserId} or d.{nameof(RB_Miai_Dating_Extend.WoManId)} ={dmodel.UserId})";
}
if (!string.IsNullOrEmpty(dmodel.UserName))
{
where += $@" and (b1.RealName like '%{dmodel.UserName}%' or b2.RealName like '%{dmodel.UserName}%')";
}
string sql = $@"select d.*,b1.RealName as ManName,u1.Photo as ManPhoto,b2.RealName as WoManName,u2.Photo as WoManPhoto from RB_Miai_Dating d
left join rb_member_user u1 on d.ManId = u1.Id
left join rb_miai_baseinfo b1 on b1.UserId = d.ManId
left join rb_member_user u2 on d.WoManId = u2.Id
left join rb_miai_baseinfo b2 on b2.UserId = d.WoManId
where {where} order by d.Id desc";
return GetPage<RB_Miai_Dating_Extend>(pageIndex, pageSize, out rowCount, sql).ToList();
}
}
}
......@@ -639,6 +639,46 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
#region 相亲约会
/// <summary>
/// 获取我的相亲约会记录分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMiaiMyDatingPageList()
{
var parms = RequestParm;
var userInfo = AppletUserInfo;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(parms.msg.ToString());
RB_Miai_Dating_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_Dating_Extend>(parms.msg.ToString());
demodel.TenantId = userInfo.TenantId;
demodel.MallBaseId = userInfo.MallBaseId;
demodel.UserId = userInfo.UserId;
if (demodel.UserId <= 0) {
return ApiResult.ParamIsNull();
}
var list = miaiModule.GetMiaiDatingPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.ManId,
x.ManName,
x.ManPhoto,
x.WoManId,
x.WoManName,
x.WoManPhoto,
Time = x.Time.ToString("yyyy-MM-dd HH:mm"),
x.Address,
x.Remark,
CreateDate = x.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")
});
return ApiResult.Success("", pagelist);
}
#endregion
#region 基础信息
/// <summary>
......
......@@ -113,6 +113,7 @@ namespace Mall.WebApi.Controllers.MallBase
}
}
#endregion
#region 招募贴
/// <summary>
......@@ -335,6 +336,101 @@ namespace Mall.WebApi.Controllers.MallBase
#endregion
#region 相亲约会
/// <summary>
/// 获取相亲约会分页列表
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult GetMiaiDatingPageList()
{
var req = base.RequestParm;
ResultPageModel pagelist = JsonConvert.DeserializeObject<ResultPageModel>(req.msg.ToString());
RB_Miai_Dating_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_Dating_Extend>(req.msg.ToString());
demodel.TenantId = Convert.ToInt32(req.uid);
demodel.MallBaseId = req.MallBaseId;
var list = miaiModule.GetMiaiDatingPageList(pagelist.pageIndex, pagelist.pageSize, out long count, demodel);
pagelist.count = Convert.ToInt32(count);
pagelist.pageData = list.Select(x => new
{
x.Id,
x.ManId,
x.ManName,
x.ManPhoto,
x.WoManId,
x.WoManName,
x.WoManPhoto,
Time = x.Time.ToString("yyyy-MM-dd HH:mm"),
x.Address,
x.Remark,
CreateDate = x.CreateDate.ToString("yyyy-MM-dd HH:mm:ss")
});
return ApiResult.Success("", pagelist);
}
/// <summary>
/// 新增/修改相亲约会记录
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetMiaiDatingInfo() {
var req = base.RequestParm;
RB_Miai_Dating_Extend demodel = JsonConvert.DeserializeObject<RB_Miai_Dating_Extend>(req.msg.ToString());
if (demodel.ManId <= 0) {
return ApiResult.ParamIsNull("请选择男方");
}
if (demodel.WoManId <= 0) {
return ApiResult.ParamIsNull("请选择女方");
}
if (string.IsNullOrEmpty(demodel.Address)) {
return ApiResult.ParamIsNull("请输入约见地址");
}
demodel.TenantId = Convert.ToInt32(req.uid);
demodel.MallBaseId = req.MallBaseId;
demodel.Status = 0;
demodel.EmpId = req.EmpId;
demodel.CreateDate = DateTime.Now;
demodel.UpdateDate = DateTime.Now;
bool flag = miaiModule.SetMiaiDatingInfo(demodel);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
/// <summary>
/// 删除相亲约会记录
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult DelMiaiDatingInfo() {
var req = base.RequestParm;
var parms = JObject.Parse(req.msg.ToString());
int DatingId = parms.GetInt("DatingId", 0);
if (DatingId <= 0) {
return ApiResult.ParamIsNull();
}
bool flag = miaiModule.DelMiaiDatingInfo(DatingId);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
#endregion
#region 星星商品
[HttpPost]
......
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