2024-12-01 23:17:54 +08:00
|
|
|
|
using Newtonsoft.Json;
|
2024-12-09 12:00:50 +08:00
|
|
|
|
using System;
|
2024-12-01 23:17:54 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
//9.2,查询我的工厂未绑定的蜗牛数:
|
|
|
|
|
public class queryUserSnailCount : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
public async Task<UserSnail> QueryUserSnailCount() // 9.1
|
|
|
|
|
{
|
|
|
|
|
// 准备请求的头部信息,包含授权令牌
|
|
|
|
|
Dictionary<string, string> head = new Dictionary<string, string>
|
|
|
|
|
{
|
|
|
|
|
{ "Authorization", Global.global.serverResponse.data.token }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 异步发送请求以获取最新的蜗牛骑士信息
|
|
|
|
|
string response92 = await web.SendRequest(web.URL + "/snail/factory/queryUserSnailCount", "POST", "{}", head);
|
|
|
|
|
|
|
|
|
|
// 调试输出接收到的响应
|
|
|
|
|
Debug.Log("9.2查询我的工厂未绑定的蜗牛数" + response92);
|
|
|
|
|
|
|
|
|
|
// 将响应反序列化为对象
|
|
|
|
|
UserSnail userSnail = JsonConvert.DeserializeObject<UserSnail>(response92);
|
2024-12-09 12:00:50 +08:00
|
|
|
|
|
2024-12-01 23:17:54 +08:00
|
|
|
|
// 返回解析后的对象
|
|
|
|
|
return userSnail;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//==========返回=====================================================================
|
|
|
|
|
//返回参数:code:200,成功
|
|
|
|
|
// message:成功,提示语
|
|
|
|
|
// data:空闲蜗牛的数组,这里取数组的长度即可,最大渲染10只蜗牛
|
|
|
|
|
// id:Long,蜗牛的id
|
2024-12-09 12:00:50 +08:00
|
|
|
|
public class UserSnail:Response
|
|
|
|
|
{
|
|
|
|
|
public List<UserSnailData> data { get; set; } // 用于存储数据列表
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class UserSnailData
|
|
|
|
|
{
|
|
|
|
|
public int id { get; set; } // id
|
|
|
|
|
public int userId { get; set; } // userId
|
|
|
|
|
public int orderId { get; set; } // orderId
|
|
|
|
|
public int slotId { get; set; } // slotId
|
|
|
|
|
public int source { get; set; } // source
|
|
|
|
|
public string exchangeCode { get; set; } // exchangeCode
|
|
|
|
|
public string workBegin { get; set; } // workBegin
|
|
|
|
|
public string workEnd { get; set; } // workEnd
|
|
|
|
|
public string workNow { get; set; } // workNow
|
|
|
|
|
public int settle { get; set; } // settle
|
|
|
|
|
public int status { get; set; } // status
|
|
|
|
|
public string createTime { get; set; } // createTime
|
|
|
|
|
public string updateTime { get; set; } // updateTime
|
|
|
|
|
}
|
|
|
|
|
/*public class UserSnail : Response
|
2024-12-01 23:17:54 +08:00
|
|
|
|
{
|
|
|
|
|
public List<UserSnailData> data;
|
|
|
|
|
}
|
|
|
|
|
public class UserSnailData
|
|
|
|
|
{
|
|
|
|
|
public long snailId;
|
2024-12-09 12:00:50 +08:00
|
|
|
|
}*/
|