优化细节

development
温天培 2 years ago
parent 41d0ca2d1b
commit e27bd95b72

@ -11,10 +11,6 @@ namespace GDZZ.Application.Entity
[Description("余额表")]
public class Balance : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 用户ID
/// </summary>

@ -2,8 +2,6 @@
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
using GDZZ.Core;
namespace GDZZ.Application.Entity
{
/// <summary>
@ -20,7 +18,7 @@ namespace GDZZ.Application.Entity
/// <summary>
/// 用户类型
/// </summary>
public UserEnum Type { get; set; }
public int Type { get; set; }
/// <summary>
/// 用户名
/// </summary>
@ -32,7 +30,7 @@ namespace GDZZ.Application.Entity
/// <summary>
/// 公共状态
/// </summary>
public CommonStatus Status { get; set; }
public int Status { get; set; }
/// <summary>
/// 微信用户ID
/// </summary>
@ -45,5 +43,13 @@ namespace GDZZ.Application.Entity
/// 开发平台ID
/// </summary>
public string UnionId { get; set; }
/// <summary>
/// 公司ID
/// </summary>
public long CompanyID { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Describe { get; set; }
}
}

@ -0,0 +1,35 @@
using System;
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
namespace GDZZ.Application.Entity
{
/// <summary>
/// 消费记录
/// </summary>
[SugarTable("mini_consume")]
[Description("消费记录")]
public class Consume : DEntityBase
{
/// <summary>
/// 消费金额
/// </summary>
public decimal CAmount { get; set; }
/// <summary>
/// 余额
/// </summary>
public decimal Surplus { get; set; }
/// <summary>
/// 用户ID
/// </summary>
public long UserID { get; set; }
/// <summary>
/// 消费类型
/// </summary>
public int Sort { get; set; }
/// <summary>
/// 沟通ID
/// </summary>
public long? ResumeID { get; set; }
}
}

@ -11,10 +11,6 @@ namespace GDZZ.Application.Entity
[Description("聊天用户好友表")]
public class LiveUserFriend : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 好友ID
/// </summary>

