12121
This commit is contained in:
12
Service/Application.Domain.Entity/model/MapBusTo.cs
Normal file
12
Service/Application.Domain.Entity/model/MapBusTo.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Application.Domain.Entity;
|
||||
|
||||
public class MapBusTo
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string mapId { get; set; }
|
||||
public string code { get; set; }
|
||||
public string par { get; set; }
|
||||
public int time { get; set; }
|
||||
public int sTime { get; set; }
|
||||
public int eTime { get; set; }
|
||||
}
|
||||
@@ -57,8 +57,8 @@ namespace Application.Domain.Entity
|
||||
/// <summary>
|
||||
/// busNeed
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string? busNeed { get; set; }
|
||||
[SugarColumn(IsNullable = true, IsJson = true)]
|
||||
public List<TowerNeed> busNeed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// busContent
|
||||
|
||||
@@ -198,6 +198,7 @@ public static class GameBus
|
||||
item.onCount = MyLev;
|
||||
if (MyLev < item.count)
|
||||
{
|
||||
item.isAsk = 0;
|
||||
isok = false;
|
||||
}
|
||||
}
|
||||
|
||||
105
Service/Application.Web/Controllers/Map/MapBusController.cs
Normal file
105
Service/Application.Web/Controllers/Map/MapBusController.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Application.Web.Controllers.Map;
|
||||
|
||||
[ApiExplorerSettings(GroupName = "Map")]
|
||||
[Route("Map/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[Authorize]
|
||||
public class MapBusController : ControllerBase
|
||||
{
|
||||
private readonly IGameMapService _mapService;
|
||||
|
||||
public MapBusController(IGameMapService mapService)
|
||||
{
|
||||
_mapService = mapService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取业务信息
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> GetBusiness(int id)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var busData = await _mapService.GetMapBusInfo(id);
|
||||
if (busData == null)
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
var onMap = await _mapService.GetUserOnMapId(userId);
|
||||
if (busData.busCode != onMap)
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
||||
return PoAction.Ok(new { data = busData, result = checkResult });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 传送
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="num"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task<IPoAction> MapBusTo(int id, int num)
|
||||
{
|
||||
string userId = StateHelper.userId;
|
||||
var busData = await _mapService.GetMapBusInfo(id);
|
||||
if (busData == null)
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
if (busData.busType != "ToMap")
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
|
||||
var toData = JsonConvert.DeserializeObject<List<MapBusTo> >(busData.busContent);
|
||||
if (num > (toData.Count - 1))
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
var onMap = await _mapService.GetUserOnMapId(userId);
|
||||
if (busData.busCode != onMap)
|
||||
{
|
||||
return PoAction.Message("业务不存在!");
|
||||
}
|
||||
var mapToData = toData[num];
|
||||
if (TimeAssist.GetHourNum < mapToData.sTime || TimeAssist.GetHourNum > mapToData.eTime)
|
||||
{
|
||||
return PoAction.Message($"当前时间不允许进入");
|
||||
}
|
||||
|
||||
var checkResult = await GameBus.CheckNeed(userId, busData.busNeed, 1);
|
||||
if (checkResult.result==false)
|
||||
{
|
||||
return PoAction.Message("不满足传送要求!");
|
||||
}
|
||||
|
||||
|
||||
if (await GameBus.UpdateBag(userId, 0, busData.busNeed, "业务传送"))
|
||||
{
|
||||
var ResultMap = await _mapService.GetToMapInfo(userId, mapToData.mapId, true, true);
|
||||
if (ResultMap != null)
|
||||
{
|
||||
return PoAction.Ok(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("操作失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return PoAction.Message("操作失败,请稍后尝试!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"AutoProgram": 1,
|
||||
"AutoProgram": 0,
|
||||
"Redis": {
|
||||
"connection": "127.0.0.1:6379,password=,defaultdatabase=5"
|
||||
},
|
||||
|
||||
@@ -1 +1,70 @@
|
||||
<template></template>
|
||||
<template>
|
||||
<div class="content" style="font-size: 16px;">
|
||||
{{ data.busTips }}
|
||||
</div>
|
||||
<div class="content" v-if="data.busType == 'ToMap'">
|
||||
<div class="common" v-if="needs.length > 0">
|
||||
传送要求:<br>
|
||||
<GamePropVerify :data="verifyData.needs"></GamePropVerify>
|
||||
</div>
|
||||
<div class="common" v-if="verifyData.result">
|
||||
<div class="item" v-for="(item, index) in content" :key="index">
|
||||
➢<Abutton @click="MapTo(index)">{{ item.name }}</Abutton>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content" v-if="data.busType == 'Box'">
|
||||
222
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
|
||||
definePageMeta({
|
||||
layout: layout.default,
|
||||
middleware: 'page-loading'
|
||||
})
|
||||
const data = ref<any>({});
|
||||
const verifyData = ref<any>({});
|
||||
const needs = ref<Array<any>>([]);
|
||||
const content = ref<Array<any>>([]);
|
||||
let busId = PageExtend.QueryString("id");
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await BindData();
|
||||
}
|
||||
finally {
|
||||
PageLoading.Close();
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
const BindData = async (): Promise<void> => {
|
||||
let result = await MapBusService.GetBusiness(Number(busId));
|
||||
if (result.code == 0) {
|
||||
data.value = result.data.data;
|
||||
verifyData.value = result.data.result;
|
||||
needs.value = verifyData.value.needs;
|
||||
content.value = JSON.parse(data.value.busContent);
|
||||
console.log(result.data);
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowDialogEvent("提示", result.msg, () => {
|
||||
PageExtend.Redirect("/map");
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const MapTo = async (index: number) => {
|
||||
MessageExtend.LoadingToast("传送中...");
|
||||
let result = await MapBusService.MapBusTo(Number(busId), index);
|
||||
MessageExtend.LoadingClose();
|
||||
if (result.code == 0) {
|
||||
PageExtend.RedirectTo("/map");
|
||||
}
|
||||
else {
|
||||
MessageExtend.ShowToast(result.msg);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="content">
|
||||
<Abar href="/user/maxname">更换称号</Abar><br>
|
||||
ID:{{ userData.userNo }} [<Abar href="/privilege/liang">升靓号</Abar>]<br>
|
||||
ID:{{ userData.userNo }} <br>
|
||||
昵称:<Abar href="/user/nick">{{ userData.nick }}</Abar><br>
|
||||
性别:<Abar href="/user/sex">{{ userData.sex }}</Abar><br>
|
||||
<Abar href="/privilege/">特权</Abar>:<br>
|
||||
|
||||
17
Web/src/services/map/MapBusService.ts
Normal file
17
Web/src/services/map/MapBusService.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export class MapBusService {
|
||||
/**
|
||||
* 获取业务信息
|
||||
* GET /Map/MapBus/GetBusiness
|
||||
*/
|
||||
static async GetBusiness(id: number) {
|
||||
return await ApiService.Request("get", "/Map/MapBus/GetBusiness", { id });
|
||||
}
|
||||
|
||||
/**
|
||||
* 传送
|
||||
* GET /Map/MapBus/MapBusTo
|
||||
*/
|
||||
static async MapBusTo(id: number, num: number) {
|
||||
return await ApiService.Request("get", "/Map/MapBus/MapBusTo", { id, num });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user