1212121
69
Service/Application.Domain.Entity/logdb/db/game_charm_log.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Application.Domain.Entity
|
||||||
|
{
|
||||||
|
[Tenant("Kg.SeaTime.Log")]
|
||||||
|
public class game_charm_log
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// logId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey = true, Length = 50)]
|
||||||
|
public string logId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// userId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? userId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// fromId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? fromId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// goodsId
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public Int32? goodsId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// name
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// img
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50, IsNullable = true)]
|
||||||
|
public string? img { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// count
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? count { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// charm
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? charm { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// sumCharm
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public int? sumCharm { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// addTime
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsNullable = true)]
|
||||||
|
public DateTime? addTime { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
11
Service/Application.Domain.Entity/view/GiftLogView.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace Application.Domain.Entity;
|
||||||
|
|
||||||
|
public class GiftLogView
|
||||||
|
{
|
||||||
|
public UserModel user { get; set; }
|
||||||
|
public UserModel from { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string img { get; set; }
|
||||||
|
public int count { get; set; }
|
||||||
|
public DateTime? time { get; set; }
|
||||||
|
}
|
||||||
@@ -16,11 +16,12 @@ public static class GoodsEnum
|
|||||||
Pack,//宝箱
|
Pack,//宝箱
|
||||||
ChoicePack,//选择宝箱
|
ChoicePack,//选择宝箱
|
||||||
Weight,//负重
|
Weight,//负重
|
||||||
|
Gift,//礼物道具
|
||||||
Exp,//经验
|
Exp,//经验
|
||||||
State,//状态物品
|
State,//状态物品
|
||||||
Ship,//船只
|
Ship,//船只
|
||||||
Practise,//修炼道具
|
Practise,//修炼道具
|
||||||
Durability,//负重道具
|
Durability,//耐久道具
|
||||||
AddExp,//扣除经验获得道具
|
AddExp,//扣除经验获得道具
|
||||||
GetExp//使用后获得经验
|
GetExp//使用后获得经验
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,4 +20,14 @@ public interface IUnitUserRelationService
|
|||||||
Task<bool> DeleteUserEnemy(string userId, string eId);
|
Task<bool> DeleteUserEnemy(string userId, string eId);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 魅力相关
|
||||||
|
|
||||||
|
Task<game_charm_log> GetUserNewGift(string userId);
|
||||||
|
Task<List<GiftLogView>> GetUserGiftLog(string userId, int page, int limit, RefAsync<int> total);
|
||||||
|
|
||||||
|
Task<bool> AddCharm(string userId, string fromId, int goodsId, string name, string img, int charm,
|
||||||
|
int count);
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -168,6 +168,10 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
|
|||||||
{
|
{
|
||||||
temp.sign = item.renown.ToString();
|
temp.sign = item.renown.ToString();
|
||||||
}
|
}
|
||||||
|
else if(type==11)
|
||||||
|
{
|
||||||
|
temp.sign = item.charm.ToString();
|
||||||
|
}
|
||||||
temp.par = "";
|
temp.par = "";
|
||||||
result.Add(temp);
|
result.Add(temp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ public class UnitUserRelationService(ISqlSugarClient DbClient, IRedisCache redis
|
|||||||
|
|
||||||
public async Task<bool> CheckIsFriend(string userId, string toId)
|
public async Task<bool> CheckIsFriend(string userId, string toId)
|
||||||
{
|
{
|
||||||
string frId = StringAssist.GetSortKey(userId, toId);
|
var data = await GetUserFriendInfo(userId, toId);
|
||||||
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_friend>();
|
return data != null;
|
||||||
return await db.Queryable<unit_user_friend>().Where(it => it.frId == frId).AnyAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<bool> AddFriend(string userId, string toId)
|
public async Task<bool> AddFriend(string userId, string toId)
|
||||||
{
|
{
|
||||||
unit_user_friend friend = new unit_user_friend();
|
unit_user_friend friend = new unit_user_friend();
|
||||||
@@ -62,6 +62,21 @@ public class UnitUserRelationService(ISqlSugarClient DbClient, IRedisCache redis
|
|||||||
return await db.Deleteable<unit_user_friend>().Where(it => it.frId == frId).ExecuteCommandAsync() > 0;
|
return await db.Deleteable<unit_user_friend>().Where(it => it.frId == frId).ExecuteCommandAsync() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<unit_user_friend> GetUserFriendInfo(string userId, string toId)
|
||||||
|
{
|
||||||
|
string frId = StringAssist.GetSortKey(userId, toId);
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_friend>();
|
||||||
|
return await db.Queryable<unit_user_friend>().Where(it => it.frId == frId).SingleAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<bool> UpdateFriendNear(string frId, int op, int count)
|
||||||
|
{
|
||||||
|
int opCount = op == 1 ? count : 0 - count;
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_friend>();
|
||||||
|
return await db.Updateable<unit_user_friend>().SetColumns(it => it.near == it.near + opCount)
|
||||||
|
.Where(it => it.frId == frId).ExecuteCommandAsync() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 仇人
|
#region 仇人
|
||||||
@@ -120,4 +135,91 @@ public class UnitUserRelationService(ISqlSugarClient DbClient, IRedisCache redis
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 赠送礼物
|
||||||
|
|
||||||
|
public async Task<game_charm_log> GetUserNewGift(string userId)
|
||||||
|
{
|
||||||
|
string key = string.Format(UserCache.BaseCacheKey, "UserNewGift");
|
||||||
|
if (await redis.HExistsHashAsync(key, userId))
|
||||||
|
{
|
||||||
|
return await redis.GetHashAsync<game_charm_log>(key, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_charm_log>();
|
||||||
|
var data = await db.Queryable<game_charm_log>().Where(it => it.userId == userId)
|
||||||
|
.OrderByDescending(it => it.addTime).FirstAsync();
|
||||||
|
if (data == null)
|
||||||
|
{
|
||||||
|
data = new game_charm_log();
|
||||||
|
}
|
||||||
|
|
||||||
|
await redis.AddHashAsync(key, userId, data);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<GiftLogView>> GetUserGiftLog(string userId, int page, int limit, RefAsync<int> total)
|
||||||
|
{
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_charm_log>();
|
||||||
|
var data = await db.Queryable<game_charm_log>().Where(it => it.userId == userId)
|
||||||
|
.OrderByDescending(it => it.addTime).ToPageListAsync(page, limit, total);
|
||||||
|
List<GiftLogView> result = new List<GiftLogView>();
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
GiftLogView temp = new GiftLogView()
|
||||||
|
{
|
||||||
|
user = await UserModelTool.GetUserView(item.userId),
|
||||||
|
from = await UserModelTool.GetUserView(item.fromId),
|
||||||
|
name = item.name,
|
||||||
|
img = item.img,
|
||||||
|
count = (int)item.count,
|
||||||
|
time = item.addTime
|
||||||
|
};
|
||||||
|
result.Add(temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> AddCharm(string userId, string fromId, int goodsId, string name, string img, int charm,
|
||||||
|
int count)
|
||||||
|
{
|
||||||
|
int sumCharm = count * charm;
|
||||||
|
var accService = App.GetService<IUnitUserAccService>();
|
||||||
|
bool result = await accService.UpdateUserData(userId, 1, nameof(AccEnum.AccType.charm), sumCharm, "赠送礼物获得");
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
game_charm_log log = new game_charm_log()
|
||||||
|
{
|
||||||
|
logId = StringAssist.NewGuid,
|
||||||
|
userId = userId,
|
||||||
|
fromId = fromId,
|
||||||
|
goodsId = goodsId,
|
||||||
|
name = name,
|
||||||
|
img = img,
|
||||||
|
count = count,
|
||||||
|
charm = charm,
|
||||||
|
sumCharm = sumCharm,
|
||||||
|
addTime = DateTime.Now
|
||||||
|
};
|
||||||
|
var db = DbClient.AsTenant().GetConnectionWithAttr<game_charm_log>();
|
||||||
|
if (await db.Insertable(log).ExecuteCommandAsync() > 0)
|
||||||
|
{
|
||||||
|
string key = string.Format(UserCache.BaseCacheKey, "UserNewGift");
|
||||||
|
await redis.AddHashAsync(key, userId,log);
|
||||||
|
|
||||||
|
//判断关系是否为好友
|
||||||
|
var frInfo = await GetUserFriendInfo(userId, fromId);
|
||||||
|
if (frInfo != null)
|
||||||
|
{
|
||||||
|
//添加亲密度
|
||||||
|
await UpdateFriendNear(frInfo.frId, 1, sumCharm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -69,6 +69,11 @@ public static class GameBus
|
|||||||
var mapService = App.GetService<IGameMapService>();
|
var mapService = App.GetService<IGameMapService>();
|
||||||
isok = await mapService.AddUserCityMap(userId, Convert.ToInt32(parameter));
|
isok = await mapService.AddUserCityMap(userId, Convert.ToInt32(parameter));
|
||||||
}
|
}
|
||||||
|
else if (goodsType.Equals(nameof(GameEnum.PropCode.skill)))
|
||||||
|
{
|
||||||
|
var skillService = App.GetService<IGameSkillService>();
|
||||||
|
isok = await skillService.UpdateUserSkill(userId, Convert.ToInt32(parameter));
|
||||||
|
}
|
||||||
|
|
||||||
return isok;
|
return isok;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,22 @@ public class UbbTool
|
|||||||
{
|
{
|
||||||
return $"<a data-type='go' data-parms='/user/user?no={no}' href='javascript:void'>{name}</a>";
|
return $"<a data-type='go' data-parms='/user/user?no={no}' href='javascript:void'>{name}</a>";
|
||||||
}
|
}
|
||||||
|
private static string _GiftUbb = "<img src='{0}' alt='{1}' />";
|
||||||
|
public static string GiftUbb(string id, string name)
|
||||||
|
{
|
||||||
|
return string.Format(_GiftUbb, id, name);
|
||||||
|
}
|
||||||
|
public static string GiveGiftStr(int count)
|
||||||
|
{
|
||||||
|
string result = string.Empty;
|
||||||
|
result += GiftUbb("images/gift/x.png", "×");
|
||||||
|
char[] num = count.ToString().ToCharArray();
|
||||||
|
|
||||||
|
foreach (char s in num)
|
||||||
|
{
|
||||||
|
result += GiftUbb(string.Format("images/gift/num_{0}.png", s.ToString()), s.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
162
Service/Application.Web/Controllers/User/GiveController.cs
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace Application.Web.Controllers.User;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 赠送接口
|
||||||
|
/// </summary>
|
||||||
|
[ApiExplorerSettings(GroupName = "User")]
|
||||||
|
[Route("User/[controller]/[action]")]
|
||||||
|
[ApiController]
|
||||||
|
[Authorize]
|
||||||
|
public class GiveController : ControllerBase
|
||||||
|
{
|
||||||
|
private readonly IGameGoodsService _goodsService;
|
||||||
|
private readonly IGameEquService _equService;
|
||||||
|
private readonly IUnitUserWeight _weightService;
|
||||||
|
private readonly IUnitUserRelationService _relationService;
|
||||||
|
private readonly IUnitUserService _userService;
|
||||||
|
private readonly IGameChatService _chatService;
|
||||||
|
private readonly IMessageService _messageService;
|
||||||
|
|
||||||
|
public GiveController(IGameGoodsService goodsService, IGameEquService equService, IUnitUserWeight weightService,
|
||||||
|
IUnitUserRelationService relationService, IUnitUserService userService, IGameChatService chatService,
|
||||||
|
IMessageService messageService)
|
||||||
|
{
|
||||||
|
_goodsService = goodsService;
|
||||||
|
_equService = equService;
|
||||||
|
_weightService = weightService;
|
||||||
|
_relationService = relationService;
|
||||||
|
_userService = userService;
|
||||||
|
_chatService = chatService;
|
||||||
|
_messageService = messageService;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取赠送礼物物品
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="no"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> GetUserGiftGoods(string no)
|
||||||
|
{
|
||||||
|
var fromInfo = await _userService.GetUserInfoByUserNo(no);
|
||||||
|
if (fromInfo == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("玩家不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
if (areaId != fromInfo.areaId)
|
||||||
|
{
|
||||||
|
return PoAction.Message("玩家不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _goodsService.GetUserGoodsData(userId, nameof(GoodsEnum.Code.Gift));
|
||||||
|
return PoAction.Ok(new
|
||||||
|
{
|
||||||
|
userNo = fromInfo.userNo,
|
||||||
|
nick = fromInfo.nick,
|
||||||
|
data = data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 赠送礼物
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="no"></param>
|
||||||
|
/// <param name="goodsId"></param>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> ToGift(string no, int goodsId, int count)
|
||||||
|
{
|
||||||
|
var fromInfo = await _userService.GetUserInfoByUserNo(no);
|
||||||
|
if (fromInfo == null)
|
||||||
|
{
|
||||||
|
return PoAction.Message("玩家不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
int areaId = StateHelper.areaId;
|
||||||
|
if (areaId != fromInfo.areaId)
|
||||||
|
{
|
||||||
|
return PoAction.Message("玩家不存在!");
|
||||||
|
}
|
||||||
|
|
||||||
|
count = count < 1 ? 1 : count;
|
||||||
|
var goodsInfo = await _goodsService.GetUserGoodsInfo(userId, goodsId);
|
||||||
|
if (goodsInfo.code != nameof(GoodsEnum.Code.Gift))
|
||||||
|
{
|
||||||
|
return PoAction.Message("该道具无法赠送!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (goodsInfo.count < count)
|
||||||
|
{
|
||||||
|
return PoAction.Message("您礼物数量不足!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await _goodsService.UpdateUserGoods(userId, 0, goodsId, count, "赠送礼物"))
|
||||||
|
{
|
||||||
|
var goods = await _goodsService.GetGoodsInfo(goodsId);
|
||||||
|
dynamic giftConfig = JsonConvert.DeserializeObject<dynamic>(goods.content);
|
||||||
|
int charm = Convert.ToInt32(giftConfig.charm);
|
||||||
|
int isBroad = Convert.ToInt32(giftConfig.isBroad);
|
||||||
|
int broadCount = Convert.ToInt32(giftConfig.broadCount);
|
||||||
|
string gifUbb = UbbTool.GiftUbb(goods.img, goods.goodsName);
|
||||||
|
|
||||||
|
if (await _relationService.AddCharm(fromInfo.userId, userId, goodsId, goods.goodsName, goods.img, charm,
|
||||||
|
count))
|
||||||
|
{
|
||||||
|
var myInfo = await _userService.GetUserInfoByUserId(userId);
|
||||||
|
string noticeMsg = $"[{UbbTool.HomeUbb(myInfo.userNo, myInfo.nick)}]赠送您{gifUbb}×{count}!";
|
||||||
|
await _chatService.SendChat(fromInfo.userId, nameof(GameChatEnum.Code.Notice), noticeMsg);
|
||||||
|
|
||||||
|
if (isBroad == 1 && count >= broadCount)
|
||||||
|
{
|
||||||
|
//发送系统广布
|
||||||
|
string tip =
|
||||||
|
$"赠送给[{UbbTool.HomeUbb(fromInfo.userNo, fromInfo.nick)}] {gifUbb} {UbbTool.GiveGiftStr(count)}";
|
||||||
|
await _messageService.SendBroadcast(userId, nameof(MessageEnum.BroadcastCode.Gift), tip);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PoAction.Ok(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("赠送失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return PoAction.Message("赠送失败,请稍后尝试!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取礼物记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="no"></param>
|
||||||
|
/// <param name="page"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<IPoAction> GetGiftLog(string? no, int page)
|
||||||
|
{
|
||||||
|
string userId = StateHelper.userId;
|
||||||
|
if (!string.IsNullOrEmpty(no))
|
||||||
|
{
|
||||||
|
var noInfo = await _userService.GetUserInfoByUserNo(no);
|
||||||
|
if (noInfo != null)
|
||||||
|
{
|
||||||
|
userId = noInfo.userId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RefAsync<int> total = 0;
|
||||||
|
var data = await _relationService.GetUserGiftLog(userId, page, 10, total);
|
||||||
|
return PoAction.Ok(new { data, total = total.Value });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -59,7 +59,14 @@ public class UserController : ControllerBase
|
|||||||
|
|
||||||
var buff = await _attrService.GetUserStateData(userId, "ALL");
|
var buff = await _attrService.GetUserStateData(userId, "ALL");
|
||||||
var stock = await _attrService.GetUserStock(userId);
|
var stock = await _attrService.GetUserStock(userId);
|
||||||
object result = new { user, attr = attrInfo, exp, vigourInfo.vitality, acc, buff, stock };
|
string gift = string.Empty;
|
||||||
|
var giftData = await _relationService.GetUserNewGift(userId);
|
||||||
|
if (!string.IsNullOrEmpty(giftData.logId))
|
||||||
|
{
|
||||||
|
gift = $"收到{giftData.name}";
|
||||||
|
}
|
||||||
|
|
||||||
|
object result = new { user, attr = attrInfo, exp, vigourInfo.vitality, acc, buff, stock,gift };
|
||||||
return PoAction.Ok(result);
|
return PoAction.Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,11 +199,17 @@ public class UserController : ControllerBase
|
|||||||
|
|
||||||
var equ = await _equService.GetUserOnEqu(userInfo.userId);
|
var equ = await _equService.GetUserOnEqu(userInfo.userId);
|
||||||
var suit = await _equService.GetUserEquSuit(userInfo.userId);
|
var suit = await _equService.GetUserEquSuit(userInfo.userId);
|
||||||
|
string gift = string.Empty;
|
||||||
|
var giftData = await _relationService.GetUserNewGift(userInfo.userId);
|
||||||
|
if (!string.IsNullOrEmpty(giftData.logId))
|
||||||
|
{
|
||||||
|
gift = $"收到{giftData.name}";
|
||||||
|
}
|
||||||
|
|
||||||
var isPk = await UserStateTool.CheckPkState(userId, userInfo.userId, isEnemy, isAtArea);
|
var isPk = await UserStateTool.CheckPkState(userId, userInfo.userId, isEnemy, isAtArea);
|
||||||
object result = new
|
object result = new
|
||||||
{
|
{
|
||||||
user, attr = new { attrInfo.lev }, acc, isOnline, onMapName, isFriend, isEnemy, team, equ, suit,isPk
|
user, attr = new { attrInfo.lev }, acc, isOnline, onMapName, isFriend, isEnemy, team, equ, suit, gift, isPk
|
||||||
};
|
};
|
||||||
return PoAction.Ok(result);
|
return PoAction.Ok(result);
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
Web/public/images/gift/num_0.png
Normal file
|
After Width: | Height: | Size: 711 B |
BIN
Web/public/images/gift/num_1.png
Normal file
|
After Width: | Height: | Size: 534 B |
BIN
Web/public/images/gift/num_2.png
Normal file
|
After Width: | Height: | Size: 708 B |
BIN
Web/public/images/gift/num_3.png
Normal file
|
After Width: | Height: | Size: 759 B |
BIN
Web/public/images/gift/num_4.png
Normal file
|
After Width: | Height: | Size: 705 B |
BIN
Web/public/images/gift/num_5.png
Normal file
|
After Width: | Height: | Size: 730 B |
BIN
Web/public/images/gift/num_6.png
Normal file
|
After Width: | Height: | Size: 716 B |
BIN
Web/public/images/gift/num_7.png
Normal file
|
After Width: | Height: | Size: 643 B |
BIN
Web/public/images/gift/num_8.png
Normal file
|
After Width: | Height: | Size: 745 B |
BIN
Web/public/images/gift/num_9.png
Normal file
|
After Width: | Height: | Size: 734 B |
BIN
Web/public/images/gift/x.png
Normal file
|
After Width: | Height: | Size: 875 B |
@@ -2,8 +2,8 @@
|
|||||||
统一配置中心
|
统一配置中心
|
||||||
*/
|
*/
|
||||||
export class BaseConfig {
|
export class BaseConfig {
|
||||||
// public static BaseUrl: string = 'https://localhost:7198'
|
public static BaseUrl: string = 'https://localhost:7198'
|
||||||
// public static BaseMediaUrl: string = 'https://localhost:7198/'
|
public static BaseMediaUrl: string = 'https://localhost:7198/'
|
||||||
public static BaseUrl:string="http://kx.iyba.cn:5291";
|
// public static BaseUrl:string="http://v3.pccsh.com";
|
||||||
public static BaseMediaUrl:string="http://kx.iyba.cn:5291";
|
// public static BaseMediaUrl:string="http://v3.pccsh.com";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,82 @@
|
|||||||
<template></template>
|
<template>
|
||||||
|
|
||||||
|
<div class="module-title">
|
||||||
|
赠送礼物
|
||||||
|
</div>
|
||||||
|
<div class="module-content">
|
||||||
|
<div class="common">
|
||||||
|
赠送给:<Abar :href='"/user/user?no=" + data.userNo'>{{ data.nick }}</Abar>(ID:{{ data.userNo }})
|
||||||
|
</div>
|
||||||
|
<div class="item" v-for="(item, index) in goods" :key="index">
|
||||||
|
{{ index + 1 }}.<Abar :href='"/prop/goods?id=" + item.goodsId'>{{ item.goodsName }}</Abar>({{ item.count }})
|
||||||
|
[<Abutton @click="showView(item)">赠送</Abutton>]
|
||||||
|
</div>
|
||||||
|
<span v-if="goods.length == 0">暂无礼物.</span>
|
||||||
|
</div>
|
||||||
|
<GamePopup v-model:show="showInfo" title="【赠送礼物】" style="width: 50%;">
|
||||||
|
<div class="common" style="margin-top: 10px;">
|
||||||
|
物品名称:{{ onShow.goodsName }}<br>
|
||||||
|
物品数量:{{ onShow.count }}<br>
|
||||||
|
<span style="font-size: 16px;">赠送数量:</span><input type="number" class="search-ipt" v-model="giveCount">
|
||||||
|
</div>
|
||||||
|
<div class="common" style="text-align: center;">
|
||||||
|
<button class="ipt-btn" name="serch" @click="GiveOk" style="margin-top: 15px;">赠送</button>
|
||||||
|
</div>
|
||||||
|
</GamePopup>
|
||||||
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
definePageMeta({
|
||||||
|
layout: layout.default,
|
||||||
|
middleware: middleware.loading
|
||||||
|
})
|
||||||
|
|
||||||
|
const data = ref<any>({});
|
||||||
|
const goods = ref<Array<any>>([]);
|
||||||
|
const showInfo = ref(false);
|
||||||
|
const onShow = ref<any>({});
|
||||||
|
const giveCount = ref(1);
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
await BindData();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PageLoading.Close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const BindData = async () => {
|
||||||
|
let no = PageExtend.QueryString("no");
|
||||||
|
let result = await GiveService.GetUserGiftGoods(no);
|
||||||
|
if (result.code == 0) {
|
||||||
|
data.value = result.data;
|
||||||
|
goods.value = result.data.data;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageExtend.ShowDialog("赠送礼物", result.msg);
|
||||||
|
}
|
||||||
|
console.log(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
const showView = (data: any) => {
|
||||||
|
showInfo.value = true;
|
||||||
|
giveCount.value = 1;
|
||||||
|
onShow.value = data;
|
||||||
|
}
|
||||||
|
|
||||||
|
const GiveOk = async () => {
|
||||||
|
let no = PageExtend.QueryString("no");
|
||||||
|
MessageExtend.LoadingToast("赠送中...");
|
||||||
|
let result = await GiveService.ToGift(no, onShow.value.goodsId, giveCount.value);
|
||||||
|
MessageExtend.LoadingClose();
|
||||||
|
if (result.code == 0) {
|
||||||
|
showInfo.value = false;
|
||||||
|
await BindData();
|
||||||
|
MessageExtend.Notify("赠送成功!", "success");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageExtend.ShowDialog("提示", result.msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
@@ -1,3 +1,54 @@
|
|||||||
<template>
|
<template>
|
||||||
暂未开放.
|
<div class="module-title">
|
||||||
|
礼物记录
|
||||||
|
</div>
|
||||||
|
<div class="module-content">
|
||||||
|
<div class="border-btm" v-for="(item, index) in data" :key="index">
|
||||||
|
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
|
||||||
|
收到[<GameUser :data="item.from" :show-icon="0"></GameUser>]赠送
|
||||||
|
<img :src="item.img" :alt="item.name"> ×{{item.count}}
|
||||||
|
</div>
|
||||||
|
<span v-if="data.length == 0">暂无.</span>
|
||||||
|
</div>
|
||||||
|
<div class="content">
|
||||||
|
<Pagination :currentPage="currentPage" :limit="10" :total="total" @pageChange="handlePageChange" />
|
||||||
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
<script setup lang="ts">
|
||||||
|
|
||||||
|
definePageMeta({
|
||||||
|
layout: layout.default,
|
||||||
|
middleware: 'page-loading'
|
||||||
|
})
|
||||||
|
|
||||||
|
const currentPage = ref<number>(1);
|
||||||
|
const total = ref<number>(0);
|
||||||
|
const data = ref<Array<any>>([]);
|
||||||
|
const no = PageExtend.QueryString("no");
|
||||||
|
onMounted(async () => {
|
||||||
|
try {
|
||||||
|
await BindData();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
PageLoading.Close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const BindData = async (): Promise<void> => {
|
||||||
|
let result = await GiveService.GetGiftLog(no, currentPage.value);
|
||||||
|
if (result.code == 0) {
|
||||||
|
data.value = result.data.data;
|
||||||
|
total.value = result.data.total;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MessageExtend.ShowDialog("提示", result.msg);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**翻页 */
|
||||||
|
const handlePageChange = async (page: number): Promise<void> => {
|
||||||
|
currentPage.value = page;
|
||||||
|
await BindData();
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -6,7 +6,8 @@
|
|||||||
性别:<Abar href="/user/sex">{{ userData.sex }}</Abar><br>
|
性别:<Abar href="/user/sex">{{ userData.sex }}</Abar><br>
|
||||||
<Abar href="/privilege/">特权</Abar>:<br>
|
<Abar href="/privilege/">特权</Abar>:<br>
|
||||||
徽章:<Abar href="/user/badge/">显示</Abar><br>
|
徽章:<Abar href="/user/badge/">显示</Abar><br>
|
||||||
社交:<Abar href="/user/gift">未收到礼物</Abar><br>
|
社交:
|
||||||
|
<Abar href="/user/gift">{{ gift == '' ? "未收到礼物" : gift }}</Abar><br>
|
||||||
婚姻:单身<br>
|
婚姻:单身<br>
|
||||||
个性签名:{{ userData.sign }}<Abar href="/user/sign">修改</Abar><br>
|
个性签名:{{ userData.sign }}<Abar href="/user/sign">修改</Abar><br>
|
||||||
宠物:暂无<br>
|
宠物:暂无<br>
|
||||||
@@ -74,6 +75,7 @@ const attrData = ref<any>({});
|
|||||||
const accData = ref<any>({});
|
const accData = ref<any>({});
|
||||||
const buff = ref<Array<any>>([]);
|
const buff = ref<Array<any>>([]);
|
||||||
const stock = ref<Array<any>>([]);
|
const stock = ref<Array<any>>([]);
|
||||||
|
const gift = ref('');
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
@@ -96,6 +98,7 @@ const BindData = async (): Promise<void> => {
|
|||||||
accData.value = result.data.acc;
|
accData.value = result.data.acc;
|
||||||
buff.value = result.data.buff;
|
buff.value = result.data.buff;
|
||||||
stock.value = result.data.stock;
|
stock.value = result.data.stock;
|
||||||
|
gift.value = result.data.gift;
|
||||||
console.log(result);
|
console.log(result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<Abar :href='"/user/message/read?id=" + userData.userNo'>私聊</Abar>. <Abar
|
<Abar :href='"/user/message/read?id=" + userData.userNo'>私聊</Abar>. <Abar
|
||||||
:href='"/user/gift/give?no=" + userData.userNo'>送礼物</Abar>. <Abar href="/user/interact/dou">逗一下</Abar><br />
|
:href='"/user/gift/give?no=" + userData.userNo'>送礼物</Abar>. <Abar href="/user/interact/dou">逗一下</Abar><br />
|
||||||
<Abar href="/user/master/add">拜师</Abar>. <Abar :href='"/trade/user?no=" + userData.userNo'>交易</Abar>. <Abar
|
<Abar href="/user/master/add">拜师</Abar>. <Abar :href='"/trade/user?no=" + userData.userNo'>交易</Abar>. <Abar
|
||||||
href="/bag/give">送道具</Abar><br>
|
href="/user/bag/give">送道具</Abar><br>
|
||||||
<Abutton @click="FriendHandle">{{ isFriend ? "删除好友" : "加好友" }}</Abutton>
|
<Abutton @click="FriendHandle">{{ isFriend ? "删除好友" : "加好友" }}</Abutton>
|
||||||
<span v-if="isEnemy == false">
|
<span v-if="isEnemy == false">
|
||||||
.<Abutton @click="AddEnemy">加仇人</Abutton>
|
.<Abutton @click="AddEnemy">加仇人</Abutton>
|
||||||
@@ -15,7 +15,9 @@
|
|||||||
昵称:{{ userData.nick }}<br>
|
昵称:{{ userData.nick }}<br>
|
||||||
特权:<br>
|
特权:<br>
|
||||||
徽章:<br>
|
徽章:<br>
|
||||||
社交: 暂无<br>
|
社交: <span v-if="gift != ''">
|
||||||
|
<Abar :href='"/user/gift?no=" + userData.userNo'>{{ gift }}</Abar>
|
||||||
|
</span><br>
|
||||||
婚姻:<br>
|
婚姻:<br>
|
||||||
结拜:暂无<br>
|
结拜:暂无<br>
|
||||||
宠物:暂无<br>
|
宠物:暂无<br>
|
||||||
@@ -117,6 +119,7 @@ const isFriend = ref(false);
|
|||||||
const isEnemy = ref(false);
|
const isEnemy = ref(false);
|
||||||
const isPk = ref(false);
|
const isPk = ref(false);
|
||||||
const team = ref<any>({});
|
const team = ref<any>({});
|
||||||
|
const gift = ref('');
|
||||||
/**装备定义 */
|
/**装备定义 */
|
||||||
const equ = ref<Array<any>>([]);
|
const equ = ref<Array<any>>([]);
|
||||||
const suit = ref<Array<any>>([]);
|
const suit = ref<Array<any>>([]);
|
||||||
@@ -154,6 +157,7 @@ const BindData = async (): Promise<void> => {
|
|||||||
isFriend.value = result.data.isFriend;
|
isFriend.value = result.data.isFriend;
|
||||||
isEnemy.value = result.data.isEnemy;
|
isEnemy.value = result.data.isEnemy;
|
||||||
team.value = result.data.team;
|
team.value = result.data.team;
|
||||||
|
gift.value = result.data.gift;
|
||||||
isPk.value = result.data.isPk;
|
isPk.value = result.data.isPk;
|
||||||
equ.value = result.data.equ;
|
equ.value = result.data.equ;
|
||||||
suit.value = result.data.suit;
|
suit.value = result.data.suit;
|
||||||
|
|||||||
25
Web/src/services/user/GiveService.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
export class GiveService {
|
||||||
|
/**
|
||||||
|
* 获取赠送礼物物品
|
||||||
|
* GET /User/Give/GetUserGiftGoods
|
||||||
|
*/
|
||||||
|
static async GetUserGiftGoods(no: string) {
|
||||||
|
return await ApiService.Request("get", "/User/Give/GetUserGiftGoods", { no });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 赠送礼物
|
||||||
|
* GET /User/Give/ToGift
|
||||||
|
*/
|
||||||
|
static async ToGift(no: string, goodsId: number, count: number) {
|
||||||
|
return await ApiService.Request("get", "/User/Give/ToGift", { no, goodsId, count });
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取礼物记录
|
||||||
|
* GET /User/Give/GetGiftLog
|
||||||
|
*/
|
||||||
|
static async GetGiftLog(no: string, page: number) {
|
||||||
|
return await ApiService.Request("get", "/User/Give/GetGiftLog", { no, page });
|
||||||
|
}
|
||||||
|
}
|
||||||