@ -9,11 +9,6 @@
余额表
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Balance.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Balance.UserID">
<summary>
用户ID
@ -69,6 +64,16 @@
开发平台ID
</summary>
</member>
<member name="P:GDZZ.Application.Entity.BaseUser.CompanyID">
<summary>
公司ID
</summary>
</member>
<member name="P:GDZZ.Application.Entity.BaseUser.Describe">
<summary>
描述
</summary>
</member>
<member name="T:GDZZ.Application.Entity.Company">
<summary>
公司属性
@ -94,6 +99,36 @@
公司详情图片
</summary>
</member>
<member name="T:GDZZ.Application.Entity.Consume">
<summary>
消费记录
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Consume.CAmount">
<summary>
消费金额
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Consume.Surplus">
<summary>
余额
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Consume.UserID">
<summary>
用户ID
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Consume.Sort">
<summary>
消费类型
</summary>
</member>
<member name="P:GDZZ.Application.Entity.Consume.ResumeID">
<summary>
沟通ID
</summary>
</member>
<member name="T:GDZZ.Application.Entity.FeedBack">
<summary>
意见反馈
@ -209,11 +244,6 @@
聊天用户好友表
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveUserFriend.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:GDZZ.Application.Entity.LiveUserFriend.FriendID">
<summary>
好友ID
@ -533,13 +563,6 @@
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Service.Auth.AuthService.WxPay(GDZZ.Application.AuthUserInput)">
<summary>
微信支付
</summary>
<param name="productId"></param>
<returns></returns>
</member>
<member name="T:GDZZ.Application.Service.Auth.IAuthService">
<summary>
业务权限控制
@ -552,41 +575,34 @@
<param name="phoneModel"></param>
<returns></returns>
</member>
<member name="T:GDZZ.Application.Service.LiveChat.ILiveChatService">
<member name="T:GDZZ.Application.Service.WXPay.Dto.BalanceOut">
<summary>
即时聊天接口
</summary>
</member>
<member name="T:GDZZ.Application.Service.LiveChat.LiveChatService">
<member name="P:GDZZ.Application.Service.WXPay.Dto.BalanceOut.UserID">
<summary>
即时聊天
用户ID
</summary>
</member>
<member name="F:GDZZ.Application.Service.LiveChat.LiveChatService._chatHubContext">
<member name="P:GDZZ.Application.Service.WXPay.Dto.BalanceOut.Amount">
<summary>
聊天总线
余额
</summary>
</member>
<member name="M:GDZZ.Application.Service.LiveChat.LiveChatService.#ctor(Microsoft.AspNetCore.SignalR.IHubContext{GDZZ.Core.ChatHub,GDZZ.Core.IChatClient},GDZZ.Core.SqlSugarRepository{GDZZ.Core.Entity.OnlineUser})">
<member name="P:GDZZ.Application.Service.WXPay.Dto.RechargeOut.TotalPrice">
<summary>
聊天服务
总价格
</summary>
<param name="chatHubContext"></param>
<param name="_sysOnlineUerRep"></param>
</member>
<member name="T:GDZZ.Application.Service.WXPay.Dto.BalanceOut">
<member name="P:GDZZ.Application.Service.WXPay.Dto.RechargeOut.PaymentMoney">
<summary>
支付金额
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.BalanceOut.UserID">
<member name="P:GDZZ.Application.Service.WXPay.Dto.RechargeOut.Status">
<summary>
用户ID
</summary>
</member>
<member name="P:GDZZ.Application.Service.WXPay.Dto.BalanceOut.Amount">
<summary>
余额
充值状态
</summary>
</member>
<member name="T:GDZZ.Application.Service.WXPay.IWXPayService">
@ -605,6 +621,24 @@
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Service.WXPay.WXPayService.GetRechargeList">
<summary>
充值记录查询
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Service.WXPay.WXPayService.UpBalance(System.Decimal,System.Nullable{System.Int64})">
<summary>
修改余额
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Service.WXPay.WXPayService.GetBalance">
<summary>
查询消费记录
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.Service.WXPay.WXPayService.WxPay(GDZZ.Application.AuthUserInput)">
<summary>
微信小程序支付
@ -668,14 +702,24 @@
</summary>
</member>
<member name="T:GDZZ.Application.BaseUserService">
<member name="P:GDZZ.Application.AuthUserOut.Describe">
<summary>
基础用户服务
</summary>
</member>
<member name="F:GDZZ.Application.BaseUserService._oauthConfig">
<member name="P:GDZZ.Application.AuthUserOut.Tenant">
<summary>
获取配置文件
租户信息
</summary>
</member>
<member name="P:GDZZ.Application.AuthUserOut.companyDto">
<summary>
公司信息
</summary>
</member>
<member name="T:GDZZ.Application.BaseUserService">
<summary>
基础用户服务
</summary>
</member>
<member name="M:GDZZ.Application.BaseUserService.Update(GDZZ.Application.UpdateBaseUserInput)">
@ -685,6 +729,12 @@
<param name="input"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Application.BaseUserService.TeacherList">
<summary>
获取教师列表
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.BaseUserService.Page(GDZZ.Application.BaseUserInput)">
<summary>
分页查询基础用户
@ -860,6 +910,21 @@
主键Id
</summary>
</member>
<member name="P:GDZZ.Application.UpdateBaseUserInput.Self">
<summary>
职业
</summary>
</member>
<member name="P:GDZZ.Application.UpdateBaseUserInput.Sex">
<summary>
性别
</summary>
</member>
<member name="P:GDZZ.Application.UpdateBaseUserInput.Describe">
<summary>
描述
</summary>
</member>
<member name="T:GDZZ.Application.BaseUserOutput">
<summary>
基础用户输出参数
@ -1326,6 +1391,11 @@
文件名称
</summary>
</member>
<member name="P:GDZZ.Application.AddLiveFriendInput.CompanyID">
<summary>
公司ID
</summary>
</member>
<member name="T:GDZZ.Application.LiveHistoryContactsOutput">
<summary>
聊天历史任务列表输出参数
@ -1396,29 +1466,16 @@
聊天服务
</summary>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.AddLive(GDZZ.Application.AddLiveHistoryContactsInput)">
<member name="M:GDZZ.Application.LiveHistoryContactsService.AddLive(GDZZ.Application.AddLiveFriendInput)">
<summary>
新增联系人
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.UPLive(GDZZ.Application.UpdateLiveHistoryContactsInput)">
<summary>
修改未读消息
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.DelLive(System.Int64)">
<summary>
删除联系人
</summary>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.List">
<summary>
获取联系人
获取联系人列表
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:GDZZ.Application.LiveHistoryContactsService.GetMessageLists(System.Int64)">

