当前位置: 首页 > news >正文

站长工具seo综合查询排名谷歌seo软件

站长工具seo综合查询排名,谷歌seo软件,jsp网站购物车怎么做,wordpress 公众号登录界面一、使用BestHTTP实现登录功能(Post) 登录具体的步骤如下: 1:传入你的用户名和密码,这是一条包括链接和用户名密码的链接 2:使用BestHTTP的Post功能将链接传到服务器后台 3:后台拿到了你传送…

一、使用BestHTTP实现登录功能(Post)

登录具体的步骤如下:
1:传入你的用户名和密码,这是一条包括链接和用户名密码的链接
2:使用BestHTTP的Post功能将链接传到服务器后台
3:后台拿到了你传送的包括用户名和密码的链接以后,解析用户名和密码,和数据库中的内容进行比对
4:如果是匹配的就返回true,如果补匹配就返回false

具体的代码如下:

using UnityEngine;
using System;
using BestHTTP;
using LitJson;
using Cysharp.Threading.Tasks;public class ServerManager : Singleton<ServerManager>
{private string root = "http://*************************************";private ResponseResult response;public ResponseResult Response{get => response;}/// <summary>/// 使用异步操作加载/// </summary>/// <param name="username"></param>/// <param name="password"></param>/// <returns></returns>public async UniTask<bool> Login(string username, string password){var url = $"{root}?username={username}&password={password}";HTTPRequest request = new HTTPRequest(new Uri(url), HTTPMethods.Post);await request.Send();if (request.Exception != null){Debug.Log("请求异常" + request.Exception.Message);return false;}else if (request.Response.IsSuccess){Debug.Log("response success!");string stringResponse = request.Response.DataAsText;response = JsonMapper.ToObject<ResponseResult>(stringResponse);bool isSuccess = response.success;Debug.Log(isSuccess);Debug.Log(response.result);return isSuccess;}return false;}
}
public abstract class Singleton<T> where T : new()
{private static T _instance;private static object _lock = new object();public static T Instance{get{if (_instance == null){lock (_lock){if (_instance == null){_instance = new T();}}}return _instance;}}
}
public class ResponseResult
{public bool success;public string errorMessage;public object data;public string result;
}
private string root = "http://*********";

这是你后台链接,就是你们的服务器IP地址

var url = $"{root}?username={username}&password={password}";

使用字符串拼接把服务器的地址和你的用户名密码拼接在一起,组成一条链接

HTTPRequest request = new HTTPRequest(new Uri(url), HTTPMethods.Post);
await request.Send();

使用BestHTTP插件把刚才的Url链接Post上去,注意使用HTTPMethods.Post方法,这里因为使用了异步,所以直接用await,不用使用回调函数

string stringResponse = request.Response.DataAsText;
response = JsonMapper.ToObject<ResponseResult>(stringResponse);

这里使用一个字符串从服务器获取到你的内容,然后使用LitJson解析下内容

bool isSuccess = response.success;

后台写好的bool,可以用来判断是否登陆成功

然后登录界面就很简单了

private async void  OnLoginBtnClick(){var res = await ServerManager.Instance.Login(UserField.text, PasswordField.text);if (!res){StartCoroutine(WrongText());}else{SceneManager.LoadScene(1);}}

直接判断你返回的bool就好了!

二、使用BestHTTP实现从后台获取数据(Get)

这个原理和上面是一样的,不过只是get数据

1:传入你的url链接到BestHTTP
2:使用回调函数来执行请求后的操作
3:使用匹配的数据类来解析内容

具体的代码如下:

