332
This commit is contained in:
parent
8c1e46b591
commit
8381a2cbab
|
|
@ -113,6 +113,6 @@ namespace CoreCms.Net.IServices
|
||||||
/// <param name="toUserId"></param>
|
/// <param name="toUserId"></param>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> UserBlackUser(int userId, int toUserId, int type);
|
Task<bool> UserBlackUser(int userId, int toUserId, int type, string reason = "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,19 @@ namespace CoreCms.Net.Model.ViewModels.SQ
|
||||||
}
|
}
|
||||||
|
|
||||||
[AutoMap(typeof(SQReservations))]
|
[AutoMap(typeof(SQReservations))]
|
||||||
public class SQReservationsApiDto : SQReservations
|
public class SQReservationsApiDto : SQReservationsBaseDto
|
||||||
{
|
{
|
||||||
public List<SQReservationParticipantsApiDto> Participants { get; set; }
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[AutoMap(typeof(SQReservations))]
|
[AutoMap(typeof(SQReservations))]
|
||||||
public class SQReservationsMyDto : SQReservations
|
public class SQReservationsMyDto : SQReservationsBaseDto
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public int pid { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 加入时间
|
/// 加入时间
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -53,6 +56,19 @@ namespace CoreCms.Net.Model.ViewModels.SQ
|
||||||
|
|
||||||
|
|
||||||
public System.Int32 pstatus { get; set; }
|
public System.Int32 pstatus { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 基类
|
||||||
|
/// </summary>
|
||||||
|
public class SQReservationsBaseDto : SQReservations
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 参与人员
|
||||||
|
/// </summary>
|
||||||
|
|
||||||
|
public List<SQReservationParticipantsApiDto> Participants { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
25
CoreCms.Net.Model/ViewModels/User/CoreCmsUserBlacklistDto.cs
Normal file
25
CoreCms.Net.Model/ViewModels/User/CoreCmsUserBlacklistDto.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
using CoreCms.Net.Model.Entities;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Model.ViewModels.User
|
||||||
|
{
|
||||||
|
[AutoMap(typeof(CoreCmsUserBlacklist))]
|
||||||
|
public class CoreCmsUserBlacklistDto : CoreCmsUserBlacklist
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 昵称
|
||||||
|
/// </summary>
|
||||||
|
public string BlockedNickName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 头像
|
||||||
|
/// </summary>
|
||||||
|
public string BlockedAvatarImage { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
99
CoreCms.Net.Services/SQ/SQServices.cs
Normal file
99
CoreCms.Net.Services/SQ/SQServices.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
using AutoMapper;
|
||||||
|
|
||||||
|
using CoreCms.Net.IServices;
|
||||||
|
using CoreCms.Net.Model.ViewModels.SQ;
|
||||||
|
|
||||||
|
using Kdbndp.KingbaseTypes;
|
||||||
|
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinUserInfoBatchGetRequest.Types;
|
||||||
|
|
||||||
|
namespace CoreCms.Net.Services.SQ
|
||||||
|
{
|
||||||
|
public static class SQServices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sQReservationParticipants"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<List<SQReservationParticipantsApiDto>> LoadSQReservationParticipantsApiDtoId(List<int> rIds, int userId, SqlSugarScope _dbBase, ICoreCmsUserBlacklistServices _coreCmsUserBlacklistServices)
|
||||||
|
{
|
||||||
|
if (rIds != null && rIds.Count > 0)
|
||||||
|
{
|
||||||
|
string sqlWhere = string.Join(",", rIds);
|
||||||
|
var participants = await _dbBase.Ado.SqlQueryAsync<SQReservationParticipantsApiDto>($"select p.id,p.reservation_id,p.status,p.join_time,p.user_id, p.role,u.nickName UserName,u.avatarImage AvatarImage from SQReservationParticipants p inner join CoreCmsUser u on p.user_id=u.id where p.status=0 and p.reservation_id in ({sqlWhere})");
|
||||||
|
if (participants != null && participants.Count > 0)
|
||||||
|
{
|
||||||
|
var userBlacklist = new List<int>();
|
||||||
|
//如果用户登录了
|
||||||
|
userBlacklist = await _coreCmsUserBlacklistServices.GetUserBlacklists(userId);
|
||||||
|
//并且用户有黑名单数据
|
||||||
|
if (userBlacklist.Count > 0)
|
||||||
|
{
|
||||||
|
//查找并修改黑名单用户
|
||||||
|
foreach (var participant in participants.Where(it => userBlacklist.Contains(it.user_id)))
|
||||||
|
{
|
||||||
|
participant.UserBlackStatus = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return participants;
|
||||||
|
}
|
||||||
|
return new List<SQReservationParticipantsApiDto>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 加载组局参与者信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="list">预约信息</param>
|
||||||
|
/// <param name="userId">当前用户</param>
|
||||||
|
/// <param name="_dbBase"></param>
|
||||||
|
/// <param name="_coreCmsUserBlacklistServices"></param>
|
||||||
|
/// <param name="_mapper"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<bool> LoadSQReservationParticipantsApiDto(this List<SQReservationsBaseDto> list, int userId, SqlSugarScope _dbBase, ICoreCmsUserBlacklistServices _coreCmsUserBlacklistServices, IMapper _mapper)
|
||||||
|
{
|
||||||
|
var rIds = list.Select(it => it.id).ToList();
|
||||||
|
if (rIds != null && rIds.Count > 0)
|
||||||
|
{
|
||||||
|
string sqlWhere = string.Join(",", rIds);
|
||||||
|
var participants = await _dbBase.Ado.SqlQueryAsync<SQReservationParticipantsApiDto>($"select p.id,p.reservation_id,p.status,p.join_time,p.user_id, p.role,u.nickName UserName,u.avatarImage AvatarImage from SQReservationParticipants p inner join CoreCmsUser u on p.user_id=u.id where p.status=0 and p.reservation_id in ({sqlWhere})");
|
||||||
|
if (participants != null && participants.Count > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (userId > 0)
|
||||||
|
{
|
||||||
|
var userBlacklist = new List<int>();
|
||||||
|
//如果用户登录了
|
||||||
|
userBlacklist = await _coreCmsUserBlacklistServices.GetUserBlacklists(userId);
|
||||||
|
//并且用户有黑名单数据
|
||||||
|
if (userBlacklist.Count > 0)
|
||||||
|
{
|
||||||
|
//查找并修改黑名单用户
|
||||||
|
foreach (var participant in participants.Where(it => userBlacklist.Contains(it.user_id)))
|
||||||
|
{
|
||||||
|
participant.UserBlackStatus = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var item in list)
|
||||||
|
{
|
||||||
|
var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it => it.role).ThenBy(it => it.status).ToList();
|
||||||
|
var dto = _mapper.Map<List<SQReservationParticipantsApiDto>>(temp);
|
||||||
|
item.Participants = dto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ namespace CoreCms.Net.Services
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<bool> UserBlackUser(int userId, int toUserId, int type)
|
public async Task<bool> UserBlackUser(int userId, int toUserId, int type, string reason = "")
|
||||||
{
|
{
|
||||||
if (userId == 0)
|
if (userId == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -176,12 +176,17 @@ namespace CoreCms.Net.Services
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
{
|
{
|
||||||
|
var black = await _dal.QueryByClauseAsync(it => it.UserId == userId && it.BlockedUserId == toUserId);
|
||||||
|
if (black != null)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
CoreCmsUserBlacklist coreCmsUserBlacklist = new CoreCmsUserBlacklist()
|
CoreCmsUserBlacklist coreCmsUserBlacklist = new CoreCmsUserBlacklist()
|
||||||
{
|
{
|
||||||
UserId = userId,
|
UserId = userId,
|
||||||
CreatedTime = DateTime.Now,
|
CreatedTime = DateTime.Now,
|
||||||
BlockedUserId = toUserId,
|
BlockedUserId = toUserId,
|
||||||
Reason = "",
|
Reason = reason,
|
||||||
};
|
};
|
||||||
await _dal.InsertAsync(coreCmsUserBlacklist);
|
await _dal.InsertAsync(coreCmsUserBlacklist);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,22 +5,27 @@ using CoreCms.Net.IRepository.UnitOfWork;
|
||||||
using CoreCms.Net.IServices;
|
using CoreCms.Net.IServices;
|
||||||
using CoreCms.Net.Model.Entities;
|
using CoreCms.Net.Model.Entities;
|
||||||
using CoreCms.Net.Model.Entities.Expression;
|
using CoreCms.Net.Model.Entities.Expression;
|
||||||
|
using CoreCms.Net.Model.ViewModels.Basics;
|
||||||
using CoreCms.Net.Model.ViewModels.SQ;
|
using CoreCms.Net.Model.ViewModels.SQ;
|
||||||
using CoreCms.Net.Model.ViewModels.UI;
|
using CoreCms.Net.Model.ViewModels.UI;
|
||||||
using CoreCms.Net.Services;
|
using CoreCms.Net.Services;
|
||||||
|
using CoreCms.Net.Services.SQ;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
|
||||||
|
using NPOI.SS.Formula.Functions;
|
||||||
|
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using CoreCms.Net.Services.SQ;
|
||||||
|
using CoreCms.Net.Utility.Extensions;
|
||||||
namespace CoreCms.Net.Web.WebApi.Controllers;
|
namespace CoreCms.Net.Web.WebApi.Controllers;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -71,20 +76,27 @@ public class SQController : ControllerBase
|
||||||
_coreCmsUserBlacklistServices = coreCmsUserBlacklistServices;
|
_coreCmsUserBlacklistServices = coreCmsUserBlacklistServices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 我的预约记录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">1发起者,0参与者</param>
|
/// <param name="type">0 参与者,1发起者</param>
|
||||||
|
/// <param name="index">起始页</param>
|
||||||
|
/// <param name="size">页大小</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<WebApiDto> GetMyReservation([FromQuery] int type = 0)
|
public async Task<WebApiDto> GetMyReservation([FromQuery] int type = 0, [FromQuery] int index = 1, [FromQuery] int size = 10)
|
||||||
{
|
{
|
||||||
var userId = _user.ID;
|
var userId = _user.ID;
|
||||||
|
|
||||||
//var list = await _SQReservationsServices.GetMyReservation(userId);
|
var list = await _dbBase.Ado.SqlQueryAsync<SQReservationsMyDto>($"select top r.*,p.id pid, p.status pstatus,p.join_time, p.quit_time ,p.is_refund from SQReservationParticipants p inner join SQReservations r on p.reservation_id=r.id where p.user_id={userId} and p.role={type} order by p.id desc OFFSET {(index - 1) * size} ROWS FETCH NEXT {size} ROWS ONLY");
|
||||||
var list = await _dbBase.Ado.SqlQueryAsync<SQReservationsMyDto>($"select r.*, p.status pstatus,p.join_time, p.quit_time ,p.is_refund from SQReservationParticipants p inner join SQReservations r on p.reservation_id=r.id where p.user_id={userId} and p.role={type}");
|
if (list != null && list.Count > 0)
|
||||||
//SQReservationsMyDto
|
{
|
||||||
|
// 转为基类列表
|
||||||
|
var baseList = list.Cast<SQReservationsBaseDto>().ToList();
|
||||||
|
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, _mapper);
|
||||||
|
}
|
||||||
return new WebApiDto()
|
return new WebApiDto()
|
||||||
{
|
{
|
||||||
Data = list,
|
Data = list,
|
||||||
|
|
@ -93,7 +105,31 @@ public class SQController : ControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// 获取正在进行的预约
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<WebApiDto> GetMyUseReservation()
|
||||||
|
{
|
||||||
|
var userId = _user.ID;
|
||||||
|
|
||||||
|
var list = await _dbBase.Ado.SqlQueryAsync<SQReservationsApiDto>($"select top 3 r.* from SQReservations r left join SQReservationParticipants p on r.id=p.reservation_id where r.status<2 and p.user_id={userId} and p.status=0 order by r.start_time ");
|
||||||
|
if (list != null && list.Count > 0)
|
||||||
|
{
|
||||||
|
// 转为基类列表
|
||||||
|
var baseList = list.Cast<SQReservationsBaseDto>().ToList();
|
||||||
|
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, _mapper);
|
||||||
|
}
|
||||||
|
return new WebApiDto()
|
||||||
|
{
|
||||||
|
Data = list,
|
||||||
|
Code = 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 首页预约列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="pageIndex"></param>
|
/// <param name="pageIndex"></param>
|
||||||
/// <param name="pageSize"></param>
|
/// <param name="pageSize"></param>
|
||||||
|
|
@ -109,68 +145,11 @@ public class SQController : ControllerBase
|
||||||
where = where.And(it => it.status < 2);
|
where = where.And(it => it.status < 2);
|
||||||
var list = await _SQReservationsServices.QueryPageAsync(where, it => it.start_time, OrderByType.Asc, pageIndex, pageSize, true);
|
var list = await _SQReservationsServices.QueryPageAsync(where, it => it.start_time, OrderByType.Asc, pageIndex, pageSize, true);
|
||||||
var pageList = _mapper.Map<List<SQReservationsApiDto>>(list);
|
var pageList = _mapper.Map<List<SQReservationsApiDto>>(list);
|
||||||
var rIds = list.Select(it => it.id).ToList();
|
if (pageList != null && pageList.Count > 0)
|
||||||
if (rIds != null && rIds.Count > 0)
|
|
||||||
{
|
{
|
||||||
string sqlWhere = string.Join(",", rIds);
|
// 转为基类列表
|
||||||
var participants = await _dbBase.Ado.SqlQueryAsync<SQReservationParticipantsApiDto>($"select p.id,p.reservation_id,p.status,p.join_time,p.user_id, p.role,u.nickName UserName,u.avatarImage AvatarImage from SQReservationParticipants p inner join CoreCmsUser u on p.user_id=u.id where p.status=0 and p.reservation_id in ({sqlWhere})");
|
var baseList = pageList.Cast<SQReservationsBaseDto>().ToList();
|
||||||
if (participants != null && participants.Count > 0)
|
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, _mapper);
|
||||||
{
|
|
||||||
var userBlacklist = new List<int>();
|
|
||||||
//如果用户登录了
|
|
||||||
if (userId > 0)
|
|
||||||
{
|
|
||||||
|
|
||||||
userBlacklist = await _coreCmsUserBlacklistServices.GetUserBlacklists(userId);
|
|
||||||
//并且用户有黑名单数据
|
|
||||||
if (userBlacklist.Count > 0)
|
|
||||||
{
|
|
||||||
//查找并修改黑名单用户
|
|
||||||
foreach (var participant in participants.Where(it => userBlacklist.Contains(it.user_id)))
|
|
||||||
{
|
|
||||||
participant.UserBlackStatus = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var item in pageList)
|
|
||||||
{
|
|
||||||
var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it => it.role).ThenBy(it => it.status).ToList();
|
|
||||||
var room = roomList.Find(it => it.id == item.room_id);
|
|
||||||
if (room != null)
|
|
||||||
{
|
|
||||||
item.room_name = $"{room.name} {room.price_per_hour.ToString("#.##")}/小时 {room.capacity}/人数";
|
|
||||||
|
|
||||||
}
|
|
||||||
var dto = _mapper.Map<List<SQReservationParticipantsApiDto>>(temp);
|
|
||||||
item.Participants = dto;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//var participants = await _SQReservationParticipantsServices.QueryListByClauseAsync(it => rIds.Contains(it.reservation_id), "", true);
|
|
||||||
//List<CoreCmsUser> userList = new List<CoreCmsUser>();
|
|
||||||
//if (participants != null && participants.Count > 0)
|
|
||||||
//{
|
|
||||||
// var userIds = participants.Select(it => it.user_id).ToList();
|
|
||||||
// userList = await _userServices.QueryListByClauseAsync(it => userIds.Contains(it.id), "", true);
|
|
||||||
//}
|
|
||||||
//foreach (var item in pageList)
|
|
||||||
//{
|
|
||||||
// var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it => it.role).ThenBy(it => it.status).ToList();
|
|
||||||
// var dto = _mapper.Map<List<SQReservationParticipantsDto>>(temp);
|
|
||||||
// if (userList != null && userList.Count > 0)
|
|
||||||
// {
|
|
||||||
// foreach (var p in dto)
|
|
||||||
// {
|
|
||||||
// var u = userList.FirstOrDefault(it => it.id == p.user_id);
|
|
||||||
// if (u != null)
|
|
||||||
// {
|
|
||||||
// p.UserName = u.nickName;
|
|
||||||
// p.AvatarImage = u.avatarImage;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// }
|
|
||||||
// item.Participants = dto;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
return new WebApiDto()
|
return new WebApiDto()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ using SqlSugar;
|
||||||
using DotLiquid.Util;
|
using DotLiquid.Util;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using CoreCms.Net.Model.ViewModels.User;
|
||||||
|
|
||||||
namespace CoreCms.Net.Web.WebApi.Controllers
|
namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
{
|
{
|
||||||
|
|
@ -91,7 +92,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
private readonly IToolsServices _toolsServices;
|
private readonly IToolsServices _toolsServices;
|
||||||
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||||
private readonly WeChatOptions _weChatOptions;
|
private readonly WeChatOptions _weChatOptions;
|
||||||
|
private readonly ICoreCmsUserBlacklistServices _coreCmsUserBlacklistServices;
|
||||||
|
private readonly SqlSugarScope _dbBase;
|
||||||
private readonly AsyncLock _mutex = new AsyncLock();
|
private readonly AsyncLock _mutex = new AsyncLock();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -123,7 +125,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
, ICoreCmsSettingServices settingServices
|
, ICoreCmsSettingServices settingServices
|
||||||
, ICoreCmsServicesServices servicesServices
|
, ICoreCmsServicesServices servicesServices
|
||||||
, IOptions<WeChatOptions> weChatOptions
|
, IOptions<WeChatOptions> weChatOptions
|
||||||
, ICoreCmsUserServicesOrderServices userServicesOrderServices, ICoreCmsUserServicesTicketServices userServicesTicketServices, ICoreCmsStoreServices storeServices, ICoreCmsCouponServices couponServices, ICoreCmsOrderServices orderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IToolsServices toolsServices)
|
, ICoreCmsUserServicesOrderServices userServicesOrderServices, ICoreCmsUserServicesTicketServices userServicesTicketServices, ICoreCmsStoreServices storeServices, ICoreCmsCouponServices couponServices, ICoreCmsOrderServices orderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IToolsServices toolsServices, ICoreCmsUserBlacklistServices coreCmsUserBlacklistServices, SqlSugarScope dbBase)
|
||||||
{
|
{
|
||||||
_user = user;
|
_user = user;
|
||||||
_userWeChatInfoServices = userWeChatInfoServices;
|
_userWeChatInfoServices = userWeChatInfoServices;
|
||||||
|
|
@ -157,6 +159,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||||
_weChatOptions = weChatOptions.Value;
|
_weChatOptions = weChatOptions.Value;
|
||||||
_toolsServices = toolsServices;
|
_toolsServices = toolsServices;
|
||||||
|
_coreCmsUserBlacklistServices = coreCmsUserBlacklistServices;
|
||||||
|
_dbBase = dbBase;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// wx.login登陆成功之后发送的请求
|
/// wx.login登陆成功之后发送的请求
|
||||||
|
|
@ -2287,5 +2291,61 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取黑名单列表
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<WebApiDto> GetMyBlackList()
|
||||||
|
{
|
||||||
|
var userId = _user.ID;
|
||||||
|
var list = await _dbBase.Ado.SqlQueryAsync<CoreCmsUserBlacklistDto>($"select b.*,u.nickName as BlockedNickName,u.avatarImage as BlockedAvatarImage from CoreCmsUserBlacklist b left join CoreCmsUser u on b.BlockedUserId=u.id where b.UserId={userId}");
|
||||||
|
return new WebApiDto()
|
||||||
|
{
|
||||||
|
Code = 0,
|
||||||
|
Data = list
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加黑名单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<WebApiDto> AddUserBlack([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var userId = _user.ID;
|
||||||
|
var toUserId = entity.id;
|
||||||
|
var isSuccess = await _coreCmsUserBlacklistServices.UserBlackUser(userId, toUserId, 0, "用户主动拉黑");
|
||||||
|
return new WebApiDto()
|
||||||
|
{
|
||||||
|
Code = 0,
|
||||||
|
Msg = isSuccess ? "已添加黑名单" : "已在黑名单中"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 取消拉黑名单
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entity"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Authorize]
|
||||||
|
public async Task<WebApiDto> CancelUserBlack([FromBody] FMIntId entity)
|
||||||
|
{
|
||||||
|
var userId = _user.ID;
|
||||||
|
var toUserId = entity.id;
|
||||||
|
await _coreCmsUserBlacklistServices.UserBlackUser(userId, toUserId, 1);
|
||||||
|
return new WebApiDto()
|
||||||
|
{
|
||||||
|
Code = 0,
|
||||||
|
Msg = "已取消拉黑"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
//
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -767,11 +767,13 @@
|
||||||
构造函数
|
构造函数
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.GetMyReservation(System.Int32)">
|
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.GetMyReservation(System.Int32,System.Int32,System.Int32)">
|
||||||
<summary>
|
<summary>
|
||||||
|
我的预约记录
|
||||||
</summary>
|
</summary>
|
||||||
<param name="type">1发起者,0参与者</param>
|
<param name="type">0 参与者,1发起者</param>
|
||||||
|
<param name="index">起始页</param>
|
||||||
|
<param name="size">页大小</param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.GetReservationList(System.Int32,System.Int32)">
|
<member name="M:CoreCms.Net.Web.WebApi.Controllers.SQController.GetReservationList(System.Int32,System.Int32)">
|
||||||
|
|
@ -908,6 +910,12 @@
|
||||||
<param name="entity"></param>
|
<param name="entity"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:CoreCms.Net.Web.WebApi.Controllers.UserController.AnonymousLogin">
|
||||||
|
<summary>
|
||||||
|
匿名登录
|
||||||
|
</summary>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="M:CoreCms.Net.Web.WebApi.Controllers.UserController.OnLogin(CoreCms.Net.Model.FromBody.FMWxPost)">
|
<member name="M:CoreCms.Net.Web.WebApi.Controllers.UserController.OnLogin(CoreCms.Net.Model.FromBody.FMWxPost)">
|
||||||
<summary>
|
<summary>
|
||||||
wx.login登陆成功之后发送的请求
|
wx.login登陆成功之后发送的请求
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user