@ -16,6 +16,8 @@ using Furion.DynamicApiController;
using Microsoft.AspNetCore.Http;
using GDZZ.Application.Help;
using Microsoft.AspNetCore.Authorization;
using Mapster;
using GDZZ.Core.Service;
namespace GDZZ.Application.Service.Auth
{
@ -27,7 +29,7 @@ namespace GDZZ.Application.Service.Auth
private readonly SqlSugarRepository<SysUser> _sysUserRep; // 用户表仓储
private readonly SqlSugarRepository<SysTenant> _sysTenantRep; //租户仓储
private readonly SqlSugarRepository<SeIF> Self; //职业仓储
private readonly SqlSugarRepository<Company> CompanyRep;
private readonly SqlSugarRepository<MiniRecharge> rechargeRep; //充值仓储
private readonly SqlSugarRepository<MiniPayTake> payTakeRep; //支付仓储
#endregion
@ -51,11 +53,14 @@ namespace GDZZ.Application.Service.Auth
SqlSugarRepository<SysTenant> sysTenantRep,
SqlSugarRepository<SysUser> sysUserRep,
SqlSugarRepository<SeIF> Self,
SqlSugarRepository<Company> CompanyRep,
SqlSugarRepository<MiniPayTake> payTakeRep,
ICacheService cacheService,
WechatOAuth wechatOAuth,
IEventPublisher eventPublisher,
IHttpContextAccessor httpContextAccessor)
{
this.CompanyRep= CompanyRep;
this._eventPublisher= eventPublisher;
this._sysUserRep = sysUserRep;
this._sysTenantRep = sysTenantRep;
@ -63,6 +68,7 @@ namespace GDZZ.Application.Service.Auth
this._httpContextAccessor = httpContextAccessor;
this.cacheService= cacheService;
this.Self = Self;
this.payTakeRep = payTakeRep;
_wechatOAuth = wechatOAuth;
_oauthConfig = options.Value.Wechat;
}
@ -76,9 +82,11 @@ namespace GDZZ.Application.Service.Auth
public async Task<AuthUserOut> SignInAsync(PhoneModel phoneModel)
{
AuthUserOut authUserOut = new AuthUserOut();
Company company = new Company();
//读取凭证
var tokenModel = await this._wechatOAuth.GetAccessTokenAsync(phoneModel.code);
//解析电话
var phoneInfo = MiniProgramUtil.AESDecrypt(phoneModel.encryptedDataStr, tokenModel.SessionKey, phoneModel.iv);
@ -87,6 +95,14 @@ namespace GDZZ.Application.Service.Auth
.Filter("TenantId", true)
.First(x => x.Phone == phoneInfo.PhoneNumber);
var wxUser = await this.Baseuser.AsQueryable()
.Filter("TenantId", true)
.Where(x => x.OpenID == tokenModel.OpenId).SingleAsync();
//账号不存在 生成系统账号
if (sysUser.IsEmpty())
{
sysUser = await this._sysUserRep.InsertReturnEntityAsync(new SysUser()
@ -111,10 +127,9 @@ namespace GDZZ.Application.Service.Auth
});
}
var wxUser = await this.Baseuser.AsQueryable()
.Filter("TenantId", true)
.Where(x => x.OpenID == tokenModel.OpenId).SingleAsync();
//区分不同类型账号
if (phoneModel.logInType ==(int)UserEnum.JOB)
{
if (wxUser.IsEmpty())
{
wxUser = await this.Baseuser.InsertReturnEntityAsync(new BaseUser()
@ -124,17 +139,31 @@ namespace GDZZ.Application.Service.Auth
CreatedTime = DateTime.Now,
CreatedUserName = sysUser.Name,
AvatarUrl = "https://gdzongzhi.com/assets/img/logo.png",
Status = CommonStatus.ENABLE,
Status =(int)CommonStatus.ENABLE,
OpenID = tokenModel.OpenId,
TenantId = 392820661919813,
Type = UserEnum.JOB,
Type = (int)UserEnum.JOB,
UserName = phoneInfo.PhoneNumber,
});
}
}
else
{
//如果是企业账号,应该是绑定了企业租户信息
if (wxUser.IsEmpty()|| wxUser.CompanyID.IsNullOrZero())
throw Oops.Oh(ErrorCode.xg1002);
//获取公司信息
company = await this.CompanyRep.SingleAsync(x=>x.Id == wxUser.CompanyID);
authUserOut.companyDto = company.Adapt<CompanyDto>();
}
if (wxUser.IsEmpty() || sysUser.IsEmpty())
throw Oops.Oh(ErrorCode.xg1002);
var Self = await this.Self.FirstOrDefaultAsync(x => x.CreatedUserId == sysUser.Id);
// 获取加密后的密码
@ -143,13 +172,13 @@ namespace GDZZ.Application.Service.Auth
// 验证账号是否被冻结
if (sysUser.Status == CommonStatus.DISABLE)
throw Oops.Oh(ErrorCode.D1017);
//获取对应租户
var tenant = this._sysTenantRep.Single(sysUser.TenantId);
if (tenant.IsNullOrZero())
throw Oops.Oh(ErrorCode.F1001);
// 生成Token令牌
authUserOut.Token = JWTEncryption.Encrypt(new Dictionary<string, object>
{
@ -180,9 +209,11 @@ namespace GDZZ.Application.Service.Auth
authUserOut.Sex = sysUser.Sex;
authUserOut.UserId = sysUser.Id;
authUserOut.UserName = sysUser.Name;
authUserOut.Self = Self.IsEmpty() ? "未填写" : Self.Name;
authUserOut.Type = UserEnum.JOB;
authUserOut.Self = Self.IsEmpty() ? null : Self.Name;
authUserOut.Type = (UserEnum)wxUser.Type;
authUserOut.OpenID = tokenModel.OpenId;
authUserOut.Tenant = tenant.Adapt<TenantOutput>();
authUserOut.Describe = wxUser.Describe;
await this.cacheService.SetUserInfoAsync(authUserOut, authUserOut.UserId);
return authUserOut;
@ -200,17 +231,11 @@ namespace GDZZ.Application.Service.Auth
return await this.cacheService.GetUserInfoAsync(UserManager.UserId);
}
/// <summary>
/// 微信支付
/// </summary>
/// <param name="productId"></param>
/// <returns></returns>
[HttpGet("Mini/WxPay")]
public async Task<dynamic> WxPay(AuthUserInput authUserInput)
{
return null;
}

@ -1,4 +1,5 @@
using GDZZ.Core;
using GDZZ.Core.Service;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Generic;
@ -57,5 +58,19 @@ namespace GDZZ.Application
/// </summary>
public string OpenID { get; set; }
/// <summary>
///
/// </summary>
public string Describe { get; set; }
/// <summary>
/// 租户信息
/// </summary>
public TenantOutput Tenant { get; set; }
/// <summary>
/// 公司信息
/// </summary>
public CompanyDto companyDto { get; set; }
}
}

