src/SSCMS.Core/Repositories/WxChatRepository.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Datory;
using SSCMS.Models;
using SSCMS.Repositories;
using SSCMS.Services;
namespace SSCMS.Core.Repositories
{
public class WxChatRepository : IWxChatRepository
{
private readonly Repository<WxChat> _repository;
public WxChatRepository(ISettingsManager settingsManager)
{
_repository = new Repository<WxChat>(settingsManager.Database, settingsManager.Redis);
}
public IDatabase Database => _repository.Database;
public string TableName => _repository.TableName;
public List<TableColumn> TableColumns => _repository.TableColumns;
public async Task<bool> UserAdd(WxChat chat)
{
var isSession = await _repository.ExistsAsync(Q
.Where(nameof(WxChat.SiteId), chat.SiteId)
.Where(nameof(WxChat.OpenId), chat.OpenId)
.Where(nameof(WxChat.IsReply), true)
.WhereDate(nameof(WxChat.CreatedDate), ">", DateTime.Now.AddDays(-1))
);
await _repository.InsertAsync(chat);
return isSession;
}
public async Task ReplyAdd(WxChat chat)
{
await _repository.InsertAsync(chat);
}
public async Task Star(int siteId, int chatId, bool star)
{
await _repository.UpdateAsync(Q.
Set(nameof(WxChat.IsStar), star)
.Where(nameof(WxChat.SiteId), siteId)
.Where(nameof(WxChat.Id), chatId)
);
}
public async Task DeleteAsync(int siteId, int chatId)
{
await _repository.DeleteAsync(Q
.Where(nameof(WxChat.Id), chatId)
);
}
public async Task DeleteAllAsync(int siteId, string openId)
后面还有 53 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
