_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/MallSystem2/productInfo22.cs

54 lines
1.8 KiB
C#
Raw Normal View History

2024-11-27 19:07:04 +08:00
using Newtonsoft.Json;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
public class productInfo22 : MonoBehaviour
{
//public async Task<MallResponsePro> getMallList(int productType, int pageNo, int pageSize)
public async Task<getProductResponse> productInfo(int productId)
{
// ׼<><D7BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><C8A8><EFBFBD><EFBFBD>
Dictionary<string, string> head22 = new Dictionary<string, string>
{
{ "Authorization", Global.global.serverResponse.data.token }
};
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
getProdectBody getProdectBody = new getProdectBody
2024-11-28 05:52:04 +08:00
{
2024-11-27 19:07:04 +08:00
productId = productId,
};
Debug.Log("====<3D><><EFBFBD><EFBFBD>====" + JsonConvert.SerializeObject(getProdectBody));
// <20><EFBFBD><ECB2BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2024-11-28 05:52:04 +08:00
string response22 = await web.SendRequest(web.URL + "/snail/product/info", "POST", JsonConvert.SerializeObject(getProdectBody), head22);
2024-11-27 19:07:04 +08:00
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ӧ
2024-11-28 05:52:04 +08:00
Debug.Log("2.2<EFBFBD><EFBFBD>Ʒ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>:=============== " + response22);
2024-11-27 19:07:04 +08:00
getProductResponse getProductResponse1 = new getProductResponse();
try
{
// <20><> JSON <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>Ϊ MallResponse <20><><EFBFBD><EFBFBD>
getProductResponse1 = JsonConvert.DeserializeObject<getProductResponse>(response22);
// <20>пգ<D0BF><D5A3><EFBFBD><EFBFBD>ȼ<EFBFBD><C8BC><EFBFBD> getProductResponse <20><> getProductResponse.data <20>Ƿ<EFBFBD>Ϊ null
2024-11-28 05:52:04 +08:00
if (getProductResponse1 != null && getProductResponse1.Data != null && getProductResponse1.Data != null)
2024-11-27 19:07:04 +08:00
{
2024-11-28 05:52:04 +08:00
Debug.Log("8=========D"+getProductResponse1.Data.ProductId);
2024-11-27 19:07:04 +08:00
}
else
{
Debug.LogWarning("<22><>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>Ϊ<EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>");
}
}
catch (Exception ex)
{
Debug.LogError("<22><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD>Ӧʧ<D3A6><CAA7>: " + ex.Message);
}
return getProductResponse1;
}
}