This commit is contained in:
Putoo
2026-07-15 12:55:22 +08:00
parent 77fcf4ea47
commit c9c870004b
10 changed files with 39 additions and 27 deletions

View File

@@ -40,7 +40,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.OrderByIF(type == 7, it => it.score, OrderByType.Desc) .OrderByIF(type == 7, it => it.score, OrderByType.Desc)
.Take(100) .Take(100)
.ToListAsync(); .ToListAsync();
total = data.Count; total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit); data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>(); List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data) foreach (var item in data)
@@ -97,7 +97,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.OrderByDescending(uc => uc.copper) .OrderByDescending(uc => uc.copper)
.Take(100) .Take(100)
.ToListAsync(); .ToListAsync();
total = data.Count; total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit); data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>(); List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data) foreach (var item in data)
@@ -120,10 +120,10 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.Where((uc, u) => uc.lev > 29) .Where((uc, u) => uc.lev > 29)
.Select<unit_user_attr>() .Select<unit_user_attr>()
.OrderByDescending(uc => uc.lev) .OrderByDescending(uc => uc.lev)
.OrderByDescending(uc=>uc.levUpdate) .OrderBy(uc=>uc.levUpdate,OrderByType.Asc)
.Take(100) .Take(100)
.ToListAsync(); .ToListAsync();
total = data.Count; total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit); data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>(); List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data) foreach (var item in data)
@@ -152,7 +152,7 @@ public class RankService(ISqlSugarClient DbClient, IRedisCache redis) : IRankSer
.OrderByIF(type == 11, uc => uc.charm, OrderByType.Desc) .OrderByIF(type == 11, uc => uc.charm, OrderByType.Desc)
.Take(100) .Take(100)
.ToListAsync(); .ToListAsync();
total = data.Count; total.Value = data.Count;
data = PageExtend.GetPageList(data, page, limit); data = PageExtend.GetPageList(data, page, limit);
List<GameRankModel> result = new List<GameRankModel>(); List<GameRankModel> result = new List<GameRankModel>();
foreach (var item in data) foreach (var item in data)

View File

@@ -57,12 +57,12 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
} }
public async Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex, public async Task<List<unit_user_equ>> GetUserEquData(string userId, int type, string equName, int PageIndex,
int PageSize, RefAsync<int> Total,int DealType) int PageSize, RefAsync<int> Total, int DealType)
{ {
long onTime = TimeExtend.GetTimeStampSeconds; long onTime = TimeExtend.GetTimeStampSeconds;
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>(); var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_equ>();
return await db.Queryable<unit_user_equ>().Where(it => return await db.Queryable<unit_user_equ>().Where(it =>
it.userId == userId && it.isOn == 0 && it.isLock == 0 && it.userId == userId && it.isOn == 0 && it.isLock == 0 &&
it.useEndTime > onTime) it.useEndTime > onTime)
.WhereIF(DealType == 0, it => it.isDeal == 1) .WhereIF(DealType == 0, it => it.isDeal == 1)
.WhereIF(DealType == 1, it => it.isDeal == 1 && it.isGive == 1) .WhereIF(DealType == 1, it => it.isDeal == 1 && it.isGive == 1)
@@ -627,7 +627,7 @@ public class GameEquService(ISqlSugarClient DbClient, IRedisCache redis) : IGame
await redis.SetAsync(key, result, 300); await redis.SetAsync(key, result, 300);
} }
return result; return result == null ? new List<AttrItem>() : result;
} }
#endregion #endregion

View File

