unity 对接 后台登录(http)

 BestHTTPBestHTTPBestHTTP-C#文档类资源-CSDN文库

using BestHTTP;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HttpTest : MonoBehaviour
{
    public string URL = "http://10.0.0.88:6001";
    void Start()
    {
        Login_UserPwd((s) => {
            Debug.Log(s);
        });
    }

    public void Login_UserPwd( Action<string> callback)
    {
        HttpBase.POST(URL + "/cumt/login", new KeyValuePair<string, string>[]
        {
            new KeyValuePair<string, string>("username", "student"), new KeyValuePair<string, string>("password", "000000"), new KeyValuePair<string, string>("softName", "Road_Risk"),new KeyValuePair<string, string>("areaNo", "4151012761")
        }, ((request, response) =>
        {
            if (response.IsSuccess)
            {
                if (callback != null)
                {
                    callback(response.DataAsText.Trim());
                }
            }
            else
            {
                if (callback != null)
                {
                    callback("Error");
                }
            }
            response.Dispose();
        }));
    }
}

猜你喜欢

转载自blog.csdn.net/qq_37524903/article/details/127103153
今日推荐