@ -21,20 +21,26 @@ namespace GDZZ.Application
public class BaseUserService : IBaseUserService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<BaseUser> _rep;
private readonly SqlSugarRepository<SeIF> Self; //职业仓储
private readonly SqlSugarRepository<SysUser> _sysUserRep; // 用户表仓储
private readonly SqlSugarRepository<OnlineUser> _sysOnlineUerRep; // 在线用户表仓储
/// <summary>
/// 获取配置文件
/// </summary>
private readonly ThirdParty _oauthConfig;
public BaseUserService(SqlSugarRepository<BaseUser> rep, SqlSugarRepository<SysUser> _sysUserRep)
public BaseUserService(SqlSugarRepository<BaseUser> rep,
SqlSugarRepository<SeIF> Self,
SqlSugarRepository<OnlineUser> _sysOnlineUerRep,
SqlSugarRepository<SysUser> _sysUserRep)
{
_rep = rep;
this._sysUserRep= _sysUserRep;
this.Self= Self;
this._sysUserRep = _sysUserRep;
this._sysOnlineUerRep= _sysOnlineUerRep;
}
@ -56,15 +62,47 @@ namespace GDZZ.Application
var user = this._rep.AsQueryable()
.Filter("TenantId", true)
.First(x => x.CreatedUserId == UserManager.UserId);
var Self = await this.Self.FirstOrDefaultAsync(x => x.CreatedUserId == sysuser.Id);
if(Self.IsEmpty())
{
await this.Self.InsertAsync(new SeIF
{
Name = input.Self,
});
}
else
{
Self.Name = input.Self;
await this.Self.AsUpdateable(Self).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
user.AvatarUrl = input.AvatarUrl;
user.Describe = input.Describe;
sysuser.Avatar = input.AvatarUrl;
sysuser.Sex = input.Sex;
await this._sysUserRep.AsUpdateable(sysuser).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
await this._rep.AsUpdateable(user).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
/// <summary>
/// 获取教师列表
/// </summary>
/// <returns></returns>
[HttpGet("/Mini/BaseUser/list")]
public async Task<dynamic> TeacherList()
{
var thls = await this._sysUserRep.AsQueryable()
.InnerJoin<OnlineUser>((u, r) => u.Id == r.UserId)
.Where(u => u.AdminType == AdminType.None)
.ToListAsync();
//var user = await _sysOnlineUerRep.AsQueryable()
// .Filter("TenantId", true)
// .Where(m => m.UserId == entity.OtherUserID).OrderByDescending(x => x.LastTime).FirstAsync();
return null;
}
/// <summary>
@ -130,5 +168,7 @@ namespace GDZZ.Application
}
}

