/// <summary> /// 帐号,密码登陆app /// </summary> /// <param name="userName"></param> /// <param name="pwd"></param> /// <param name="device"></param> /// <param name="platform"></param> /// <param name="loginActionCallBack"></param> /// <returns></returns> public bool LoginToApp(string userName, string pwd, Action <int> loginActionCallBack = null) { _loginActionCallBack = loginActionCallBack; if (string.IsNullOrEmpty(userName)) { PromptManager.Instance.MessageBox(PromptManager.Type.FloatingTip, "用户名不能为空"); _loginActionCallBack.Invoke(2); return(false); } if (string.IsNullOrEmpty(pwd)) { PromptManager.Instance.MessageBox(PromptManager.Type.FloatingTip, "密码不能为空"); _loginActionCallBack.Invoke(2); return(false); } //btn_login.enabled = false; _userName = userName; _pwd = pwd; PlayerPrefs.SetString("user_cache_name", _userName); PlayerPrefs.SetString("user_cache_pwd", _pwd); JsonData rpcObj = new JsonData(); rpcObj["clientDate"] = SnapHttpManager.GetTimeStamp(); rpcObj["username"] = userName; rpcObj["password"] = pwd; rpcObj["version"] = MiscUtils.GetVersion(); rpcObj["device"] = SystemInfo.deviceType.ToString(); rpcObj["platform"] = SystemInfo.operatingSystem; rpcObj["deviceNew"] = SystemInfo.deviceType.ToString(); rpcObj["gameDeviceID"] = SelfPlayerData.DeviceID; SnapAppApi.Request_SnapAppApi(SnapAppApiInterface.Request_LoginApp, SnapHttpConfig.NET_REQUEST_POST, rpcObj, onLoginRequestFinish); return(true); }
/// <summary> /// 把本地文件上传到oss,默认为根据头文件进行上传 /// </summary> /// <param name="filePath"></param> /// <param name="uploadType"></param> /// <param name="resultAction"></param> public void PutObjectFileToOSS(string filePath, Action <string> resultAction = null) { _resultAction = resultAction; string[] arr = filePath.Split('.'); string[] arr2 = arr[0].ToString().Split('/'); string fileExtType = arr[1]; //game / upload /{ YYYYMMdd}/{ user_uuid}/{ timestamp}.mp3 int index = 0; if (DebugConfigController.Instance.FormalData) { // 正式服 index = 1; } UploadOSSPathHeader = ConfigurationController.Instance.OSSListGamePaths[index] + "/"; UploadOSSPathHeader += DateTime.UtcNow.ToString("yyyyMMdd") + "/" + SelfPlayerData.Uuid + "/" + SnapHttpManager.GetTimeStamp(); if (fileExtType == "txt" || fileExtType == "json" || fileExtType == "xml") { _filePath = filePath; fileUploadKey = UploadOSSPathHeader + "." + arr[1]; _fileExtType = 0; GetFileKey(() => { PutObjectWithHeader(_resultAction); }); } else if (fileExtType == "mp3" || fileExtType == "wav") { fileUploadKey = UploadOSSPathHeader + ".mp3"; _fileExtType = 1; //wav to mp3 string mp3FileName = arr2[arr2.Length - 1] + ".mp3"; string mp3FilePath = ""; for (int i = 0; i < arr2.Length - 1; i++) { mp3FilePath += arr2[i] + "/"; } mp3FilePath = mp3FilePath.Substring(0, mp3FilePath.Length - 1); _filePath = Path.Combine(mp3FilePath, mp3FileName); WaveToMP3(filePath, _filePath, LAMEPreset.ABR_128); } }