Merge branch 'refs/heads/abp' into digital-collectibles
This commit is contained in:
@@ -19,5 +19,10 @@ namespace Yi.Framework.Bbs.Domain.Shared.Enums
|
|||||||
/// 广播
|
/// 广播
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Broadcast,
|
Broadcast,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 钱钱
|
||||||
|
/// </summary>
|
||||||
|
Money
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,13 @@ namespace Yi.Framework.Bbs.Domain.Shared.Etos
|
|||||||
Message = message;
|
Message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BbsNoticeEventArgs( NoticeTypeEnum noticeType, Guid acceptUserId, string message)
|
||||||
|
{
|
||||||
|
NoticeType = noticeType;
|
||||||
|
AcceptUserId = acceptUserId;
|
||||||
|
Message = message;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 发送广播
|
/// 发送广播
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -38,6 +38,13 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
|
|||||||
case Shared.Enums.NoticeTypeEnum.Broadcast:
|
case Shared.Enums.NoticeTypeEnum.Broadcast:
|
||||||
_hubContext.Clients.All.SendAsync(NoticeTypeEnum.Broadcast.ToString(), eventData.Message);
|
_hubContext.Clients.All.SendAsync(NoticeTypeEnum.Broadcast.ToString(), eventData.Message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case Shared.Enums.NoticeTypeEnum.Money:
|
||||||
|
if (BbsNoticeHub.HubUserModels.TryGetValue(eventData.AcceptUserId.ToString(), out var hubUserModel2))
|
||||||
|
{
|
||||||
|
_hubContext.Clients.Client(hubUserModel2.ConnnectionId).SendAsync(NoticeTypeEnum.Personal.ToString(), eventData.Message,entity.CreationTime);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
using Volo.Abp;
|
using Volo.Abp;
|
||||||
using Volo.Abp.DependencyInjection;
|
using Volo.Abp.DependencyInjection;
|
||||||
using Volo.Abp.EventBus;
|
using Volo.Abp.EventBus;
|
||||||
|
using Volo.Abp.EventBus.Local;
|
||||||
using Yi.Framework.Bbs.Domain.Entities;
|
using Yi.Framework.Bbs.Domain.Entities;
|
||||||
using Yi.Framework.Bbs.Domain.Shared.Consts;
|
using Yi.Framework.Bbs.Domain.Shared.Consts;
|
||||||
|
using Yi.Framework.Bbs.Domain.Shared.Enums;
|
||||||
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
using Yi.Framework.Bbs.Domain.Shared.Etos;
|
||||||
using Yi.Framework.SqlSugarCore.Abstractions;
|
using Yi.Framework.SqlSugarCore.Abstractions;
|
||||||
|
|
||||||
@@ -11,9 +13,11 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
|
|||||||
public class MoneyChangeEventHandler : ILocalEventHandler<MoneyChangeEventArgs>, ITransientDependency
|
public class MoneyChangeEventHandler : ILocalEventHandler<MoneyChangeEventArgs>, ITransientDependency
|
||||||
{
|
{
|
||||||
private ISqlSugarRepository<BbsUserExtraInfoEntity> _userInfoRepository;
|
private ISqlSugarRepository<BbsUserExtraInfoEntity> _userInfoRepository;
|
||||||
public MoneyChangeEventHandler(ISqlSugarRepository<BbsUserExtraInfoEntity> userInfoRepository)
|
private ILocalEventBus _localEventBus;
|
||||||
|
public MoneyChangeEventHandler(ISqlSugarRepository<BbsUserExtraInfoEntity> userInfoRepository, ILocalEventBus localEventBus)
|
||||||
{
|
{
|
||||||
_userInfoRepository = userInfoRepository;
|
_userInfoRepository = userInfoRepository;
|
||||||
|
_localEventBus = localEventBus;
|
||||||
}
|
}
|
||||||
public async Task HandleEventAsync(MoneyChangeEventArgs eventData)
|
public async Task HandleEventAsync(MoneyChangeEventArgs eventData)
|
||||||
{
|
{
|
||||||
@@ -28,6 +32,9 @@ namespace Yi.Framework.Bbs.Domain.EventHandlers
|
|||||||
await _userInfoRepository._Db.Updateable<BbsUserExtraInfoEntity>()
|
await _userInfoRepository._Db.Updateable<BbsUserExtraInfoEntity>()
|
||||||
.SetColumns(it => it.Money == it.Money + eventData.Number)
|
.SetColumns(it => it.Money == it.Money + eventData.Number)
|
||||||
.Where(x => x.UserId == eventData.UserId).ExecuteCommandAsync();
|
.Where(x => x.UserId == eventData.UserId).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
|
||||||
|
await _localEventBus.PublishAsync(new BbsNoticeEventArgs(NoticeTypeEnum.Money, eventData.UserId,eventData.Number.ToString()), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import signalR from "@/utils/signalR";
|
import signalR from "@/utils/signalR";
|
||||||
import useNoticeStore from "@/stores/notice";
|
import useNoticeStore from "@/stores/notice";
|
||||||
|
import useUserStore from "@/stores/user";
|
||||||
import { dayjs } from 'element-plus'
|
import { dayjs } from 'element-plus'
|
||||||
const receiveMsg=(connection)=> {
|
const receiveMsg=(connection)=> {
|
||||||
|
|
||||||
@@ -11,6 +12,13 @@ const receiveMsg=(connection)=> {
|
|||||||
creationTime
|
creationTime
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
const userStore=useUserStore();
|
||||||
|
connection.on("Money", (message,creationTime) => {
|
||||||
|
const updateMoneyNumber=Number(message)
|
||||||
|
userStore.updateMoney(updateMoneyNumber)
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ()=>{
|
export default ()=>{
|
||||||
|
|||||||
@@ -122,23 +122,6 @@ const useUserStore = defineStore("user", {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//找回密码
|
|
||||||
retrievePassword(userInfo)
|
|
||||||
{
|
|
||||||
const password = userInfo.password.trim();
|
|
||||||
const phone = userInfo.phone;
|
|
||||||
const uuid = userInfo.uuid;
|
|
||||||
const code = userInfo.code;
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
retrievePassword(password, phone, code, uuid)
|
|
||||||
.then((response) => {
|
|
||||||
resolve(response);
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
reject(error);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// 重置用户信息
|
// 重置用户信息
|
||||||
resetInfo() {
|
resetInfo() {
|
||||||
this.roles = [];
|
this.roles = [];
|
||||||
@@ -153,9 +136,12 @@ const useUserStore = defineStore("user", {
|
|||||||
this.codeImageURL = "data:image/jpg;base64," + data.img;
|
this.codeImageURL = "data:image/jpg;base64," + data.img;
|
||||||
this.codeUUid = data.uuid;
|
this.codeUUid = data.uuid;
|
||||||
},
|
},
|
||||||
updateToken(token)
|
updateToken(token) {
|
||||||
{
|
|
||||||
this.token = token;
|
this.token = token;
|
||||||
|
},
|
||||||
|
//更新钱钱
|
||||||
|
updateMoney(updateMoneyNumber){
|
||||||
|
this.money=this.money+updateMoneyNumber
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
persist: {
|
persist: {
|
||||||
|
|||||||
Reference in New Issue
Block a user