@ -102,6 +102,26 @@ namespace GDZZ.Application
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
/// <summary>
/// 职业
/// </summary>
public string Self { get; set; }
/// <summary>
/// 性别
/// </summary>
public Gender Sex { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Describe { get; set; }
}
public class QueryeBaseUserInput : DeleteBaseUserInput

@ -1,18 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GDZZ.Application.Service.LiveChat
{
/// <summary>
/// 即时聊天接口
/// </summary>
public interface ILiveChatService
{
}
}

@ -1,45 +0,0 @@
using GDZZ.Core;
using GDZZ.Core.Entity;
using GDZZ.Core.Service;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SignalR;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
namespace GDZZ.Application.Service.LiveChat
{
/// <summary>
/// 即时聊天
/// </summary>
[ApiDescriptionSettings("Application", Name = "LiveChat", Order = 1)]
public class LiveChatService:Hub<ILiveChatService> ,ILiveChatService, IDynamicApiController, ITransient
{
/// <summary>
/// 聊天总线
/// </summary>
private readonly IHubContext<ChatHub, IChatClient> _chatHubContext;
private readonly SqlSugarRepository<OnlineUser> sysOnlineUerRep; // 在线用户表仓储
/// <summary>
/// 聊天服务
/// </summary>
/// <param name="chatHubContext"></param>
/// <param name="_sysOnlineUerRep"></param>
public LiveChatService(IHubContext<ChatHub, IChatClient> chatHubContext,
SqlSugarRepository<OnlineUser> _sysOnlineUerRep)
{
this.sysOnlineUerRep = _sysOnlineUerRep;
_chatHubContext = chatHubContext;
}
}
}

