添加项目文件。
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
namespace UserApi
|
||||
{
|
||||
public static class AssemblyMarker
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
using System.Linq;
|
||||
using AdminDomain.BeautifulNumber;
|
||||
using AdminDomain.Entity;
|
||||
using Common;
|
||||
using Common.CommonModel;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserDomain.Entity;
|
||||
using UserService.BeautifulNumber;
|
||||
|
||||
namespace UserApi.BeautifulNumber
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
|
||||
public class BeautifulNumberController : BaseController
|
||||
{
|
||||
private readonly IBeautifulNumberService _beautifulNumberService;
|
||||
|
||||
public BeautifulNumberController(IBeautifulNumberService beautifulNumberService)
|
||||
{
|
||||
_beautifulNumberService = beautifulNumberService;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("available")]
|
||||
public async Task<PageResponse<BeautifulNumberDto>> GetAvailableList([FromQuery] BeautifulNumberListParam param)
|
||||
{
|
||||
param.page = param.page > 0 ? param.page : 1;
|
||||
param.size = param.size > 0 ? param.size : 20;
|
||||
param.status = (int)BeautifulNumberStatus.Available;
|
||||
var result = await _beautifulNumberService.GetList(param);
|
||||
var dtos = result.Data.Select(MapToDto).ToList();
|
||||
return this.ToPageResult(dtos, result.Count);
|
||||
}
|
||||
|
||||
[HttpGet("check/{number}")]
|
||||
public async Task<BaseResponse<BeautifulNumberDto>> CheckNumber(string number)
|
||||
{
|
||||
var result = await _beautifulNumberService.CheckNumber(number);
|
||||
return this.ToResult(MapToDto(result));
|
||||
}
|
||||
|
||||
private static BeautifulNumberDto MapToDto(BeautifulNumberConfig entity)
|
||||
{
|
||||
if (entity == null) return new BeautifulNumberDto();
|
||||
return new BeautifulNumberDto
|
||||
{
|
||||
Id = entity.Id ?? "",
|
||||
Number = entity.Number ?? "",
|
||||
RuleName = entity.RuleName ?? "",
|
||||
Level = entity.Level ?? "",
|
||||
Price = entity.Price,
|
||||
Status = (int)entity.Status,
|
||||
SaleTime = entity.SaleTime,
|
||||
BuyerUserId = entity.BuyerUserId ?? "",
|
||||
UserId = entity.UserId ?? "",
|
||||
Remark = entity.Remark ?? "",
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class BeautifulNumberDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Number { get; set; }
|
||||
public string RuleName { get; set; }
|
||||
public string Level { get; set; }
|
||||
public long Price { get; set; }
|
||||
public int Status { get; set; }
|
||||
public long SaleTime { get; set; }
|
||||
public string BuyerUserId { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public long CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class PurchaseBeautifulNumberParam
|
||||
{
|
||||
public string Number { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Common;
|
||||
using CommonInfrastructure;
|
||||
using Domain.Admin.Admin;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using MongoRepository;
|
||||
|
||||
namespace UserApi.Dict
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
public class DictController : BaseController
|
||||
{
|
||||
private readonly IMongoBaseRepository<SystemDic> _dicRepo;
|
||||
|
||||
public DictController(IMongoBaseRepository<SystemDic> dicRepo)
|
||||
{
|
||||
_dicRepo = dicRepo;
|
||||
}
|
||||
|
||||
[HttpGet("GetByCode")]
|
||||
public async Task<BaseResponse<SystemDic>> GetByCode(string code)
|
||||
{
|
||||
var dic = await _dicRepo.FindOneAsync(c => c.IsDelete == false && c.Code == code);
|
||||
return this.ToResult(dic);
|
||||
}
|
||||
|
||||
[HttpGet("GetListByCode")]
|
||||
public async Task<BaseResponse<List<SystemDic>>> GetListByCode(string code)
|
||||
{
|
||||
var all = await _dicRepo.FilterByAsync(c => c.IsDelete == false);
|
||||
var parent = all.FirstOrDefault(c => c.Code == code);
|
||||
if (parent == null)
|
||||
return this.ToResult(new List<SystemDic>());
|
||||
var children = all.Where(c => c.ParentId == parent.Id).OrderBy(c => c.Order).ToList();
|
||||
return this.ToResult(children);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
using Common;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserService.Notices;
|
||||
using System.Linq;
|
||||
using CommonDomain;
|
||||
namespace UserApi.Faq
|
||||
{
|
||||
[ApiController, Route("adminapi/[controller]")]
|
||||
public class FaqController : BaseController
|
||||
{
|
||||
private readonly IFaqService _faqService;
|
||||
|
||||
public FaqController(IFaqService faqService)
|
||||
{
|
||||
_faqService = faqService;
|
||||
}
|
||||
|
||||
[HttpGet("CategoryTree")]
|
||||
public async Task<BaseCommonResponse> GetCategoryTree()
|
||||
{
|
||||
var tree = await _faqService.GetCategoryTree();
|
||||
var dtos = tree.Select(MapToTreeNodeDto).ToList();
|
||||
return new ListResponse<FaqCategoryTreeNodeDto>
|
||||
{
|
||||
Code = CommonResponseCodeEnum.Success,
|
||||
Info = "获取成功",
|
||||
Data = dtos
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet("Questions")]
|
||||
public async Task<BaseCommonResponse> GetQuestions(string categoryId)
|
||||
{
|
||||
var list = await _faqService.GetQuestionsByCategory(categoryId);
|
||||
if (list == null)
|
||||
return new ListResponse<FaqQuestionDto> { Code = CommonResponseCodeEnum.Success, Data = new List<FaqQuestionDto>() };
|
||||
var dtos = list.Select(MapToQuestionDto).ToList();
|
||||
return new ListResponse<FaqQuestionDto>
|
||||
{
|
||||
Code = CommonResponseCodeEnum.Success,
|
||||
Info = "获取成功",
|
||||
Data = dtos
|
||||
};
|
||||
}
|
||||
|
||||
[HttpPost("QuestionList")]
|
||||
public async Task<BaseCommonResponse> GetQuestionList([FromBody] FaqQueryParam param)
|
||||
{
|
||||
var result = await _faqService.QueryQuestions(param.CategoryId, param.PageIndex, param.PageSize);
|
||||
var dtos = result.list.Select(MapToQuestionDto).ToList();
|
||||
return new PageDataResponse<FaqQuestionDto>
|
||||
{
|
||||
Code = CommonResponseCodeEnum.Success,
|
||||
Info = "获取成功",
|
||||
Data = dtos,
|
||||
Count = (int)result.count
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet("QuestionDetail")]
|
||||
public async Task<BaseResponse<FaqQuestionDto>> GetQuestionDetail(string id)
|
||||
{
|
||||
var question = await _faqService.GetQuestionById(id);
|
||||
if (question == null)
|
||||
return this.ToFailResult<FaqQuestionDto>("问题不存在");
|
||||
|
||||
return this.ToResult(MapToQuestionDto(question));
|
||||
}
|
||||
|
||||
|
||||
private static FaqCategoryTreeNodeDto MapToTreeNodeDto(FaqCategoryTreeNode entity)
|
||||
{
|
||||
if (entity == null) return new FaqCategoryTreeNodeDto();
|
||||
return new FaqCategoryTreeNodeDto
|
||||
{
|
||||
Id = entity.Id ?? "",
|
||||
Name = entity.Name ?? "",
|
||||
Icon = entity.Icon ?? "",
|
||||
Sort = entity.Sort,
|
||||
IsEnable = entity.IsEnable,
|
||||
Children = entity.Children?.Select(MapToTreeNodeDto).ToList() ?? new List<FaqCategoryTreeNodeDto>(),
|
||||
QuestionCount = entity.QuestionCount
|
||||
};
|
||||
}
|
||||
|
||||
private static FaqQuestionDto MapToQuestionDto(FaqQuestion entity)
|
||||
{
|
||||
if (entity == null) return new FaqQuestionDto();
|
||||
return new FaqQuestionDto
|
||||
{
|
||||
Id = entity.Id ?? "",
|
||||
CategoryId = entity.CategoryId ?? "",
|
||||
Title = entity.Title ?? "",
|
||||
Content = entity.Content ?? "",
|
||||
Sort = entity.Sort,
|
||||
IsEnable = entity.IsEnable,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class FaqCategoryTreeNodeDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Icon { get; set; }
|
||||
public int Sort { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public List<FaqCategoryTreeNodeDto> Children { get; set; } = new();
|
||||
public int QuestionCount { get; set; }
|
||||
}
|
||||
|
||||
public class FaqQuestionDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string CategoryId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Content { get; set; }
|
||||
public int Sort { get; set; }
|
||||
public bool IsEnable { get; set; }
|
||||
public DateTime CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class FaqQueryParam
|
||||
{
|
||||
public string? CategoryId { get; set; }
|
||||
public int PageIndex { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 10;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
|
||||
using Common;
|
||||
using CommonDomain;
|
||||
using CommonDomain.BaseModel;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserService.GameConfigs;
|
||||
namespace UserApi.GameConfigs
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
public class ActivityConfigController : BaseController
|
||||
{
|
||||
private readonly IActivityConfigService _activityConfigService;
|
||||
private readonly IGameConfigService _gameConfigService;
|
||||
|
||||
public ActivityConfigController(IActivityConfigService activityConfigService, IGameConfigService gameConfigService)
|
||||
{
|
||||
_activityConfigService = activityConfigService;
|
||||
_gameConfigService = gameConfigService;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<BaseResponse<ActivityConfig>> Get()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.BattleOrderConfig != null)
|
||||
BattleOrderGiftProductHelper.Enrich(config.BattleOrderConfig, await _gameConfigService.Get());
|
||||
if (config?.LotteryActivityConfig != null)
|
||||
LotteryPrizeProductHelper.Enrich(config.LotteryActivityConfig, await _gameConfigService.Get());
|
||||
return this.ToResult(config ?? new ActivityConfig());
|
||||
}
|
||||
|
||||
[HttpGet("diamondShopList")]
|
||||
public async Task<ListResponse<DiamondShopConfig>> GetDiamondShopList()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
return this.ToListResult(config?.DiamondShopConfigs ?? new List<DiamondShopConfig>());
|
||||
}
|
||||
|
||||
[HttpGet("goldShopList")]
|
||||
public async Task<ListResponse<GoldShopConfig>> GetGoldShopList()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
return this.ToListResult(config?.GoldShopConfigs ?? new List<GoldShopConfig>());
|
||||
}
|
||||
|
||||
[HttpGet("signConfigs")]
|
||||
public async Task<ListResponse<SignConfig>> GetSignConfigs()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
return this.ToListResult(config?.SignConfigs ?? new List<SignConfig>());
|
||||
}
|
||||
|
||||
[HttpGet("reliefConfig")]
|
||||
public async Task<BaseResponse<ReliefConfig>> GetReliefConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.ReliefConfig != null)
|
||||
return this.ToResult(config.ReliefConfig);
|
||||
else
|
||||
return this.ToFailResult<ReliefConfig>("配置不存在");
|
||||
}
|
||||
|
||||
[HttpGet("registerConfig")]
|
||||
public async Task<BaseResponse<RegisterConfig>> GetRegisterConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.RegisterConfig != null)
|
||||
return this.ToResult(config.RegisterConfig);
|
||||
else
|
||||
return this.ToFailResult<RegisterConfig>("配置不存在");
|
||||
}
|
||||
|
||||
[HttpGet("fishingReturnConfig")]
|
||||
public async Task<BaseResponse<FishingReturnConfig>> GetFishingReturnConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.FishingReturnConfig != null)
|
||||
return this.ToResult(config.FishingReturnConfig);
|
||||
else
|
||||
return this.ToFailResult<FishingReturnConfig>("配置不存在");
|
||||
}
|
||||
|
||||
[HttpGet("battleOrderConfig")]
|
||||
public async Task<BaseResponse<BattleOrderConfig>> GetBattleOrderConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.BattleOrderConfig != null)
|
||||
{
|
||||
BattleOrderGiftProductHelper.Enrich(config.BattleOrderConfig, await _gameConfigService.Get());
|
||||
return this.ToResult(config.BattleOrderConfig);
|
||||
}
|
||||
else
|
||||
return this.ToFailResult<BattleOrderConfig>("配置不存在");
|
||||
}
|
||||
|
||||
[HttpGet("lotteryConfig")]
|
||||
public async Task<BaseResponse<LotteryActivityConfig>> GetLotteryConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.LotteryActivityConfig != null)
|
||||
{
|
||||
LotteryPrizeProductHelper.Enrich(config.LotteryActivityConfig, await _gameConfigService.Get());
|
||||
return this.ToResult(config.LotteryActivityConfig);
|
||||
}
|
||||
else
|
||||
return this.ToFailResult<LotteryActivityConfig>("配置不存在");
|
||||
}
|
||||
|
||||
[HttpGet("rankingRewardConfig")]
|
||||
public async Task<BaseResponse<RankingRewardConfig>> GetRankingRewardConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.RankingRewardConfig != null)
|
||||
return this.ToResult(config.RankingRewardConfig);
|
||||
else
|
||||
return this.ToFailResult<RankingRewardConfig>("配置不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using AutoMapper;
|
||||
using ChessGameDomain;
|
||||
using Common;
|
||||
using CommonDomain;
|
||||
using CommonDomain.BaseModel;
|
||||
using CommonDomain.Enum;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using RedisService;
|
||||
using UserService.GameConfigs;
|
||||
|
||||
namespace UserApi.GameConfigs
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
|
||||
public class GameConfigController : BaseController
|
||||
{
|
||||
private readonly IGameConfigService _gameConfigService;
|
||||
|
||||
|
||||
public GameConfigController(IGameConfigService gameConfigService)
|
||||
{
|
||||
_gameConfigService = gameConfigService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet]
|
||||
|
||||
public async Task<BaseResponse<GameConfig>> Get()
|
||||
{
|
||||
var res = await _gameConfigService.Get();
|
||||
return this.ToResult(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,478 @@
|
||||
using System.Linq;
|
||||
using Common;
|
||||
using CommonDomain.BaseModel;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserApi;
|
||||
using UserDomain;
|
||||
using UserDomain.Entity;
|
||||
using UserService;
|
||||
using UserService.Response;
|
||||
using UserService.Param;
|
||||
using UserService.Tasks;
|
||||
using UserService.Tasks.Param;
|
||||
using UserService.User;
|
||||
using UserService.BattleOrder;
|
||||
using UserService.GameConfigs;
|
||||
|
||||
namespace UserApi.Hall
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
|
||||
public class HallController : BaseController
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly ITaskService _taskService;
|
||||
private readonly IBattleOrderService _battleOrderService;
|
||||
private readonly IActivityConfigService _activityConfigService;
|
||||
|
||||
public HallController(IUserService userService, ITaskService taskService, IBattleOrderService battleOrderService, IActivityConfigService activityConfigService)
|
||||
{
|
||||
_userService = userService;
|
||||
_taskService = taskService;
|
||||
_battleOrderService = battleOrderService;
|
||||
_activityConfigService = activityConfigService;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("SaveSafeBox")]
|
||||
public async Task<BaseResponse<string>> SaveSafeBox(int gold)
|
||||
{
|
||||
var res = await _userService.SaveSafeBox(gold, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("GetSafeBox")]
|
||||
public async Task<BaseResponse<string>> GetSafeBox(long gold, string password)
|
||||
{
|
||||
var res = await _userService.GetSafeBox(gold, password, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("SetSafeBoxPassword")]
|
||||
public async Task<BaseResponse<string>> SetSafeBoxPassword(string password)
|
||||
{
|
||||
var res = await _userService.SetSafeBoxPassword(password, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("ResetSafeBoxPassword")]
|
||||
public async Task<BaseResponse<string>> ResetSafeBoxPassword(string password, string code)
|
||||
{
|
||||
var res = await _userService.ResetSafeBoxPassword(password, code, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("GetRelief")]
|
||||
public async Task<BaseResponse<string>> GetRelief()
|
||||
{
|
||||
var res = await _userService.GetReliefGold(loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("SynthesisFragment")]
|
||||
public async Task<BaseResponse<BaseProductCount>> SynthesisFragment(string propNumber)
|
||||
{
|
||||
var res = await _userService.SyntheticFragments(propNumber, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<BaseProductCount>(res.model);
|
||||
else
|
||||
return this.ToFailResult<BaseProductCount>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet("BuyProp")]
|
||||
public async Task<BaseResponse<string>> BuyProp(string propNumber, int count = 1)
|
||||
{
|
||||
var res = await _userService.BuyProps(propNumber, count, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UseVipExp")]
|
||||
public async Task<BaseResponse<string>> UseVipExp(int count = 1)
|
||||
{
|
||||
var res = await _userService.UseVipExp(count, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("BuyGold")]
|
||||
public async Task<BaseResponse<string>> BuyGold(string number, int count = 1)
|
||||
{
|
||||
var res = await _userService.BuyGold(number, count, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("BuyDiamond")]
|
||||
public async Task<BaseResponse<string>> BuyDiamond(string number, int count = 1)
|
||||
{
|
||||
var res = await _userService.BuyDiamond(number, count, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.url);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("SignIn")]
|
||||
public async Task<BaseResponse<long>> SignIn()
|
||||
{
|
||||
var res = await _userService.Sign(loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<long>(res.gold);
|
||||
else
|
||||
return this.ToFailResult<long>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("ChangeCannon")]
|
||||
public async Task<BaseResponse<string>> ChangeCannon(string number)
|
||||
{
|
||||
var res = await _userService.ChangeCannon(number, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet("ChangeWing")]
|
||||
public async Task<BaseResponse<string>> ChangeWing(string number)
|
||||
{
|
||||
var res = await _userService.ChangeWing(number, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("ChangeGodWar")]
|
||||
public async Task<BaseResponse<string>> ChangeGodWar(string number)
|
||||
{
|
||||
var res = await _userService.ChangeGodWar(number, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UnloadCannon")]
|
||||
public async Task<BaseResponse<string>> UnloadCannon(string number)
|
||||
{
|
||||
var res = await _userService.UnloadCannon(number, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UnloadWing")]
|
||||
public async Task<BaseResponse<string>> UnloadWing(string number)
|
||||
{
|
||||
var res = await _userService.UnloadWing(number, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UnloadGodWar")]
|
||||
public async Task<BaseResponse<string>> UnloadGodWar(string number)
|
||||
{
|
||||
var res = await _userService.UnloadGodWar(number, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<string>(res.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("GetVipDayGift")]
|
||||
public async Task<BaseResponse<GiftResponse>> GetVipDayGift()
|
||||
{
|
||||
var res = await _userService.GetVipDayGift(loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<GiftResponse>(res.model);
|
||||
else
|
||||
return this.ToFailResult<GiftResponse>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetVipGift")]
|
||||
public async Task<BaseResponse<GiftResponse>> GetVipGift(int vipLevel)
|
||||
{
|
||||
var res = await _userService.GetVipGift(vipLevel, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult<GiftResponse>(res.model);
|
||||
else
|
||||
return this.ToFailResult<GiftResponse>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[HttpGet("GetUserTaskList")]
|
||||
[Authorize]
|
||||
public async Task<ListResponse<UserTaskDto>> GetUserTaskList(int taskType)
|
||||
{
|
||||
var result = await _taskService.GetUserTaskList(new GetUserTaskListParam() { TaskType = taskType }, loginUser.UserId);
|
||||
var dtos = result.Select(MapToUserTaskDto).ToList();
|
||||
return this.ToListResult(dtos);
|
||||
}
|
||||
|
||||
private static UserTaskDto MapToUserTaskDto(UserTask entity)
|
||||
{
|
||||
if (entity == null) return new UserTaskDto();
|
||||
return new UserTaskDto
|
||||
{
|
||||
Id = entity.Id ?? "",
|
||||
UserId = entity.UserId ?? "",
|
||||
Number = entity.Number ?? "",
|
||||
Remark = entity.Remark ?? "",
|
||||
TaskType = (int)entity.TaskType,
|
||||
TaskEvent = (int)entity.TaskEvent,
|
||||
TaskCount = entity.TaskCount,
|
||||
Count = entity.Count,
|
||||
IsFinish = entity.IsFinish,
|
||||
OtherId = entity.OtherId ?? "",
|
||||
IsGet = entity.IsGet,
|
||||
TaskAddTime = entity.TaskAddTime,
|
||||
TaskEndTime = entity.TaskEndTime,
|
||||
TaskFinishTime = entity.TaskFinishTime,
|
||||
Exp = entity.Exp
|
||||
};
|
||||
}
|
||||
[HttpGet("DistributeRewards")]
|
||||
public async Task<BaseResponse<string>> DistributeRewards(string id)
|
||||
{
|
||||
var result = await _taskService.DistributeRewards(id, loginUser.UserId);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpPost("GetUserRewardList")]
|
||||
public async Task<PageResponse<UserRewardDto>> GetUserRewardList(GetUserRewardListParam param)
|
||||
{
|
||||
param.UserId = loginUser.UserId;
|
||||
var res = await _userService.GetUserRewardList(param);
|
||||
if(res.list==null || res.list.Count()==0)
|
||||
return this.ToPageResult<UserRewardDto>(null, res.count);
|
||||
var dtos = res.list.Select(MapToUserRewardDto).ToList();
|
||||
return this.ToPageResult(dtos, res.count);
|
||||
}
|
||||
|
||||
private static UserRewardDto MapToUserRewardDto(UserReward entity)
|
||||
{
|
||||
if (entity == null) return new UserRewardDto();
|
||||
return new UserRewardDto
|
||||
{
|
||||
Id = entity.Id ?? "",
|
||||
UserId = entity.UserId ?? "",
|
||||
Type = entity.Type,
|
||||
Source = (int)entity.Source,
|
||||
CurrencyType = entity.CurrencyType,
|
||||
BeforeCount = entity.BeforeCount,
|
||||
ChangeCount = entity.ChangeCount,
|
||||
AfterCount = entity.AfterCount,
|
||||
OtherId = entity.OtherId ?? "",
|
||||
OtherUserId = entity.OtherUserId ?? "",
|
||||
Remark = entity.Remark ?? "",
|
||||
RoomName = entity.RoomName ?? "",
|
||||
RoomInfo = entity.RoomInfo ?? "",
|
||||
Tax = entity.Tax,
|
||||
CreateTime = entity.CreateTime
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class UserTaskDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public string Number { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public int TaskType { get; set; }
|
||||
public int TaskEvent { get; set; }
|
||||
public int TaskCount { get; set; }
|
||||
public double Count { get; set; }
|
||||
public bool IsFinish { get; set; }
|
||||
public string OtherId { get; set; }
|
||||
public bool IsGet { get; set; }
|
||||
public long TaskAddTime { get; set; }
|
||||
public long TaskEndTime { get; set; }
|
||||
public long TaskFinishTime { get; set; }
|
||||
public long Exp { get; set; }
|
||||
}
|
||||
|
||||
public class UserRewardDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
public string UserId { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int Source { get; set; }
|
||||
public int CurrencyType { get; set; }
|
||||
public long BeforeCount { get; set; }
|
||||
public long ChangeCount { get; set; }
|
||||
public long AfterCount { get; set; }
|
||||
public string OtherId { get; set; }
|
||||
public string OtherUserId { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public string RoomName { get; set; }
|
||||
public string RoomInfo { get; set; }
|
||||
public int Tax { get; set; }
|
||||
public long CreateTime { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
[HttpGet("GetBattleOrder")]
|
||||
public async Task<BaseResponse<BattleOrderResponse>> GetBattleOrder()
|
||||
{
|
||||
var result = await _battleOrderService.GetUserBattleOrderWithConfigAsync(loginUser.UserId);
|
||||
return this.ToResult(result);
|
||||
}
|
||||
|
||||
[HttpGet("GetBattleOrderLevelStatus")]
|
||||
public async Task<BaseResponse<BattleOrderLevelStatusResponse>> GetBattleOrderLevelStatus()
|
||||
{
|
||||
var result = await _battleOrderService.GetLevelRewardStatusAsync(loginUser.UserId);
|
||||
return this.ToResult(result);
|
||||
}
|
||||
|
||||
[HttpGet("ReceiveAllBattleOrderRewards")]
|
||||
public async Task<ListResponse<GiftConfig>> ReceiveAllBattleOrderRewards()
|
||||
{
|
||||
var result = await _battleOrderService.ReceiveAllRewardsAsync(loginUser.UserId);
|
||||
if (result.success)
|
||||
return this.ToListResult(result.rewards);
|
||||
else
|
||||
return this.ToListFailResult<GiftConfig>(result.message);
|
||||
}
|
||||
|
||||
[HttpGet("ReceiveBattleOrderLevelReward")]
|
||||
public async Task<ListResponse<GiftConfig>> ReceiveBattleOrderLevelReward( int level)
|
||||
{
|
||||
var result = await _battleOrderService.ReceiveLevelRewardAsync(loginUser.UserId, level);
|
||||
if (result.success)
|
||||
return this.ToListResult(result.rewards);
|
||||
else
|
||||
return this.ToListFailResult<GiftConfig>(result.message);
|
||||
}
|
||||
|
||||
[HttpGet("BuyBattleOrderLevel")]
|
||||
public async Task<BaseResponse<BuyBattleOrderLevelResponse>> BuyBattleOrderLevel(int levelCount)
|
||||
{
|
||||
var result = await _battleOrderService.BuyLevelsAsync(loginUser.UserId, levelCount);
|
||||
if (result.success)
|
||||
return this.ToResult(new BuyBattleOrderLevelResponse
|
||||
{
|
||||
NewLevel = result.newLevel,
|
||||
Cost = result.cost
|
||||
});
|
||||
else
|
||||
return this.ToFailResult<BuyBattleOrderLevelResponse>(result.message);
|
||||
}
|
||||
|
||||
[HttpGet("BuyBattleOrderAdvance")]
|
||||
public async Task<BaseResponse<BuyBattleOrderAdvanceResponse>> BuyBattleOrderAdvance(int type)
|
||||
{
|
||||
var result = await _battleOrderService.BuyAdvanceAsync(loginUser.UserId, type);
|
||||
if (result.success)
|
||||
return this.ToResult(new BuyBattleOrderAdvanceResponse
|
||||
{
|
||||
Success = true,
|
||||
Message = result.message,
|
||||
PurchasedAdvances = result.purchasedAdvances
|
||||
});
|
||||
else
|
||||
return this.ToFailResult<BuyBattleOrderAdvanceResponse>(result.message);
|
||||
}
|
||||
|
||||
[HttpGet("ReceiveAllTaskRewards")]
|
||||
public async Task<BaseResponse<object>> ReceiveAllTaskRewards()
|
||||
{
|
||||
var result = await _taskService.ReceiveAllTaskRewardsAsync(loginUser.UserId);
|
||||
if (result.success)
|
||||
return this.ToResult<object>(new { message = result.message, totalExp = result.totalExp });
|
||||
else
|
||||
return this.ToFailResult<object>(result.message);
|
||||
}
|
||||
|
||||
[HttpGet("GetRanking")]
|
||||
public async Task<BaseResponse<RankingResponse>> GetRanking(int type = 1)
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
var rankingConfig = config?.RankingRewardConfig;
|
||||
if (rankingConfig != null && rankingConfig.IsMaintaining)
|
||||
{
|
||||
return this.ToFailResult<RankingResponse>(
|
||||
string.IsNullOrEmpty(rankingConfig.MaintainingMessage)
|
||||
? "当前排行榜正在维护中,请稍后再试"
|
||||
: rankingConfig.MaintainingMessage);
|
||||
}
|
||||
var result = await _userService.GetRanking(loginUser, type);
|
||||
return this.ToResult(result);
|
||||
}
|
||||
|
||||
[HttpGet("SendBroadcast")]
|
||||
public async Task<BaseResponse<string>> SendBroadcast(string message)
|
||||
{
|
||||
var res = await _userService.SendBroadcast(message, loginUser);
|
||||
if (res.isok)
|
||||
return this.ToResult(res.msg);
|
||||
return this.ToFailResult<string>(res.msg);
|
||||
}
|
||||
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpGet("GetChessRoomPartitionCount")]
|
||||
public async Task<BaseResponse<int>> GetChessRoomPartitionCount([FromServices] UserService.GameConfigs.IGameConfigService gameConfigService)
|
||||
{
|
||||
var config = await gameConfigService.Get();
|
||||
if (config == null)
|
||||
return this.ToFailResult<int>("配置不存在");
|
||||
|
||||
var total = config.RoomConfigs
|
||||
.Where(r => r.GameType == CommonDomain.Enum.GameTypeEnum.中国象棋)
|
||||
.Sum(r => r.RoomPartitionNum);
|
||||
|
||||
return this.ToResult(total);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace UserApi.Login
|
||||
{
|
||||
public class DateTimeResponse
|
||||
{
|
||||
public int Year { get; set; }
|
||||
public int Month { get; set; }
|
||||
public int Day { get; set; }
|
||||
public int Hour { get; set; }
|
||||
public int Minute { get; set; }
|
||||
public int Seconds { get; set; }
|
||||
public int MilliSeconds { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Date { get; set; }
|
||||
public string Time { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public string DayOfWeek { get; set; }
|
||||
public bool DstActive { get; set; }
|
||||
public long Timestamp { get; set; }
|
||||
public string Service { get; set; } = "UserApi";
|
||||
public string DateTimeNow { get; set; } = string.Empty;
|
||||
public string DateTimeNowKind { get; set; } = string.Empty;
|
||||
public long DateTimeNowTimestamp { get; set; }
|
||||
public string DateTimeOffsetUtcNow { get; set; } = string.Empty;
|
||||
public long DateTimeOffsetUtcNowTimestamp { get; set; }
|
||||
public long DifferenceMs { get; set; }
|
||||
public string Container { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
using Common;
|
||||
using Common.Utils;
|
||||
using Common.WX;
|
||||
using Common.WX.Response;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserService;
|
||||
using UserService.Param;
|
||||
using UserService.Response;
|
||||
using UserService.User;
|
||||
|
||||
namespace UserApi.Login
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
|
||||
public class LoginController : BaseController
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly WXBaseHelper _weiXinPayHelper;
|
||||
|
||||
public LoginController(IUserService userService, WXBaseHelper weiXinPayHelper)
|
||||
{
|
||||
_userService = userService;
|
||||
_weiXinPayHelper = weiXinPayHelper;
|
||||
}
|
||||
[HttpGet("GetAccessToken")]
|
||||
public async Task<BaseResponse<string>> GetAccessToken()
|
||||
{
|
||||
var result = await _weiXinPayHelper.GetAccessToken();
|
||||
|
||||
if (!result.isok)
|
||||
return this.ToFailResult<string>("登陆失败" + result.msg);
|
||||
else
|
||||
{
|
||||
return this.ToResult(result.accessToken);
|
||||
}
|
||||
}
|
||||
[HttpGet("GetSessionToken")]
|
||||
public async Task<BaseResponse<AccessTokenResponse>> GetSessionToken(string js_code)
|
||||
{
|
||||
var result = await _weiXinPayHelper.GetAccessTokenByCode(js_code);
|
||||
if (!result.isok)
|
||||
return this.ToFailResult<AccessTokenResponse>("登陆失败" + result.msg);
|
||||
else
|
||||
{
|
||||
return this.ToResult(result.response);
|
||||
}
|
||||
}
|
||||
private string GetClientIp()
|
||||
{
|
||||
var forwarded = HttpContext.Request.Headers["X-Forwarded-For"].FirstOrDefault();
|
||||
if (!string.IsNullOrWhiteSpace(forwarded))
|
||||
return forwarded.Split(',')[0].Trim();
|
||||
return HttpContext.Connection.RemoteIpAddress?.ToString() ?? "";
|
||||
}
|
||||
|
||||
[HttpPost("registerWX")]
|
||||
|
||||
public async Task<BaseResponse<UserToken>> RegisterWX(RegisterUserWeiXinParam param)
|
||||
{
|
||||
var ip = GetClientIp();
|
||||
var result = await _userService.RegisterWeiXin(param, ip);
|
||||
return this.ToResult(result);
|
||||
}
|
||||
[HttpPost("register")]
|
||||
|
||||
public async Task<BaseResponse<UserToken>> Register(RegisterUserParam param)
|
||||
{
|
||||
var ip = GetClientIp();
|
||||
var result = await _userService.Register(param, ip);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.user);
|
||||
else
|
||||
return this.ToFailResult<UserToken>(result.msg);
|
||||
}
|
||||
[HttpGet("SendMobileCode")]
|
||||
|
||||
public async Task<BaseResponse<string>> SendMobileCode(string mobile)
|
||||
{
|
||||
var result = await _userService.SendMobileCode(mobile);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
[HttpGet("LoginWx")]
|
||||
public async Task<BaseResponse<UserToken>> LoginWx(string openId)
|
||||
{
|
||||
var ip = GetClientIp();
|
||||
var result = await _userService.LoginWx(openId, ip);
|
||||
return this.ToResult(result);
|
||||
}
|
||||
[HttpGet("Login")]
|
||||
public async Task<BaseResponse<UserToken>> Login(string mobile, string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mobile))
|
||||
return this.ToFailResult<UserToken>("请输入手机号");
|
||||
if (string.IsNullOrEmpty(code))
|
||||
return this.ToFailResult<UserToken>("请输入验证码或密码");
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(mobile, @"^1[3-9]\d{9}$"))
|
||||
return this.ToFailResult<UserToken>("手机号格式错误");
|
||||
|
||||
var ip = GetClientIp();
|
||||
var result = await _userService.Login(mobile, code, ip);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.user);
|
||||
else
|
||||
return this.ToFailResult<UserToken>(result.msg);
|
||||
}
|
||||
[HttpGet("LoginByPassword")]
|
||||
public async Task<BaseResponse<UserToken>> LoginByPassword(string mobile, string password)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mobile))
|
||||
return this.ToFailResult<UserToken>("请输入手机号");
|
||||
if (string.IsNullOrEmpty(password))
|
||||
return this.ToFailResult<UserToken>("请输入密码");
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(mobile, @"^1[3-9]\d{9}$"))
|
||||
return this.ToFailResult<UserToken>("手机号格式错误");
|
||||
|
||||
var ip = GetClientIp();
|
||||
var result = await _userService.LoginByPassword(mobile, password, ip);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.user);
|
||||
return this.ToFailResult<UserToken>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("GetDateTime")]
|
||||
public async Task<BaseResponse<DateTimeResponse>> GetDateTime()
|
||||
{
|
||||
var now = DateTime.Now;
|
||||
var nowOffset = new DateTimeOffset(now);
|
||||
var utcNow = DateTimeOffset.UtcNow;
|
||||
var nowTimestamp = nowOffset.ToUnixTimeMilliseconds();
|
||||
var utcNowTimestamp = utcNow.ToUnixTimeMilliseconds();
|
||||
var localNow = now;
|
||||
return this.ToResult(new DateTimeResponse
|
||||
{
|
||||
Year = localNow.Year,
|
||||
Month = localNow.Month,
|
||||
Day = localNow.Day,
|
||||
Hour = localNow.Hour,
|
||||
Minute = localNow.Minute,
|
||||
Seconds = localNow.Second,
|
||||
MilliSeconds = localNow.Millisecond,
|
||||
DateTime = localNow.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
Date = localNow.ToString("yyyy-MM-dd"),
|
||||
Time = localNow.ToString("HH:mm:ss"),
|
||||
TimeZone = TimeZoneInfo.Local.DisplayName,
|
||||
DayOfWeek = localNow.DayOfWeek.ToString(),
|
||||
DstActive = TimeZoneInfo.Local.IsDaylightSavingTime(localNow),
|
||||
Timestamp = utcNowTimestamp,
|
||||
Service = "UserApi",
|
||||
DateTimeNow = now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
|
||||
DateTimeNowKind = now.Kind.ToString(),
|
||||
DateTimeNowTimestamp = nowTimestamp,
|
||||
DateTimeOffsetUtcNow = utcNow.ToString("yyyy-MM-dd HH:mm:ss.fff zzz"),
|
||||
DateTimeOffsetUtcNowTimestamp = utcNowTimestamp,
|
||||
DifferenceMs = utcNowTimestamp - nowTimestamp,
|
||||
Container = Environment.MachineName
|
||||
});
|
||||
}
|
||||
[HttpGet("ResetPassword")]
|
||||
public async Task<BaseResponse<string>> ResetPassword(string mobile, string password, string code)
|
||||
{
|
||||
if (string.IsNullOrEmpty(mobile))
|
||||
return this.ToFailResult<string>("请输入手机号");
|
||||
if (string.IsNullOrEmpty(code))
|
||||
return this.ToFailResult<string>("请输入验证码");
|
||||
if (string.IsNullOrEmpty(password))
|
||||
return this.ToFailResult<string>("请输入新密码");
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(mobile, @"^1[3-9]\d{9}$"))
|
||||
return this.ToFailResult<string>("手机号格式错误");
|
||||
|
||||
var result = await _userService.UpdatePassword(mobile, password, code);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using Common;
|
||||
using CommonDomain;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserDomain.Entity;
|
||||
using UserService;
|
||||
using UserService.GameConfigs;
|
||||
|
||||
namespace UserApi.Lottery
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class LotteryController : BaseController
|
||||
{
|
||||
private readonly ILotteryService _lotteryService;
|
||||
private readonly IActivityConfigService _activityConfigService;
|
||||
private readonly IGameConfigService _gameConfigService;
|
||||
|
||||
public LotteryController(ILotteryService lotteryService, IActivityConfigService activityConfigService,
|
||||
IGameConfigService gameConfigService)
|
||||
{
|
||||
_lotteryService = lotteryService;
|
||||
_activityConfigService = activityConfigService;
|
||||
_gameConfigService = gameConfigService;
|
||||
}
|
||||
|
||||
[HttpGet("Config")]
|
||||
public async Task<BaseResponse<LotteryConfigResponse>> GetConfig()
|
||||
{
|
||||
var config = await _activityConfigService.Get();
|
||||
if (config?.LotteryActivityConfig == null)
|
||||
return this.ToFailResult<LotteryConfigResponse>("配置不存在");
|
||||
|
||||
LotteryPrizeProductHelper.Enrich(config.LotteryActivityConfig, await _gameConfigService.Get());
|
||||
|
||||
var drawnPrizes = await _lotteryService.GetUserDrawnPrizes(loginUser.UserId);
|
||||
return this.ToResult(new LotteryConfigResponse
|
||||
{
|
||||
Config = config.LotteryActivityConfig,
|
||||
DrawnPrizeIds = drawnPrizes ?? new List<string>()
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("Draw")]
|
||||
public async Task<BaseResponse<LotteryDrawResponse>> Draw([FromQuery] int poolType = 0)
|
||||
{
|
||||
var res = await _lotteryService.Draw(loginUser.UserId, poolType);
|
||||
if (!res.success)
|
||||
return this.ToFailResult<LotteryDrawResponse>(res.message);
|
||||
return this.ToResult(new LotteryDrawResponse
|
||||
{
|
||||
PrizeId = res.prize.PrizeId,
|
||||
Name = res.prize.Name,
|
||||
Type = res.prize.Type,
|
||||
Count = res.prize.Count,
|
||||
OtherId = res.prize.OtherId,
|
||||
Cost = res.cost,
|
||||
PoolType = poolType
|
||||
});
|
||||
}
|
||||
|
||||
[HttpGet("UserStatus")]
|
||||
public async Task<BaseResponse<LotteryUserStatus>> UserStatus()
|
||||
{
|
||||
var status = await _lotteryService.GetUserStatus(loginUser.UserId);
|
||||
return this.ToResult(status);
|
||||
}
|
||||
|
||||
[HttpGet("DrawnPrizes")]
|
||||
public async Task<BaseResponse<List<string>>> DrawnPrizes()
|
||||
{
|
||||
var list = await _lotteryService.GetUserDrawnPrizes(loginUser.UserId);
|
||||
return this.ToResult(list);
|
||||
}
|
||||
}
|
||||
|
||||
public class LotteryDrawResponse
|
||||
{
|
||||
public string PrizeId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Type { get; set; }
|
||||
public long Count { get; set; }
|
||||
public string OtherId { get; set; }
|
||||
public long Cost { get; set; }
|
||||
public int PoolType { get; set; }
|
||||
}
|
||||
|
||||
public class LotteryConfigResponse
|
||||
{
|
||||
public LotteryActivityConfig Config { get; set; }
|
||||
public List<string> DrawnPrizeIds { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Common;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserDomain.Entity;
|
||||
using UserService.Notices;
|
||||
using UserService.Notices.Param;
|
||||
|
||||
namespace UserApi.Notices
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class NoticeController : BaseController
|
||||
{
|
||||
private readonly INoticeService _noticeService;
|
||||
|
||||
public NoticeController(INoticeService noticeService)
|
||||
{
|
||||
_noticeService = noticeService;
|
||||
}
|
||||
|
||||
[HttpPost("list")]
|
||||
public async Task<PageResponse<NoticeDto>> GetNoticeList(GetNoticeListParam param)
|
||||
{
|
||||
var result = await _noticeService.GetList(param);
|
||||
var list = result.list ?? new List<Notice>();
|
||||
var dtos = list.Select(n => new NoticeDto
|
||||
{
|
||||
Id = n.Id,
|
||||
Title = n.Title,
|
||||
Content = n.Content,
|
||||
Recommend = n.Recommend,
|
||||
TopImage = n.TopImage,
|
||||
ContentImages = n.ContentImages,
|
||||
CreateTime = n.CreateTime
|
||||
});
|
||||
return this.ToPageResult(dtos, (int)result.count);
|
||||
}
|
||||
|
||||
[HttpGet("get")]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<NoticeDto>> GetNotice(string id)
|
||||
{
|
||||
var result = await _noticeService.Get(id);
|
||||
if (result == null)
|
||||
{
|
||||
return this.ToFailResult<NoticeDto>("公告不存在");
|
||||
}
|
||||
|
||||
var dto = new NoticeDto
|
||||
{
|
||||
Id = result.Id,
|
||||
Title = result.Title,
|
||||
Content = result.Content,
|
||||
Recommend = result.Recommend,
|
||||
TopImage = result.TopImage,
|
||||
ContentImages = result.ContentImages,
|
||||
CreateTime = result.CreateTime
|
||||
};
|
||||
return this.ToResult(dto);
|
||||
}
|
||||
|
||||
[HttpGet("get/newone")]
|
||||
[AllowAnonymous]
|
||||
public async Task<BaseResponse<NoticeDto>> GetNewOne()
|
||||
{
|
||||
var result = await _noticeService.GetNewOne();
|
||||
if (result == null)
|
||||
{
|
||||
return this.ToFailResult<NoticeDto>("暂无公告");
|
||||
}
|
||||
|
||||
var dto = new NoticeDto
|
||||
{
|
||||
Id = result.Id,
|
||||
Title = result.Title,
|
||||
Content = result.Content,
|
||||
Recommend = result.Recommend,
|
||||
TopImage = result.TopImage,
|
||||
ContentImages = result.ContentImages,
|
||||
CreateTime = result.CreateTime
|
||||
};
|
||||
return this.ToResult(dto);
|
||||
}
|
||||
}
|
||||
|
||||
public class NoticeDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Content { get; set; }
|
||||
|
||||
public string Recommend { get; set; }
|
||||
|
||||
public string TopImage { get; set; }
|
||||
|
||||
public List<string> ContentImages { get; set; }
|
||||
|
||||
public long CreateTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
// See https://aka.ms/new-console-template for more information
|
||||
Console.WriteLine("Hello, World!");
|
||||
@@ -0,0 +1,29 @@
|
||||
using Common;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserService.ScratchCard;
|
||||
|
||||
namespace UserApi.ScratchCard
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class ScratchCardController : BaseController
|
||||
{
|
||||
private readonly IScratchCardService _scratchCardService;
|
||||
|
||||
public ScratchCardController(IScratchCardService scratchCardService)
|
||||
{
|
||||
_scratchCardService = scratchCardService;
|
||||
}
|
||||
|
||||
[HttpGet("draw")]
|
||||
public async Task<BaseResponse<ScratchCardResult>> Draw()
|
||||
{
|
||||
var res = await _scratchCardService.Draw(loginUser.UserId);
|
||||
if (res.success)
|
||||
return this.ToResult(res.result);
|
||||
return this.ToFailResult<ScratchCardResult>(res.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Common;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserService.SummonCard;
|
||||
|
||||
namespace UserApi.SummonCard
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class SummonCardController : BaseController
|
||||
{
|
||||
private readonly ISummonCardService _summonCardService;
|
||||
|
||||
public SummonCardController(ISummonCardService summonCardService)
|
||||
{
|
||||
_summonCardService = summonCardService;
|
||||
}
|
||||
|
||||
[HttpGet("use")]
|
||||
public async Task<BaseResponse<string>> Use()
|
||||
{
|
||||
var res = await _summonCardService.Use(loginUser.UserId);
|
||||
if (res.success)
|
||||
return this.ToResult(res.message);
|
||||
return this.ToFailResult<string>(res.message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Common;
|
||||
using Common.CommonModel;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserDomain;
|
||||
using UserDomain.Entity;
|
||||
using UserDomain.Param;
|
||||
|
||||
namespace UserApi.User
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class FeedbackController : BaseController
|
||||
{
|
||||
private readonly IUserFeedbackService _feedbackService;
|
||||
|
||||
public FeedbackController(IUserFeedbackService feedbackService)
|
||||
{
|
||||
_feedbackService = feedbackService;
|
||||
}
|
||||
|
||||
[HttpPost("Submit")]
|
||||
public async Task<BaseResponse<string>> Submit([FromBody] AddFeedbackParam param)
|
||||
{
|
||||
var result = await _feedbackService.Submit(param, loginUser.UserId, loginUser.Number, loginUser.UserName);
|
||||
if (result)
|
||||
return this.ToResult("提交成功");
|
||||
else
|
||||
return this.ToFailResult<string>("提交失败");
|
||||
}
|
||||
|
||||
[HttpGet("MyList")]
|
||||
public async Task<PageResponse<FeedbackDto>> GetMyList(int pageIndex = 1, int pageSize = 10)
|
||||
{
|
||||
var result = await _feedbackService.GetUserFeedbacks(loginUser.UserId, pageIndex, pageSize);
|
||||
var dtos = result.list.Select(f => new FeedbackDto
|
||||
{
|
||||
Id = f.Id,
|
||||
Type = f.Type,
|
||||
Title = f.Title,
|
||||
Content = f.Content,
|
||||
Images = string.IsNullOrEmpty(f.Images) ? new List<string>() : f.Images.Split(',').ToList(),
|
||||
QQ = f.QQ ?? "",
|
||||
Contact = f.Contact ?? "",
|
||||
Status = f.Status,
|
||||
Reply = f.Reply ?? "",
|
||||
ReplyTime = f.ReplyTime.HasValue ? new DateTimeOffset(f.ReplyTime.Value).ToUnixTimeMilliseconds() : 0,
|
||||
SubmitTime = new DateTimeOffset(f.SubmitTime).ToUnixTimeMilliseconds()
|
||||
});
|
||||
return this.ToPageResult(dtos, (int)result.count);
|
||||
}
|
||||
|
||||
[HttpGet("Detail")]
|
||||
public async Task<BaseResponse<FeedbackDetailDto>> GetDetail(string id)
|
||||
{
|
||||
var feedback = await _feedbackService.GetById(id, loginUser.UserId);
|
||||
if (feedback == null)
|
||||
return this.ToFailResult<FeedbackDetailDto>("反馈不存在");
|
||||
|
||||
var dto = new FeedbackDetailDto
|
||||
{
|
||||
Id = feedback.Id,
|
||||
Type = feedback.Type,
|
||||
Title = feedback.Title,
|
||||
Content = feedback.Content,
|
||||
Images = string.IsNullOrEmpty(feedback.Images) ? new List<string>() : feedback.Images.Split(',').ToList(),
|
||||
QQ = feedback.QQ ?? "",
|
||||
Contact = feedback.Contact ?? "",
|
||||
Status = feedback.Status,
|
||||
Reply = feedback.Reply ?? "",
|
||||
ReplyTime = feedback.ReplyTime.HasValue ? new DateTimeOffset(feedback.ReplyTime.Value).ToUnixTimeMilliseconds() : 0,
|
||||
SubmitTime = new DateTimeOffset(feedback.SubmitTime).ToUnixTimeMilliseconds()
|
||||
};
|
||||
return this.ToResult(dto);
|
||||
}
|
||||
}
|
||||
|
||||
public class FeedbackDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public int Type { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Content { get; set; }
|
||||
|
||||
public List<string> Images { get; set; }
|
||||
|
||||
public string QQ { get; set; }
|
||||
|
||||
public string Contact { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
|
||||
public string Reply { get; set; }
|
||||
|
||||
public long ReplyTime { get; set; }
|
||||
|
||||
public long SubmitTime { get; set; }
|
||||
}
|
||||
|
||||
public class FeedbackDetailDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public int Type { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Content { get; set; }
|
||||
|
||||
public List<string> Images { get; set; }
|
||||
|
||||
public string QQ { get; set; }
|
||||
|
||||
public string Contact { get; set; }
|
||||
|
||||
public int Status { get; set; }
|
||||
|
||||
public string Reply { get; set; }
|
||||
|
||||
public long ReplyTime { get; set; }
|
||||
|
||||
public long SubmitTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserService.ImageUpload;
|
||||
|
||||
namespace UserApi.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class ImageUploadController : ControllerBase
|
||||
{
|
||||
private readonly IImageUploadService _imageUploadService;
|
||||
|
||||
public ImageUploadController(IImageUploadService imageUploadService)
|
||||
{
|
||||
_imageUploadService = imageUploadService;
|
||||
}
|
||||
|
||||
[HttpPost("upload")]
|
||||
public async Task<IActionResult> UploadFile(IFormFile file)
|
||||
{
|
||||
var result = await _imageUploadService.UploadImageAsync(file);
|
||||
|
||||
if (!result.isOk)
|
||||
{
|
||||
return BadRequest(result.errorMessage);
|
||||
}
|
||||
|
||||
return Ok(new { path = result.path });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,341 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Common;
|
||||
using Common.CommonModel;
|
||||
using CommonInfrastructure;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using UserDomain.Entity;
|
||||
using UserService.Param;
|
||||
using UserService.User;
|
||||
using UserService.User.Response;
|
||||
|
||||
namespace UserApi.User
|
||||
{
|
||||
[ApiController, Route("api/[controller]")]
|
||||
[Authorize]
|
||||
public class UserController : BaseController
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
|
||||
public UserController(IUserService userService)
|
||||
{
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
[HttpGet("RealNameAuth")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> RealNameAuth(string realName, string idCard)
|
||||
{
|
||||
var result = await _userService.RealNameAuth(idCard, realName, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UpdateUserName")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> UpdateUserName(string userName)
|
||||
{
|
||||
var result = await _userService.UpdateUserName(userName, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("BindWX")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> BindWX(string openId)
|
||||
{
|
||||
var result = await _userService.BindWX(openId, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("BindMobile")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> BindMobile(string mobile, string code)
|
||||
{
|
||||
var result = await _userService.BindMobile(mobile, code, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UpdateAvatar")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> UpdateAvatar(string avatarUrl)
|
||||
{
|
||||
var result = await _userService.UpdateAvatar(avatarUrl, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("UpdateAvatarFrame")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> UpdateAvatarFrame(string avatarFrame)
|
||||
{
|
||||
var result = await _userService.UpdateAvatarFrame(avatarFrame, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("GetUser")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<UserEntity>> GetUser(string userid)
|
||||
{
|
||||
var result = await _userService.GetUser(userid);
|
||||
if (result == null)
|
||||
return this.ToFailResult<UserEntity>("用户不存在");
|
||||
return this.ToResult(result);
|
||||
}
|
||||
|
||||
[HttpGet("GetUserAssets")]
|
||||
public async Task<BaseResponse<UserAssetsResponse>> GetUserAssets()
|
||||
{
|
||||
var user = await _userService.GetUser(loginUser.UserId);
|
||||
return this.ToResult(new UserAssetsResponse
|
||||
{
|
||||
Gold = user.Assets.Gold,
|
||||
Diamond = user.Assets.Diamond,
|
||||
Props = user.Props
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("GetUserList")]
|
||||
[Authorize]
|
||||
public async Task<PageResponse<UserListItemDto>> GetUserList(BaseListPageParam param)
|
||||
{
|
||||
var result = await _userService.GetUserList(param);
|
||||
var dtos = result.list.Select(u => new UserListItemDto
|
||||
{
|
||||
Id = u.Id,
|
||||
Number = u.BaseInfo?.Number ?? "",
|
||||
UserName = u.BaseInfo?.UserName ?? "",
|
||||
AvatarUrl = u.BaseInfo?.AvatarUrl ?? "",
|
||||
Mobile = u.BaseInfo?.Mobile ?? "",
|
||||
CreateTime = u.CreateTime
|
||||
});
|
||||
return this.ToPageResult(dtos, (int)result.count);
|
||||
}
|
||||
|
||||
[HttpPost("SendEmail")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> SendEmail(SendEmailParam param)
|
||||
{
|
||||
var result = await _userService.SendEmail(param, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("GetEmail")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<EmailDto>> GetEmail(string id)
|
||||
{
|
||||
var result = await _userService.GetEmail(id, loginUser);
|
||||
if (result == null)
|
||||
return this.ToFailResult<EmailDto>("邮件不存在");
|
||||
|
||||
var dto = new EmailDto
|
||||
{
|
||||
Id = result.Id,
|
||||
Title = result.Title,
|
||||
Content = result.Content,
|
||||
SendTime = result.SendTime,
|
||||
ReadTime = result.ReadTime,
|
||||
IsRead = result.IsRead,
|
||||
IsReward = result.IsReward,
|
||||
RewardDiamond = result.RewardDiamond,
|
||||
RewardGold = result.RewardGold,
|
||||
RewardItems = result.RewardItems,
|
||||
ExpireTime = result.ExpireTime
|
||||
};
|
||||
return this.ToResult(dto);
|
||||
}
|
||||
|
||||
[HttpGet("RewardEmail")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<RewardEmailResponse>> RewardEmail(int type, string? id = "")
|
||||
{
|
||||
var result = await _userService.RewardEmail(type, id, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.model);
|
||||
else
|
||||
return this.ToFailResult<RewardEmailResponse>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("DeleteEmail")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> DeleteEmail(int type, string? id = "")
|
||||
{
|
||||
var result = await _userService.DeleteEmail(type, id, loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("ReadEmailMore")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<string>> ReadEmailMore()
|
||||
{
|
||||
var result = await _userService.ReadEmailMore(loginUser);
|
||||
if (result.isok)
|
||||
return this.ToResult(result.msg);
|
||||
else
|
||||
return this.ToFailResult<string>(result.msg);
|
||||
}
|
||||
|
||||
[HttpGet("GetNoReadCount")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<long>> GetNoReadCount()
|
||||
{
|
||||
var result = await _userService.GetNoReadCount(loginUser);
|
||||
return this.ToResult(result);
|
||||
}
|
||||
|
||||
[HttpPost("GetEmailByPage")]
|
||||
[Authorize]
|
||||
public async Task<PageResponse<UserEmail>> GetEmailByPage(GetEmailPageParam param)
|
||||
{
|
||||
var result = await _userService.GetEmailByPage(param, loginUser);
|
||||
|
||||
return this.ToPageResult(result.list, (int)result.count);
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetFishingReturnInfo")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<FishingReturnDto>> GetFishingReturnInfo()
|
||||
{
|
||||
var result = await _userService.GetFishingReturnInfo(loginUser);
|
||||
var dto = new FishingReturnDto
|
||||
{
|
||||
TodayConsume = result.TodayConsume,
|
||||
YesterdayConsume = result.YesterdayConsume,
|
||||
IsClaimed = result.IsClaimed,
|
||||
CanClaimGold = result.CanClaimGold
|
||||
};
|
||||
return this.ToResult(dto);
|
||||
}
|
||||
|
||||
[HttpGet("ClaimFishingReturn")]
|
||||
[Authorize]
|
||||
public async Task<BaseResponse<ClaimFishingReturnDto>> ClaimFishingReturn()
|
||||
{
|
||||
var result = await _userService.ClaimFishingReturn(loginUser);
|
||||
if (result.isok)
|
||||
{
|
||||
return this.ToResult(new ClaimFishingReturnDto
|
||||
{
|
||||
Gold = result.gold,
|
||||
Message = result.msg
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.ToFailResult<ClaimFishingReturnDto>(result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class UserDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Number { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string AvatarUrl { get; set; }
|
||||
|
||||
public string Mobile { get; set; }
|
||||
|
||||
public int Diamond { get; set; }
|
||||
|
||||
public long Gold { get; set; }
|
||||
|
||||
public int VipLevel { get; set; }
|
||||
|
||||
public long CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class UserListItemDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Number { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
|
||||
public string AvatarUrl { get; set; }
|
||||
|
||||
public string Mobile { get; set; }
|
||||
|
||||
public long CreateTime { get; set; }
|
||||
}
|
||||
|
||||
public class EmailDto
|
||||
{
|
||||
public string Id { get; set; }
|
||||
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Content { get; set; }
|
||||
|
||||
public long SendTime { get; set; }
|
||||
|
||||
public long ReadTime { get; set; }
|
||||
|
||||
public bool IsRead { get; set; }
|
||||
|
||||
public bool IsReward { get; set; }
|
||||
|
||||
public int RewardDiamond { get; set; }
|
||||
|
||||
public long RewardGold { get; set; }
|
||||
|
||||
public List<CommonDomain.BaseModel.BaseProductCount> RewardItems { get; set; }
|
||||
|
||||
public long ExpireTime { get; set; }
|
||||
}
|
||||
|
||||
public class FishingReturnDto
|
||||
{
|
||||
public long TodayConsume { get; set; }
|
||||
|
||||
public long YesterdayConsume { get; set; }
|
||||
|
||||
public bool IsClaimed { get; set; }
|
||||
|
||||
public long CanClaimGold { get; set; }
|
||||
}
|
||||
|
||||
public class ClaimFishingReturnDto
|
||||
{
|
||||
public long Gold { get; set; }
|
||||
|
||||
public string Message { get; set; }
|
||||
}
|
||||
|
||||
public class UserAssetsResponse
|
||||
{
|
||||
public long Gold { get; set; }
|
||||
public int Diamond { get; set; }
|
||||
public List<CommonDomain.BaseModel.BaseProductCount> Props { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AutoMapper" Version="14.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CommonService\CommonService.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\CommonInfrastructure\CommonInfrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\Common\Common.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\SharpAbp.Infrastructure.Api\SharpAbp.Infrastructure.Api.csproj" />
|
||||
<ProjectReference Include="..\..\RedisService\RedisService.csproj" />
|
||||
<ProjectReference Include="..\UserDomain\UserDomain.csproj" />
|
||||
<ProjectReference Include="..\UserService\UserService.csproj" />
|
||||
<ProjectReference Include="..\..\AdminSrc\AdminDomain\AdminDomain.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user