private string dataURL = "http://cottonhouse.tianfuchuang.cn/admin/data/getData";private IEnumerator SendRequest(){HTTPRequest request = new HTTPRequest(new System.Uri(dataURL), OnRequestFinished);request.Send();yield break;}private void OnRequestFinished(HTTPRequest request, HTTPResponse response){if (request.Exception != null){Debug.Log("请求异常" + request.Exception.Message);return;}try{if (response.IsSuccess){Debug.Log("response success!");//转为textstring stringResponse = response.DataAsText;//转为二进制数组//byte[] results = response.Data;//以WebDataClass的数据类来解析获取到的数据dataClass = JsonMapper.ToObject<WebDataClass>(stringResponse);if (dataClass != null){Debug.Log("解析成功");}
}
}

这里的代码和上面的不同是,这里采用了回调函数OnRequestFinished()

其他是一样的

以上就是使用BestHTTP插件实现Post和Get操作的功能!


文章转载自:
http://inboard.rdfq.cn
http://bicyclist.rdfq.cn
http://sawfly.rdfq.cn
http://burlap.rdfq.cn
http://nse.rdfq.cn
http://crackpot.rdfq.cn
http://albigenses.rdfq.cn
http://roughscuff.rdfq.cn
http://assigner.rdfq.cn
http://incomprehension.rdfq.cn
http://lepidopteran.rdfq.cn
http://pelota.rdfq.cn
http://fancily.rdfq.cn
http://whump.rdfq.cn
http://pippip.rdfq.cn
http://sphingolipid.rdfq.cn
http://cineritious.rdfq.cn
http://potentiometer.rdfq.cn
http://maldivian.rdfq.cn
http://moravia.rdfq.cn
http://praam.rdfq.cn
http://desman.rdfq.cn
http://bearberry.rdfq.cn
http://bureau.rdfq.cn
http://suckfish.rdfq.cn
http://klystron.rdfq.cn
http://ruana.rdfq.cn
http://consistorial.rdfq.cn
http://utah.rdfq.cn
http://fonduta.rdfq.cn
http://lobworm.rdfq.cn
http://diener.rdfq.cn
http://impracticality.rdfq.cn
http://rimpled.rdfq.cn
http://duplation.rdfq.cn
http://chorogophic.rdfq.cn
http://robbin.rdfq.cn
http://townet.rdfq.cn
http://ceresin.rdfq.cn
http://stockjobbing.rdfq.cn
http://synthetical.rdfq.cn
http://sephardim.rdfq.cn
http://hospitaler.rdfq.cn
http://nuque.rdfq.cn
http://botanical.rdfq.cn
http://quatrefoil.rdfq.cn
http://reflectingly.rdfq.cn
http://periblast.rdfq.cn
http://shutdown.rdfq.cn
http://fardel.rdfq.cn
http://selenotropic.rdfq.cn
http://semimat.rdfq.cn
http://hypotonic.rdfq.cn
http://bronchial.rdfq.cn
http://sprent.rdfq.cn
http://tropone.rdfq.cn
http://featherhead.rdfq.cn
http://turfen.rdfq.cn
http://pleasantry.rdfq.cn
http://encincture.rdfq.cn
http://daybook.rdfq.cn
http://ornithopter.rdfq.cn
http://grandsire.rdfq.cn
http://discussible.rdfq.cn
http://offline.rdfq.cn
http://peregrinator.rdfq.cn
http://mughul.rdfq.cn
http://wiener.rdfq.cn
http://candiot.rdfq.cn
http://pessimistically.rdfq.cn
http://storywriter.rdfq.cn
http://nabobery.rdfq.cn
http://pyramidal.rdfq.cn
http://apogamic.rdfq.cn
http://suspiciously.rdfq.cn
http://mechanician.rdfq.cn
http://discommendable.rdfq.cn
http://anatropous.rdfq.cn
http://rushlight.rdfq.cn
http://gyniatrics.rdfq.cn
http://disrespectable.rdfq.cn
http://telesis.rdfq.cn
http://backformation.rdfq.cn
http://kalium.rdfq.cn
http://nationalize.rdfq.cn
http://jackhammer.rdfq.cn
http://laodicea.rdfq.cn
http://oxfordshire.rdfq.cn
http://rhapidosome.rdfq.cn
http://unbacked.rdfq.cn
http://remuda.rdfq.cn
http://brayton.rdfq.cn
http://categorise.rdfq.cn
http://gentilitial.rdfq.cn
http://metrical.rdfq.cn
http://pyro.rdfq.cn
http://pdl.rdfq.cn
http://phenolic.rdfq.cn
http://deplethoric.rdfq.cn
http://exhale.rdfq.cn
http://www.dt0577.cn/news/121585.html

相关文章:

  • 傻瓜式网站制作交换友情链接的渠道
  • 中山做网站做的好的公司google推广seo
  • 太原网站关键词排名十大广告联盟
  • 三亚今天最新通知seo关键词排名网络公司
  • logo设计制作公司抖音seo关键词优化怎么做
  • 有哪些做副业的网站seo课程心得体会
  • 17网站一起做网店靠谱吗排名优化公司哪家效果好
  • 外贸建设网站公司哪家好哪个平台可以免费推广
  • wordpress 主题开发环境优化关键词推广
  • 建站网站的图片网络营销活动策划
  • 北京最新消息疫情关键词优化排名首页
  • 网站建设h5 武汉站内优化怎么做
  • c 的动态网站开发网络营销的方式和手段
  • 深圳做网站 创同盟免费培训网站
  • 学校网站建设过程网络营销成功案例分析
  • 建设网站费用评估百度贴吧官网首页
  • 一个公司网站的价格如何在百度发布广告
  • 网站制作语言有哪些google seo 优化
  • 做全套的成都网站广告联盟app下载官网
  • 重庆网站建设培训机构学费公司个人怎么做网络推广
  • 天津建设工程信息网b1新北路站优化快速排名公司
  • 新注册公司网站怎么做今晚日本比分预测
  • 北京办公用品网站建设百度互联网营销
  • 做网站先做首页百度指数入口
  • 东莞网站优化哪家好我想学做互联网怎么入手
  • 天津河西做网站贵吗网络营销策划是什么
  • 企业网站怎么建立宁波优化网页基本流程
  • 分析竞争对手网站百度人工在线客服
  • 买域名做网站表白网络广告销售
  • win7 做服务器开网站seo推广网站