diff --git a/GDZZ.Application/Entity/Balance.cs b/GDZZ.Application/Entity/Balance.cs
index 24abeb6..e98fe52 100644
--- a/GDZZ.Application/Entity/Balance.cs
+++ b/GDZZ.Application/Entity/Balance.cs
@@ -11,10 +11,6 @@ namespace GDZZ.Application.Entity
[Description("余额表")]
public class Balance : DEntityBase
{
- ///
- /// 租户Id
- ///
- public long TenantId { get; set; }
///
/// 用户ID
///
diff --git a/GDZZ.Application/Entity/BaseUser.cs b/GDZZ.Application/Entity/BaseUser.cs
index 232ddb5..1cc44ca 100644
--- a/GDZZ.Application/Entity/BaseUser.cs
+++ b/GDZZ.Application/Entity/BaseUser.cs
@@ -2,8 +2,6 @@
using SqlSugar;
using System.ComponentModel;
using GDZZ.Core.Entity;
-using GDZZ.Core;
-
namespace GDZZ.Application.Entity
{
///
@@ -20,7 +18,7 @@ namespace GDZZ.Application.Entity
///
/// 用户类型
///
- public UserEnum Type { get; set; }
+ public int Type { get; set; }
///
/// 用户名
///
@@ -32,7 +30,7 @@ namespace GDZZ.Application.Entity
///
/// 公共状态
///
- public CommonStatus Status { get; set; }
+ public int Status { get; set; }
///
/// 微信用户ID
///
@@ -45,5 +43,13 @@ namespace GDZZ.Application.Entity
/// 开发平台ID
///
public string UnionId { get; set; }
+ ///
+ /// 公司ID
+ ///
+ public long CompanyID { get; set; }
+ ///
+ /// 描述
+ ///
+ public string Describe { get; set; }
}
}
\ No newline at end of file
diff --git a/GDZZ.Application/Entity/Consume.cs b/GDZZ.Application/Entity/Consume.cs
new file mode 100644
index 0000000..229962d
--- /dev/null
+++ b/GDZZ.Application/Entity/Consume.cs
@@ -0,0 +1,35 @@
+using System;
+using SqlSugar;
+using System.ComponentModel;
+using GDZZ.Core.Entity;
+namespace GDZZ.Application.Entity
+{
+ ///
+ /// 消费记录
+ ///
+ [SugarTable("mini_consume")]
+ [Description("消费记录")]
+ public class Consume : DEntityBase
+ {
+ ///
+ /// 消费金额
+ ///
+ public decimal CAmount { get; set; }
+ ///
+ /// 余额
+ ///
+ public decimal Surplus { get; set; }
+ ///
+ /// 用户ID
+ ///
+ public long UserID { get; set; }
+ ///
+ /// 消费类型
+ ///
+ public int Sort { get; set; }
+ ///
+ /// 沟通ID
+ ///
+ public long? ResumeID { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/GDZZ.Application/Entity/LiveUserFriend.cs b/GDZZ.Application/Entity/LiveUserFriend.cs
index 9d20003..510c08b 100644
--- a/GDZZ.Application/Entity/LiveUserFriend.cs
+++ b/GDZZ.Application/Entity/LiveUserFriend.cs
@@ -11,10 +11,6 @@ namespace GDZZ.Application.Entity
[Description("聊天用户好友表")]
public class LiveUserFriend : DEntityBase
{
- ///
- /// 租户Id
- ///
- public long TenantId { get; set; }
///
/// 好友ID
///
diff --git a/GDZZ.Application/GDZZ.Application.xml b/GDZZ.Application/GDZZ.Application.xml
index 8ca4238..a689de1 100644
--- a/GDZZ.Application/GDZZ.Application.xml
+++ b/GDZZ.Application/GDZZ.Application.xml
@@ -9,11 +9,6 @@
余额表
-
-
- 租户Id
-
-
用户ID
@@ -69,6 +64,16 @@
开发平台ID
+
+
+ 公司ID
+
+
+
+
+ 描述
+
+
公司属性
@@ -94,6 +99,36 @@
公司详情图片
+
+
+ 消费记录
+
+
+
+
+ 消费金额
+
+
+
+
+ 余额
+
+
+
+
+ 用户ID
+
+
+
+
+ 消费类型
+
+
+
+
+ 沟通ID
+
+
意见反馈
@@ -209,11 +244,6 @@
聊天用户好友表
-
-
- 租户Id
-
-
好友ID
@@ -533,13 +563,6 @@
-
-
- 微信支付
-
-
-
-
业务权限控制
@@ -552,41 +575,34 @@
-
-
- 即时聊天接口
-
-
-
+
- 即时聊天
+
-
+
- 聊天总线
+ 用户ID
-
+
- 聊天服务
+ 余额
-
-
-
+
-
+ 总价格
-
+
- 用户ID
+ 支付金额
-
+
- 余额
+ 充值状态
@@ -605,6 +621,24 @@
+
+
+ 充值记录查询
+
+
+
+
+
+ 修改余额
+
+
+
+
+
+ 查询消费记录
+
+
+
微信小程序支付
@@ -668,14 +702,24 @@
-
+
- 基础用户服务
+
-
+
- 获取配置文件
+ 租户信息
+
+
+
+
+ 公司信息
+
+
+
+
+ 基础用户服务
@@ -685,6 +729,12 @@
+
+
+ 获取教师列表
+
+
+
分页查询基础用户
@@ -860,6 +910,21 @@
主键Id
+
+
+ 职业
+
+
+
+
+ 性别
+
+
+
+
+ 描述
+
+
基础用户输出参数
@@ -1326,6 +1391,11 @@
文件名称
+
+
+ 公司ID
+
+
聊天历史任务列表输出参数
@@ -1396,29 +1466,16 @@
聊天服务
-
+
新增联系人
-
-
- 修改未读消息
-
-
-
-
-
- 删除联系人
-
-
-
- 获取联系人
+ 获取联系人列表
-
diff --git a/GDZZ.Application/Service/Auth/AuthService.cs b/GDZZ.Application/Service/Auth/AuthService.cs
index 34fc7ef..4bcc52e 100644
--- a/GDZZ.Application/Service/Auth/AuthService.cs
+++ b/GDZZ.Application/Service/Auth/AuthService.cs
@@ -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 _sysUserRep; // 用户表仓储
private readonly SqlSugarRepository _sysTenantRep; //租户仓储
private readonly SqlSugarRepository Self; //职业仓储
-
+ private readonly SqlSugarRepository CompanyRep;
private readonly SqlSugarRepository rechargeRep; //充值仓储
private readonly SqlSugarRepository payTakeRep; //支付仓储
#endregion
@@ -51,11 +53,14 @@ namespace GDZZ.Application.Service.Auth
SqlSugarRepository sysTenantRep,
SqlSugarRepository sysUserRep,
SqlSugarRepository Self,
+ SqlSugarRepository CompanyRep,
+ SqlSugarRepository 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;
}
@@ -75,10 +81,12 @@ namespace GDZZ.Application.Service.Auth
[AllowAnonymous]
public async Task SignInAsync(PhoneModel phoneModel)
{
- AuthUserOut authUserOut = new AuthUserOut();
- //读取凭证
- var tokenModel = await this._wechatOAuth.GetAccessTokenAsync(phoneModel.code);
+ 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,30 +127,43 @@ namespace GDZZ.Application.Service.Auth
});
}
- var wxUser = await this.Baseuser.AsQueryable()
- .Filter("TenantId", true)
- .Where(x => x.OpenID == tokenModel.OpenId).SingleAsync();
-
- if (wxUser.IsEmpty())
+ //区分不同类型账号
+ if (phoneModel.logInType ==(int)UserEnum.JOB)
{
- wxUser = await this.Baseuser.InsertReturnEntityAsync(new BaseUser()
+ if (wxUser.IsEmpty())
{
- UnionId = tokenModel.Unionid,
- CreatedUserId = sysUser.Id,
- CreatedTime = DateTime.Now,
- CreatedUserName = sysUser.Name,
- AvatarUrl = "https://gdzongzhi.com/assets/img/logo.png",
- Status = CommonStatus.ENABLE,
- OpenID = tokenModel.OpenId,
- TenantId = 392820661919813,
- Type = UserEnum.JOB,
- UserName = phoneInfo.PhoneNumber,
- });
+ wxUser = await this.Baseuser.InsertReturnEntityAsync(new BaseUser()
+ {
+ UnionId = tokenModel.Unionid,
+ CreatedUserId = sysUser.Id,
+ CreatedTime = DateTime.Now,
+ CreatedUserName = sysUser.Name,
+ AvatarUrl = "https://gdzongzhi.com/assets/img/logo.png",
+ Status =(int)CommonStatus.ENABLE,
+ OpenID = tokenModel.OpenId,
+ TenantId = 392820661919813,
+ 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();
- if(wxUser.IsEmpty()|| sysUser.IsEmpty())
+
+ }
+ 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
{
@@ -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();
+ 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);
}
- ///
- /// 微信支付
- ///
- ///
- ///
- [HttpGet("Mini/WxPay")]
- public async Task WxPay(AuthUserInput authUserInput)
- {
- return null;
- }
+
+
+
+
diff --git a/GDZZ.Application/Service/Auth/DTO/AuthUserOut.cs b/GDZZ.Application/Service/Auth/DTO/AuthUserOut.cs
index f60b06b..de75574 100644
--- a/GDZZ.Application/Service/Auth/DTO/AuthUserOut.cs
+++ b/GDZZ.Application/Service/Auth/DTO/AuthUserOut.cs
@@ -1,4 +1,5 @@
using GDZZ.Core;
+using GDZZ.Core.Service;
using Org.BouncyCastle.Bcpg.OpenPgp;
using System;
using System.Collections.Generic;
@@ -55,7 +56,21 @@ namespace GDZZ.Application
///
///
///
- public string OpenID { get; set; }
+ public string OpenID { get; set; }
+ ///
+ ///
+ ///
+ public string Describe { get; set; }
+
+ ///
+ /// 租户信息
+ ///
+ public TenantOutput Tenant { get; set; }
+
+ ///
+ /// 公司信息
+ ///
+ public CompanyDto companyDto { get; set; }
}
}
diff --git a/GDZZ.Application/Service/BaseUser/BaseUserService.cs b/GDZZ.Application/Service/BaseUser/BaseUserService.cs
index 0d899c0..09511b6 100644
--- a/GDZZ.Application/Service/BaseUser/BaseUserService.cs
+++ b/GDZZ.Application/Service/BaseUser/BaseUserService.cs
@@ -21,20 +21,26 @@ namespace GDZZ.Application
public class BaseUserService : IBaseUserService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository _rep;
+ private readonly SqlSugarRepository Self; //职业仓储
+
private readonly SqlSugarRepository _sysUserRep; // 用户表仓储
+ private readonly SqlSugarRepository _sysOnlineUerRep; // 在线用户表仓储
+
- ///
- /// 获取配置文件
- ///
- private readonly ThirdParty _oauthConfig;
- public BaseUserService(SqlSugarRepository rep, SqlSugarRepository _sysUserRep)
+ public BaseUserService(SqlSugarRepository rep,
+ SqlSugarRepository Self,
+
+ SqlSugarRepository _sysOnlineUerRep,
+ SqlSugarRepository _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();
-
-
}
+
+ ///
+ /// 获取教师列表
+ ///
+ ///
+ [HttpGet("/Mini/BaseUser/list")]
+ public async Task TeacherList()
+ {
+ var thls = await this._sysUserRep.AsQueryable()
+ .InnerJoin((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;
+ }
///
@@ -130,5 +168,7 @@ namespace GDZZ.Application
+
+
}
}
diff --git a/GDZZ.Application/Service/BaseUser/Dto/BaseUserInput.cs b/GDZZ.Application/Service/BaseUser/Dto/BaseUserInput.cs
index a149850..5f968ee 100644
--- a/GDZZ.Application/Service/BaseUser/Dto/BaseUserInput.cs
+++ b/GDZZ.Application/Service/BaseUser/Dto/BaseUserInput.cs
@@ -102,6 +102,26 @@ namespace GDZZ.Application
[Required(ErrorMessage = "主键Id不能为空")]
public long Id { get; set; }
+
+ ///
+ /// 职业
+ ///
+ public string Self { get; set; }
+
+
+ ///
+ /// 性别
+ ///
+ public Gender Sex { get; set; }
+
+
+ ///
+ /// 描述
+ ///
+ public string Describe { get; set; }
+
+
+
}
public class QueryeBaseUserInput : DeleteBaseUserInput
diff --git a/GDZZ.Application/Service/LiveChat/ILiveChatService.cs b/GDZZ.Application/Service/LiveChat/ILiveChatService.cs
deleted file mode 100644
index 5a2a4c4..0000000
--- a/GDZZ.Application/Service/LiveChat/ILiveChatService.cs
+++ /dev/null
@@ -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
-{
- ///
- /// 即时聊天接口
- ///
- public interface ILiveChatService
- {
-
-
-
- }
-}
diff --git a/GDZZ.Application/Service/LiveChat/LiveChatService.cs b/GDZZ.Application/Service/LiveChat/LiveChatService.cs
deleted file mode 100644
index f8eec90..0000000
--- a/GDZZ.Application/Service/LiveChat/LiveChatService.cs
+++ /dev/null
@@ -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
-{
- ///
- /// 即时聊天
- ///
- [ApiDescriptionSettings("Application", Name = "LiveChat", Order = 1)]
- public class LiveChatService:Hub ,ILiveChatService, IDynamicApiController, ITransient
- {
- ///
- /// 聊天总线
- ///
- private readonly IHubContext _chatHubContext;
-
- private readonly SqlSugarRepository sysOnlineUerRep; // 在线用户表仓储
-
-
- ///
- /// 聊天服务
- ///
- ///
- ///
- public LiveChatService(IHubContext chatHubContext,
- SqlSugarRepository _sysOnlineUerRep)
- {
- this.sysOnlineUerRep = _sysOnlineUerRep;
- _chatHubContext = chatHubContext;
- }
-
-
-
-
-
- }
-}
diff --git a/GDZZ.Application/Service/LiveHistoryContacts/Dto/LiveHistoryContactsInput.cs b/GDZZ.Application/Service/LiveHistoryContacts/Dto/LiveHistoryContactsInput.cs
index 3fc9f37..9ffe22f 100644
--- a/GDZZ.Application/Service/LiveHistoryContacts/Dto/LiveHistoryContactsInput.cs
+++ b/GDZZ.Application/Service/LiveHistoryContacts/Dto/LiveHistoryContactsInput.cs
@@ -116,4 +116,15 @@ namespace GDZZ.Application
///
public string FileName { get; set; }
}
+
+
+ public class AddLiveFriendInput
+ {
+
+ ///
+ /// 公司ID
+ ///
+ public long CompanyID { get; set; }
+
+ }
}
diff --git a/GDZZ.Application/Service/LiveHistoryContacts/LiveHistoryContactsService.cs b/GDZZ.Application/Service/LiveHistoryContacts/LiveHistoryContactsService.cs
index 2d77d2b..d8f3122 100644
--- a/GDZZ.Application/Service/LiveHistoryContacts/LiveHistoryContactsService.cs
+++ b/GDZZ.Application/Service/LiveHistoryContacts/LiveHistoryContactsService.cs
@@ -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 _rep; //聊天历史任务列表仓储
+ private readonly SqlSugarRepository Baseuser; // wx用户仓储
private readonly SqlSugarRepository liveMessageRep; //消息仓储
private readonly SqlSugarRepository liveUserFriend; //好友表仓储
private readonly SqlSugarRepository _sysUserRep; // 用户表仓储
@@ -45,6 +48,7 @@ namespace GDZZ.Application
public LiveHistoryContactsService(SqlSugarRepository rep,
ICacheService cacheService,
IOptions options,
+ SqlSugarRepository Baseuser,
SqlSugarRepository _sysUserRep,
SqlSugarRepository sysOnlineUerRep,
SqlSugarRepository 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 聊天列表
+
+
+
///
/// 新增联系人
///
///
[HttpPost("/Mini/LiveHistoryContacts/AddLive")]
- public async Task AddLive(AddLiveHistoryContactsInput input)
+ public async Task AddLive(AddLiveFriendInput input)
{
- var entity = input.Adapt();
- 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);
+
+ //判断是是好友
+
+ var fends =await this.liveUserFriend.Where(x => x.FriendID == UserManager.UserId && x.CreatedUserId == user.Id).FirstAsync();
+ if (fends.IsNullOrZero())
+ {
+ List friends = new List();
+ if(user.Id != UserManager.UserId)
+ {
+ friends.Add(new LiveUserFriend()
+ {
+ FriendID = user.Id,
+ });
+ }
- ///
- /// 修改未读消息
- ///
- ///
- [HttpPut("/Mini/LiveHistoryContacts/UPLive")]
- public async Task UPLive(UpdateLiveHistoryContactsInput input)
- {
- //this.cacheService.UpUnreadAsync(input.Id);
- }
+ friends.Add(new LiveUserFriend()
+ {
+ FriendID = UserManager.UserId,
+ CreatedUserId = user.Id
+ });
+ foreach (var item in friends)
+ {
+ await this.liveUserFriend.InsertAsync(item);
+ }
+ }
+ else
+ {
+ }
- ///
- /// 删除联系人
- ///
- ///
- [HttpDelete("/Mini/LiveHistoryContacts/DelLive")]
- public async Task DelLive(long ID)
- {
- var entity = await this.liveUserFriend.SingleAsync(x => x.Id == ID);
- await _rep.DeleteAsync(entity);
await this.cacheService.DelLiveHistoryService(UserManager.UserId);
+ return user;
}
-
-
-
-
-
///
- /// 获取联系人
+ /// 获取联系人列表
///
- ///
///
[HttpGet("/Mini/LiveHistoryContacts/list")]
public async Task> List()
@@ -137,12 +151,12 @@ namespace GDZZ.Application
Id = item.FriendID,
Index = sysUser.Name.Substring(0, 1),
LastSendTime = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000,
-
+
};
//查询聊天记录
//rm -rf mk dir ls install cd home //ru-rf
- var live = await this.liveMessageRep.Where(x => x.CreatedUserId == UserManager.UserId && x.OtherUserID == item.FriendID || (x.CreatedUserId == item.FriendID && x.OtherUserID == UserManager.UserId)).OrderByDescending(x =>x.CreatedTime).FirstAsync();
+ var live = await this.liveMessageRep.Where(x => x.CreatedUserId == UserManager.UserId && x.OtherUserID == item.FriendID || (x.CreatedUserId == item.FriendID && x.OtherUserID == UserManager.UserId)).OrderByDescending(x => x.CreatedTime).FirstAsync();
if (live != null)
{
@@ -167,6 +181,12 @@ namespace GDZZ.Application
await this.cacheService.SetLiveHistoryService(UserManager.UserId, historyLists);
return historyLists;
}
+
+
+
+
+
+
#endregion
#region 聊天详情
diff --git a/GDZZ.Application/Service/WXPay/WXPayService.cs b/GDZZ.Application/Service/WXPay/WXPayService.cs
index ffc9102..d836a4d 100644
--- a/GDZZ.Application/Service/WXPay/WXPayService.cs
+++ b/GDZZ.Application/Service/WXPay/WXPayService.cs
@@ -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 _sysUserRep; // 用户表仓储
private readonly SqlSugarRepository _sysTenantRep; //租户仓储
private readonly SqlSugarRepository self; //职业仓储
+ private readonly SqlSugarRepository ComsumeRep; //消费记录仓储
private readonly SqlSugarRepository balance; //余额仓储
private readonly SqlSugarRepository rechargeRep; //充值仓储
@@ -60,6 +62,7 @@ namespace GDZZ.Application.Service.WXPay
SqlSugarRepository sysTenantRep,
SqlSugarRepository sysUserRep,
SqlSugarRepository balance,
+ SqlSugarRepository ComsumeRep,
SqlSugarRepository Self,
SqlSugarRepository rechargeRep,
SqlSugarRepository 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> 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>();
}
+ ///
+ /// 修改余额
+ ///
+ ///
+ [HttpGet]
+ [Route("Mini/v1/UpBalance")]
+ public async Task 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;
+ }
+
+
+ ///
+ /// 查询消费记录
+ ///
+ ///
+ [HttpGet]
+ [Route("Mini/v1/GetBalance")]
+ public async Task GetBalance()
+ {
+ return await this.ComsumeRep.Where(x=>x.UserID == UserManager.UserId).ToListAsync();
+ }
+
///
@@ -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")
diff --git a/GDZZ.Core/Enum/ErrorCode.cs b/GDZZ.Core/Enum/ErrorCode.cs
index f6c7cd5..bfe7dff 100644
--- a/GDZZ.Core/Enum/ErrorCode.cs
+++ b/GDZZ.Core/Enum/ErrorCode.cs
@@ -392,9 +392,15 @@ public enum ErrorCode
[ErrorCodeItemMetadata("检测数据不存在")]
xg1002,
+ ///
+ /// 请添加数据列
+ ///
[ErrorCodeItemMetadata("请添加数据列")]
db1000,
+ ///
+ /// 数据表不存在
+ ///
[ErrorCodeItemMetadata("数据表不存在")]
db1001,
@@ -408,5 +414,16 @@ public enum ErrorCode
/// 租户不存在
///
[ErrorCodeItemMetadata("租户不存在")]
- F1001
+ F1001,
+
+ ///
+ /// 余额不足
+ ///
+ [ErrorCodeItemMetadata("余额不足")]
+ B1001,
+ ///
+ /// 未绑定公司
+ ///
+ [ErrorCodeItemMetadata("未绑定公司")]
+ B1002
}
diff --git a/GDZZ.Core/GDZZ.Core.xml b/GDZZ.Core/GDZZ.Core.xml
index 7b2a7af..76aefa7 100644
--- a/GDZZ.Core/GDZZ.Core.xml
+++ b/GDZZ.Core/GDZZ.Core.xml
@@ -2560,6 +2560,16 @@
检测数据不存在
+
+
+ 请添加数据列
+
+
+
+
+ 数据表不存在
+
+
表单不存在
@@ -2570,6 +2580,16 @@
租户不存在
+
+
+ 余额不足
+
+
+
+
+ 未绑定公司
+
+
文件扩展枚举
@@ -3535,6 +3555,11 @@
是否租户管理员
+
+
+ 登录类型
+
+
AccessToken参数
diff --git a/GDZZ.Core/OAuth/PhoneModel.cs b/GDZZ.Core/OAuth/PhoneModel.cs
index 4e1f664..9985341 100644
--- a/GDZZ.Core/OAuth/PhoneModel.cs
+++ b/GDZZ.Core/OAuth/PhoneModel.cs
@@ -9,14 +9,17 @@ namespace GDZZ.Core.OAuth
public class PhoneModel
{
+ ///
+ /// 登录类型
+ ///
+ public int logInType { get; set; }
-
public string encryptedDataStr { get; set; }
-
-
public string iv { get; set; }
public string code { get; set; }
+
+
}
}
diff --git a/GDZZ.Core/Service/Role/SysRoleService.cs b/GDZZ.Core/Service/Role/SysRoleService.cs
index 2889931..8622c96 100644
--- a/GDZZ.Core/Service/Role/SysRoleService.cs
+++ b/GDZZ.Core/Service/Role/SysRoleService.cs
@@ -69,10 +69,27 @@ public class SysRoleService : ISysRoleService, IDynamicApiController, ITransient
public async Task QueryRolePageList([FromQuery] RoleInput input)
{
var roles = await _sysRoleRep.AsQueryable()
+ .InnerJoin((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();
}
diff --git a/GDZZ.Web.Entry/wwwroot/Upload/Default/400356345643077.jpg b/GDZZ.Web.Entry/wwwroot/Upload/Default/400356345643077.jpg
new file mode 100644
index 0000000..7c9a2b0
Binary files /dev/null and b/GDZZ.Web.Entry/wwwroot/Upload/Default/400356345643077.jpg differ