using Newtonsoft.Json; using System.Collections; using System.Collections.Generic; using System.Threading.Tasks; using UnityEngine; public class BuyGoodId42 : MonoBehaviour { public async Task buyGoodId(int cutePoolId) // 4.2 { // 准备请求的头部信息,包含授权令牌 Dictionary head41 = new Dictionary { { "Authorization", Global.global.serverResponse.data.token } }; // 请求体 BuyGoodIdBody buyGoodIdBody = new BuyGoodIdBody { userId = Global.global.serverResponse.data.userId, cutePoolId = cutePoolId }; // 异步发送请求 Debug.Log("======入参======" + JsonConvert.SerializeObject(buyGoodIdBody)); string response42 = await web.SendRequest(web.URL + "/snail/cutePool/buy", "POST", JsonConvert.SerializeObject(buyGoodIdBody), head41); // 调试输出接收到的响应 Debug.Log("4.2购买靓号==" + response42); // 将响应反序列化为对象 BuyGoodIdResponse buyGoodIdResponse = JsonConvert.DeserializeObject(response42); // Debug.Log("8==================================D" + buyGoodIdResponse.Data.TotalCount); return buyGoodIdResponse; } }