@ -116,4 +116,15 @@ namespace GDZZ.Application
/// </summary>
public string FileName { get; set; }
}
public class AddLiveFriendInput
{
/// <summary>
/// 公司ID
/// </summary>
public long CompanyID { get; set; }
}
}

@ -24,6 +24,8 @@ using Yitter.IdGenerator;
using Microsoft.Extensions.Options;
using ICacheService = GDZZ.Application.Help.ICacheService;
using System.Threading;
using System.ComponentModel.Design;
using Furion.FriendlyException;
namespace GDZZ.Application
{
@ -34,6 +36,7 @@ namespace GDZZ.Application
public class LiveHistoryContactsService : ILiveHistoryContactsService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<LiveHistoryContacts> _rep; //聊天历史任务列表仓储
private readonly SqlSugarRepository<BaseUser> Baseuser; // wx用户仓储
private readonly SqlSugarRepository<LiveMessage> liveMessageRep; //消息仓储
private readonly SqlSugarRepository<LiveUserFriend> liveUserFriend; //好友表仓储
private readonly SqlSugarRepository<SysUser> _sysUserRep; // 用户表仓储
@ -45,6 +48,7 @@ namespace GDZZ.Application
public LiveHistoryContactsService(SqlSugarRepository<LiveHistoryContacts> rep,
ICacheService cacheService,
IOptions<UploadFileOptions> options,
SqlSugarRepository<BaseUser> Baseuser,
SqlSugarRepository<SysUser> _sysUserRep,
SqlSugarRepository<OnlineUser> sysOnlineUerRep,
SqlSugarRepository<LiveUserFriend> liveUserFriend,
@ -54,6 +58,7 @@ namespace GDZZ.Application
_rep = rep;
_options = options.Value;
this.Baseuser= Baseuser;
this.cacheService = cacheService;
this._chatHubContext= chatHubContext;
this._sysOnlineUerRep = sysOnlineUerRep;
@ -64,53 +69,62 @@ namespace GDZZ.Application
#region 聊天列表
/// <summary>
/// 新增联系人
/// </summary>
/// <returns></returns>
[HttpPost("/Mini/LiveHistoryContacts/AddLive")]
public async Task AddLive(AddLiveHistoryContactsInput input)
public async Task<dynamic> AddLive(AddLiveFriendInput input)
{
var entity = input.Adapt<LiveHistoryContacts>();
await _rep.InsertAsync(entity);
await this.cacheService.DelLiveHistoryService(UserManager.UserId);
}
var baseUser = await this.Baseuser.AsQueryable().Filter("TenantId", true).Where(x => x.CompanyID == input.CompanyID).SingleAsync();
if (baseUser.IsNullOrZero())
throw Oops.Oh(ErrorCode.B1002);
var user = await this._sysUserRep.Where(x => x.Id == baseUser.CreatedUserId).SingleAsync();
if (user.IsNullOrZero())
throw Oops.Oh(ErrorCode.xg1002);
//判断是是好友
/// <summary>
/// 修改未读消息
/// </summary>
/// <returns></returns>
[HttpPut("/Mini/LiveHistoryContacts/UPLive")]
public async Task UPLive(UpdateLiveHistoryContactsInput input)
var fends =await this.liveUserFriend.Where(x => x.FriendID == UserManager.UserId && x.CreatedUserId == user.Id).FirstAsync();
if (fends.IsNullOrZero())
{
//this.cacheService.UpUnreadAsync(input.Id);
}
/// <summary>
/// 删除联系人
/// </summary>
/// <returns></returns>
[HttpDelete("/Mini/LiveHistoryContacts/DelLive")]
public async Task DelLive(long ID)
List<LiveUserFriend> friends = new List<LiveUserFriend>();
if(user.Id != UserManager.UserId)
{
var entity = await this.liveUserFriend.SingleAsync(x => x.Id == ID);
await _rep.DeleteAsync(entity);
await this.cacheService.DelLiveHistoryService(UserManager.UserId);
friends.Add(new LiveUserFriend()
{
FriendID = user.Id,
});
}
friends.Add(new LiveUserFriend()
{
FriendID = UserManager.UserId,
CreatedUserId = user.Id
});
foreach (var item in friends)
{
await this.liveUserFriend.InsertAsync(item);
}
}
else
{
}
await this.cacheService.DelLiveHistoryService(UserManager.UserId);
return user;
}
/// <summary>
/// 获取联系人
/// 获取联系人列表
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/Mini/LiveHistoryContacts/list")]
public async Task<List<LiveHistoryLists>> List()
@ -167,6 +181,12 @@ namespace GDZZ.Application
await this.cacheService.SetLiveHistoryService(UserManager.UserId, historyLists);
return historyLists;
}
#endregion
#region 聊天详情

