private string GetShareFiles(HttpContext context) { string strJsonResult = string.Empty; string userAccount = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); Guid transactionid = Guid.NewGuid(); string funname = "GetShareFiles"; try { do { string urlcode = context.Request["code"]; string valcode = context.Request["valcode"]; DownResult arinfo = new DownResult(); BigAttachManager dll = new BigAttachManager(ClientIP); dll.GetShareFiles(transactionid, urlcode, valcode, ref arinfo, out strJsonResult); if (arinfo.error == "Unauthorized") { context.Response.StatusCode = 401; } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error($"File.ashx调用接口{funname}异常", context.Request.RawUrl, ex.ToString(), transactionid); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); } return(strJsonResult); }
public bool GetShareFiles( Guid transactionid, string urlcode, string valcode, ref DownResult resultinfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string paramstr = string.Empty; paramstr += $"urlcode:{urlcode}"; string funname = "GetShareFiles"; Guid userid = Guid.Empty; try { do { resultinfo = new DownResult(); BigAttachDBProvider Provider = new BigAttachDBProvider(); result = Provider.GetShareFiles(transactionid, urlcode, valcode, ref resultinfo, out error); if (result == true) { strJsonResult = JsonConvert.SerializeObject(resultinfo); LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), true, transactionid); result = true; break; } else { resultinfo.error = "302"; resultinfo.data = null; strJsonResult = JsonConvert.SerializeObject(resultinfo); LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(userid.ToString(), funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("BigAttachManager调用GetShareFiles异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
/// <summary> /// 一首歌曲下载好后创建通知 /// </summary> public static ToastNotification Done(string filename,DownResult res) { string result = ""; switch (res) { case DownResult.Su:result="下载成功"; break; case DownResult.Fa: result = "下载失败"; break; default:break; } XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); XmlNodeList elements = toastXml.GetElementsByTagName("text"); elements[0].AppendChild(toastXml.CreateTextNode("酷狗音乐UWP")); elements[1].AppendChild(toastXml.CreateTextNode("文件:"+filename+result)); ToastNotification toast = new ToastNotification(toastXml); return toast; }
/// <summary> /// 一首歌曲下载好后创建通知 /// </summary> public static ToastNotification Done(string filename, DownResult res) { string result = ""; switch (res) { case DownResult.Su: result = "下载成功"; break; case DownResult.Fa: result = "下载失败"; break; default: break; } XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); XmlNodeList elements = toastXml.GetElementsByTagName("text"); elements[0].AppendChild(toastXml.CreateTextNode("酷狗音乐UWP")); elements[1].AppendChild(toastXml.CreateTextNode("文件:" + filename + result)); ToastNotification toast = new ToastNotification(toastXml); return(toast); }