| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class WebRequestBackgroundData
- {
- //体验流水数据
- public static string flowData = WebRequestBackgroundPrefix.WebRequestPrefixData + "/api/product-data-access/evaluate-flow-data/add";
- //软件编码
- public static string softwareCode = "ZWN_SW_UNITY_LLK_001";
- //token
- public static string tokenData = "";
- //public static string tokenData = "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ6ZWV3YWluIiwidXNlcklkIjoyNzUwMDUyNDUzMDA5ODE4MywidXNlckNvZGUiOiJ6d25fMjc1MDA1MjQ1MzAwOTgxODQiLCJleHBpcmVUaW1lIjoxNjQzODYwNTYzNTYwLCJleHAiOjE2NDM4NjA1NjN9.OBj7a5AxqtGThiaKOzez78pRsgUPeObdZMt1ESwkr4c";
- //Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ6ZWV3YWluIiwidXNlcklkIjoyNzUwMDUyNDUzMDA5ODE4MywidXNlckNvZGUiOiJ6d25fMjc1MDA1MjQ1MzAwOTgxODQiLCJleHBpcmVUaW1lIjoxNjQzODYwNTYzNTYwLCJleHAiOjE2NDM4NjA1NjN9.OBj7a5AxqtGThiaKOzez78pRsgUPeObdZMt1ESwkr4c
- // todo: For Project LinkGame 需要移出去
- /// <summary>
- /// 发送服务器数据和接收游戏总时长
- /// </summary>
- /// <param name="correctRate">准确率</param>
- /// <param name="experienceTime">体验时长,单位(秒)</param>
- /// <param name="focusResult">专注评价</param>
- /// <param name="gameLevel">课件关卡</param>
- /// <param name="reactionResult">反应评价</param>
- /// <param name="sportResult">运动评价</param>
- /// <returns></returns>
- public static int GetFlowData(string correctRate, int experienceTime, string focusResult, int gameLevel,string reactionResult, string sportResult)
- {
- string stateUrl = flowData;
- string softwareCode = WebRequestBackgroundData.softwareCode;
- string heraddata = tokenData;
- int gameTotalduration = 0;
- string requestJson = string.Format(@"{{""correctRate"":""{0}"",""experienceTime"":{1},""focusResult"":""{2}"",""gameLevel"":{3},""reactionResult"":""{4}"",""softwareCode"":""{5}"",""sportResult"":""{6}""}}",
- correctRate, experienceTime, focusResult, gameLevel, reactionResult, softwareCode, sportResult);
- if (string.IsNullOrEmpty(heraddata)) { }
- else
- {
- HttpWebRequsetManger.SendHttpData(heraddata, stateUrl, requestJson, (string data) =>
- {
- JsonBackgroundFlowData jsonEmpowerData = ReadJosn.LoadJson<JsonBackgroundFlowData>(data);
- if (jsonEmpowerData.code == 0)
- {
- gameTotalduration = jsonEmpowerData.data.evaluateTime / 60;
- }
- else
- {
- Debug.Log("code不为0 message" + jsonEmpowerData.message);
- }
- });
- }
- return gameTotalduration;
- }
- }
|