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

466 lines
24 KiB
C#

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_Currencytocash : 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;
/// <summary>
/// 判断页面是否刷新
/// </summary>
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_Currencytocash.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 strttype = Request.QueryString["ttype"];
String key = Request.QueryString["key"];
sb.Append(" and utype=1");
if (MemberuLevel29 > 0)
{
sb.Append(" And MemberId in(Select b.id from user_info b where b.IFStores=0 And b.ContactIDS like '" + MemberContactIDS + "%')");
}
if (!String.IsNullOrEmpty(strttype))
{
sb.Append(" and b18=" + strttype);
ttype.SelectedValue = strttype;
}
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,b17,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 ProductName From user_info b Where b.Id=MemberId) as ProductName,(Select Phone2 From user_info b Where b.Id=MemberId) as Phone2,(Select RealName2 From user_info b Where b.Id=MemberId) as RealName2,(Select PostalCode From user_info b Where b.Id=MemberId) as PostalCode,(Select AliAccount From user_info b Where b.Id=MemberId) as AliAccount,(Select AliName From user_info b Where b.Id=MemberId) as AliName,(Select aliimage From user_info b Where b.Id=MemberId) as aliimage,(Select weixinimage From user_info b Where b.Id=MemberId) as weixinimage,(Select qbaddress From user_info b Where b.Id=MemberId) as qbaddress", "", "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;
}
DataSet ds = daoResults.GetList1("sum(Totalmoney) as Totalmoney,sum(b0) as b0,sum(b1) as b1", "IFDelete=0" + sb.ToString());
if (ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["Totalmoney"].ToString() != "")
{
Label_b1.Text = Convert.ToDouble(ds.Tables[0].Rows[0]["Totalmoney"]).ToString("0.####");
Label_b2.Text = Convert.ToDouble(ds.Tables[0].Rows[0]["b1"]).ToString("0.####");
Label_b3.Text = Convert.ToDouble(ds.Tables[0].Rows[0]["b0"]).ToString("0.####");
}
else
{
Label_b1.Text = "0";
Label_b2.Text = "0";
Label_b3.Text = "0";
}
}
else
{
Label_b1.Text = "0";
Label_b2.Text = "0";
Label_b3.Text = "0";
}
ds.Clear();
}
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)
{
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<string> RegistrationIDList = new List<string>();
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)
{
}
}
}
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)
{
int t = Convert.ToInt32(mr.b18.ToString().Split('.')[0]);
Double daddmoney = mr.Totalmoney;
Double ktCurrency = umodel.umoney32;
string strmoney = "umoney32";
int utype = 4;
if (t == 1)
{
utype = 14;
ktCurrency = umodel.umoney34;
strmoney = "umoney34";
}
else if (t == 2)
{
utype = 17;
ktCurrency = umodel.umoney41;
strmoney = "umoney41";
}
else if (t == 3)
{
utype = 15;
ktCurrency = umodel.umoney39;
strmoney = "umoney39";
}
else if (t == 4)
{
utype = 19;
ktCurrency = umodel.umoney37;
strmoney = "umoney37";
}
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 = ktCurrency + daddmoney;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "提现退款";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = utype;
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(strmoney, 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<string> RegistrationIDList = new List<string>();
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")
{
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();
}
}
}