@ -22,6 +22,7 @@ using Senparc.Weixin.Exceptions;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using Mapster;
using Furion.FriendlyException;
namespace GDZZ.Application.Service.WXPay
{
@ -35,6 +36,7 @@ namespace GDZZ.Application.Service.WXPay
private readonly SqlSugarRepository<SysUser> _sysUserRep; // 用户表仓储
private readonly SqlSugarRepository<SysTenant> _sysTenantRep; //租户仓储
private readonly SqlSugarRepository<SeIF> self; //职业仓储
private readonly SqlSugarRepository<Consume> ComsumeRep; //消费记录仓储
private readonly SqlSugarRepository<Balance> balance; //余额仓储
private readonly SqlSugarRepository<MiniRecharge> rechargeRep; //充值仓储
@ -60,6 +62,7 @@ namespace GDZZ.Application.Service.WXPay
SqlSugarRepository<SysTenant> sysTenantRep,
SqlSugarRepository<SysUser> sysUserRep,
SqlSugarRepository<Balance> balance,
SqlSugarRepository<Consume> ComsumeRep,
SqlSugarRepository<SeIF> Self,
SqlSugarRepository<MiniRecharge> rechargeRep,
SqlSugarRepository<MiniPayTake> payTakeRep,
@ -67,11 +70,12 @@ namespace GDZZ.Application.Service.WXPay
IHttpContextAccessor _httpContextAccessor,
IEventPublisher eventPublisher)
{
this.self = Self;
this.balance = balance;
this.Baseuser = Baseuser;
this.ComsumeRep = ComsumeRep;
this._sysUserRep = sysUserRep;
this._sysTenantRep = sysTenantRep;
this.self = Self;
this.rechargeRep = rechargeRep;
this.payTakeRep = payTakeRep;
this._wechatOAuth = wechatOAuth;
@ -106,11 +110,53 @@ namespace GDZZ.Application.Service.WXPay
[Route("Mini/v1/GetRechargeList")]
public async Task<List<RechargeOut>> GetRechargeList()
{
var rechargeLiist = this.rechargeRep.Where(x => x.CreatedUserId == UserManager.UserId).ToListAsync();
var rechargeLiist =await this.rechargeRep.Where(x => x.CreatedUserId == UserManager.UserId).ToListAsync();
return rechargeLiist.Adapt<List<RechargeOut>>();
}
/// <summary>
/// 修改余额
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("Mini/v1/UpBalance")]
public async Task<dynamic> UpBalance(decimal Consume,long? ResumeID)
{
var comrep = await this.ComsumeRep.Where(x=>x.ResumeID== ResumeID).FirstAsync();
if(!comrep.IsNullOrZero()) //已经消费过了
return true;
var ban = await this.balance.Where(x => x.UserID == UserManager.UserId).FirstAsync();
if (ban == null)
throw Oops.Oh(ErrorCode.xg1002);
ban.Amount -= Consume;
if (ban.Amount < 0)
throw Oops.Oh(ErrorCode.B1001);
await this.ComsumeRep.InsertAsync(new Consume()
{
CAmount= Consume,
Surplus = ban.Amount,
ResumeID = ResumeID
});
return await this.balance.AsUpdateable(ban).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync()>0;
}
/// <summary>
/// 查询消费记录
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("Mini/v1/GetBalance")]
public async Task<dynamic> GetBalance()
{
return await this.ComsumeRep.Where(x=>x.UserID == UserManager.UserId).ToListAsync();
}
/// <summary>
@ -191,8 +237,7 @@ namespace GDZZ.Application.Service.WXPay
string return_code = resHandler.GetParameter("return_code");
string return_msg = resHandler.GetParameter("return_msg");
string res = null;
var res = "";
resHandler.SetKey(Config.SenparcWeixinSetting.TenPayV3_Key);
//验证请求是否从微信发过来(安全)
if (resHandler.IsTenpaySign() && return_code.ToUpper() == "SUCCESS")