@@ -233,6 +233,9 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
{ {
await UserStateTool.SetUserMapDefault(lowUser); await UserStateTool.SetUserMapDefault(lowUser);
} }
//战败后,结束挂机
var hookService = App.GetService<IOnHookService>();
await hookService.StopOnHook(lowUser);
fightData.state = 1; fightData.state = 1;
fightData.winCode = nameof(UserEnum.AttrCode.Person); fightData.winCode = nameof(UserEnum.AttrCode.Person);
@@ -414,7 +417,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
var cityInfo = await mapService.GetCityInfo((int)mapInfo.cityId); var cityInfo = await mapService.GetCityInfo((int)mapInfo.cityId);
var winUserInfo = await userService.GetUserInfoByUserId(winUser); var winUserInfo = await userService.GetUserInfoByUserId(winUser);
var lowUserInfo = await userService.GetUserInfoByUserId(lowUser); var lowUserInfo = await userService.GetUserInfoByUserId(lowUser);
//系统广播 //系统广播
string boradMsg = string boradMsg =
$"[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]在{cityInfo.cityName}·{mapInfo.mapName}击杀了[{UbbTool.HomeUbb(lowUserInfo.userNo, lowUserInfo.nick)}]!"; $"[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]在{cityInfo.cityName}·{mapInfo.mapName}击杀了[{UbbTool.HomeUbb(lowUserInfo.userNo, lowUserInfo.nick)}]!";
@@ -424,7 +427,7 @@ public class GameFightService(ISqlSugarClient DbClient, IRedisCache redis) : IGa
string noticeMsg = string noticeMsg =
$"您在{cityInfo.cityName}·{mapInfo.mapName}被[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]击杀!"; $"您在{cityInfo.cityName}·{mapInfo.mapName}被[{UbbTool.HomeUbb(winUserInfo.userNo, winUserInfo.nick)}]击杀!";
await chatService.SendChat(lowUser, (int)lowUserInfo.areaId, nameof(GameChatEnum.Code.Notice), noticeMsg); await chatService.SendChat(lowUser, (int)lowUserInfo.areaId, nameof(GameChatEnum.Code.Notice), noticeMsg);
if (mapInfo.isPk == 1) if (mapInfo.isPk == 1 && fightData.userId == winUser)
{ {
var relationService = App.GetService<IUnitUserRelationService>(); var relationService = App.GetService<IUnitUserRelationService>();
if (await relationService.CheckUserEnemy(winUser, lowUser) == false) if (await relationService.CheckUserEnemy(winUser, lowUser) == false)

View File

@@ -125,11 +125,9 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
var loadState = await GetUserLoadState(userId); var loadState = await GetUserLoadState(userId);
result = await GameAttrTool.CheckRoleLoadBuff(result, loadState); result = await GameAttrTool.CheckRoleLoadBuff(result, loadState);
result = await ReviseUserRoleAttr(result); result = await ReviseUserRoleAttr(result);
return result;
#endregion #endregion
return result; return result;
} }
catch (Exception e) catch (Exception e)
@@ -588,13 +586,15 @@ public class UnitUserAttrService(ISqlSugarClient DbClient, IRedisCache redis) :
var data = await redis.GetHashAsync<List<unit_user_state>>(key, userId); var data = await redis.GetHashAsync<List<unit_user_state>>(key, userId);
if (data == null) if (data == null)
{ {
long endTime = TimeExtend.GetTimeStampSeconds;
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_state>(); var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_state>();
data = await db.Queryable<unit_user_state>().Where(it => it.userId == userId && it.endTime > endTime) data = await db.Queryable<unit_user_state>().Where(it => it.userId == userId)
.ToListAsync(); .ToListAsync();
await redis.AddHashAsync(key, userId, data); await redis.AddHashAsync(key, userId, data);
} }
long endTime = TimeExtend.GetTimeStampSeconds;
data = data.FindAll(it => it.endTime > endTime);
return data; return data;
} }

View File

