public void GetExchangeRecord(uint uid, uint pageIndex, uint pageSize, DateTime dt, string key, Action <BS_MoneyRecord> result) { //string url = GameApp.GameData.BackStorgeUrl + "/ProxyHandler/User.ashx?action=getrecharge"; string url = GameApp.GameData.BackStorgeUrl + GlobalConst.URL.GetRecord; var req = new BS_MoneyRecordRequest(); req.Url = url; req.OrderTime = dt; req.PageSize = pageSize; req.PageIndex = pageIndex; req.UserID = uid; req.Result = result; req.OrderType = 201; req.Key = key; StartCoroutine("GetRechargeOrExchangeRecord", req); }
public IEnumerator GetRechargeOrExchangeRecord(BS_MoneyRecordRequest req) { var data = new WWWForm(); data.AddField("UserID", req.UserID.ToString()); data.AddField("currentPageIndex", req.PageIndex.ToString()); data.AddField("pageSize", req.PageSize.ToString()); data.AddField("date", req.OrderTime.ToString("yyyyMMdd")); data.AddField("OrderType", req.OrderType.ToString()); data.AddField("token", req.Key); float elapsedTime = 0.0f; var www = new WWW(req.Url, data); yield return(www); while (!www.isDone) { elapsedTime += Time.deltaTime; if (elapsedTime >= TIMEOUT) { break; } yield return(new WaitForFixedUpdate()); } if (!string.IsNullOrEmpty(www.error) || string.IsNullOrEmpty(www.text)) { req.Result(null); yield break; } var records = JsonMapper.ToObject <BS_MoneyRecord>(www.text); req.Result(records); yield break; }