using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Data; using System.IO; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Vod.V20180717; using TencentCloud.Vod.V20180717.Models; namespace Mtxfw.VipSite { public partial class Admin_Member_live : Mtxfw.Utility.MemberBase { Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results(); Mtxfw.DAL.user_Results_jl2 daojl2 = new Mtxfw.DAL.user_Results_jl2(); public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); public Mtxfw.DAL.user_live daolive = new Mtxfw.DAL.user_live(); public string strTitle = ""; public int t = 0; public int gtype = 0; 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_live.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("直播间管理") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } Page.Title = "直播间管理 - " + GetWebName; Data_Bind(); seclect_Drop.Items.Add(new ListItem("关闭", "1")); seclect_Drop.Items.Add(new ListItem("删除", "2")); } MyPager.PageChanged += delegate(object s, EventArgs ex) { Data_Bind(); }; } protected void Data_Bind() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); String MemberId = Request.QueryString["MemberId"]; String key = Request.QueryString["key"]; String SJ = Request.QueryString["SJ"]; String SJ2 = Request.QueryString["SJ2"]; sb.Append("gtype=" + gtype + " and ttype=0"); if (!String.IsNullOrEmpty(SJ) && !String.IsNullOrEmpty(SJ2)) { sb.Append("and (addtime between '" + SJ + " 00:00:00' and '" + SJ2 + " 23:59:59') "); } if (!String.IsNullOrEmpty(MemberId)) { sb.Append(" and MemberId=" + MemberId); } if (!String.IsNullOrEmpty(key)) { key = key.Trim(); sb.Append(" and MemberId=(Select id from user_info b where b.UserName='" + key + "')"); } string groupby = ""; string strOrder = "addtime desc"; int Start = 0; int Limit = 0; Int32 Recount = 0; MyPager.PageSize = 100; Start = MyPager.PageSize * (MyPager.CurrentPageIndex - 1); Limit = MyPager.PageSize; DataSet dss = daolive.GetDataSet(groupby, strOrder, "*,(Select UserName From user_info b Where b.Id=MemberId) as MemberName,(Select realname From user_info b Where b.Id=MemberId) as realname,(Select NCName From user_info b Where b.Id=MemberId) as NCName", "", sb.ToString(), Start, Limit, out Recount); Mtxfw.Utility.Tools.ToBind(Repeater1, dss.Tables[1]); MyPager.RecordCount = Recount; if (MyPager.RecordCount == 0) { MyPager.Visible = false; } } 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"); Int32 strID = Int32.Parse(Check.CssClass); if (Check.Checked == true) { Mtxfw.Model.user_live mr = daolive.GetModel(strID); if (mr != null) { if (strs == "1") { Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId); if (umodel != null) { mr.seef = 4; daolive.Update(mr); 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 = "关闭直播间,用户名为" + umodel.UserName + ",时间为" + mr.addtime; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } if (strs == "2") { DataSet ds = new DAL.user_livefile().GetList("gtype=" + gtype + " and ttype=0 And liveid=" + mr.Id); if (ds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { int fid = Convert.ToInt32(Dr["id"]); string file_id = Dr["file_id"].ToString(); // 必要步骤: // 实例化一个认证对象,入参需要传入腾讯云账户密钥对 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 = file_id; DeleteMediaResponse res = client.DeleteMediaSync(req); // 输出 JSON 格式的字符串回包 Mtxfw.Utility.Common.WriteHtml("/weixin/TencentCloudDelete.txt", AbstractModel.ToJsonString(res) + "|" + res.RequestId); new DAL.user_livefile().Delete(fid); } } if (mr.livepic != "") { try { if (File.Exists(Server.MapPath(mr.livepic))) { File.Delete(Server.MapPath(mr.livepic)); } } catch { } } daolive.Delete(strID); string strUserName = ""; Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId); if (umodel != null) { strUserName = umodel.UserName; } 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 = "删除直播间,用户名为" + strUserName + ",时间为" + mr.addtime; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } } } Response.Redirect(Request.Url.AbsoluteUri); } public string getpics(string pics) { string returnpics = ""; string[] apic = pics.Split('|'); foreach (string pic in apic) { if (pic != "") { string strpic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "100x100", "cut"); returnpics += ""; } } return returnpics; } } }