代码修改后的版本,全部提交
This commit is contained in:
286
Mtxfw.VipSite/Admin_Member_gong.aspx.cs
Normal file
286
Mtxfw.VipSite/Admin_Member_gong.aspx.cs
Normal file
@@ -0,0 +1,286 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Security.Cryptography;
|
||||
using TencentCloud.Common;
|
||||
using TencentCloud.Common.Profile;
|
||||
using TencentCloud.Vod.V20180717;
|
||||
using TencentCloud.Vod.V20180717.Models;
|
||||
namespace Mtxfw.VipSite
|
||||
{
|
||||
public partial class Admin_Member_gong : Mtxfw.Utility.MemberBase
|
||||
{
|
||||
public Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
|
||||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
string hostname = Request.Url.Host;
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
if (Session["IFPassword"] == null)
|
||||
{
|
||||
Response.Redirect("/Member_IFPassword.aspx?Url=/Admin_Member_gong.aspx");
|
||||
}
|
||||
if (IFStores != 1)
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||||
}
|
||||
if (MemberJS.IndexOf("视频管理") == -1)
|
||||
{
|
||||
Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx");
|
||||
}
|
||||
Data_Bind();
|
||||
Page.Title = "释放流量积分视频管理 - " + GetWebName;
|
||||
}
|
||||
|
||||
MyPager.PageChanged += delegate(object s, EventArgs ex)
|
||||
{
|
||||
Data_Bind();
|
||||
};
|
||||
}
|
||||
|
||||
protected void Data_Bind()
|
||||
{
|
||||
MyPager.PageSize = 50;
|
||||
MyPager.RecordCount = daoArt.GetCount("gtype=0 and ParentID=18");
|
||||
if (MyPager.RecordCount == 0)
|
||||
{
|
||||
MyPager.Visible = false;
|
||||
}
|
||||
Mtxfw.Utility.Tools.ToBind(Repeater1, daoArt.GetPager(MyPager, "(Select Count(b.id) From Article b Where b.parentid=30 And b.senderid=a.id) as ACount,", "gtype=0 and ParentID=18 Order by LinkID desc"));
|
||||
}
|
||||
protected void Delete_Click(object s, CommandEventArgs ex)
|
||||
{
|
||||
Int32 ID = int.Parse(ex.CommandName);
|
||||
Mtxfw.Model.Article model = daoArt.GetModel(ID);
|
||||
if (model != null)
|
||||
{
|
||||
if (model.Paths2 != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
// 必要步骤:
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户密钥对 SecretId,SecretKey。
|
||||
// 本示例采用从环境变量读取的方式,则需要在环境变量中先设置这两个值。
|
||||
// 您也可以直接将密钥对写入代码中,但是注意不要复制、上传或分享代码,以免泄露密钥对危及您的财产安全。
|
||||
Credential cred = new Credential
|
||||
{
|
||||
SecretId = config.AccessKeyId,
|
||||
SecretKey = config.AccessKeySecret
|
||||
};
|
||||
|
||||
// 实例化一个 client 选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
// 指定签名算法(默认为 HmacSHA256)
|
||||
clientProfile.SignMethod = ClientProfile.SIGN_SHA1;
|
||||
// 非必要步骤
|
||||
// 实例化一个客户端配置对象,可以指定超时时间等配置
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
// SDK 默认使用 POST 方法。
|
||||
// 如果您一定要使用 GET 方法,可以在这里设置。GET 方法无法处理一些较大的请求。
|
||||
httpProfile.ReqMethod = "POST";
|
||||
// SDK 有默认的超时时间,非必要请不要进行调整。
|
||||
// 如有需要请在代码中查阅以获取最新的默认值。
|
||||
httpProfile.Timeout = 30; // 请求连接超时时间,单位为秒,默认值为60
|
||||
// SDK 会自动指定域名。通常无需指定域名,但如果您访问的是金融区的服务,则必须手动指定域名。
|
||||
// 例如云服务器的上海金融区域名:cvm.ap-shanghai-fsi.tencentcloudapi.com
|
||||
|
||||
// 代理服务器,当您的环境下有代理服务器时设定
|
||||
httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");
|
||||
|
||||
clientProfile.HttpProfile = httpProfile;
|
||||
|
||||
// 实例化要请求产品(以 CVM 为例)的 client 对象
|
||||
// 第二个参数是地域信息,可以直接填写字符串 ap-guangzhou,或者引用预设的常量,clientProfile 是可选的
|
||||
VodClient client = new VodClient(cred, "ap-beijing", clientProfile);
|
||||
DeleteMediaRequest req = new DeleteMediaRequest();
|
||||
req.FileId = model.Paths2;
|
||||
DeleteMediaResponse res = client.DeleteMediaSync(req);
|
||||
// 输出 JSON 格式的字符串回包
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/TencentCloudDelete.txt", AbstractModel.ToJsonString(res) + "|" + res.RequestId);
|
||||
|
||||
model.Paths = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||||
logmodel.MemberId = Card;
|
||||
logmodel.AddTime = DateTime.Now;
|
||||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||||
logmodel.Body = "删除银花优选释放流量积分视频,标题:" + model.Title + "";
|
||||
logmodel.UType = 0;
|
||||
logmodel.gtype = 0;
|
||||
new DAL.User_CZ_log().Add(logmodel);
|
||||
}
|
||||
daoArt.Delete(ID);
|
||||
|
||||
Response.Redirect(Request.Url.AbsoluteUri);
|
||||
}
|
||||
protected void Run_Click(object s, System.EventArgs e)
|
||||
{
|
||||
|
||||
CheckBox Check = new CheckBox();
|
||||
string strs = seclect_Drop.SelectedItem.Value;
|
||||
foreach (RepeaterItem Item in Repeater1.Items)
|
||||
{
|
||||
//在行中查找到该单选框
|
||||
Check = (CheckBox)Item.FindControl("checka");
|
||||
int strID = int.Parse(Check.CssClass);
|
||||
if (Check.Checked == true)
|
||||
{
|
||||
if (strs == "0")
|
||||
{
|
||||
Mtxfw.Model.Article model = daoArt.GetModel(strID);
|
||||
if (model != null)
|
||||
{
|
||||
if (model.Paths2 != "")
|
||||
{
|
||||
try
|
||||
{
|
||||
// 必要步骤:
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户密钥对 SecretId,SecretKey。
|
||||
// 本示例采用从环境变量读取的方式,则需要在环境变量中先设置这两个值。
|
||||
// 您也可以直接将密钥对写入代码中,但是注意不要复制、上传或分享代码,以免泄露密钥对危及您的财产安全。
|
||||
Credential cred = new Credential
|
||||
{
|
||||
SecretId = config.AccessKeyId,
|
||||
SecretKey = config.AccessKeySecret
|
||||
};
|
||||
|
||||
// 实例化一个 client 选项,可选的,没有特殊需求可以跳过
|
||||
ClientProfile clientProfile = new ClientProfile();
|
||||
// 指定签名算法(默认为 HmacSHA256)
|
||||
clientProfile.SignMethod = ClientProfile.SIGN_SHA1;
|
||||
// 非必要步骤
|
||||
// 实例化一个客户端配置对象,可以指定超时时间等配置
|
||||
HttpProfile httpProfile = new HttpProfile();
|
||||
// SDK 默认使用 POST 方法。
|
||||
// 如果您一定要使用 GET 方法,可以在这里设置。GET 方法无法处理一些较大的请求。
|
||||
httpProfile.ReqMethod = "POST";
|
||||
// SDK 有默认的超时时间,非必要请不要进行调整。
|
||||
// 如有需要请在代码中查阅以获取最新的默认值。
|
||||
httpProfile.Timeout = 30; // 请求连接超时时间,单位为秒,默认值为60
|
||||
// SDK 会自动指定域名。通常无需指定域名,但如果您访问的是金融区的服务,则必须手动指定域名。
|
||||
// 例如云服务器的上海金融区域名:cvm.ap-shanghai-fsi.tencentcloudapi.com
|
||||
|
||||
// 代理服务器,当您的环境下有代理服务器时设定
|
||||
httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");
|
||||
|
||||
clientProfile.HttpProfile = httpProfile;
|
||||
|
||||
// 实例化要请求产品(以 CVM 为例)的 client 对象
|
||||
// 第二个参数是地域信息,可以直接填写字符串 ap-guangzhou,或者引用预设的常量,clientProfile 是可选的
|
||||
VodClient client = new VodClient(cred, "ap-beijing", clientProfile);
|
||||
DeleteMediaRequest req = new DeleteMediaRequest();
|
||||
req.FileId = model.Paths2;
|
||||
DeleteMediaResponse res = client.DeleteMediaSync(req);
|
||||
// 输出 JSON 格式的字符串回包
|
||||
Mtxfw.Utility.Common.WriteHtml("/weixin/TencentCloudDelete.txt", AbstractModel.ToJsonString(res) + "|" + res.RequestId);
|
||||
|
||||
model.Paths2 = "";
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||||
logmodel.MemberId = Card;
|
||||
logmodel.AddTime = DateTime.Now;
|
||||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||||
logmodel.Body = "删除银花优选释放流量积分视频,标题:" + model.Title + "";
|
||||
logmodel.UType = 0;
|
||||
logmodel.gtype = 0;
|
||||
new DAL.User_CZ_log().Add(logmodel);
|
||||
daoArt.Delete(strID);
|
||||
}
|
||||
}
|
||||
else if (strs == "1")
|
||||
{
|
||||
Mtxfw.Model.Article model = daoArt.GetModel(strID);
|
||||
if (model != null)
|
||||
{
|
||||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||||
logmodel.MemberId = Card;
|
||||
logmodel.AddTime = DateTime.Now;
|
||||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||||
logmodel.Body = "审核通过银花优选释放流量积分视频,标题:" + model.Title + "";
|
||||
logmodel.UType = 0;
|
||||
logmodel.gtype = 0;
|
||||
new DAL.User_CZ_log().Add(logmodel);
|
||||
//daoArt.UpdateuSeef();
|
||||
daoArt.UpdateuSel("Seef", 1, strID);
|
||||
}
|
||||
}
|
||||
else if (strs == "2")
|
||||
{
|
||||
Mtxfw.Model.Article model = daoArt.GetModel(strID);
|
||||
if (model != null)
|
||||
{
|
||||
Model.User_CZ_log logmodel = new Model.User_CZ_log();
|
||||
logmodel.MemberId = Card;
|
||||
logmodel.AddTime = DateTime.Now;
|
||||
logmodel.IP = Mtxfw.Utility.Common.GetIP;
|
||||
logmodel.Body = "取消审核银花优选释放流量积分视频,标题:" + model.Title + "";
|
||||
logmodel.UType = 0;
|
||||
logmodel.gtype = 0;
|
||||
new DAL.User_CZ_log().Add(logmodel);
|
||||
daoArt.UpdateuSel("Seef", 0, strID);
|
||||
}
|
||||
}
|
||||
else if (strs == "3")
|
||||
{
|
||||
Mtxfw.Model.Article model = daoArt.GetModel(strID);
|
||||
if (model != null)
|
||||
{
|
||||
TextBox LinkID = (TextBox)Item.FindControl("txtLinkID");
|
||||
if (!System.Text.RegularExpressions.Regex.IsMatch(LinkID.Text, @"^-?\d+$"))
|
||||
{
|
||||
ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('" + model.Title + "的排序ID填写错误!');</script>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
daoArt.UpdateuSel("LinkID", Convert.ToInt32(LinkID.Text), strID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Data_Bind();
|
||||
}
|
||||
public string cvideo(string video)
|
||||
{
|
||||
if (video.IndexOf("http://1301659355.vod2.myqcloud.com") != -1)
|
||||
{
|
||||
string key = "fHI4e1IgVr69Gx4sf1dC";
|
||||
string strp = video.Replace("http://1301659355.vod2.myqcloud.com", "");
|
||||
string Dir = strp.Substring(0, strp.LastIndexOf("/")) + "/";
|
||||
string t = Mtxfw.Utility.Common.GetTimeStamp16(DateTime.Now.AddHours(24), false).ToLower();
|
||||
string exper = "0";
|
||||
string rlimit = "";
|
||||
string us = DateTime.Now.ToString("yyyyMMddHHmmss");
|
||||
StringBuilder sb = new StringBuilder(32);
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
string strkey = key + Dir + t + exper + rlimit + us;
|
||||
byte[] st = md5.ComputeHash(Encoding.GetEncoding("utf-8").GetBytes(strkey));
|
||||
for (int i = 0; i < st.Length; i++)
|
||||
{
|
||||
sb.Append(st[i].ToString("x").PadLeft(2, '0'));
|
||||
}
|
||||
string sign = sb.ToString();
|
||||
video += "?t=" + t + "&exper=" + exper + "&rlimit=" + rlimit + "&us=" + us + "&sign=" + sign;
|
||||
}
|
||||
return video;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user