@ -392,9 +392,15 @@ public enum ErrorCode
[ErrorCodeItemMetadata("检测数据不存在")]
xg1002,
/// <summary>
/// 请添加数据列
/// </summary>
[ErrorCodeItemMetadata("请添加数据列")]
db1000,
/// <summary>
/// 数据表不存在
/// </summary>
[ErrorCodeItemMetadata("数据表不存在")]
db1001,
@ -408,5 +414,16 @@ public enum ErrorCode
/// 租户不存在
/// </summary>
[ErrorCodeItemMetadata("租户不存在")]
F1001
F1001,
/// <summary>
/// 余额不足
/// </summary>
[ErrorCodeItemMetadata("余额不足")]
B1001,
/// <summary>
/// 未绑定公司
/// </summary>
[ErrorCodeItemMetadata("未绑定公司")]
B1002
}

@ -2560,6 +2560,16 @@
检测数据不存在
</summary>
</member>
<member name="F:GDZZ.Core.ErrorCode.db1000">
<summary>
请添加数据列
</summary>
</member>
<member name="F:GDZZ.Core.ErrorCode.db1001">
<summary>
数据表不存在
</summary>
</member>
<member name="F:GDZZ.Core.ErrorCode.F1000">
<summary>
表单不存在
@ -2570,6 +2580,16 @@
租户不存在
</summary>
</member>
<member name="F:GDZZ.Core.ErrorCode.B1001">
<summary>
余额不足
</summary>
</member>
<member name="F:GDZZ.Core.ErrorCode.B1002">
<summary>
未绑定公司
</summary>
</member>
<member name="T:GDZZ.Core.FileExtensionEnum">
<summary>
文件扩展枚举
@ -3535,6 +3555,11 @@
是否租户管理员
</summary>
</member>
<member name="P:GDZZ.Core.OAuth.PhoneModel.logInType">
<summary>
登录类型
</summary>
</member>
<member name="T:GDZZ.Core.TokenModel">
<summary>
AccessToken参数

@ -9,14 +9,17 @@ namespace GDZZ.Core.OAuth
public class PhoneModel
{
/// <summary>
/// 登录类型
/// </summary>
public int logInType { get; set; }
public string encryptedDataStr { get; set; }
public string iv { get; set; }
public string code { get; set; }
}
}

@ -69,10 +69,27 @@ public class SysRoleService : ISysRoleService, IDynamicApiController, ITransient
public async Task<dynamic> QueryRolePageList([FromQuery] RoleInput input)
{
var roles = await _sysRoleRep.AsQueryable()
.InnerJoin<SysTenant>((u, r) => r.Id == u.TenantId)
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code.Trim()))
.Where(u => u.Status == (int)CommonStatus.ENABLE)
.OrderBy(u => u.Sort)
.Select((u, r) => new
{
Tendand = r.Name,
Code = u.Code,
Name = u.Name,
CreatedTime= u.CreatedTime,
CreatedUserId = u.CreatedUserId,
CreatedUserName = u.CreatedUserName,
DataScopeType = u.DataScopeType,
ID = u.Id,
IsDeleted= u.IsDeleted,
RoleType= u.RoleType,
Sort = u.Sort,
Status = u.Status,
TenantId= u.TenantId
})
.ToPagedListAsync(input.PageNo, input.PageSize);
return roles.XnPagedResult();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 KiB

Loading…
Cancel
Save