Exemple #1
0
    IEnumerator Submit()
    {
        //Form
        WWWForm form = new WWWForm();

        form.AddField("plat", inputField[0].text);
        form.AddField("category", inputField[1].text);

        UnityWebRequest www = UnityWebRequest.Post("http://pkm-tol.herokuapp.com/public/api/vahicle/12", form);

        www.SendWebRequest();
        Debug.Log(Session.GetInstance().Id);

        //Waiting Upload
        while (www.isDone == false)
        {
            Debug.Log("Menuggu Upload");
            yield return(www);

            Debug.Log(www.ToString());
        }

        //Belum Selesai Download
        if (www.downloadHandler.isDone == false)
        {
            Debug.Log("Menunggu Download");
            yield return(www);

            Debug.Log(www.downloadHandler.text);
            //exeption.text = www.downloadHandler.text;
        }

        if (www.error == null)
        {
            //Query Selesai
            Debug.Log("Selesai");
            Debug.Log(www.downloadHandler.text);

            string json   = www.downloadHandler.text;
            PlatID myPlat = new PlatID();
            myPlat = JsonUtility.FromJson <PlatID>(json);
            Debug.Log(myPlat.id);

            Session.GetInstance().Id = myPlat.id;
            PlayerPrefs.SetString("PlatID", myPlat.id);
            Debug.Log(Session.GetInstance().Id);
        }
        else
        {
            Debug.Log(www.error);
        }
    }
Exemple #2
0
        protected void GetQueryString()
        {
            HeadControl1.IsPlatSingle = true;
            HeadControl1.IsHasNoPlat  = false;
            HeadControl1.IsSoftSingle = true;

            HeadControl1.HiddenTime    = true;
            HeadControl1.MySupportSoft = AvailableSofts;
            //其他页面传递过来
            if (HeadControl1.IsFirstLoad && string.IsNullOrEmpty(Request["inputsoftselect"]))
            {
                SoftID         = CookieSoftid;
                PlatID         = CookiePlatid;
                EndTimeForHour = UtilityService.GetInstance().GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.Daily, ReportType.SoftUserForHour, CacheTimeOption.TenMinutes);
                EndTime        = UtilityService.GetInstance().GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.Daily, ReportType.UserUseNewActivity, CacheTimeOption.TenMinutes);
                BeginTime      = EndTime.AddDays(-30);
            }


            //用户选择模式
            else
            {
                if (!string.IsNullOrEmpty(Request["inputsoftselect"]) && !string.IsNullOrEmpty(Request["inputplatformselect"]))
                {
                    PlatID = Convert.ToInt32(Request["inputplatformselect"]);
                    SoftID = Convert.ToInt32(Request["inputsoftselect"]);
                }
                else
                {
                    PlatID = Convert.ToInt32(HeadControl1.PlatID);
                    SoftID = Convert.ToInt32(HeadControl1.SoftID);
                }
                EndTimeForHour = UtilityService.GetInstance().GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.Daily, ReportType.SoftUserForHour, CacheTimeOption.TenMinutes);
                EndTime        = UtilityService.GetInstance().GetMaxTimeCache(net91com.Stat.Core.PeriodOptions.Daily, ReportType.UserUseNewActivity, CacheTimeOption.TenMinutes);
                BeginTime      = EndTime.AddDays(-30);
                SetRequestCookie(SoftID, PlatID);
            }

            HeadControl1.SoftID = SoftID.ToString();
            HeadControl1.PlatID = PlatID.ToString();
            //设置时段的时间和 最近30日的时间
            DateTimeFor30      = EndTime.Date.ToShortDateString();
            DateTimeSpan       = EndTimeForHour.Date.ToShortDateString();
            DateTimeFor30Begin = BeginTime.ToShortDateString();
        }