Files
g.hnyhua.cn/Mtxfw.VipSite/pay/qiniunotifyUrl.aspx.cs
2026-02-07 15:48:27 +08:00

130 lines
6.0 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Xml;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Script.Serialization;
namespace Mtxfw.shop
{
public partial class qiniunotifyUrl : System.Web.UI.Page
{
DAL.user_info daoUser = new DAL.user_info();
DAL.order_info daoorder = new DAL.order_info();
DAL.user_Results daoResults = new DAL.user_Results();
DAL.user_Results_jl2 daojl2 = new DAL.user_Results_jl2();
DAL.order_product_info daoorderproduct = new DAL.order_product_info();
Utility.Config config0 = new Utility.Config("");
DAL.Article daoArt = new DAL.Article();
DAL.user_live daolive = new DAL.user_live();
DAL.user_proxy daoproxy = new DAL.user_proxy();
DAL.user_jjfp daojjfp = new DAL.user_jjfp();
DAL.P_Product daoProduct = new DAL.P_Product();
DAL.P_Guige daoGuige = new DAL.P_Guige();
int gtype = 0;
public string APIv3key = "";
protected void Page_Load(object sender, EventArgs e)
{
try
{
string hostname = Request.Url.Host;
byte[] bytes = Request.BinaryRead(Request.ContentLength);
string strRequest = System.Text.Encoding.UTF8.GetString(bytes);
Utility.Common.WriteHtml("/weixin/qiniunotifyUrl.txt", strRequest);
qiniu_returns qr = (qiniu_returns)Fromqiniu_returnsJson(strRequest);
if (qr.code == 0)
{
DataSet gds = daoArt.GetList("thumb_media_id='" + qr.id + "' Order By id asc");
if (gds.Tables[0].Rows.Count > 0)
{
int id = int.Parse(gds.Tables[0].Rows[0]["id"].ToString());
int ParentID = int.Parse(gds.Tables[0].Rows[0]["ParentID"].ToString());
if (ParentID == 19)
{
Mtxfw.Model.Article amodel = daoArt.GetModel(id);
if (amodel != null)
{
string strContent = amodel.Content;
Regex R = new Regex("<source src=\"([\\S\\s\\t\\n]*?)\" type=\"video/mp4\"/>");
Match M = R.Match(strContent);
if (M.Success)
{
string strResult0 = M.Groups[1].ToString();
if (strResult0.IndexOf("https://fv.pmhapp.cn/") != -1)
{
string pic = amodel.Content.Replace("http://fv.klx2024.com/", "");
// 空间名
string Bucket = config0.qiniuScope;
// 文件名
string Key = pic;
Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config0.qiniuAccessKey, config0.qiniuSecretKey);
Qiniu.Storage.Config config = new Qiniu.Storage.Config();
config.Zone = Qiniu.Storage.Zone.ZONE_CN_South;
Qiniu.Http.HttpResult deleteRet = new Qiniu.Storage.BucketManager(mac, config).Delete(Bucket, Key);
if (deleteRet.Code != (int)Qiniu.Http.HttpCode.OK)
{
}
}
}
}
}
else
{
string tps = gds.Tables[0].Rows[0]["Paths"].ToString();
if (tps.IndexOf("https://fv.pmhapp.cn/mdavideo/") != -1)
{
Mtxfw.Model.Article amodel = daoArt.GetModel(id);
if (amodel != null)
{
amodel.Paths = tps.Replace("mdavideo/", "mdadvideo/");
daoArt.Update(amodel);
string pic = tps.Replace("http://fv.klx2024.com/", "");
// 空间名
string Bucket = config0.qiniuScope;
// 文件名
string Key = pic;
Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config0.qiniuAccessKey, config0.qiniuSecretKey);
Qiniu.Storage.Config config = new Qiniu.Storage.Config();
config.Zone = Qiniu.Storage.Zone.ZONE_CN_South;
Qiniu.Http.HttpResult deleteRet = new Qiniu.Storage.BucketManager(mac, config).Delete(Bucket, Key);
if (deleteRet.Code != (int)Qiniu.Http.HttpCode.OK)
{
}
}
}
}
}
gds.Clear();
}
}
catch (Exception err)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/qiniunotifyUrlerr.txt", err.ToString());
}
}
public object Fromqiniu_returnsJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize<qiniu_returns>(json);
}
}
public class qiniu_returns
{
public int code { get; set; }
public String id { get; set; }
}
}