添加项目文件。
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Threading.Tasks;
|
||||
using CommonDomain;
|
||||
using UserDomain.Entity;
|
||||
|
||||
namespace UserService
|
||||
{
|
||||
public interface ILotteryService
|
||||
{
|
||||
|
||||
|
||||
Task<LotteryUserStatus?> GetUserStatus(string userId);
|
||||
|
||||
Task<(bool success, string message, LotteryPrize? prize, long cost)> Draw(string userId, int poolType = 0);
|
||||
|
||||
Task<List<string>> GetUserDrawnPrizes(string userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using UserDomain.Entity;
|
||||
using UserDomain.Param;
|
||||
|
||||
namespace UserDomain
|
||||
{
|
||||
public interface IUserFeedbackService
|
||||
{
|
||||
Task<bool> Submit(AddFeedbackParam param, string userId, string userNumber, string userName);
|
||||
|
||||
Task<(List<UserFeedback> list, long count)> GetUserFeedbacks(string userId, int pageIndex, int pageSize);
|
||||
|
||||
Task<UserFeedback?> GetById(string id, string userId);
|
||||
|
||||
Task<(List<UserFeedback> list, long count)> QueryPage(FeedbackQueryParam param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using UserDomain.Entity;
|
||||
using UserDomain.Param;
|
||||
|
||||
namespace UserDomain
|
||||
{
|
||||
public interface IUserLoginLogService
|
||||
{
|
||||
Task<bool> AddLog(UserLoginLog log);
|
||||
|
||||
Task<(List<UserLoginLog> list, long count)> QueryPage(UserLoginLogQueryParam param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using UserService.Param;
|
||||
using UserService.Tasks.Param;
|
||||
|
||||
namespace UserService.User
|
||||
{
|
||||
public interface IUserMQService
|
||||
{
|
||||
Task Test(string txt);
|
||||
Task CompletedTask(CompletedTaskParam param);
|
||||
|
||||
Task UserAssetChange(UserAssetParam param);
|
||||
Task GameCoinsSettlement(GameCoinsSettlementParam param);
|
||||
|
||||
Task KillFishLog(AddKillFishLogCapParam param);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
using Common.CommonModel;
|
||||
using CommonDomain;
|
||||
using CommonDomain.BaseModel;
|
||||
using CommonInfrastructure.Response;
|
||||
using UserDomain.Entity;
|
||||
using UserService.Param;
|
||||
using UserService.Response;
|
||||
using UserService.Tasks.Param;
|
||||
using UserService.User.Response;
|
||||
|
||||
namespace UserService.User
|
||||
{
|
||||
public interface IUserService
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
Task<UserToken> RegisterWeiXin(RegisterUserWeiXinParam param, string ip);
|
||||
|
||||
|
||||
Task<(bool isok, string msg, UserToken user)> Register(RegisterUserParam param, string ip);
|
||||
|
||||
Task<(bool isok, string msg)> SendMobileCode(string mobile);
|
||||
Task<UserToken> LoginWx(string openId, string ip);
|
||||
|
||||
Task<(bool isok, string msg, UserToken user)> Login(string mobile, string code, string ip);
|
||||
Task<(bool isok, string msg, UserToken user)> LoginByPassword(string mobile, string password, string ip);
|
||||
Task<(bool isok, string msg)> UpdatePassword(string mobile, string password, string code);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> RealNameAuth(string idCardNumber, string realName, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> UpdateUserName(string userName, LoginUser loginUser);
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> BindWX(string openId, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> BindMobile(string mobile, string code, LoginUser loginUser);
|
||||
|
||||
|
||||
Task<(List<UserEntity> list, int count)> GetUserList(BaseListPageParam param);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> UpdateUser(UserEntity user);
|
||||
|
||||
Task<(bool isok, string msg)> UpdateAvatar(string avatarUrl, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> UpdateAvatarFrame(string avatarFrame, LoginUser loginUser);
|
||||
|
||||
Task<UserEntity> GetUser(string id);
|
||||
|
||||
Task<UserEntity> SearchUser(string key);
|
||||
Task<UserEntity> GetUserByMobile(string mobile);
|
||||
Task<UserEntity> GetUserByNuimber(string number);
|
||||
Task<UserEntity> GetUserByOpenId(string openId);
|
||||
|
||||
|
||||
Task EveryDayTask();
|
||||
Task EveryHourTask();
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> SaveSafeBox(long gold, LoginUser loginUser);
|
||||
Task<(bool isok, string msg)> GetSafeBox(long gold, string password, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> SetSafeBoxPassword(string password, LoginUser loginUser);
|
||||
Task<(bool isok, string msg)> ResetSafeBoxPassword(string password, string code, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> InitUserPassword(string userId);
|
||||
|
||||
Task<(bool isok, string msg)> InitSafeBoxPassword(string userId);
|
||||
Task<(bool isok, string msg)> GetReliefGold(LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg, BaseProductCount model)> SyntheticFragments(string propNumber, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> BuyProps(string propNumber, int count, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> UseVipExp(int count, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> BuyGold(string number, int count, LoginUser loginUser);
|
||||
|
||||
|
||||
Task<(bool isok, string msg, string url)> BuyDiamond(string number, int count, LoginUser loginUser);
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> BuyDiamondPayCallBack(string orderId);
|
||||
|
||||
Task<(bool isok, string msg, long gold)> Sign(LoginUser loginUser);
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> ChangeCannon(string number, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> ChangeWing(string number, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> ChangeGodWar(string number, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> UnloadCannon(string number, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> UnloadWing(string number, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> UnloadGodWar(string number, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg, GiftResponse model)> GetVipDayGift(LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg, GiftResponse model)> GetVipGift(int vipLevel, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
|
||||
Task<(List<UserReward> list, int count)> GetUserRewardList(GetUserRewardListParam param);
|
||||
|
||||
|
||||
|
||||
|
||||
Task<long> GameCoinsSettlement(GameCoinsSettlementParam param);
|
||||
|
||||
Task<(bool isok, string msg)> SendEmail(SendEmailParam param, LoginUser loginUser);
|
||||
Task<UserEmail> GetEmail(string id, LoginUser loginUser);
|
||||
Task<UserEmail> GetEmail(string id);
|
||||
Task<long> GetNoReadCount(LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg, RewardEmailResponse model)> RewardEmail(int type, string id, LoginUser loginUser);
|
||||
Task<(bool isok, string msg)> DeleteEmail(int type, string id, LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg)> ReadEmailMore(LoginUser loginUser);
|
||||
|
||||
Task<(List<UserEmail> list, long count)> GetEmailByPage(GetEmailPageParam param, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> UpdateAssets(UserAssetParam param);
|
||||
|
||||
|
||||
|
||||
Task RecordFishingConsume(long consumeGold, LoginUser loginUser);
|
||||
|
||||
Task<FishingReturnInfo> GetFishingReturnInfo(LoginUser loginUser);
|
||||
|
||||
Task<(bool isok, string msg, long gold)> ClaimFishingReturn(LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task<RankingResponse> GetRanking(LoginUser loginUser, int type = 1);
|
||||
Task DailyRankingReward();
|
||||
|
||||
|
||||
Task<(bool isok, string msg)> SendBroadcast(string message, LoginUser loginUser);
|
||||
|
||||
|
||||
|
||||
Task SendKillAnnouncement(KillAnnounceParam param);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MongoRepository;
|
||||
using MongoDB.Driver;
|
||||
using CommonDomain;
|
||||
using UserDomain.Entity;
|
||||
|
||||
namespace CommonService
|
||||
{
|
||||
public class LotteryService : ILotteryService
|
||||
{
|
||||
|
||||
|
||||
private readonly IMongoBaseRepository<LotteryRecord> _recordRepo;
|
||||
|
||||
private readonly IMongoBaseRepository<LotteryUserStatus> _userStatusRepo;
|
||||
|
||||
private readonly IUserService _userService;
|
||||
|
||||
private readonly ICapPublisher _capPublisher;
|
||||
|
||||
public LotteryService(
|
||||
IMongoBaseRepository<ActivityConfig> activityRepo,
|
||||
IMongoBaseRepository<LotteryRecord> recordRepo,
|
||||
IMongoBaseRepository<LotteryUserStatus> userStatusRepo,
|
||||
IUserService userService,
|
||||
ICapPublisher capPublisher)
|
||||
{
|
||||
_activityRepo = activityRepo;
|
||||
_recordRepo = recordRepo;
|
||||
_userStatusRepo = userStatusRepo;
|
||||
_userService = userService;
|
||||
_capPublisher = capPublisher;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<LotteryUserStatus?> GetUserStatus(string userId)
|
||||
{
|
||||
var status = await _userStatusRepo.FindOneAsync(s => s.UserId == userId && s.ActivityId == activityId);
|
||||
if (status == null)
|
||||
{
|
||||
status = new LotteryUserStatus
|
||||
{
|
||||
UserId = userId
|
||||
};
|
||||
await _userStatusRepo.InsertOneAsync(status);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
public async Task<(bool success, string message, LotteryPrize? prize, long cost)> Draw(string userId)
|
||||
{
|
||||
var activity = await GetActivity(activityId);
|
||||
if (activity == null)
|
||||
return (false, "活动不存在或未开启", null, 0);
|
||||
|
||||
var now = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
|
||||
if (now < activity.StartTime)
|
||||
return (false, "活动未开始", null, 0);
|
||||
if (now > activity.EndTime)
|
||||
return (false, "活动已结束", null, 0);
|
||||
|
||||
var userStatus = await GetUserStatus(userId, activityId);
|
||||
if (userStatus.IsFinished)
|
||||
return (false, "您已抽完所有奖项,活动结束", null, 0);
|
||||
|
||||
if (activity.UserMaxDraw > 0 && userStatus.TotalDrawCount >= activity.UserMaxDraw)
|
||||
return (false, "已达最大抽奖次数", null, 0);
|
||||
|
||||
var costIndex = Math.Min(userStatus.TotalDrawCount, activity.Costs.Count - 1);
|
||||
var cost = activity.Costs[costIndex];
|
||||
|
||||
var user = await _userService.GetUser(userId);
|
||||
if (user == null)
|
||||
return (false, "用户不存在", null, 0);
|
||||
if (user.Assets.Gold < cost)
|
||||
return (false, "金币不足", null, 0);
|
||||
|
||||
var level = DrawLevel(activity.Pools);
|
||||
if (level == null)
|
||||
return (false, "奖池已空", null, 0);
|
||||
|
||||
var prize = DrawPrize(level, userStatus.DrawnPrizeIds);
|
||||
if (prize == null)
|
||||
{
|
||||
prize = DrawPrizeFromAll(activity.Pools, userStatus.DrawnPrizeIds);
|
||||
if (prize == null)
|
||||
return (false, "所有奖项已抽完", null, 0);
|
||||
level = activity.Pools.FirstOrDefault(p => p.PrizeList.Any(x => x.PrizeId == prize.PrizeId));
|
||||
}
|
||||
|
||||
if (prize.TotalCount > 0 && prize.DrawnCount >= prize.TotalCount)
|
||||
return (false, "该奖项已抽完", null, 0);
|
||||
|
||||
user.Assets.Gold -= cost;
|
||||
await _userService.UpdateUser(user);
|
||||
|
||||
var record = new LotteryRecord
|
||||
{
|
||||
UserId = userId,
|
||||
ActivityId = activityId,
|
||||
PrizeId = prize.PrizeId,
|
||||
Level = level.Level,
|
||||
Cost = cost,
|
||||
DrawTime = now
|
||||
};
|
||||
await _recordRepo.InsertOneAsync(record);
|
||||
|
||||
userStatus.DrawnPrizeIds.Add(prize.PrizeId);
|
||||
userStatus.TotalDrawCount++;
|
||||
|
||||
var allPrizeIds = activity.Pools.SelectMany(p => p.PrizeList).Select(x => x.PrizeId).ToList();
|
||||
if (allPrizeIds.All(id => userStatus.DrawnPrizeIds.Contains(id)))
|
||||
{
|
||||
userStatus.IsFinished = true;
|
||||
}
|
||||
await _userStatusRepo.ReplaceOneAsync(userStatus);
|
||||
|
||||
prize.DrawnCount++;
|
||||
|
||||
await _capPublisher.Publish("Lottery.DrawPrize", new LotteryDrawMessage
|
||||
{
|
||||
UserId = userId,
|
||||
PrizeId = prize.PrizeId,
|
||||
PrizeName = prize.Name,
|
||||
Type = prize.Type,
|
||||
Count = prize.Count,
|
||||
OtherId = prize.OtherId
|
||||
});
|
||||
|
||||
return (true, "抽奖成功", prize, cost);
|
||||
}
|
||||
|
||||
private LotteryPoolLevel? DrawLevel(List<LotteryPoolLevel> pools)
|
||||
{
|
||||
var availablePools = pools.Where(p =>
|
||||
p.PrizeList.Any(x => !x.TotalCount.Equals(0) && x.DrawnCount < x.TotalCount)).ToList();
|
||||
if (!availablePools.Any())
|
||||
return null;
|
||||
|
||||
long totalWeight = availablePools.Sum(p => (long)p.Weight);
|
||||
if (totalWeight <= 0)
|
||||
return null;
|
||||
|
||||
long randomValue = NextInt64(0, totalWeight);
|
||||
long currentWeightSum = 0;
|
||||
|
||||
foreach (var pool in availablePools)
|
||||
{
|
||||
currentWeightSum += pool.Weight;
|
||||
if (randomValue < currentWeightSum)
|
||||
return pool;
|
||||
}
|
||||
return availablePools.LastOrDefault();
|
||||
}
|
||||
|
||||
private LotteryPrize? DrawPrize(LotteryPoolLevel level, List<string> drawnPrizeIds)
|
||||
{
|
||||
var availablePrizes = level.PrizeList
|
||||
.Where(p => !drawnPrizeIds.Contains(p.PrizeId) &&
|
||||
(p.TotalCount == 0 || p.DrawnCount < p.TotalCount))
|
||||
.ToList();
|
||||
if (!availablePrizes.Any())
|
||||
return null;
|
||||
|
||||
int totalWeight = availablePrizes.Sum(p => p.Weight);
|
||||
if (totalWeight <= 0)
|
||||
return null;
|
||||
|
||||
int randomValue = Next(0, totalWeight);
|
||||
int currentWeightSum = 0;
|
||||
|
||||
foreach (var prize in availablePrizes)
|
||||
{
|
||||
currentWeightSum += prize.Weight;
|
||||
if (randomValue < currentWeightSum)
|
||||
return prize;
|
||||
}
|
||||
return availablePrizes.LastOrDefault();
|
||||
}
|
||||
|
||||
private LotteryPrize? DrawPrizeFromAll(List<LotteryPoolLevel> pools, List<string> drawnPrizeIds)
|
||||
{
|
||||
foreach (var pool in pools.OrderByDescending(p => p.Weight))
|
||||
{
|
||||
var prize = DrawPrize(pool, drawnPrizeIds);
|
||||
if (prize != null)
|
||||
return prize;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetUserDrawnPrizes(string userId, string activityId)
|
||||
{
|
||||
var status = await GetUserStatus(userId, activityId);
|
||||
return status?.DrawnPrizeIds ?? new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using CommonDomain.Enum;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class AddKillFishLogCapParam
|
||||
{
|
||||
public string UserId { get; set; }
|
||||
|
||||
public GameTypeEnum GameType { get; set; } = GameTypeEnum.风雷之渊;
|
||||
|
||||
public int RoomLevel { get; set; } = 0;
|
||||
|
||||
public int RoomPartition { get; set; } = 0;
|
||||
|
||||
public int RoomNumber { get; set; } = 0;
|
||||
|
||||
|
||||
public string FishNumber { get; set; }
|
||||
|
||||
|
||||
public long Cost { get; set; }
|
||||
|
||||
|
||||
public double Income { get; set; }
|
||||
public double Factor { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class AddUserPropParam
|
||||
{
|
||||
public string PropId { get; set; }
|
||||
public int Count { get; set; }
|
||||
|
||||
public int Type { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class GameCoinsSettlementParam
|
||||
{
|
||||
|
||||
public string UserId { get; set; }
|
||||
public long BeforeGold { get; set; } = 0;
|
||||
|
||||
public long AfterGold { get; set; } = 0;
|
||||
|
||||
|
||||
public string Remark { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string RoomName { get; set; } = string.Empty;
|
||||
|
||||
public string RoomInfo { get; set; } = string.Empty;
|
||||
|
||||
public long RoomSessionId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Common.CommonModel;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class GetEmailPageParam : BaseListPageParam
|
||||
{
|
||||
|
||||
public int ReadStatus { get; set; } = 0;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Common.CommonModel;
|
||||
using UserDomain.Enum;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class GetUserRewardListParam :BaseListPageParam
|
||||
{
|
||||
public string UserId { get; set; }= string.Empty;
|
||||
|
||||
public int Type { get; set; } = 0;
|
||||
|
||||
public int Source { get; set; } = 0;
|
||||
|
||||
public int CurrencyType { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class RegisterUserParam
|
||||
{
|
||||
|
||||
public string Account { get; set; } = string.Empty;
|
||||
public string NickName { get; set; } = string.Empty;
|
||||
public string PassWord { get; set; } = string.Empty;
|
||||
public string? Mobile { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class RegisterUserWeiXinParam
|
||||
{
|
||||
public string? OpenId { get; set; }
|
||||
|
||||
public string? NickName { get; set; }
|
||||
|
||||
public string? AvatarUrl { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using CommonDomain.BaseModel;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class SendEmailParam
|
||||
{
|
||||
|
||||
|
||||
public string? UserId { get; set; }
|
||||
public string? Title { get; set; }
|
||||
public string? Content { get; set; }
|
||||
public int RewardDiamond { get; set; } = 0;
|
||||
public long RewardGold { get; set; } = 0;
|
||||
public List<BaseProductCount>? RewardItems { get; set; } = null;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class UpdateUserDataParam
|
||||
{
|
||||
|
||||
public string Id { get; set; }
|
||||
public int Diamond { get; set; } = 0;
|
||||
public long Gold { get; set; } = 0;
|
||||
public int Level { get; set; } = 1;
|
||||
public long Exp { get; set; } = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using CommonDomain.BaseModel;
|
||||
using UserDomain.Enum;
|
||||
|
||||
namespace UserService.Param
|
||||
{
|
||||
public class UserAssetParam
|
||||
{
|
||||
|
||||
|
||||
public string UserId { get; set; }
|
||||
|
||||
public RewardSource Source { get; set; }
|
||||
|
||||
public UserAssetChangeTypeEnum ChangeType { get; set; }
|
||||
public int Diamond { get; set; } = 0;
|
||||
|
||||
public long Gold { get; set; } = 0;
|
||||
|
||||
|
||||
|
||||
public string OtherId { get; set; }= string.Empty;
|
||||
|
||||
public List<BaseProductCount> RewardItems { get; set; }
|
||||
|
||||
|
||||
public string OtherUserId { get; set; } = string.Empty;
|
||||
|
||||
public string Remark { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public string RoomName { get; set; } = string.Empty;
|
||||
|
||||
public string RoomInfo { get; set; } = string.Empty;
|
||||
|
||||
public int Tax { get; set; } = 0;
|
||||
|
||||
public long Exp { get; set; } = 0;
|
||||
|
||||
public bool IsAddRecord { get; set; } = true;
|
||||
|
||||
public bool AffectFishFactor { get; set; } = true;
|
||||
|
||||
public long TotalRechargeGoldDelta { get; set; } = 0;
|
||||
|
||||
public bool SyncToFrontend { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace UserService.Response
|
||||
{
|
||||
public class RankingResponse
|
||||
{
|
||||
public int RankingType { get; set; }
|
||||
|
||||
public string RankingTypeName { get; set; } = string.Empty;
|
||||
|
||||
public List<RankingUserResponse> UserList { get; set; } = new List<RankingUserResponse>();
|
||||
|
||||
public RankingUserResponse? User { get; set; }
|
||||
}
|
||||
|
||||
public class RankingUserResponse
|
||||
{
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
public int Rank { get; set; }
|
||||
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
public string NickName { get; set; } = string.Empty;
|
||||
|
||||
public string Number { get; set; } = string.Empty;
|
||||
|
||||
public string AvatarUrl { get; set; } = string.Empty;
|
||||
|
||||
public string Mobile { get; set; } = string.Empty;
|
||||
|
||||
public int Level { get; set; }
|
||||
|
||||
public long RankingValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CommonDomain.BaseModel;
|
||||
|
||||
namespace UserService.User.Response
|
||||
{
|
||||
public class RewardEmailResponse
|
||||
{
|
||||
public bool IsReward { get; set; } = false;
|
||||
public int RewardDiamond { get; set; } = 0;
|
||||
public long RewardGold { get; set; } = 0;
|
||||
public List<BaseProductCount> RewardItems { get; set; } = new List<BaseProductCount>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
using UserDomain.Entity;
|
||||
namespace UserService.Response
|
||||
{
|
||||
public class UserToken: UserEntity
|
||||
{
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
using MongoRepository;
|
||||
using UserDomain;
|
||||
using UserDomain.Entity;
|
||||
using UserDomain.Param;
|
||||
|
||||
namespace UserService
|
||||
{
|
||||
public class UserFeedbackService : IUserFeedbackService
|
||||
{
|
||||
private readonly IMongoBaseRepository<UserFeedback> _feedbackRepo;
|
||||
|
||||
public UserFeedbackService(IMongoBaseRepository<UserFeedback> feedbackRepo)
|
||||
{
|
||||
_feedbackRepo = feedbackRepo;
|
||||
}
|
||||
|
||||
public async Task<bool> Submit(AddFeedbackParam param, string userId, string userNumber, string userName)
|
||||
{
|
||||
var feedback = new UserFeedback
|
||||
{
|
||||
UserId = userId,
|
||||
UserNumber = userNumber,
|
||||
UserName = userName,
|
||||
Type = param.Type,
|
||||
Title = param.Title,
|
||||
Content = param.Content,
|
||||
Images = param.Images,
|
||||
QQ = param.QQ,
|
||||
Contact = param.Contact,
|
||||
Status = 0,
|
||||
SubmitTime = DateTime.Now
|
||||
};
|
||||
|
||||
var result = await _feedbackRepo.InsertOneAsync(feedback);
|
||||
return result.ok;
|
||||
}
|
||||
|
||||
public async Task<(List<UserFeedback> list, long count)> GetUserFeedbacks(string userId, int pageIndex, int pageSize)
|
||||
{
|
||||
var result = await _feedbackRepo.QueryPageAsync(
|
||||
filterExpression: x => x.UserId == userId,
|
||||
orderExpression: x => x.SubmitTime,
|
||||
desc: true,
|
||||
pageSize: pageSize,
|
||||
pageIndex: pageIndex
|
||||
);
|
||||
|
||||
return (result.list.ToList(), result.count);
|
||||
}
|
||||
|
||||
public async Task<UserFeedback?> GetById(string id, string userId)
|
||||
{
|
||||
return await _feedbackRepo.FindOneAsync(x => x.Id == id && x.UserId == userId);
|
||||
}
|
||||
|
||||
public async Task<(List<UserFeedback> list, long count)> QueryPage(FeedbackQueryParam param)
|
||||
{
|
||||
var result = await _feedbackRepo.QueryPageAsync(
|
||||
filterExpression: x =>
|
||||
(string.IsNullOrEmpty(param.UserId) || x.UserId == param.UserId) &&
|
||||
(string.IsNullOrEmpty(param.UserNumber) || x.UserNumber == param.UserNumber) &&
|
||||
(string.IsNullOrEmpty(param.UserName) || (x.UserName != null && x.UserName.Contains(param.UserName))) &&
|
||||
(!param.Type.HasValue || x.Type == param.Type) &&
|
||||
(!param.Status.HasValue || x.Status == param.Status) &&
|
||||
(!param.StartTime.HasValue || x.SubmitTime >= param.StartTime) &&
|
||||
(!param.EndTime.HasValue || x.SubmitTime <= param.EndTime),
|
||||
orderExpression: x => x.SubmitTime,
|
||||
desc: true,
|
||||
pageSize: param.PageSize,
|
||||
pageIndex: param.PageIndex
|
||||
);
|
||||
|
||||
return (result.list.ToList(), result.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using MongoRepository;
|
||||
using UserDomain;
|
||||
using UserDomain.Entity;
|
||||
using UserDomain.Param;
|
||||
|
||||
namespace UserService
|
||||
{
|
||||
public class UserLoginLogService : IUserLoginLogService
|
||||
{
|
||||
private readonly IMongoBaseRepository<UserLoginLog> _logRepo;
|
||||
|
||||
public UserLoginLogService(IMongoBaseRepository<UserLoginLog> logRepo)
|
||||
{
|
||||
_logRepo = logRepo;
|
||||
}
|
||||
|
||||
public async Task<bool> AddLog(UserLoginLog log)
|
||||
{
|
||||
var result = await _logRepo.InsertOneAsync(log);
|
||||
return result.ok;
|
||||
}
|
||||
|
||||
public async Task<(List<UserLoginLog> list, long count)> QueryPage(UserLoginLogQueryParam param)
|
||||
{
|
||||
var result = await _logRepo.QueryPageAsync(
|
||||
filterExpression: x =>
|
||||
(string.IsNullOrEmpty(param.UserId) || x.UserId == param.UserId) &&
|
||||
(string.IsNullOrEmpty(param.UserNumber) || x.UserNumber == param.UserNumber) &&
|
||||
(string.IsNullOrEmpty(param.UserName) || (x.UserName != null && x.UserName.Contains(param.UserName))) &&
|
||||
(!param.LoginType.HasValue || x.LoginType == param.LoginType) &&
|
||||
(!param.Status.HasValue || x.Status == param.Status) &&
|
||||
(!param.Platform.HasValue || x.Platform == param.Platform) &&
|
||||
(!param.StartTime.HasValue || x.LoginTime >= param.StartTime) &&
|
||||
(!param.EndTime.HasValue || x.LoginTime <= param.EndTime),
|
||||
orderExpression: x => x.LoginTime,
|
||||
desc: true,
|
||||
pageSize: param.PageSize,
|
||||
pageIndex: param.PageIndex
|
||||
);
|
||||
|
||||
return (result.list.ToList(), result.count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
using AutoMapper;
|
||||
using Common.Utils;
|
||||
using CommonDomain;
|
||||
using DotNetCore.CAP;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MongoRepository;
|
||||
using UserDomain.Entity;
|
||||
using UserService.Param;
|
||||
using UserService.Tasks;
|
||||
using UserService.Tasks.Param;
|
||||
|
||||
namespace UserService.User
|
||||
{
|
||||
public class UserMQService : IUserMQService, ICapSubscribe
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly ITaskService _taskService;
|
||||
private readonly IMongoBaseRepository<KillFishLog> _killLog;
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
public UserMQService(IUserService userService, ITaskService taskService, IMongoBaseRepository<KillFishLog> killLog, IMapper mapper)
|
||||
{
|
||||
_userService = userService;
|
||||
_taskService = taskService;
|
||||
_killLog = killLog;
|
||||
_mapper = mapper;
|
||||
}
|
||||
[CapSubscribe("test")]
|
||||
public async Task Test(string txt)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
[CapSubscribe(TopicKeys.任务完成)]
|
||||
public async Task CompletedTask(CompletedTaskParam param)
|
||||
{
|
||||
_taskService.CompletedTask(param);
|
||||
}
|
||||
|
||||
[CapSubscribe(TopicKeys.用户资产变更)]
|
||||
public async Task UserAssetChange(UserAssetParam param)
|
||||
{
|
||||
await _userService.UpdateAssets(param);
|
||||
}
|
||||
[CapSubscribe(TopicKeys.游戏金币结算)]
|
||||
public async Task GameCoinsSettlement(GameCoinsSettlementParam param)
|
||||
{
|
||||
|
||||
|
||||
await _userService.GameCoinsSettlement(param);
|
||||
}
|
||||
|
||||
[CapSubscribe(TopicKeys.击杀鱼日志)]
|
||||
public async Task KillFishLog(AddKillFishLogCapParam param)
|
||||
{
|
||||
var model = _mapper.Map<KillFishLog>(param);
|
||||
model.Id = Guid.NewGuid().ToString();
|
||||
model.CreateTime = DateTime.Now.ToTimeStamp();
|
||||
await _killLog.InsertOneAsync(model);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user