@@ -44,6 +44,11 @@ public class TradeController : ControllerBase
count = count < 1 ? 1 : count; count = count < 1 ? 1 : count;
string userId = StateHelper.userId; string userId = StateHelper.userId;
int areaId = StateHelper.areaId; int areaId = StateHelper.areaId;
if (price > 100000000000)
{
return PoAction.Message("最大单价不能超过10万金!");
}
int lev = await _attrService.GetUserLev(userId); int lev = await _attrService.GetUserLev(userId);
if (lev < 60) if (lev < 60)
{ {

View File

@@ -2,8 +2,8 @@
统一配置中心 统一配置中心
*/ */
export class BaseConfig { export class BaseConfig {
public static BaseUrl: string = 'https://localhost:7198' // public static BaseUrl: string = 'https://localhost:7198'
public static BaseMediaUrl: string = 'https://localhost:7198/' // public static BaseMediaUrl: string = 'https://localhost:7198/'
// public static BaseUrl:string="http://v3.pccsh.com"; public static BaseUrl:string="http://v3.pccsh.com";
// public static BaseMediaUrl:string="http://v3.pccsh.com"; public static BaseMediaUrl:string="http://v3.pccsh.com";
} }

View File

@@ -18,10 +18,12 @@
<div class="item border-btm" v-for="(item, index) in data" :key="index"> <div class="item border-btm" v-for="(item, index) in data" :key="index">
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}. {{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.
<span v-if="item.code == 'Equ'"> <span v-if="item.code == 'Equ'">
<Abar :href='"/trade/info?id=" + item.tradeId'>{{ item.name }}({{ item.price }}铜贝)</Abar> <Abar :href='"/trade/info?id=" + item.tradeId'>{{ item.name }}({{ GameTool.FormatCopper(item.price) }})
</Abar>
</span> </span>
<span v-else> <span v-else>
<Abar :href='"/prop/goods?id=" + item.propId'>{{ item.name }}({{ item.price }}铜贝)</Abar> <Abar :href='"/prop/goods?id=" + item.propId'>{{ item.name }}({{ GameTool.FormatCopper(item.price) }})
</Abar>
</span> </span>
[<Abutton @click="Buy(item)">购买</Abutton>] [<Abutton @click="Buy(item)">购买</Abutton>]
</div> </div>
@@ -36,7 +38,7 @@
<!-- 自定义内容 --> <!-- 自定义内容 -->
<div class="common"> <div class="common">
物品名称{{ showGoods.name }}<br> 物品名称{{ showGoods.name }}<br>
购买单价{{ showGoods.price }} 铜贝<br> 购买单价{{ GameTool.FormatCopper(showGoods.price) }}<br>
<span v-if="showGoods.code != 'Equ'"> <span v-if="showGoods.code != 'Equ'">
剩余数量{{ showGoods.count }} 剩余数量{{ showGoods.count }}
</span> </span>
@@ -88,6 +90,7 @@ const BindData = async (): Promise<void> => {
const Change = async (_type: string) => { const Change = async (_type: string) => {
type.value = _type; type.value = _type;
currentPage.value = 1;
await BindData(); await BindData();
} }

View File

@@ -6,10 +6,10 @@
<div class="item border-btm" v-for="(item, index) in data" :key="index"> <div class="item border-btm" v-for="(item, index) in data" :key="index">
{{ index + 1 }}.[{{ GetRankName(item.code) }}] {{ index + 1 }}.[{{ GetRankName(item.code) }}]
<span v-if="item.code == 'Equ'"> <span v-if="item.code == 'Equ'">
<Abar :href='"/trade/info?id=" + item.tradeId'>{{ item.name }}({{ item.price }}铜贝)</Abar> <Abar :href='"/trade/info?id=" + item.tradeId'>{{ item.name }}({{ GameTool.FormatCopper(item.price) }})</Abar>
</span> </span>
<span v-else> <span v-else>
<Abar :href='"/prop/goods?id=" + item.propId'>{{ item.name }}({{ item.price }}铜贝)</Abar> <Abar :href='"/prop/goods?id=" + item.propId'>{{ item.name }}({{ GameTool.FormatCopper(item.price) }})</Abar>
</span> </span>
(<Abutton @click="Down(item.tradeId)">下架</Abutton>)<br> (<Abutton @click="Down(item.tradeId)">下架</Abutton>)<br>
<span v-if="item.code != 'Equ'"> <span v-if="item.code != 'Equ'">

View File

@@ -6,10 +6,10 @@
<div class="item border-btm" v-for="(item, index) in data" :key="index"> <div class="item border-btm" v-for="(item, index) in data" :key="index">
{{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.[{{ GetRankName(item.code) }}] {{ PageExtend.GetPageIndex(currentPage, 10, index + 1) }}.[{{ GetRankName(item.code) }}]
<span v-if="item.code == 'Equ'"> <span v-if="item.code == 'Equ'">
<Abar :href='"/trade/info?id=" + item.tradeId'>{{ item.name }}({{ item.price }}铜贝)</Abar> <Abar :href='"/trade/info?id=" + item.tradeId'>{{ item.name }}({{ GameTool.FormatCopper(item.price) }})</Abar>
</span> </span>
<span v-else> <span v-else>
<Abar :href='"/prop/goods?id=" + item.propId'>{{ item.name }}({{ item.price }}铜贝)</Abar> <Abar :href='"/prop/goods?id=" + item.propId'>{{ item.name }}({{ GameTool.FormatCopper(item.price) }})</Abar>
</span> </span>
[<Abutton @click="Buy(item)">购买</Abutton>] [<Abutton @click="Buy(item)">购买</Abutton>]
</div> </div>
@@ -24,7 +24,7 @@
<!-- 自定义内容 --> <!-- 自定义内容 -->
<div class="common"> <div class="common">
物品名称{{ showGoods.name }}<br> 物品名称{{ showGoods.name }}<br>
购买单价{{ showGoods.price }} 铜贝<br> 购买单价{{ GameTool.FormatCopper(showGoods.price) }}<br>
<span v-if="showGoods.code != 'Equ'"> <span v-if="showGoods.code != 'Equ'">
剩余数量{{ showGoods.count }} 剩余数量{{ showGoods.count }}
</span> </span>

View File

@@ -46,7 +46,8 @@ const BindData = async () => {
if (result.code == 0) { if (result.code == 0) {
data.value = result.data.data; data.value = result.data.data;
unitExp.value = result.data.unitExp; unitExp.value = result.data.unitExp;
dupExp.value = result.data.dupExp; dupExp.value = result.data.dupExp;
console.log(result);
} }
else { else {
MessageExtend.ShowDialog("特性", result.msg); MessageExtend.ShowDialog("特性", result.msg);