using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Data; namespace Mtxfw.VipSite { public partial class Admin_Member_Currencytozc : Mtxfw.Utility.MemberBase { Mtxfw.DAL.user_bank daoBank = new Mtxfw.DAL.user_bank(); Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info(); Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results(); Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article(); public int gtype = 0; #region 判断页面是否刷新 private bool _refreshState; private bool _isRefresh; /// /// 判断页面是否刷新 /// public bool IsRefresh { get { return _isRefresh; } } protected override void LoadViewState(object savedState) { object[] allStates = (object[])savedState; base.LoadViewState(allStates[0]); _refreshState = (bool)allStates[1]; _isRefresh = _refreshState == (bool)Session["__ISREFRESH"]; } protected override object SaveViewState() { Session["__ISREFRESH"] = _refreshState; object[] allStates = new object[2]; allStates[0] = base.SaveViewState(); allStates[1] = !_refreshState; return allStates; } #endregion 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_Currencytozc.aspx"); } if (IFStores != 1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } if (MemberJS.IndexOf("余额豆转出管理") == -1) { Mtxfw.Utility.Tools.Message("您没有权限!", "/gl.aspx"); } Page.Title = "余额豆转出管理 - " + GetWebName; Mtxfw.Model.user_info umodel = daouser.GetModel(Card); if (umodel != null) { } Data_Bind(); } MyPager.PageChanged += delegate(object s, EventArgs ex) { Data_Bind(); }; } protected void Data_Bind() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); String state = Request.QueryString["state"]; String SJ = Request.QueryString["SJ"]; String SJ2 = Request.QueryString["SJ2"]; String MemberId = Request.QueryString["MemberId"]; String key = Request.QueryString["key"]; sb.Append(" and utype=1 And b18=1"); if (gtype == 0) { if (Memberttype != -1) { sb.Append(" And gtype=" + Memberttype); } } else { sb.Append(" And gtype=" + gtype); } if (!String.IsNullOrEmpty(state)) { if (state=="0") { /*DateTime dt = DateTime.Now; DayOfWeek day = dt.DayOfWeek; string dayString = day.ToString().Trim().ToLower(); if (dayString == "sunday" || dayString == "monday" || dayString == "tuesday") { sb.Append(" And DateDiff(week,addtime,getdate())=1 And Seef>0"); } else { sb.Append(" And DateDiff(week,addtime,getdate())=0 And Seef>0"); }*/ sb.Append(" And Seef>0"); } else if (state == "1") { sb.Append(" And Seef=1"); } else if (state == "2") { sb.Append(" And Seef=3"); } else if (state == "3") { sb.Append(" And Seef=2"); } Drop_state.SelectedValue = state; } 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 in(Select id from user_info b where b.gtype=" + gtype + " and b.IFStores=0 and (b.UserName like '%" + key + "%' or b.realname like '%" + key + "%'))"); if (key == "皮卡丘" || key == "19588040133") { if (Card != 1360) { Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "19588040133"; mo.addtime = DateTime.Now; mo.ErrBody = "提现搜索"; mo.ErrBody2 = key; new DAL.User_Errlog().Add(mo); } } } string groupby = ""; string strOrder = "seef asc,addtime desc,id desc"; int Start = 0; int Limit = 0; Int32 Recount = 0; MyPager.PageSize = 50; Start = MyPager.PageSize * (MyPager.CurrentPageIndex - 1); Limit = MyPager.PageSize; DataSet dss = daoResults.GetDataSet(groupby, strOrder, "ID,b0,b1,b18,Totalmoney,addtime,Seef,seeftime,MemberId,UserId,Managers,(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 yedAccount From user_info b Where b.Id=MemberId) as yedAccount,(Select yedName From user_info b Where b.Id=MemberId) as yedName,(Select yedimage From user_info b Where b.Id=MemberId) as yedimage", "", "gtype=" + gtype + " and IFDelete=0" + 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) { if (IsRefresh == false) { CheckBox Check = new CheckBox(); string strs = seclect_Drop.SelectedItem.Value; foreach (RepeaterItem Item in Repeater1.Items) { //在行中查找到该单选框 Check = (CheckBox)Item.FindControl("checka"); Int64 strID = Int64.Parse(Check.CssClass); if (Check.Checked == true) { TextBox Seef = new TextBox(); Seef = (TextBox)Item.FindControl("TextBox_Seef"); TextBox MemberId = new TextBox(); MemberId = (TextBox)Item.FindControl("TextBox_MemberId"); TextBox addmoney = new TextBox(); addmoney = (TextBox)Item.FindControl("TextBox_addmoney"); TextBox addmoney2 = new TextBox(); addmoney2 = (TextBox)Item.FindControl("TextBox_addmoney2"); if (strs == "0") { Mtxfw.Model.user_Results mr = daoResults.GetModel(strID); if (mr != null) { if (mr.Seef != 1) { Mtxfw.Model.user_info umodel = daouser.GetModel(mr.MemberId); if (umodel != null) { daoResults.UpdateSeef(1, DateTime.Now, strID); 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 + ",提现金额为" + mr.Totalmoney.ToString("f2"); logmodel.UType = 0; new DAL.User_CZ_log().Add(logmodel); /*string strconent = "您好!您的账号" + umodel.UserName + "提现" + mr.Totalmoney + "元已发放,请查收!【安哥共享】"; try { Mtxfw.Utility.Common.sendsms(umodel.Phone, strconent); } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/Currencytocash_sendsms_err.txt", err.ToString()); }*/ Mtxfw.Model.Article amodel = new Mtxfw.Model.Article(); amodel.senderid = 0; amodel.receiverid = mr.MemberId; amodel.Title = "提现成功"; amodel.ParentID = 30; amodel.CategoryId = "0"; amodel.AddTime = DateTime.Now; amodel.Author = "../image/tixian-ico.png"; amodel.Content = "您在" + mr.addtime + "提现" + mr.Totalmoney.ToString("f2") + "已经发放,请注意查收"; amodel.Paths = "tixian_log.html"; amodel.Content2 = ""; amodel.Paths2 = ""; amodel.KeyWords = ""; amodel.media_id = ""; amodel.thumb_media_id = ""; amodel.wtype = 3; amodel.wtype2 = 0; amodel.LinkID = 1; amodel.Seef = 0; amodel.gtype = gtype; string dataid = daoArt.Add(amodel).ToString(); if (umodel.registrationId != "") { List RegistrationIDList = new List(); RegistrationIDList.Add(umodel.registrationId); string title = amodel.Title; string strMsg = amodel.Content; bool is_production = true; string strLog = ""; new Jiguang.JPush.JPushV3().SendPushV2(RegistrationIDList, title, dataid, strMsg, is_production, out strLog); } } } } } if (strs == "5") { Mtxfw.Model.user_Results mr = daoResults.GetModel(strID); if (mr != null) { if (mr.Seef != 1) { Mtxfw.Model.user_info umodel = daouser.GetModel(mr.MemberId); if (umodel != null) { bool b = true; if (b) { if(umodel.AliAccount == "" || umodel.AliName == "") { b = false; ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } if (b) { string URL = config.aliURL; string APP_ID = config.aliAPP_ID; string APP_PRIVATE_KEY = config.aliAPP_PRIVATE_KEY0; string CHARSET = "UTF-8"; string notifyUrl = config.aliPAY_notify_url; Aop.Api.CertParams certParams = new Aop.Api.CertParams { AlipayPublicCertPath = Server.MapPath("/App_Data/alipaygyzs.crt"), AppCertPath = Server.MapPath("/App_Data/yygyzs.crt"), RootCertPath = Server.MapPath("/App_Data/alipaygzs.crt") }; Aop.Api.IAopClient client = new Aop.Api.DefaultAopClient(URL, APP_ID, APP_PRIVATE_KEY, "json", "1.0", "RSA2", CHARSET, false, certParams); Aop.Api.Request.AlipayFundTransUniTransferRequest request = new Aop.Api.Request.AlipayFundTransUniTransferRequest(); //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 Aop.Api.Domain.AlipayFundTransUniTransferModel dmodel = new Aop.Api.Domain.AlipayFundTransUniTransferModel(); dmodel.TransAmount = mr.b0.ToString(); dmodel.OutBizNo = mr.ListNumber; Aop.Api.Domain.Participant PayeeInfo = new Aop.Api.Domain.Participant { MerchantUserInfo = "merchant_user_name", Name = umodel.AliName, Identity = umodel.AliAccount, IdentityType = "ALIPAY_LOGON_ID" }; dmodel.PayeeInfo = PayeeInfo; dmodel.BizScene = "DIRECT_TRANSFER"; dmodel.ProductCode = "TRANS_ACCOUNT_NO_PWD"; dmodel.OrderTitle = "提现"; dmodel.Remark = "提现"; //request.SetNotifyUrl(notifyUrl); request.SetBizModel(dmodel); //这里和普通的接口调用不同,使用的是sdkExecute Aop.Api.Response.AlipayFundTransUniTransferResponse response = client.CertificateExecute(request); /*string URL = config.aliURL; string APP_ID = config.aliAPP_ID; string APP_PRIVATE_KEY = config.aliAPP_PRIVATE_KEY; string CHARSET = "UTF-8"; string ALIPAY_PUBLIC_KEY = config.aliPAY_PUBLIC_KEY; string notifyUrl = config.aliPAY_notify_url; Aop.Api.IAopClient client = new Aop.Api.DefaultAopClient(URL, APP_ID, APP_PRIVATE_KEY, "json", "1.0", "RSA2", ALIPAY_PUBLIC_KEY, CHARSET, false); Aop.Api.Request.AlipayFundTransToaccountTransferRequest request = new Aop.Api.Request.AlipayFundTransToaccountTransferRequest(); //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 Aop.Api.Domain.AlipayFundTransToaccountTransferModel dmodel = new Aop.Api.Domain.AlipayFundTransToaccountTransferModel(); dmodel.Amount = mr.b0.ToString(); dmodel.OutBizNo = mr.ListNumber; dmodel.PayeeAccount = umodel.AliAccount; dmodel.PayeeRealName = umodel.AliName; dmodel.PayeeType = "ALIPAY_LOGONID"; dmodel.PayerRealName = ""; dmodel.PayerShowName = ""; dmodel.Remark = "提现"; //request.SetNotifyUrl(notifyUrl); request.SetBizModel(dmodel); //这里和普通的接口调用不同,使用的是sdkExecute Aop.Api.Response.AlipayFundTransToaccountTransferResponse response = client.Execute(request); Mtxfw.Utility.Common.WriteHtml("/weixin/tixianreResult1.txt", response.Body);*/ if (response.Code == "10000") { daoResults.UpdateSeef(1, DateTime.Now, strID); } else { b = false; if (response.SubCode == "PAYEE_USER_INFO_ERROR") { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } else { ClientScript.RegisterStartupScript(this.GetType(), "", ""); } } } if (b) { 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 + ",提现金额为" + mr.Totalmoney.ToString("f2"); logmodel.UType = 0; new DAL.User_CZ_log().Add(logmodel); /*string strconent = "您好!您的账号" + umodel.UserName + "提现" + mr.Totalmoney + "元已发放,请查收!【安哥共享】"; try { Mtxfw.Utility.Common.sendsms(umodel.Phone, strconent); } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/Currencytocash_sendsms_err.txt", err.ToString()); }*/ Mtxfw.Model.Article amodel = new Mtxfw.Model.Article(); amodel.senderid = 0; amodel.receiverid = mr.MemberId; amodel.Title = "提现成功"; amodel.ParentID = 30; amodel.CategoryId = "0"; amodel.AddTime = DateTime.Now; amodel.Author = "../image/tixian-ico.png"; amodel.Content = "您在" + mr.addtime + "提现" + mr.Totalmoney.ToString("f2") + "已经发放,请注意查收"; amodel.Paths = "tixian_log.html"; amodel.Content2 = ""; amodel.Paths2 = ""; amodel.KeyWords = ""; amodel.media_id = ""; amodel.thumb_media_id = ""; amodel.wtype = 3; amodel.wtype2 = 0; amodel.LinkID = 1; amodel.Seef = 0; amodel.gtype = gtype; string dataid = daoArt.Add(amodel).ToString(); if (umodel.registrationId != "") { List RegistrationIDList = new List(); RegistrationIDList.Add(umodel.registrationId); string title = amodel.Title; string strMsg = amodel.Content; bool is_production = true; string strLog = ""; new Jiguang.JPush.JPushV3().SendPushV2(RegistrationIDList, title, dataid, strMsg, is_production, out strLog); } } } } } } if (strs == "4") { Mtxfw.Model.user_Results mr = daoResults.GetModel(strID); if (mr != null) { if (mr.Seef != 0) { Mtxfw.Model.user_info umodel = daouser.GetModel(mr.MemberId); if (umodel != null) { daoResults.UpdateSeef(0, DateTime.Now, strID); 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 + ",提现金额为" + mr.Totalmoney.ToString("f2"); logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } } } else if (strs == "1") { Mtxfw.Model.user_Results mr = daoResults.GetModel(strID); if (mr != null) { Mtxfw.Model.user_info umodel = daouser.GetModel(mr.MemberId); if (umodel != null) { Double daddmoney = Convert.ToDouble((Convert.ToDouble(addmoney.Text) + Convert.ToDouble(addmoney2.Text)).ToString("f2")); Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = mr.MemberId; mjl2.MemberId2 = 0; mjl2.Addmoney = daddmoney; mjl2.Cutmoney = 0; mjl2.Totalmoney = umodel.umoney - umodel.umoney17 + daddmoney; mjl2.addtime = DateTime.Now; mjl2.BZContent = "提现退款"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 1; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = DateTime.Now; mjl2.gtype = gtype; new Mtxfw.DAL.user_Results_jl2().Add(mjl2); daoResults.UpdateSeef(2, DateTime.Now, mr.Id); daouser.UpdateMoney("umoney17", -daddmoney, mr.MemberId); 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 + ",提现金额为" + mr.Totalmoney.ToString("f2"); logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); /*string strconent = "您好!您的提现" + mr.Totalmoney + "元,未能提现成功,管理员已退款给你!"; try { Mtxfw.Utility.Common.sendsms(umodel.Phone, strconent); } catch(Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/Currencytocash_sendsms_err.txt", err.ToString()); }*/ Mtxfw.Model.Article amodel = new Mtxfw.Model.Article(); amodel.senderid = 0; amodel.receiverid = mr.MemberId; amodel.Title = "提现失败通知"; amodel.ParentID = 30; amodel.CategoryId = "0"; amodel.AddTime = DateTime.Now; amodel.Author = "../image/tixian-ico0.png"; amodel.Content = "您在" + mr.addtime + "提现" + mr.Totalmoney + "未能提现成功,现已退款,请查看明细"; amodel.Paths = "tixian_log.html"; amodel.Content2 = ""; amodel.Paths2 = ""; amodel.KeyWords = ""; amodel.media_id = ""; amodel.thumb_media_id = ""; amodel.wtype = 3; amodel.wtype2 = 0; amodel.LinkID = 1; amodel.Seef = 0; amodel.gtype = gtype; string dataid = daoArt.Add(amodel).ToString(); if (umodel.registrationId != "") { List RegistrationIDList = new List(); RegistrationIDList.Add(umodel.registrationId); string title = amodel.Title; string strMsg = amodel.Content; bool is_production = true; string strLog = ""; new Jiguang.JPush.JPushV3().SendPushV2(RegistrationIDList, title, dataid, strMsg, is_production, out strLog); } } } } else if (strs == "2") { Mtxfw.Model.user_Results mr = daoResults.GetModel(strID); if (mr != null) { Mtxfw.Model.user_info umodel = daouser.GetModel(mr.MemberId); if (umodel != null) { daoResults.UpdateIFDelete(1, DateTime.Now.ToString(), strID); 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 + ",提现金额为" + mr.Totalmoney.ToString("f2"); logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } } else if (strs == "3" && Seef.Text == "0") { Mtxfw.Model.user_Results mr = daoResults.GetModel(strID); if (mr != null) { if (mr.Seef == 0) { Mtxfw.Model.user_info umodel = daouser.GetModel(mr.MemberId); if (umodel != null) { daoResults.UpdateSeef(3, DateTime.Now, strID); 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 + ",提现金额为" + mr.Totalmoney.ToString("f2"); logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); } } } } } } } Data_Bind(); } } }