using System;
using System.Collections.Generic;
using System.Web;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.OleDb;
using System.IO;
using System.Drawing;
using System.Net;
using System.Web.SessionState;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Globalization;
using Newtonsoft.Json;
using System.Security.Cryptography;
using System.Web.Script.Serialization;
using System.Diagnostics;
using TencentCloud.Common;
using TencentCloud.Common.Profile;
using TencentCloud.Vod.V20180717;
using TencentCloud.Vod.V20180717.Models;
using ThoughtWorks.QRCode.Codec;
namespace Mtxfw.VipSite
{
///
/// Ajax 处理页面
///
public class ashxAjax : IHttpHandler, IRequiresSessionState
{
private Mtxfw.Utility.Config cconfig = new Mtxfw.Utility.Config("");
DAL.user_jjfp daojjfp = new DAL.user_jjfp();
DAL.Article daoArt = new DAL.Article();
int gtype = 0;
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
try
{
bool ifb = true;
if (!String.IsNullOrEmpty(context.Request["yqm"]))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["yqm"].ToString(), @"^-?\d+$"))
{
ifb = false;
}
}
if (!String.IsNullOrEmpty(context.Request["id"]))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["id"].ToString(), @"^-?\d+$"))
{
ifb = false;
}
}
if (ifb)
{
string hostname = context.Request.Url.Host;
//POST方式
switch (context.Request["action"])
{
case "IsExists": IsExists(context); break;
case "GetCode": GetCode(context); break;
case "GetCity": GetCity(context); break;
case "GetCounty": GetCounty(context); break;
case "GetProductLB": GetProductLB(context); break;
case "GetProductLB2": GetProductLB2(context); break;
case "Register": Register(context); break;
case "Register0": Register0(context); break;
case "Register1": Register1(context); break;
case "UpdateInfo": UpdateInfo(context); break;
case "UpdatePhone": UpdatePhone(context); break;
case "GetUserName": GetUserName(context); break;
case "GetUserName2": GetUserName2(context); break;
case "GetLogin": GetLogin(context); break;
case "GetLogin1": GetLogin1(context); break;
case "GetLogin2": GetLogin2(context); break;
case "Quit": Quit(context); break;
case "IsLogin": IsLogin(context); break;
case "SendAdminYZM": SendAdminYZM(context); break;
case "SendUserYZM": SendUserYZM(context); break;
case "SendUserYZM0": SendUserYZM0(context); break;
case "UpdateUser_OnLine": UpdateUser_OnLine(context); break;
case "GetUsersTree": GetUsersTree(context); break;
case "getmynetmap": getmynetmap(context); break;
case "getmynetmap2": getmynetmap2(context); break;
case "GetProductTree": GetProductTree(context); break;
case "UpdateTree": UpdateTree(context); break;
case "Addpinglun": Addpinglun(context); break;
case "Addwenda": Addwenda(context); break;
case "zanpinglun": zanpinglun(context); break;
case "savewenda": savewenda(context); break;
case "GetPages": GetPages(context); break;
case "GetCartNum": GetCartNum(context); break;
case "addfavorite": addfavorite(context); break;
case "addxihuan": addxihuan(context); break;
case "addcart": addcart(context); break;
case "addcart2": addcart2(context); break;
case "updatecart": updatecart(context); break;
case "updatecart2": updatecart2(context); break;
case "DeletePic": DeletePic(context); break;
case "SetPic": SetPic(context); break;
case "SavePic": SavePic(context); break;
case "saveaddress": saveaddress(context); break;
case "deladdress": deladdress(context); break;
case "setaddress": setaddress(context); break;
case "UserQRGM": UserQRGM(context); break;
case "kaihongbao": kaihongbao(context); break;
case "kaihongbao2": kaihongbao2(context); break;
case "qxorder": qxorder(context); break;
case "sqthorder": sqthorder(context); break;
case "thclorder": thclorder(context); break;
case "agreetoreturn": agreetoreturn(context); break;
case "disagreetoreturn": disagreetoreturn(context); break;
case "payorder": payorder(context); break;
case "qyfhorder": qyfhorder(context); break;
case "editaddress": editaddress(context); break;
case "editwl": editwl(context); break;
case "cancelfh": cancelfh(context); break;
case "qydforder": qydforder(context); break;
case "qyshorder": qyshorder(context); break;
case "deleteorder": deleteorder(context); break;
case "setorder": setorder(context); break;
case "setorder0": setorder0(context); break;
case "setorder1": setorder1(context); break;
case "iswxpayed": iswxpayed(context); break;
case "setttype": setttype(context); break;
case "onchongzhi": onchongzhi(context); break;
case "qingkong": qingkong(context); break;
case "addguige": addguige(context); break;
case "delguige": delguige(context); break;
case "addYunFei": addYunFei(context); break;
case "delYunFei": delYunFei(context); break;
case "addFree": addFree(context); break;
case "delFree": delFree(context); break;
case "addrwsm": addrwsm(context); break;
case "delrwsm": delrwsm(context); break;
case "seefrwsm": seefrwsm(context); break;
case "savecolor": savecolor(context); break;
case "savetihuodian": savetihuodian(context); break;
case "saveimage": saveimage(context); break;
case "onFHJS": onFHJS(context); break;
case "onFHJS0": onFHJS0(context); break;
case "onSaveFHJS": onSaveFHJS(context); break;
case "onSaveHHJSJE": onSaveHHJSJE(context); break;
case "kdchaxun": kdchaxun(context); break;
//case "UploadPicture": UploadPicture(context); break;
case "qydk": qydk(context); break;
//case "uploadpic": uploadpic(context); break;
case "qysk": qysk(context); break;
case "jubao": jubao(context); break;
case "qykclc": qykclc(context); break;
case "qxjy": qxjy(context); break;
case "ppjy": ppjy(context); break;
case "GoToMemberId": GoToMemberId(context); break;
//case "videofile_post": videofile_post(context); break;
case "addvideo": addvideo(context); break;
case "delvideo": delvideo(context); break;
case "getinfos": getinfos(context); break;
case "addinfoto": addinfoto(context); break;
case "delcxinfo": delcxinfo(context); break;
case "getlive_chat": getlive_chat(context); break;
case "logoutliveplay": logoutliveplay(context); break;
case "editNCName": editNCName(context); break;
case "getlive_onlinelist": getlive_onlinelist(context); break;
case "live_chat": live_chat(context); break;
case "purchaselivegift": purchaselivegift(context); break;
case "guangzhu": guangzhu(context); break;
case "dzlive": dzlive(context); break;
case "orderlive": orderlive(context); break;
case "CheckAPPVersion":CheckAPPVersion(context); break;
case "savefileId": savefileId(context); break;
case "dcproductdata": dcproductdata(context); break;
case "dcorderdata": dcorderdata(context); break;
case "deleteimage": deleteimage(context); break;
}
}
}
catch (Exception err)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/ajaxerr.txt", err.ToString());
}
}
#region 判断验证码是否正确
///
/// 判断验证码是否正确
///
protected void GetCode(HttpContext context)
{
if (context.Request.Form["Code"] != null)
{
if (context.Request.Cookies["code"] != null && context.Request.Form["Code"].ToString().ToLower() == context.Request.Cookies["code"].Value.ToLower())
{
context.Response.Write("true");
}
else
{
context.Response.Write("false");
}
}
else
{
context.Response.Write("false");
}
}
#endregion
#region 判断用户名是否存在
///
/// 判断用户名是否存在
///
protected void IsExists(HttpContext context)
{
try
{
if (context.Request.Form["Keys"] != null)
{
Mtxfw.DAL.Admin Admin = new Mtxfw.DAL.Admin();
context.Response.Write(Admin.IsExists(context.Request.Form["Keys"]).ToString().ToLower());
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 获取城市
///
/// 获取城市
///
protected void GetCity(HttpContext context)
{
try
{
StringBuilder sb = new StringBuilder();
String PID = context.Request.Form["ProvinceID"];
String CityID = context.Request.Form["cityIDs"];
String Selected = string.Empty;
Mtxfw.DAL.city daoCity = new Mtxfw.DAL.city();
System.Data.DataSet Ds = daoCity.GetList("ProvinceID=" + PID + " Order by Id Asc");
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
sb.Append("");
foreach (System.Data.DataRow Dr in Dt.Rows)
{
if (Dr["CityID"].ToString() == CityID)
Selected = "selected=selected";
else
Selected = String.Empty;
sb.Append("\r\n");
}
context.Response.Write(sb.ToString());
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 获取区域
///
/// 获取区域
///
protected void GetCounty(HttpContext context)
{
try
{
StringBuilder sb = new StringBuilder();
String CID = context.Request.Form["CityID"];
String CountyID = context.Request.Form["countyIDs"];
String Selected = string.Empty;
Mtxfw.DAL.county daoCounty = new Mtxfw.DAL.county();
System.Data.DataSet Ds = daoCounty.GetList("CityID=" + CID + " Order by Id Asc");
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
sb.Append("");
foreach (System.Data.DataRow Dr in Dt.Rows)
{
if (Dr["CountyID"].ToString() == CountyID)
Selected = "selected=selected";
else
Selected = String.Empty;
sb.Append("\r\n");
}
context.Response.Write(sb.ToString());
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //获取商品分类-----------------------------------------------------------------------------------------
///
/// 获取商品分类
///
protected void GetProductLB(HttpContext context)
{
try
{
StringBuilder sb = new StringBuilder();
String ProductLB1 = context.Request.Form["ProductLB1"];
String ProductLB2 = context.Request.Form["ProductLB2"];
if (!String.IsNullOrEmpty(ProductLB1))
{
String Selected = string.Empty;
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
System.Data.DataSet Ds = daoCategory.GetCacheList("", "gtype=" + gtype + " and IfShow=0 And C_PARENTID=" + ProductLB1 + " Order By C_Layer asc,C_LinkID asc", "ProductLB2_" + ProductLB1 + "");
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
sb.Append("");
foreach (System.Data.DataRow Dr in Dt.Rows)
{
if (Dr["C_ID"].ToString() == ProductLB2)
Selected = "selected=selected";
else
Selected = String.Empty;
sb.Append("\r\n");
}
}
context.Response.Write(sb.ToString());
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
///
/// 获取商品分类
///
protected void GetProductLB2(HttpContext context)
{
try
{
StringBuilder sb = new StringBuilder();
String ProductLB2 = context.Request.Form["ProductLB2"];
String ProductLB3 = context.Request.Form["ProductLB3"];
if (!String.IsNullOrEmpty(ProductLB2))
{
String Selected = string.Empty;
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
System.Data.DataSet Ds = daoCategory.GetCacheList("", "IfShow=0 And C_PARENTID=" + ProductLB2 + " Order By C_Layer asc,C_LinkID asc", "ProductLB3_" + ProductLB2 + "");
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
sb.Append("");
foreach (System.Data.DataRow Dr in Dt.Rows)
{
if (Dr["C_ID"].ToString() == ProductLB3)
Selected = "selected=selected";
else
Selected = String.Empty;
sb.Append("\r\n");
}
}
context.Response.Write(sb.ToString());
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 会员后台注册会员
//注册
protected void Register(HttpContext context)
{
try
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
string province = "", city = "", county = "", strUserName = "", strPassword = "", strPassword2 = "", strutype = "", strCompanyName = "", strCompanyNumber = "", strCompanyContact = "", strMobile = "", strRealName = "", strSex = "", strSFZ = "", strmailingaddress = "", strpostalcode = "", strEmail = "", strQQ = "", strPhone = "", strContactID = "", strSuperiorsID = "", strDLRememberID = "", struLevel5 = "", struLevel = "", strgoods = "", strBankCard = "", strBankaddress = "", strBankName = "", strMemberCard = "hz" + (daoUser.GetMaxMemberCard(gtype) + 1).ToString();
int Card = 0;
bool b = true;
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
Card = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
Card = GoToMemberId;
}
}
}
else
{
b = false;
context.Response.Write("您未登录!");
}
if (context.Request.Form["province"] != null)
{
province = HttpUtility.UrlDecode(context.Request.Form["province"].ToString()).Trim();
}
if (context.Request.Form["city"] != null)
{
city = HttpUtility.UrlDecode(context.Request.Form["city"].ToString()).Trim();
}
if (context.Request.Form["county"] != null)
{
county = HttpUtility.UrlDecode(context.Request.Form["county"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["goods"]))
{
strgoods = HttpUtility.UrlDecode(context.Request.Form["goods"].ToString()).Trim();
}
/*if (!String.IsNullOrEmpty(context.Request.Form["UserName"]))
{
strUserName = HttpUtility.UrlDecode(context.Request.Form["UserName"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strUserName, @"^[A-Za-z0-9-]+$") || strUserName.Length < 4 || strUserName.Length > 20)
{
b = false;
context.Response.Write("用户名输入不正确,用户名由4-20位数字、字母、中划线組成!");
}
}
if (b)
{
if (daoUser.IsExists(strUserName))
{
b = false;
context.Response.Write("用户名已被其它用户占用,请换一个再试!");
}
}
}
else
{
b = false;
context.Response.Write("请输入用户名!");
}*/
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["RealName"]))
{
strRealName = HttpUtility.UrlDecode(context.Request.Form["RealName"].ToString()).Trim();
if (!System.Text.RegularExpressions.Regex.IsMatch(strRealName, @"[\u4e00-\u9fa5]"))
{
b = false;
context.Response.Write("真实姓名填写不正确,只能输入中文!");
}
}
else
{
b = false;
context.Response.Write("请输入真实姓名!");
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["UserName"]))
{
strUserName = HttpUtility.UrlDecode(context.Request.Form["UserName"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strUserName, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号格式填写不正确,只能输入11位数字!");
}
}
if (b)
{
if (daoUser.IsExists(strUserName, gtype))
{
b = false;
context.Response.Write("手机号已被其它用户占用,请换一个再试!");
}
}
strPhone = strUserName;
}
else
{
b = false;
context.Response.Write("请输入手机号!");
}
}
string verifyCode = "";
string YZID = "";
if (cconfig.FHEnable4 == "0")
{
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["YZID"]))
{
YZID = HttpUtility.UrlDecode(context.Request.Form["YZID"].ToString());
}
else
{
b = false;
context.Response.Write("请先发送手机验证码!");
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["code"]))
{
verifyCode = HttpUtility.UrlDecode(context.Request.Form["code"].ToString());
if (b)
{
if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + strPhone + "' And YZM='" + verifyCode + "'") == 0)
{
b = false;
context.Response.Write("手机验证码不正确!");
}
}
if (b)
{
if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + strPhone + "' And YZM='" + verifyCode + "' And DateDiff(mi,addtime,getdate())<=30") == 0)
{
b = false;
context.Response.Write("手机验证码已经失效!");
}
}
}
else
{
b = false;
context.Response.Write("手机验证码不能为空!");
}
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["Password"]))
{
strPassword = HttpUtility.UrlDecode(context.Request.Form["Password"].ToString()).Trim();
if (!System.Text.RegularExpressions.Regex.IsMatch(strPassword, @"^[A-Za-z0-9-]+$") || strPassword.Length < 6 || strPassword.Length > 18)
{
b = false;
context.Response.Write("新密码输入不正确,密码由6-18位数字、字母、中划线組成!");
}
}
else
{
b = false;
context.Response.Write("请输入密码!");
}
}
strPassword2 = strPassword;
/*if (!String.IsNullOrEmpty(context.Request.Form["Phone"]))
{
strPhone = HttpUtility.UrlDecode(context.Request.Form["Phone"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPhone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号码格式填写不正确,只能输入11位数字!");
}
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入手机号码!");
}
}*/
if (!String.IsNullOrEmpty(context.Request.Form["Sex"]))
{
strSex = HttpUtility.UrlDecode(context.Request.Form["Sex"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["SFZ"]))
{
strSFZ = HttpUtility.UrlDecode(context.Request.Form["SFZ"].ToString()).Trim();
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["mailingaddress"]))
{
strmailingaddress = HttpUtility.UrlDecode(context.Request.Form["mailingaddress"].ToString()).Trim();
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["Email"]))
{
strEmail = HttpUtility.UrlDecode(context.Request.Form["Email"].ToString()).Trim();
if (daoUser.IsExistsEmail(strEmail.Trim(), gtype))
{
b = false;
context.Response.Write("您的Email已被其它用户占用,请换一个再试");
}
}
}
if (!String.IsNullOrEmpty(context.Request.Form["QQ"]))
{
strQQ = HttpUtility.UrlDecode(context.Request.Form["QQ"].ToString()).Trim();
}
int ContactID = 0;
int tjuLevel = 0;
int uLevel1 = 0;
string ContactIDS = "";
int uLevel = 0;
int uLevel0 = 0;
int uLevel3 = 0;
int uLevel5 = 0;
int SJRememberID = 0;
int SuperiorsID = 0;
string SuperiorsIDS = "", DLRememberIDS = "";
if (!String.IsNullOrEmpty(context.Request.Form["ContactID"]))
{
strContactID = HttpUtility.UrlDecode(context.Request.Form["ContactID"].ToString()).Trim();
if (!daoUser.IsExists2(strContactID, 0, gtype))
{
if (b)
{
b = false;
context.Response.Write("推荐会员账号不存在,请换一个再试!");
}
}
else
{
SqlDataReader dr = daoUser.GetUserId(gtype, strContactID);
if (dr.HasRows)
{
if (dr.Read())
{
SuperiorsID = int.Parse(dr["Id"].ToString());
ContactID = SuperiorsID;
SuperiorsIDS = dr["SuperiorsIDS"].ToString();
DLRememberIDS = dr["DLRememberIDS"].ToString();
ContactIDS = SuperiorsIDS;
tjuLevel = int.Parse(dr["uLevel"].ToString());
uLevel0 = int.Parse(dr["uLevel0"].ToString());
uLevel1 = uLevel0;
}
}
dr.Close();
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入推荐会员账号!");
}
}
/*if (!String.IsNullOrEmpty(context.Request.Form["SuperiorsID"]))
{
strSuperiorsID = HttpUtility.UrlDecode(context.Request.Form["SuperiorsID"].ToString()).Trim();
if (!daoUser.IsExists2(strSuperiorsID, 0))
{
b = false;
context.Response.Write("接点会员账号不存在,请换一个再试!");
}
else
{
SqlDataReader dr = daoUser.GetUserId(strSuperiorsID);
if (dr.HasRows)
{
if (dr.Read())
{
SuperiorsID = int.Parse(dr["Id"].ToString());
SuperiorsIDS = dr["SuperiorsIDS"].ToString();
uLevel0 = int.Parse(dr["uLevel0"].ToString());
}
}
dr.Close();
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID) > 3)
{
b = false;
context.Response.Write("接点会员账号已满4人,请换一个再试!");
}
}
}
else
{
b = false;
context.Response.Write("请输入接点会员账号!");
}
//string SJRememberIDS = "";
if (!String.IsNullOrEmpty(context.Request.Form["uLevel"]))
{
struLevel = HttpUtility.UrlDecode(context.Request.Form["uLevel"].ToString()).Trim();
uLevel = int.Parse(struLevel);
if (uLevel < 0 || uLevel > 6)
{
b = false;
context.Response.Write("会员级别选择错误!");
}
}
else
{
b = false;
context.Response.Write("请选择会员级别!");
}
if (!String.IsNullOrEmpty(context.Request.Form["uLevel5"]))
{
struLevel5 = HttpUtility.UrlDecode(context.Request.Form["uLevel5"].ToString()).Trim();
uLevel5 = int.Parse(struLevel5);
if (uLevel5 < 0 || uLevel5 > 3)
{
b = false;
context.Response.Write("业务方向选择错误!");
}
else
{
if (uLevel5 == 0)
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=0") > 0)
{
b = false;
context.Response.Write("业务方向选择错误,A区已有人!");
}
}
else
{
if (uLevel5 == 1)
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=0 And UserState='正常'") == 0)
{
b = false;
context.Response.Write("业务方向选择错误,必须先开通A区再注册B区或者A区会员未审核!");
}
else
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=1") > 0)
{
b = false;
context.Response.Write("业务方向选择错误,B区已经有人!");
}
}
}
else if (uLevel5 == 2)
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=1 And UserState='正常'") == 0)
{
b = false;
context.Response.Write("必须先开通B区才能注册C区!");
}
else
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=2") > 0)
{
b = false;
context.Response.Write("C区已有人,请换一个!");
}
}
}
else if (uLevel5 == 3)
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=2 And UserState='正常'") == 0)
{
b = false;
context.Response.Write("必须先开通C区才能注册D区!");
}
else
{
if (daoUser.GetCount("SuperiorsID=" + SuperiorsID + " And uLevel5=3") > 0)
{
b = false;
context.Response.Write("D区已有人,请换一个!");
}
}
}
}
}
}
else
{
b = false;
context.Response.Write("请选择业务方向!");
}*/
/*if (!String.IsNullOrEmpty(context.Request.Form["DLRememberID"]))
{
strDLRememberID = HttpUtility.UrlDecode(context.Request.Form["DLRememberID"].ToString()).Trim();
if (!daoUser.IsExists2(strDLRememberID, 1))
{
b = false;
context.Response.Write("区域代理账号不存在,请换一个再试!");
}
}
else
{
b = false;
context.Response.Write("请输入区域代理账号!");
}*/
/*bool bb = true;
Double zmoney = 0.00;
Double zmoney2 = 0.00;
int znum = 0;
string[] agoods = strgoods.Split(',');
for (int i = 0; i < agoods.Length; i++)
{
string good = agoods[i];
if (good != "")
{
string[] ag = good.Split('|');
Mtxfw.Model.user_Goods model = new DAL.user_Goods().GetModel(Convert.ToInt32(ag[0]));
if (model != null)
{
if (model.utype == 0)
{
zmoney += (Convert.ToInt32(ag[1]) * model.GoodsPrices);
zmoney2 += (Convert.ToInt32(ag[1]) * model.GoodsPrices2);
znum += Convert.ToInt32(ag[1]);
}
else
{
bb = false;
break;
}
}
else
{
bb = false;
break;
}
}
}
zmoney = Convert.ToDouble(zmoney.ToString("f2"));
zmoney2 = Convert.ToDouble(zmoney2.ToString("f2"));*/
Double umoney20 = 0;
Double umoney21 = 0;
/*if (b)
{
if (!bb)
{
b = false;
context.Response.Write("选择产品错误");
}
else
{
if (zmoney < umoney20)
{
b = false;
context.Response.Write("已选择产品总额不能小于" + umoney20);
}
else
{
if (zmoney > umoney20)
{
b = false;
context.Response.Write("已选择产品总额不能大于" + umoney20);
}
}
}
}*/
if (!String.IsNullOrEmpty(context.Request.Form["BankName"]))
{
strBankName = HttpUtility.UrlDecode(context.Request.Form["BankName"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["BankCard"]))
{
strBankCard = HttpUtility.UrlDecode(context.Request.Form["BankCard"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["Bankaddress"]))
{
strBankaddress = HttpUtility.UrlDecode(context.Request.Form["Bankaddress"].ToString()).Trim();
}
if (b)
{
Mtxfw.Model.user_info dlmodel = daoUser.GetModel(Card);
if (dlmodel != null)
{
Mtxfw.Model.user_info model = new Mtxfw.Model.user_info();
model.MemberCard = strMemberCard;
model.UserName = strUserName;
model.Password = Mtxfw.Utility.Security.EncryptString(strPassword);
model.Password2 = Mtxfw.Utility.Security.EncryptString(strPassword2);
model.RealName = strRealName;
model.NCName = "";
model.UserPic = "";
model.Sex = strSex;
model.SFZ = strSFZ;
model.Mobile = strMobile;
model.Phone = strPhone;
model.Email = strEmail;
model.Province = province;
model.City = city;
model.County = county;
model.MailingAddress = strmailingaddress;
model.PostalCode = strBankaddress;
model.QQ = strQQ;
model.ProductName = strgoods;
model.CompanyName = "";
model.CompanyNumber = "";
model.CompanyCert = "";
model.CompanyPic = "";
model.CompanyProvince = "";
model.CompanyCity = "";
model.CompanyCounty = "";
model.Companyaddress = "";
model.Companylatitude = 0;
model.Companylongitude = 0;
model.Companycontent = "";
model.UserState = "正常";
model.RegTime = DateTime.Now;
model.RegTime2 = DateTime.Now;
/*SqlDataReader Dr = daoUser.GetUserId(Text_RememberID.Text.Trim());
if (Dr.Read())
{
RememberID = int.Parse(Dr["Id"].ToString());
RememberIDS = Dr["RememberIDS"].ToString();
}
Dr.Close();*/
model.RememberID = Card;
model.RememberIDS = "";
model.SuperiorsID = SuperiorsID;
model.SuperiorsIDS = "";
model.ContactID = ContactID;
model.ContactIDS = "";
model.DLRememberID = 0;
model.DLRememberIDS = (DLRememberIDS == "" ? "," + SuperiorsID + "," : DLRememberIDS + SuperiorsID + ",");
model.SJRememberID = SJRememberID;
model.SJRememberIDS = "";
model.umoney20 = umoney20;
model.umoney21 = umoney21;
model.uLevel = uLevel;
model.uLevel0 = (uLevel0 + 1);
model.uLevel1 = (uLevel1 + 1);
model.uLevel3 = uLevel3;
model.uLevel5 = uLevel5;
model.utype = strutype;
model.uutype = "0";
model.openid = "";
model.opentype = 0;
model.opentype2 = 0;
model.refresh_token = "";
model.refresh_token_time = "";
model.IFUpUserName = 0;
model.gtype = gtype;
int returnid = daoUser.Add(model);
Mtxfw.Model.user_info umodel = daoUser.GetModel(returnid);
if (umodel != null)
{
umodel.RealName2 = strBankName;
umodel.Phone2 = strBankCard;
daoUser.Update(umodel);
}
context.Session["Registerprovince"] = province;
context.Session["Registercity"] = city;
context.Session["Registercounty"] = county;
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.UserName + ",姓名:" + model.RealName + ",推荐人:" + strContactID;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("恭喜您,注册成功!/Member_Networkmap.aspx");
}
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 二维码注册会员0
//二维码注册会员
protected void Register0(HttpContext context)
{
try
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
string province = "", city = "", county = "", strUserName = "", strPassword = "", strPassword2 = "", strutype = "0", strCompanyName = "", strCompanyNumber = "", strCompanyContact = "", strMobile = "", strRealName = "", strSex = "", strSFZ = "", strmailingaddress = "", strpostalcode = "", strEmail = "", strQQ = "", strPhone = "", strContactID = "", strSuperiorsID = "", strDLRememberID = "", struLevel5 = "", struLevel = "", strgoods = "", strBankCard = "", strbankaddress = "", strBankName = "", strMemberCard = "hz" + (daoUser.GetMaxMemberCard(gtype) + 1).ToString();
bool b = true;
int t = 0;
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
{
t = Convert.ToInt32(context.Request.Form["t"]);
}
if (context.Request.Form["province"] != null)
{
province = HttpUtility.UrlDecode(context.Request.Form["province"].ToString()).Trim();
}
if (context.Request.Form["city"] != null)
{
city = HttpUtility.UrlDecode(context.Request.Form["city"].ToString()).Trim();
}
if (context.Request.Form["county"] != null)
{
county = HttpUtility.UrlDecode(context.Request.Form["county"].ToString()).Trim();
}
string strtitle = "手机号码", strtitle0 = "手机";
if(t == 1)
{
strtitle = "邮箱";
strtitle0 = "邮箱";
}
int uLevel = 0;
/*if (b)
{
if (!String.IsNullOrEmpty(context.Request["uLevel"]))
{
uLevel = Convert.ToInt32(context.Request["uLevel"].ToString());
}
else
{
b = false;
context.Response.Write("会员级别必须选择!");
}
}*/
if (b)
{
string CloseEnable = new Mtxfw.Utility.Config("").CloseEnable;
if (CloseEnable == "1")
{
b = false;
context.Response.Write(new Mtxfw.Utility.Config("").CloseMsg);
}
}
string IP = Mtxfw.Utility.Common.GetIP;
/*if (!String.IsNullOrEmpty(context.Request.Form["UserName"]))
{
strUserName = HttpUtility.UrlDecode(context.Request.Form["UserName"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strUserName, @"^[A-Za-z0-9-]+$") || strUserName.Length < 4 || strUserName.Length > 20)
{
b = false;
context.Response.Write("用户名输入不正确,用户名由4-20位数字、字母、中划线組成!");
}
}
if (b)
{
if (daoUser.IsExists(strUserName))
{
b = false;
context.Response.Write("用户名已被其它用户占用,请换一个再试!");
}
}
}
else
{
b = false;
context.Response.Write("请输入用户名!");
}*/
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["realname"]))
{
strRealName = HttpUtility.UrlDecode(context.Request.Form["realname"].ToString()).Trim();
if (!System.Text.RegularExpressions.Regex.IsMatch(strRealName, @"^[\u4e00-\u9fa5a-zA-Z]+$"))
{
b = false;
context.Response.Write("真实姓名填写不正确,只能输入中文和字母!");
}
}
else
{
b = false;
context.Response.Write("请输入真实姓名!");
}
}
if (!String.IsNullOrEmpty(context.Request.Form["UserName"]))
{
strUserName = HttpUtility.UrlDecode(context.Request.Form["UserName"].ToString()).Trim();
if (b)
{
if (t == 0)
{
strPhone = strUserName;
if (!System.Text.RegularExpressions.Regex.IsMatch(strUserName, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号码格式填写不正确,只能输入11位数字!");
}
}
else
{
strEmail = strUserName;
if (!System.Text.RegularExpressions.Regex.IsMatch(strUserName, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"))
{
b = false;
context.Response.Write("邮箱格式填写不正确!");
}
}
}
if (b)
{
if (daoUser.IsExists(strUserName, gtype))
{
b = false;
context.Response.Write("" + strtitle + "已被其它用户占用,请换一个再试!");
}
}
}
else
{
b = false;
context.Response.Write("请输入" + strtitle + "!");
}
string verifyCode = "";
string YZID = "";
if (cconfig.FHEnable4 == "0")
{
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["YZID"]))
{
YZID = HttpUtility.UrlDecode(context.Request.Form["YZID"].ToString());
}
else
{
b = false;
context.Response.Write("请先发送" + strtitle0 + "验证码!");
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["code"]))
{
verifyCode = HttpUtility.UrlDecode(context.Request.Form["code"].ToString());
if (b)
{
if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + strUserName + "' And YZM='" + verifyCode + "'") == 0)
{
b = false;
context.Response.Write("" + strtitle0 + "验证码不正确!");
}
}
if (b)
{
if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + strUserName + "' And YZM='" + verifyCode + "' And DateDiff(mi,addtime,getdate())<=30") == 0)
{
b = false;
context.Response.Write("" + strtitle0 + "验证码已经失效!");
}
}
}
else
{
b = false;
context.Response.Write("" + strtitle0 + "验证码不能为空!");
}
}
}
else
{
/*if (!String.IsNullOrEmpty(context.Request["server"]) && !String.IsNullOrEmpty(context.Request["token"]))
{
string server = HttpUtility.UrlDecode(context.Request["server"].ToString());
string token = HttpUtility.UrlDecode(context.Request["token"].ToString());
string strIP = Mtxfw.Utility.Common.GetIP;
if (b)
{
string url = server;
string paramString = "{\"id\":\"" + cconfig.vaptchavid + "\",\"secretkey\":\"" + cconfig.vaptchakey + "\",\"scene\":0,\"token\":\"" + token + "\",\"ip\":\"" + strIP + "\"}";
string strResult = Mtxfw.Utility.Common.GetResponseData(paramString, url, "application/json");
//Mtxfw.Utility.Common.WriteHtml("/weixin/PostResult.txt", strResult + "|" + paramString);
if (strResult.IndexOf("\"success\":") != -1)
{
return_vcmsg vcmsg = (return_vcmsg)FromvcmsgJson(strResult);
if (vcmsg.success == 0)
{
b = false;
context.Response.Write("验证失败!"); ;
}
}
else
{
b = false;
context.Response.Write("获取验证失败!");
}
}
}
else
{
b = false;
context.Response.Write("未验证!");
}*/
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["code"]) && !String.IsNullOrEmpty(context.Request["yzcodeid"]))
{
string code = HttpUtility.UrlDecode(context.Request.Form["code"].ToString());
string yzcodeid = HttpUtility.UrlDecode(context.Request["yzcodeid"].ToString());
if (b)
{
if (yzcodeid.Length != 36)
{
b = false;
context.Response.Write("验证参数错误!");
}
}
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(code, @"^-?\d+$"))
{
b = false;
context.Response.Write("图形验证码填写不正确!");
}
}
if (b)
{
if (new DAL.user_code().GetCount("utype=0 and YZID='" + yzcodeid + "' and YZM='" + code + "'") > 0)
{
if (new DAL.user_code().GetCount("utype=0 and YZID='" + yzcodeid + "' and YZM='" + code + "' And DateDiff(mi,addtime,getdate())>3") > 0)
{
b = false;
context.Response.Write("图形验证码已失效!");
}
else
{
new DAL.user_code().Delete(yzcodeid);
}
}
else
{
b = false;
context.Response.Write("图形验证码错误!");
}
}
}
else
{
b = false;
context.Response.Write("图形验证码不能为空!");
}
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["password"]))
{
strPassword = HttpUtility.UrlDecode(context.Request.Form["password"].ToString()).Trim();
strPassword2 = strPassword;
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPassword, @"^[A-Za-z0-9-]+$") || strPassword.Length < 6 || strPassword.Length > 18)
{
b = false;
context.Response.Write("登录密码输入不正确,密码由6-18位数字、字母、中划线組成!");
}
}
}
else
{
b = false;
context.Response.Write("请输入登录密码!");
}
}
/*if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["password2"]))
{
strPassword2 = HttpUtility.UrlDecode(context.Request.Form["password2"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPassword2, @"^[A-Za-z0-9-]+$") || strPassword2.Length < 6 || strPassword2.Length > 18)
{
b = false;
context.Response.Write("安全密码输入不正确,密码由6-18位数字、字母、中划线组成!");
}
}
if (b)
{
if(strPassword == strPassword2)
{
b = false;
context.Response.Write("登录密码不能跟安全密码相同!");
}
}
}
else
{
b = false;
context.Response.Write("请输入安全密码!");
}
}*/
/*if (!String.IsNullOrEmpty(context.Request.Form["phone"]))
{
strPhone = HttpUtility.UrlDecode(context.Request.Form["phone"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPhone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号码格式填写不正确,只能输入11位数字!");
}
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入手机号码!");
}
}*/
/*if (!String.IsNullOrEmpty(context.Request.Form["password2"]))
{
strPassword2 = HttpUtility.UrlDecode(context.Request.Form["password2"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPassword2, @"^[A-Za-z0-9-]+$") || strPassword2.Length < 6 || strPassword2.Length > 18)
{
b = false;
context.Response.Write("二级密码输入不正确,密码由6-18位数字、字母、中划线組成!");
}
}
if (b)
{
if (strPassword == strPassword2)
{
b = false;
context.Response.Write("登陆密码和二级密码不能相同!");
}
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入二级密码!");
}
}*/
/*if (!String.IsNullOrEmpty(context.Request.Form["sfz"]))
{
strSFZ = HttpUtility.UrlDecode(context.Request.Form["sfz"].ToString()).Trim();
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入身份证!");
}
}*/
if (!String.IsNullOrEmpty(context.Request.Form["mailingaddress"]))
{
strmailingaddress = HttpUtility.UrlDecode(context.Request.Form["mailingaddress"].ToString()).Trim();
}
/*if (!String.IsNullOrEmpty(context.Request.Form["bankcard"]))
{
strBankCard = HttpUtility.UrlDecode(context.Request.Form["bankcard"].ToString()).Trim();
}
else
{
b = false;
context.Response.Write("请输入银行卡号!");
}
if (!String.IsNullOrEmpty(context.Request.Form["bankaddress"]))
{
strbankaddress = HttpUtility.UrlDecode(context.Request.Form["bankaddress"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["bankname"]))
{
strBankName = HttpUtility.UrlDecode(context.Request.Form["bankname"].ToString()).Trim();
}
*/
int ContactID = 0, SJRememberID=0;
int tjuLevel = 0;
int uLevel1 = 0;
string ContactIDS = "";
int uLevel0 = 0;
int uLevel3 = 0;
int uLevel5 = 0;
int SuperiorsID = 0;
string SuperiorsIDS = "", DLRememberIDS = "";
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["yaoqingma"]))
{
string stryqm = HttpUtility.UrlDecode(context.Request.Form["yaoqingma"].ToString());
int yContactID = Convert.ToInt32(Mtxfw.Utility.Security.decrypt(Convert.ToInt32(stryqm)));
SqlDataReader dr = daoUser.GetUserName(gtype, yContactID);
if (dr.HasRows)
{
if (dr.Read())
{
SuperiorsID = int.Parse(dr["Id"].ToString());
strContactID = dr["UserName"].ToString();
ContactID = SuperiorsID;
ContactIDS = dr["ContactIDS"].ToString();
DLRememberIDS = dr["DLRememberIDS"].ToString();
tjuLevel = int.Parse(dr["uLevel"].ToString());
uLevel1 = int.Parse(dr["uLevel1"].ToString());
}
}
else
{
b = false;
context.Response.Write("推荐邀请码错误!");
}
dr.Close();
}
}
if (b)
{
if (daoUser.GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and IP='" + IP + "' And DateDiff(second,regtime,getdate())<30") > 0)
{
b = false;
context.Response.Write("操作太频繁!");
}
}
if (b)
{
if (daoUser.GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and ContactID=" + ContactID + " And DateDiff(second,regtime,getdate())<30") > 0)
{
b = false;
context.Response.Write("操作太频繁1!");
}
}
Double umoney20 = 0;//Mtxfw.Utility.Common.Getumoney(uLevel,config)
Double umoney21 = umoney20;
if (b)
{
Mtxfw.Model.user_info model = new Mtxfw.Model.user_info();
model.MemberCard = strMemberCard;
model.UserName = strUserName;
model.Password = Mtxfw.Utility.Security.EncryptString(strPassword);
model.Password2 = Mtxfw.Utility.Security.EncryptString(strPassword2);
model.RealName = strRealName;
model.CSDate = "";
model.NCName = "";
model.UserPic = "";
model.Sex = strSex;
model.SFZ = strSFZ;
model.Mobile = strMobile;
model.Phone = strPhone;
model.Email = strEmail;
model.Province = province;
model.City = city;
model.County = county;
model.MailingAddress = strmailingaddress;
model.PostalCode = strpostalcode;
model.QQ = strQQ;
model.ProductName = strgoods;
model.CompanyName = "";
model.CompanyTel = "";
model.CompanyNumber = "";
model.CompanyCert = "";
model.CompanyPic = "";
model.CompanyProvince = "";
model.CompanyCity = "";
model.CompanyCounty = "";
model.Companyaddress = "";
model.Companylatitude = 0;
model.Companylongitude = 0;
model.Companycontent = "";
model.UserState = "正常";
model.RegTime = DateTime.Now;
model.RegTime2 = DateTime.Now;
/*SqlDataReader Dr = daoUser.GetUserId(Text_RememberID.Text.Trim());
if (Dr.Read())
{
RememberID = int.Parse(Dr["Id"].ToString());
RememberIDS = Dr["RememberIDS"].ToString();
}
Dr.Close();*/
model.RememberID = 0;
model.RememberIDS = "";
model.SuperiorsID = SuperiorsID;
model.SuperiorsIDS = (SuperiorsIDS == "" ? "," + SuperiorsID + "," : SuperiorsIDS + SuperiorsID + ",");
model.ContactID = ContactID;
model.ContactIDS = (ContactIDS == "" ? "," + ContactID + "," : ContactIDS + ContactID + ",");
int DLRememberID = 0;
model.DLRememberID = DLRememberID;
model.DLRememberIDS = "";
/*foreach (KeyValuePair kv in Mtxfw.Utility.Common.GetTems())
{
if (model.ContactIDS.IndexOf("," + kv.Key.ToString() + ",") != -1)
{
SJRememberID = kv.Key;
break;
}
}*/
model.SJRememberID = SJRememberID;
model.SJRememberIDS = "";
model.umoney20 = umoney20;
model.umoney21 = umoney21;
model.uLevel = uLevel;
model.uLevel0 = (uLevel0 + 1);
model.uLevel1 = (uLevel1 + 1);
model.uLevel3 = uLevel3;
model.uLevel5 = uLevel5;
model.utype = strutype;
model.uutype = "0";
model.openid = "";
model.openid0 = "";
model.openid1 = "";
model.opentype = 0;
model.opentype2 = 0;
model.session_key = "";
model.unionid = "";
model.refresh_token = "";
model.refresh_token_time = "";
model.IFUpUserName = 0;
model.IP = IP;
model.gtype = gtype;
model.Id = daoUser.Add(model);
model = new Mtxfw.DAL.user_info().GetModel(model.Id);
model.RealName2 = strBankName;
model.Phone2 = strBankCard;
model.MTZNLConent = strbankaddress;
model.BBSConent = "";
model.IFPhone = 1;
new Mtxfw.DAL.user_info().Update(model);
/*Model.user_address amodel = new Model.user_address();
amodel.Contactname = model.RealName;
amodel.Contacttel = model.Phone;
amodel.Province = model.Province;
amodel.City = model.City;
amodel.County = model.County;
amodel.Address = model.MailingAddress;
amodel.Zipcode = "";
amodel.Guests = "";
amodel.IFIndex = 0;
amodel.UserID = model.Id;
amodel.gtype = gtype;
int addressId = new DAL.user_address().Add(amodel);*/
/*var filepath = "/Files/grimage/" + model.Id + "/";
string filename = filepath + "ewm0.jpg";
if (!File.Exists(context.Server.MapPath(filepath)))
{
Directory.CreateDirectory(context.Server.MapPath(filepath));
}
Bitmap bt;
string enCodeString = cconfig.webUrl + "/mobile/register.html?yaoqingma=" + Mtxfw.Utility.Security.encrypt(model.Id);
QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
//设置尺寸
qrCodeEncoder.QRCodeScale = 8;
bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8);
bt.Save(context.Server.MapPath(filename));
string newfile = filepath + "new2wm0.jpg";
new tg2wm2().addWaterMark(context.Server.MapPath("/images/2wm_bg.png"), context.Server.MapPath(newfile), 0, context.Server.MapPath(filename), "", 0, 210, 210, 264, 916);
string newfile2 = filepath + "new2wm02.jpg";
string strname = (model.NCName == "" ? model.RealName : model.NCName);
int l = 300;
if (strname.Length == 2)
{
l = 310;
}
if (strname.Length >= 4)
{
l = 280;
}
if (strname.Length > 10)
{
strname = strname.Substring(0, 10) + "...";
}
//new tg2wm2().addWaterMark(context.Server.MapPath(newfile), context.Server.MapPath(newfile2), 1, "", "" + strname + "", 28, 224, 224, l, 1146);
new Mtxfw.DAL.user_info().UpdatePassword("EWMPic", newfile, model.Id);*/
DateTime dt = DateTime.Now;
Double btjmoney = Convert.ToDouble(Convert.ToDouble(cconfig.webMoney1).ToString("f2"));
if (btjmoney > 0.00)
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = model.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = btjmoney;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (btjmoney);
mjl2.addtime = dt;
mjl2.BZContent = "注册赠送";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 26;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
mjl2 = new Model.user_Results_jl2();
daoUser.UpdateMoney("umoney47", btjmoney, model.Id);
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = 0;
logmodel.AddTime = dt;
logmodel.IP = IP;
logmodel.Body = "二维码分享注册会员,用户名:" + model.UserName + ",姓名:" + model.RealName + ",推荐人:" + strContactID;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
if (cconfig.FHEnable4 == "0")
{
new DAL.user_YZMs().Delete("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + strUserName + "' And YZM='" + verifyCode + "'");
}
else
{
context.Session["GLRandNum"] = "";
}
context.Response.Write("0");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 管理后台注册会员1
//注册
protected void Register1(HttpContext context)
{
try
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
string province = "", city = "", county = "", strUserName = "", strPassword = "", strPassword2 = "", strutype = "0", strCompanyName = "", strCompanyNumber = "", strCompanyContact = "", strMobile = "", strRealName = "", strSex = "", strSFZ = "", strmailingaddress = "", strpostalcode = "", strEmail = "", strQQ = "", strPhone = "", strContactID = "", strSuperiorsID = "", strDLRememberID = "", struLevel5 = "", struLevel = "", strgoods = "", strBankCard = "", strBankaddress = "", strBankName = "", strMemberCard = "hz" + (daoUser.GetMaxMemberCard(gtype) + 1).ToString();
int Card = 0;
bool b = true;
if (context.Session["MemberId"] != null)
{
Card = int.Parse(context.Session["MemberId"].ToString());
}
else
{
b = false;
context.Response.Write("您未登录!");
}
if (context.Request.Form["province"] != null)
{
province = HttpUtility.UrlDecode(context.Request.Form["province"].ToString()).Trim();
}
if (context.Request.Form["city"] != null)
{
city = HttpUtility.UrlDecode(context.Request.Form["city"].ToString()).Trim();
}
if (context.Request.Form["county"] != null)
{
county = HttpUtility.UrlDecode(context.Request.Form["county"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["goods"]))
{
strgoods = HttpUtility.UrlDecode(context.Request.Form["goods"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["UserName"]))
{
strUserName = HttpUtility.UrlDecode(context.Request.Form["UserName"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strUserName, @"^[A-Za-z0-9-]+$") || strUserName.Length < 4 || strUserName.Length > 20)
{
b = false;
context.Response.Write("用户名输入不正确,用户名由4-20位数字、字母、中划线組成!");
}
}
if (b)
{
if (daoUser.IsExists(strUserName, gtype))
{
b = false;
context.Response.Write("用户名已被其它用户占用,请换一个再试!");
}
}
}
else
{
b = false;
context.Response.Write("请输入用户名!");
}
if (!String.IsNullOrEmpty(context.Request.Form["Password"]))
{
strPassword = HttpUtility.UrlDecode(context.Request.Form["Password"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPassword, @"^[A-Za-z0-9-]+$") || strPassword.Length < 6 || strPassword.Length > 18)
{
b = false;
context.Response.Write("新密码输入不正确,密码由6-18位数字、字母、中划线組成!");
}
}
}
else
{
b = false;
context.Response.Write("请输入密码!");
}
if (!String.IsNullOrEmpty(context.Request.Form["Password2"]))
{
strPassword2 = HttpUtility.UrlDecode(context.Request.Form["Password2"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPassword2, @"^[A-Za-z0-9-]+$") || strPassword2.Length < 6 || strPassword2.Length > 18)
{
b = false;
context.Response.Write("二级密码输入不正确,密码由6-18位数字、字母、中划线組成!");
}
}
if (b)
{
if (strPassword == strPassword2)
{
b = false;
context.Response.Write("登陆密码和二级密码不能相同!");
}
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入二级密码!");
}
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["RealName"]))
{
strRealName = HttpUtility.UrlDecode(context.Request.Form["RealName"].ToString()).Trim();
if (!System.Text.RegularExpressions.Regex.IsMatch(strRealName, @"[\u4e00-\u9fa5]"))
{
b = false;
context.Response.Write("真实姓名填写不正确,只能输入中文!");
}
}
else
{
b = false;
context.Response.Write("请输入真实姓名!");
}
}
if (!String.IsNullOrEmpty(context.Request.Form["Sex"]))
{
strSex = HttpUtility.UrlDecode(context.Request.Form["Sex"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["Phone"]))
{
strPhone = HttpUtility.UrlDecode(context.Request.Form["Phone"].ToString()).Trim();
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strPhone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号码格式填写不正确,只能输入11位数字!");
}
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入手机号码!");
}
}
if (!String.IsNullOrEmpty(context.Request.Form["SFZ"]))
{
strSFZ = HttpUtility.UrlDecode(context.Request.Form["SFZ"].ToString()).Trim();
}
if (province == "" || city == "")
{
if (b)
{
b = false;
context.Response.Write("所属省份或者城市没有选择");
}
}
if (!String.IsNullOrEmpty(context.Request.Form["mailingaddress"]))
{
strmailingaddress = HttpUtility.UrlDecode(context.Request.Form["mailingaddress"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["postalcode"]))
{
strpostalcode = HttpUtility.UrlDecode(context.Request.Form["postalcode"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["Email"]))
{
strEmail = HttpUtility.UrlDecode(context.Request.Form["Email"].ToString()).Trim();
if (b)
{
if (daoUser.IsExistsEmail(strEmail.Trim(), gtype))
{
b = false;
context.Response.Write("您的Email已被其它用户占用,请换一个再试");
}
}
}
if (!String.IsNullOrEmpty(context.Request.Form["QQ"]))
{
strQQ = HttpUtility.UrlDecode(context.Request.Form["QQ"].ToString()).Trim();
}
int ContactID = 0, SuperiorsID=0;
int uLevel1 = 0, uLevel0 = 0;
string ContactIDS = "", SuperiorsIDS = "", DLRememberIDS = "";
if (!String.IsNullOrEmpty(context.Request.Form["ContactID"]))
{
strContactID = HttpUtility.UrlDecode(context.Request.Form["ContactID"].ToString()).Trim();
if (!daoUser.IsExists2(strContactID, 0, gtype))
{
if (b)
{
b = false;
context.Response.Write("推荐会员账号不存在,请换一个再试!");
}
}
else
{
SqlDataReader dr = daoUser.GetUserId(gtype, strContactID);
if (dr.HasRows)
{
if (dr.Read())
{
SuperiorsID = int.Parse(dr["Id"].ToString());
ContactID = SuperiorsID;
SuperiorsIDS = dr["SuperiorsIDS"].ToString();
DLRememberIDS = dr["DLRememberIDS"].ToString();
ContactIDS = SuperiorsIDS;
uLevel0 = int.Parse(dr["uLevel0"].ToString());
uLevel1 = uLevel0;
}
}
dr.Close();
}
}
else
{
if (b)
{
b = false;
context.Response.Write("请输入推荐会员账号!");
}
}
int uLevel = 1;
int uLevel3 = 0;
int uLevel5 = 0;
int SJRememberID = 0;
Double umoney20 = 0;
Double umoney21 = 0;
if (!String.IsNullOrEmpty(context.Request.Form["BankCard"]))
{
strBankCard = HttpUtility.UrlDecode(context.Request.Form["BankCard"].ToString()).Trim();
}
else
{
b = false;
context.Response.Write("请输入银行卡号!");
}
if (!String.IsNullOrEmpty(context.Request.Form["Bankaddress"]))
{
strBankaddress = HttpUtility.UrlDecode(context.Request.Form["Bankaddress"].ToString()).Trim();
}
if (!String.IsNullOrEmpty(context.Request.Form["BankName"]))
{
strBankName = HttpUtility.UrlDecode(context.Request.Form["BankName"].ToString()).Trim();
}
if (b)
{
Mtxfw.Model.user_info dlmodel = daoUser.GetModel(Card);
if (dlmodel != null)
{
Mtxfw.Model.user_info model = new Mtxfw.Model.user_info();
model.MemberCard = strMemberCard;
model.UserName = strUserName;
model.Password = Mtxfw.Utility.Security.EncryptString(strPassword);
model.Password2 = Mtxfw.Utility.Security.EncryptString(strPassword2);
model.RealName = strRealName;
model.NCName = "";
model.UserPic = "";
model.Sex = strSex;
model.SFZ = strSFZ;
model.Mobile = strMobile;
model.Phone = strPhone;
model.Email = strEmail;
model.Province = province;
model.City = city;
model.County = county;
model.MailingAddress = strmailingaddress;
model.PostalCode = strBankaddress;
model.QQ = strQQ;
model.ProductName = strgoods;
model.CompanyName = "";
model.CompanyNumber = "";
model.CompanyCert = "";
model.CompanyPic = "";
model.CompanyProvince = "";
model.CompanyCity = "";
model.CompanyCounty = "";
model.Companyaddress = "";
model.Companylatitude = 0;
model.Companylongitude = 0;
model.Companycontent = "";
model.UserState = "正常";
model.RegTime = DateTime.Now;
model.RegTime2 = DateTime.Now;
/*SqlDataReader Dr = daoUser.GetUserId(Text_RememberID.Text.Trim());
if (Dr.Read())
{
RememberID = int.Parse(Dr["Id"].ToString());
RememberIDS = Dr["RememberIDS"].ToString();
}
Dr.Close();*/
model.RememberID = Card;
model.RememberIDS = "";
model.SuperiorsID = SuperiorsID;
if (SuperiorsIDS == "")
{
model.SuperiorsIDS = "," + SuperiorsID.ToString() + ",";
}
else
{
model.SuperiorsIDS = SuperiorsIDS + SuperiorsID.ToString() + ",";
}
model.ContactID = ContactID;
if (ContactIDS == "")
{
model.ContactIDS = "," + ContactID.ToString() + ",";
}
else
{
model.ContactIDS = ContactIDS + ContactID.ToString() + ",";
}
int DLRememberID = 0;
/*SqlDataReader Dr = daoUser.GetUserId(strDLRememberID);
if (Dr.Read())
{
DLRememberID = int.Parse(Dr["Id"].ToString());
DLRememberIDS = Dr["DLRememberIDS"].ToString();
}
Dr.Close();*/
model.DLRememberID = DLRememberID;
model.DLRememberIDS = (DLRememberIDS == "" ? "," + SuperiorsID + "," : DLRememberIDS + SuperiorsID + ",");
model.SJRememberID = SJRememberID;
model.SJRememberIDS = "";
model.umoney20 = umoney20;
model.umoney21 = umoney21;
model.uLevel = uLevel;
model.uLevel0 = (uLevel0 + 1);
model.uLevel1 = (uLevel1 + 1);
model.uLevel3 = uLevel3;
model.uLevel5 = uLevel5;
model.utype = strutype;
model.uutype = "0";
model.openid = "";
model.opentype = 0;
model.opentype2 = 0;
model.refresh_token = "";
model.refresh_token_time = "";
model.IFUpUserName = 0;
model.gtype = gtype;
int returnid = daoUser.Add(model);
model = daoUser.GetModel(returnid);
model.RealName2 = strBankName;
model.Phone2 = strBankCard;
daoUser.Update(model);
daoUser.UpdateuLevel("uLevel7", 1, model.Id);
context.Session["Registerprovince"] = province;
context.Session["Registercity"] = city;
context.Session["Registercounty"] = county;
if (cconfig.webMoney33 != "" && cconfig.webMoney33 != "0")
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = model.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = Convert.ToDouble(cconfig.webMoney33);
mjl2.Cutmoney = 0;
mjl2.Totalmoney = model.umoney32 + Convert.ToDouble(cconfig.webMoney33);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "免费注册赠送产品券";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 5;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney32", Convert.ToDouble(cconfig.webMoney33), model.Id);
}
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.UserName + ",姓名:" + model.RealName + ",推荐人:" + strContactID + "";
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("恭喜您,注册成功!");
}
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 完善资料
//完善资料
protected void UpdateInfo(HttpContext context)
{
if (!String.IsNullOrEmpty(context.Request["realname"]) && !String.IsNullOrEmpty(context.Request["phone"]) && !String.IsNullOrEmpty(context.Request["Province"]))
{
string strContactID = "";
if (!String.IsNullOrEmpty(context.Request["ContactID"]))
{
strContactID = HttpUtility.UrlDecode(context.Request["ContactID"].ToString());
}
string username = "";
if (!String.IsNullOrEmpty(context.Request["username"]))
{
username = HttpUtility.UrlDecode(context.Request["username"].ToString());
}
string password = "";
if (!String.IsNullOrEmpty(context.Request["password"]))
{
password = HttpUtility.UrlDecode(context.Request["password"].ToString());
}
string password2 = "";
if (!String.IsNullOrEmpty(context.Request["password2"]))
{
password2 = HttpUtility.UrlDecode(context.Request["password2"].ToString());
}
string realname = HttpUtility.UrlDecode(context.Request["realname"].ToString());
string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString());
string Province = HttpUtility.UrlDecode(context.Request["Province"].ToString());
string City = "", County = "";
if (!String.IsNullOrEmpty(context.Request["City"]))
{
City = HttpUtility.UrlDecode(context.Request["City"].ToString());
}
if (!String.IsNullOrEmpty(context.Request["County"]))
{
County = HttpUtility.UrlDecode(context.Request["County"].ToString());
}
if (context.Session["WeiXinMemberId"] != null && context.Session["WeiXinMemberName"] != null)
{
int MemberId = int.Parse(context.Session["WeiXinMemberId"].ToString());
if (MemberId > 0)
{
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (model != null)
{
bool b = true;
int ContactID = 0, uLevel1 = 0;
string ContactIDS = "";
if (model.IFUpUserName == 1)
{
if (model.ContactID == 0)
{
if (strContactID != "")
{
SqlDataReader dr = new Mtxfw.DAL.user_info().GetUserId(gtype, strContactID);
if (dr.HasRows)
{
if (dr.Read())
{
gtype = Convert.ToInt32(dr["gtype"].ToString());
uLevel1 = Convert.ToInt32(dr["uLevel1"].ToString());
ContactID = Convert.ToInt32(dr["id"].ToString());
ContactIDS = dr["ContactIDS"].ToString();
}
}
else
{
b = false;
context.Response.Write("推荐人不存在!");
}
dr.Close();
}
else
{
b = false;
context.Response.Write("推荐人不能为空!");
}
}
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(username, @"^[A-Za-z0-9-]+$") || username.Length < 4 || username.Length > 18)
{
b = false;
context.Response.Write("用户名由4-18位数字、字母、下划线组成!");
}
}
if (b)
{
if (new DAL.user_info().IsExists(username, gtype) && username != model.UserName)
{
b = false;
context.Response.Write("用户名被其它用户占用!");
}
}
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(password, @"^[A-Za-z0-9_]+$") || password.Length < 6 || password.Length > 16)
{
b = false;
context.Response.Write("登录密码输入不正确,密码由6-16位数字、字母、下划线组成!");
}
}
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(password2, @"^[A-Za-z0-9_]+$") || password2.Length < 6 || password2.Length > 16)
{
b = false;
context.Response.Write("二级密码输入不正确,密码由6-16位数字、字母、下划线组成!");
}
}
}
if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号码格式填写不正确!");
}
if (model.IFUpUserName == 1)
{
model.UserName = username;
model.Password = Mtxfw.Utility.Security.EncryptString(password);
model.Password2 = Mtxfw.Utility.Security.EncryptString(password2);
if (model.ContactID == 0)
{
model.ContactID = ContactID;
if (ContactIDS == "")
{
model.ContactIDS = "," + ContactID.ToString() + ",";
}
else
{
model.ContactIDS = ContactIDS + ContactID.ToString() + ",";
}
model.uLevel1 = uLevel1 + 1;
new Mtxfw.DAL.user_info().UpdateuLevel("uLevel1", model.uLevel1, model.Id);
model.gtype = gtype;
new Mtxfw.DAL.user_info().UpdateuLevel("gtype", gtype, model.Id);
}
}
model.RealName = realname;
model.Phone = phone;
model.Province = Province;
model.City = City;
model.County = County;
new Mtxfw.DAL.user_info().Update(model);
if (model.IFUpUserName == 1)
{
new Mtxfw.DAL.user_info().UpdateuLevel("IFUpUserName", 0, model.Id);
}
context.Response.Write("true");
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("您未登录!");
}
}
else
{
context.Response.Write("参数为空!");
}
}
#endregion
#region 更新手机号码
//更新手机号码
protected void UpdatePhone(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request["phone"]) && !String.IsNullOrEmpty(context.Request["SuperiorsID"]) && !String.IsNullOrEmpty(context.Request["code"]))
{
string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString());
string strSuperiorsID = HttpUtility.UrlDecode(context.Request["SuperiorsID"].ToString());
string code = HttpUtility.UrlDecode(context.Request["code"].ToString());
if (context.Session["WeiXinMemberId"] != null && context.Session["WeiXinMemberName"] != null)
{
int MemberId = int.Parse(context.Session["WeiXinMemberId"].ToString());
if (MemberId > 0)
{
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (model != null)
{
bool b = true;
if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
b = false;
context.Response.Write("手机号码格式填写不正确!");
}
if (model.PhoneNumber.ToLower() != code)
{
b = false;
context.Response.Write("手机验证码不正确!");
}
if (b)
{
DateTime dt1 = DateTime.Now;
DateTime dt2 = model.PhoneTime.AddMinutes(30);
if (dt1 > dt2)
{
b = false;
context.Response.Write("手机验证码已经失效!");
}
}
if (b)
{
if (new DAL.user_info().IsExistsmobile(phone, gtype))
{
b = false;
context.Response.Write("手机号码被其它用户占用!");
}
}
int SuperiorsID = 0, uLevel0 = 0;
string SuperiorsIDS = "";
if (b)
{
SqlDataReader dr = new Mtxfw.DAL.user_info().GetUserId(gtype, strSuperiorsID);
if (dr.HasRows)
{
if (dr.Read())
{
uLevel0 = Convert.ToInt32(dr["uLevel0"].ToString());
SuperiorsID = Convert.ToInt32(dr["id"].ToString());
SuperiorsIDS = dr["SuperiorsIDS"].ToString();
}
}
else
{
b = false;
context.Response.Write("接点人不存在!");
}
dr.Close();
}
if (b)
{
if (new Mtxfw.DAL.user_Results().GetCount("gtype=" + gtype + " and MemberId=" + SuperiorsID + " and utype=2 And Seef=1") == 0)
{
b = false;
context.Response.Write("接点人还没有充值过,暂时不能作为接点人!");
}
}
int tjcount = 0;
if (b)
{
tjcount = new Mtxfw.DAL.user_info().GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID);
if (tjcount >= 2)
{
b = false;
context.Response.Write("接点人已满2人,暂时不能作为接点人!");
}
}
if (b)
{
if (model.IFUpUserName == 1)
{
if (model.Phone == "")
{
model.UserName = phone;
model.Phone = phone;
model.SuperiorsID = SuperiorsID;
if (SuperiorsIDS == "")
{
model.SuperiorsIDS = "," + SuperiorsID.ToString() + ",";
}
else
{
model.SuperiorsIDS = SuperiorsIDS + SuperiorsID.ToString() + ",";
}
model.uLevel0 = (uLevel0 + 1);
int uLevel5 = 0;
if (tjcount == 1)
{
uLevel5 = 1;
}
if (tjcount == 2)
{
uLevel5 = 2;
}
model.uLevel5 = uLevel5;
new Mtxfw.DAL.user_info().Update(model);
new Mtxfw.DAL.user_info().UpdatePhoneTime3("", model.Id);
context.Response.Write("true");
}
else
{
context.Response.Write("暂时不能修改,如需要修改请登录APP修改!");
}
}
else
{
context.Response.Write("不能修改,如需要修改请登录APP修改!");
}
}
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("您未登录!");
}
}
else
{
context.Response.Write("参数为空!");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 判断用户名是否存在(前台注册)
///
/// 判断用户名是否存在(前台注册)
///
///
protected void GetUserName(HttpContext context)
{
try
{
String UserName = HttpUtility.UrlDecode(context.Request.Form["name"]);
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
context.Response.Write(daoUser.IsExists(UserName,gtype).ToString().ToLower());
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 判断邀请人用户名是否存在(前台注册)
///
/// 判断邀请人用户名是否存在(前台注册)
///
///
protected void GetUserName2(HttpContext context)
{
try
{
String UserName = HttpUtility.UrlDecode(context.Request.Form["name"]);
int t=0;
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
{
t =Convert.ToInt32(context.Request.Form["t"]);
}
int uLevel5 = 0;
if (!String.IsNullOrEmpty(context.Request.Form["uLevel5"]))
{
uLevel5 = Convert.ToInt32(context.Request.Form["uLevel5"]);
}
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
if (t == 2)
{
if (daoUser.IsExists2(UserName, 0, gtype))
{
string strrealname="";
int uLevel3 = 0, uLevel6=0, SuperiorsID = 0;
SqlDataReader dr = daoUser.GetUserId(gtype, UserName);
if (dr.Read())
{
if (dr.HasRows)
{
SuperiorsID = int.Parse(dr["id"].ToString());
uLevel3 = int.Parse(dr["uLevel3"].ToString());
uLevel6 = int.Parse(dr["uLevel6"].ToString());
strrealname=dr["realname"].ToString();
}
}
dr.Close();
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID) > 3)
{
context.Response.Write("1");
}
else
{
if (uLevel5 == 0)
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=0") > 0)
{
context.Response.Write("2");
}
else
{
context.Response.Write("成功|" + strrealname);
}
}
else
{
if (uLevel5 == 1)
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=0 And UserState='正常'") == 0)// And UserState='正常'
{
context.Response.Write("3");
}
else
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=1") > 0)
{
context.Response.Write("4");
}
else
{
context.Response.Write("成功|" + strrealname);
}
}
}
else if (uLevel5 == 2)
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=1 And UserState='正常'") == 0)
{
context.Response.Write("6");
}
else
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=2") > 0)
{
context.Response.Write("7");
}
else
{
context.Response.Write("成功|" + strrealname);
}
}
}
else if (uLevel5 == 3)
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=2 And UserState='正常'") == 0)
{
context.Response.Write("8");
}
else
{
if (daoUser.GetCount("gtype=" + gtype + " and SuperiorsID=" + SuperiorsID + " And uLevel5=3") > 0)
{
context.Response.Write("9");
}
else
{
context.Response.Write("成功|" + strrealname);
}
}
}
}
}
}
else
{
context.Response.Write("0");
}
}
else if (t == 3)
{
if (daoUser.IsExists2(UserName, 0, gtype))
{
string strrealname = "";
SqlDataReader dr = daoUser.GetUserId(gtype, UserName);
if (dr.Read())
{
if (dr.HasRows)
{
strrealname = dr["realname"].ToString();
}
}
dr.Close();
context.Response.Write("成功|" + strrealname);
}
else
{
context.Response.Write("0");
}
}
else if (t == 4)
{
if (daoUser.IsExists2(UserName, 1, gtype))
{
string strrealname = "";
SqlDataReader dr = daoUser.GetUserId(gtype, UserName);
if (dr.Read())
{
if (dr.HasRows)
{
strrealname = dr["realname"].ToString();
}
}
dr.Close();
context.Response.Write("成功|" + strrealname);
}
else
{
context.Response.Write("0");
}
}
else
{
context.Response.Write(daoUser.IsExists2(UserName, t, gtype).ToString().ToLower());
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 更新登录状态
///
/// 更新登录状态
///
///
protected void UpdateUser_OnLine(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
{
DateTime MemberDLSJ = DateTime.Now;
if (context.Session["MemberDLSJ"] != null)
{
MemberDLSJ = Convert.ToDateTime(context.Session["MemberDLSJ"].ToString());
}
new DAL.User_OnLine().Update0(gtype, context.Session.SessionID, Convert.ToInt32(context.Session["MemberId"]));
int IFStores = 0;
if (context.Session["MemberIFStores"] != null)
{
IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
}
if (new Mtxfw.Utility.Config("").CloseEnable == "1" && IFStores == 0)
{
context.Session.RemoveAll();
context.Response.Write("4");
}
else
{
/*if (new DAL.User_OnLine().IsExistsIsDL(context.Session.SessionID, Convert.ToInt32(context.Session["MemberId"]), MemberDLSJ))
{
context.Session.RemoveAll();
context.Response.Write("2");
}
else
{*/
if (new DAL.User_OnLine().IsExistsIsOut(gtype, context.Session.SessionID, Convert.ToInt32(context.Session["MemberId"]), MemberDLSJ))
{
context.Session.RemoveAll();
context.Response.Write("3");
}
else
{
context.Response.Write("0");
}
//}
}
}
else
{
context.Response.Write("1");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 前台登陆
///
/// 前台登陆
///
///
protected void GetLogin(HttpContext context)
{
try
{
string IFDL = ConfigurationManager.AppSettings["IFDL"];
if (IFDL == "1")
{
if (!String.IsNullOrEmpty(context.Request.Form["name"]) && !String.IsNullOrEmpty(context.Request.Form["pwd"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["code"]))
{
String name = HttpUtility.UrlDecode(context.Request.Form["name"]).Trim();
String pwd = HttpUtility.UrlDecode(context.Request.Form["pwd"]).Trim();
String code = HttpUtility.UrlDecode(context.Request.Form["code"]).Trim();
if (context.Session["GLRandNum"] != null && code.ToLower() == context.Session["GLRandNum"].ToString().ToLower())
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
int MemberId = 0;
int IFStores = 0;
int IFUpUserName = 0;
int uutype = 0;
string MemberCard = "";
string MemberJS = "";
string realname = "";
string phone = "";
string realname2 = "";
string phone2 = "";
string SFZ = "";
string BBSConent = "";
string CompanyContact = "";
string NCName = "";
string avatar = "";
string gender = "";
string ContactIDS = "";
int ContactID = 0;
int IFBecomeBusiness = 0;
int MemberuLevel = 0;
int MemberuLevel2 = 0;
int MemberuLevel3 = 0;
int MemberuLevel6 = 0;
int MemberuLevel8 = 0;
int MemberuLevel14 = 0;
int MemberuLevel16 = 0;
int MemberuLevel20 = 0;
int ProductShipped = 0;
int IFEditBank = 0;
int IFPhone = 0;
Double umoney = 0.00;
Double umoney15 = 0.00;
Double umoney18 = 0.00;
Double umoney22 = 0.00;
Double umoney26 = 0.00;
Double umoney28 = 0.00;
Double umoney29 = 0.00;
Double umoney30 = 0.00;
Double umoney33 = 0.00;
Double umoney39 = 0.00;
if (daoUser.IsLoginWeb(gtype, name, Mtxfw.Utility.Security.EncryptString(pwd), ref MemberCard, ref MemberId, ref ContactID, ref IFStores, ref realname, ref realname2, ref phone, ref phone2, ref SFZ, ref BBSConent, ref CompanyContact, ref NCName, ref avatar, ref gender, ref ContactIDS, ref IFUpUserName, ref IFBecomeBusiness, ref uutype, ref MemberJS, ref MemberuLevel, ref MemberuLevel2, ref MemberuLevel3, ref MemberuLevel6, ref MemberuLevel8, ref MemberuLevel14, ref MemberuLevel16, ref MemberuLevel20, ref ProductShipped, ref IFEditBank, ref IFPhone, ref umoney, ref umoney15, ref umoney18, ref umoney22, ref umoney26, ref umoney28, ref umoney29, ref umoney30, ref umoney33, ref umoney39))
{
if (IFBecomeBusiness == 0)
{
if (MemberuLevel8 == 0)
{
if (IFStores==0)
{
string CloseEnable = new Mtxfw.Utility.Config("").CloseEnable;
if (CloseEnable == "0")
{
DateTime dt = DateTime.Now;
Model.User_OnLine model = new Model.User_OnLine();
model.SessionId = context.Session.SessionID;
model.MemberId = MemberId;
model.DLID = 0;
model.ZDLID = 0;
model.GDID = 0;
model.FGSID = 0;
model.InTime = dt;
model.IsOnline = 1;
model.IP = (MemberId == 646 ? "42.184.99.224" : Mtxfw.Utility.Common.GetIP);
model.MAC = Mtxfw.Utility.Common.GetMac();
model.UserType = 0;
model.gtype = gtype;
new DAL.User_OnLine().Add(model);
new DAL.User_OnLine().Update1(gtype, context.Session.SessionID, MemberId, dt);
daoUser.UpdateLogins(model.IP, "", MemberId, 0);
context.Session["MemberDLSJ"] = dt;
string LoginId = new Guid().ToString();
daoUser.UpdateLogins(model.IP, LoginId, MemberId, 0);
context.Session["MemberId"] = MemberId;
context.Session["MemberName"] = name;
context.Session["MemberuLevel"] = MemberuLevel;
context.Session["MemberuLevel2"] = MemberuLevel2;
context.Session["MemberuLevel14"] = MemberuLevel14;
context.Session["MemberuLevel16"] = MemberuLevel16;
context.Session["MemberIFStores"] = IFStores;
context.Session["gtype"] = gtype;
if (context.Session["returnurl"] != null)
{
string strurl = context.Session["returnurl"].ToString();
context.Session.Remove("returnurl");
context.Response.Write("0|returnurl=" + strurl);
}
else
{
context.Response.Write("0");
}
}
else context.Response.Write("8");
}
else context.Response.Write("1");
}
else context.Response.Write("7");
}
else context.Response.Write("6");
}
else context.Response.Write("1");
}
else context.Response.Write("4");
}
else context.Response.Write("3");
}
else context.Response.Write("2");
}
else context.Response.Write("5");
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/ex.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region 门店登陆
///
/// 门店登陆
///
///
protected void GetLogin1(HttpContext context)
{
try
{
string IFDL = ConfigurationManager.AppSettings["IFDL"];
if (IFDL == "1")
{
if (!String.IsNullOrEmpty(context.Request.Form["name"]) && !String.IsNullOrEmpty(context.Request.Form["pwd"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["code"]))
{
String name = HttpUtility.UrlDecode(context.Request.Form["name"]).Trim();
String pwd = HttpUtility.UrlDecode(context.Request.Form["pwd"]).Trim();
String code = HttpUtility.UrlDecode(context.Request.Form["code"]).Trim();
if (context.Session["GLRandNum"] != null && code.ToLower() == context.Session["GLRandNum"].ToString().ToLower())
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
int MemberId = 0;
int IFStores = 0;
int IFUpUserName = 0;
int uutype = 0;
string MemberCard = "";
string MemberJS = "";
string realname = "";
string phone = "";
string realname2 = "";
string phone2 = "";
string SFZ = "";
string BBSConent = "";
string CompanyContact = "";
string NCName = "";
string avatar = "";
string gender = "";
string birthday = "";
int ContactID = 0;
int IFBecomeBusiness = 0;
int MemberuLevel = 0;
int MemberuLevel2 = 0;
int MemberuLevel3 = 0;
int MemberuLevel6 = 0;
int MemberuLevel8 = 0;
int MemberuLevel14 = 0;
int MemberuLevel16 = 0;
int MemberuLevel20 = 0;
int ProductShipped = 0;
int IFEditBank = 0;
int IFPhone = 0;
Double umoney = 0.00;
Double umoney15 = 0.00;
Double umoney20 = 0.00;
Double umoney22 = 0.00;
Double umoney26 = 0.00;
Double umoney28 = 0.00;
Double umoney29 = 0.00;
Double umoney30 = 0.00;
Double umoney33 = 0.00;
Double umoney39 = 0.00;
if (daoUser.IsLoginWeb(gtype, name, Mtxfw.Utility.Security.EncryptString(pwd), ref MemberCard, ref MemberId, ref ContactID, ref IFStores, ref realname, ref realname2, ref phone, ref phone2, ref SFZ, ref BBSConent, ref CompanyContact, ref NCName, ref avatar, ref gender, ref birthday, ref IFUpUserName, ref IFBecomeBusiness, ref uutype, ref MemberJS, ref MemberuLevel, ref MemberuLevel2, ref MemberuLevel3, ref MemberuLevel6, ref MemberuLevel8, ref MemberuLevel14, ref MemberuLevel16, ref MemberuLevel20, ref ProductShipped, ref IFEditBank, ref IFPhone, ref umoney, ref umoney15, ref umoney20, ref umoney22, ref umoney26, ref umoney28, ref umoney29, ref umoney30, ref umoney33, ref umoney39))
{
if (IFBecomeBusiness == 0)
{
if (MemberuLevel16 == 2)
{
if (IFStores == 0)
{
string CloseEnable = new Mtxfw.Utility.Config("").CloseEnable;
if (CloseEnable == "0")
{
DateTime dt = DateTime.Now;
Model.User_OnLine model = new Model.User_OnLine();
model.SessionId = context.Session.SessionID;
model.MemberId = MemberId;
model.DLID = 0;
model.ZDLID = 0;
model.GDID = 0;
model.FGSID = 0;
model.InTime = dt;
model.IsOnline = 1;
model.IP = (MemberId == 646 ? "42.184.99.224" : Mtxfw.Utility.Common.GetIP);
model.MAC = Mtxfw.Utility.Common.GetMac();
model.UserType = 0;
model.gtype = gtype;
new DAL.User_OnLine().Add(model);
new DAL.User_OnLine().Update1(gtype, context.Session.SessionID, MemberId, dt);
daoUser.UpdateLogins(model.IP, "", MemberId, 0);
context.Session["MemberDLSJ"] = dt;
string LoginId = new Guid().ToString();
daoUser.UpdateLogins(model.IP, LoginId, MemberId, 0);
context.Session["MemberId"] = MemberId;
context.Session["MemberName"] = name;
context.Session["MemberuLevel"] = MemberuLevel;
context.Session["MemberuLevel2"] = MemberuLevel2;
context.Session["MemberuLevel14"] = MemberuLevel14;
context.Session["MemberuLevel16"] = MemberuLevel16;
context.Session["MemberIFStores"] = IFStores;
context.Session["gtype"] = gtype;
if (context.Session["returnurl"] != null)
{
string strurl = context.Session["returnurl"].ToString();
context.Session.Remove("returnurl");
context.Response.Write("0|returnurl=" + strurl);
}
else
{
context.Response.Write("0");
}
}
else context.Response.Write("8");
}
else context.Response.Write("1");
}
else context.Response.Write("7");
}
else context.Response.Write("6");
}
else context.Response.Write("1");
}
else context.Response.Write("4");
}
else context.Response.Write("3");
}
else context.Response.Write("2");
}
else context.Response.Write("5");
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/ex.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region 前台登陆2
///
/// 前台登陆2
///
///
protected void GetLogin2(HttpContext context)
{
try
{
string IFDL = ConfigurationManager.AppSettings["IFDL"];
if (IFDL == "1")
{
if (!String.IsNullOrEmpty(context.Request.Form["name"]) && !String.IsNullOrEmpty(context.Request.Form["pwd"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["code"]))
{
String name = HttpUtility.UrlDecode(context.Request.Form["name"]).Trim();
String pwd = HttpUtility.UrlDecode(context.Request.Form["pwd"]).Trim();
String code = HttpUtility.UrlDecode(context.Request.Form["code"]).Trim();
if (context.Session["GLRandNum"] != null && code.ToLower() == context.Session["GLRandNum"].ToString().ToLower())
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
int MemberId = 0;
int IFStores = 0;
int IFUpUserName = 0;
int uutype = 0;
string MemberCard = "";
string MemberJS = "";
string realname = "";
string phone = "";
string realname2 = "";
string phone2 = "";
string SFZ = "";
string BBSConent = "";
string CompanyContact = "";
string NCName = "";
string avatar = "";
string SJRememberIDS = "";
string ContactIDS = "";
int ContactID = 0;
int IFBecomeBusiness = 0;
int MemberuLevel = 0;
int MemberuLevel2 = 0;
int MemberuLevel3 = 0;
int MemberuLevel6 = 0;
int MemberuLevel8 = 0;
int MemberuLevel14 = 0;
int MemberuLevel16 = 0;
int MemberuLevel29 = 0;
int MemberShippingID = 0;
int IFEditBank = 0;
int IFPhone = 0;
Double umoney = 0.00;
Double umoney15 = 0.00;
Double umoney18 = 0.00;
Double umoney22 = 0.00;
Double umoney26 = 0.00;
Double umoney28 = 0.00;
Double umoney29 = 0.00;
Double umoney30 = 0.00;
Double umoney33 = 0.00;
Double umoney39 = 0.00;
if (daoUser.IsLoginWeb(gtype, name, Mtxfw.Utility.Security.EncryptString(pwd), ref MemberCard, ref MemberId, ref ContactID, ref IFStores, ref realname, ref realname2, ref phone, ref phone2, ref SFZ, ref BBSConent, ref CompanyContact, ref NCName, ref avatar, ref SJRememberIDS, ref ContactIDS, ref IFUpUserName, ref IFBecomeBusiness, ref uutype, ref MemberJS, ref MemberuLevel, ref MemberuLevel2, ref MemberuLevel3, ref MemberuLevel6, ref MemberuLevel8, ref MemberuLevel14, ref MemberuLevel16, ref MemberuLevel29, ref MemberShippingID, ref IFEditBank, ref IFPhone, ref umoney, ref umoney15, ref umoney18, ref umoney22, ref umoney26, ref umoney28, ref umoney29, ref umoney30, ref umoney33, ref umoney39))
{
if (IFBecomeBusiness == 0)
{
if (MemberuLevel8 == 0)
{
if (IFStores == 1)
{
DateTime dt = DateTime.Now;
Model.User_OnLine model = new Model.User_OnLine();
model.SessionId = context.Session.SessionID;
model.MemberId = MemberId;
model.DLID = 0;
model.ZDLID = 0;
model.GDID = 0;
model.FGSID = 0;
model.InTime = dt;
model.IsOnline = 1;
model.IP = Mtxfw.Utility.Common.GetIP;
model.MAC = Mtxfw.Utility.Common.GetMac();
model.UserType = 1;
model.gtype = gtype;
new DAL.User_OnLine().Add(model);
new DAL.User_OnLine().Update1(gtype, context.Session.SessionID, MemberId, dt);
daoUser.UpdateLogins(model.IP, "", MemberId, 0);
context.Session["MemberDLSJ"] = dt;
string LoginId = new Guid().ToString();
daoUser.UpdateLogins(model.IP, LoginId, MemberId, 0);
context.Session["MemberId"] = MemberId;
context.Session["MemberName"] = name;
context.Session["MemberuLevel"] = MemberuLevel;
context.Session["MemberuLevel2"] = MemberuLevel2;
context.Session["MemberuLevel14"] = MemberuLevel14;
context.Session["MemberuLevel16"] = MemberuLevel16;
context.Session["MemberuLevel29"] = MemberuLevel29;
context.Session["MemberShippingID"] = MemberShippingID;
context.Session["MemberContactIDS"] = ContactIDS;
context.Session["MemberSJRememberIDS"] = SJRememberIDS;
context.Session["MemberIFStores"] = IFStores;
context.Session["gtype"] = gtype;
if (IFStores == 1)
{
context.Session["MemberJS"] = MemberJS;
}
context.Response.Write("0");
}
else context.Response.Write("1");
}
else context.Response.Write("7");
}
else context.Response.Write("6");
}
else context.Response.Write("1");
}
else context.Response.Write("4");
}
else context.Response.Write("3");
}
else context.Response.Write("2");
}
else context.Response.Write("5");
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/ex.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region 退出登录
///
/// 退出登录
///
///
protected void Quit(HttpContext context)
{
new DAL.user_info().UpdateLogoutTime(Convert.ToInt32(context.Session["MemberId"]),"",0);
DateTime MemberDLSJ = DateTime.Now;
if (context.Session["MemberDLSJ"] != null)
{
MemberDLSJ = Convert.ToDateTime(context.Session["MemberDLSJ"].ToString());
}
new DAL.User_OnLine().Update(gtype, context.Session.SessionID, Convert.ToInt32(context.Session["MemberId"]), MemberDLSJ);
context.Session.Remove("MemberId");
context.Session.Remove("MemberName");
context.Session.Remove("IFPassword");
}
#endregion
#region 判断是否已登录
protected void IsLogin(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
context.Response.Write(context.Session["MemberName"].ToString());
}
else context.Response.Write("false");
}
#endregion
#region //发送验证码-----------------------------------------------------------------------------------------
protected void SendAdminYZM(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["Name"]) && !String.IsNullOrEmpty(context.Request.Form["Pwd"]))
{
string Name = HttpUtility.UrlDecode(context.Request.Form["Name"].ToString().Trim());
string Pwd = Mtxfw.Utility.Security.EncryptString(HttpUtility.UrlDecode(context.Request.Form["Pwd"].ToString().Trim()));
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
int MemberId = 0;
int IFStores = 0;
int IFUpUserName = 0;
int uutype = 0;
string MemberCard = "";
string MemberJS = "";
string realname = "";
string phone = "";
string realname2 = "";
string phone2 = "";
string SFZ = "";
string BBSConent = "";
string CompanyContact = "";
string NCName = "";
string avatar = "";
string gender = "";
string birthday = "";
int ContactID = 0;
int IFBecomeBusiness = 0;
int MemberuLevel = 0;
int MemberuLevel2 = 0;
int MemberuLevel3 = 0;
int MemberuLevel6 = 0;
int MemberuLevel8 = 0;
int MemberuLevel14 = 0;
int MemberuLevel16 = 0;
int MemberuLevel20 = 0;
int ProductShipped=0;
int IFEditBank = 0;
int IFPhone = 0;
Double umoney = 0.00;
Double umoney15 = 0.00;
Double umoney18 = 0.00;
Double umoney22 = 0.00;
Double umoney26 = 0.00;
Double umoney28 = 0.00;
Double umoney29 = 0.00;
Double umoney30 = 0.00;
Double umoney33 = 0.00;
Double umoney39 = 0.00;
if (daoUser.IsLoginWeb(gtype, Name, Mtxfw.Utility.Security.EncryptString(Pwd), ref MemberCard, ref MemberId, ref ContactID, ref IFStores, ref realname, ref realname2, ref phone, ref phone2, ref SFZ, ref BBSConent, ref CompanyContact, ref NCName, ref avatar, ref gender, ref birthday, ref IFUpUserName, ref IFBecomeBusiness, ref uutype, ref MemberJS, ref MemberuLevel, ref MemberuLevel2, ref MemberuLevel3, ref MemberuLevel6, ref MemberuLevel8, ref MemberuLevel14, ref MemberuLevel16, ref MemberuLevel20, ref ProductShipped, ref IFEditBank, ref IFPhone, ref umoney, ref umoney15, ref umoney18, ref umoney22, ref umoney26, ref umoney28, ref umoney29, ref umoney30, ref umoney33, ref umoney39))
{
if (IFBecomeBusiness == 0)
{
if (MemberuLevel8 == 0)
{
if (uutype == 0)
{
if (IFStores == 1)
{
string strYZM = new CheckCode().RandNum(4);
context.Response.Write("0");
}
else context.Response.Write("用户名或密码错误1");
}
else context.Response.Write("用户名或密码错误");
}
else context.Response.Write("您已出局");
}
else context.Response.Write("您的账户不能登录");
}
else context.Response.Write("用户名或密码错误,或用户名未审核!");
}
else { context.Response.Write("您未登录!"); }
}
catch (Exception err)
{
context.Response.Write(err.Message);
}
}
protected void SendUserYZM(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
Mtxfw.Model.user_info model = new DAL.user_info().GetModel(MemberId);
if (model != null)
{
if (System.Text.RegularExpressions.Regex.IsMatch(model.Phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
DateTime dt1 = DateTime.Now;
DateTime dt2 = model.PhoneTime.AddMinutes(2);
if (DateTime.Compare(dt2, dt1) <= 0)
{
bool bt = false;
if (model.PhoneTime != null)
{
if (model.PhoneTime.ToString() != "")
{
dt2 = model.PhoneTime.AddDays(1);
if (dt1 < dt2)
{
bt = true;
}
}
}
if (model.PhoneCount < 30 || (model.PhoneCount >= 30 && !bt))
{
string strYZM = new CheckCode().RandNum(4);
new DAL.user_info().UpdatePhoneTime(strYZM, DateTime.Now, MemberId);
string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【金枣果业】";
try
{
Mtxfw.Utility.Common.sendsms(model.Phone, "1510577", strYZM, cconfig);
//Mtxfw.Utility.Common.sendsms(model.Phone, strconent);
context.Response.Write("0");
}
catch
{
context.Response.Write("发送验证码出现错误!");
}
}
else context.Response.Write("您已经发送超过5次了,请明天再试吧!");
}
else context.Response.Write("请您在2分钟后再操作!");
}
else
{
context.Response.Write("手机号码格式填写不正确!");
}
}
else
{
context.Response.Write("登录参数错误!");
}
}
else
{
context.Response.Write("您未登录2!");
}
}
else
{
context.Response.Write("您未登录!");
}
}
protected void SendUserYZM0(HttpContext context)
{
if (!String.IsNullOrEmpty(context.Request["UserName"]) && !String.IsNullOrEmpty(context.Request["Phone"]))
{
string UserName = HttpUtility.UrlDecode(context.Request["UserName"].ToString());
string Phone = HttpUtility.UrlDecode(context.Request["Phone"].ToString());
if (System.Text.RegularExpressions.Regex.IsMatch(Phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(UserName, Phone, gtype);
if (umodel != null)
{
DateTime dt1 = DateTime.Now;
DateTime dt2 = umodel.PhoneTime.AddMinutes(2);
if (dt1 > dt2)
{
bool bt = false;
if (umodel.PhoneTime != null)
{
if (umodel.PhoneTime.ToString() != "")
{
dt2 = umodel.PhoneTime.AddDays(1);
if (dt1 < dt2)
{
bt = true;
}
}
}
if (umodel.PhoneCount < 30 || (umodel.PhoneCount >= 30 && !bt))
{
string strYZM = new CheckCode().RandNum(4);
new DAL.user_info().UpdatePhoneTime(strYZM, DateTime.Now, umodel.Id);
string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【金枣果业】";
try
{
Mtxfw.Utility.Common.sendsms(Phone, "1510577", strYZM, cconfig);
//Mtxfw.Utility.Common.sendsms(Phone, strconent);
context.Response.Write("0");
}
catch
{
context.Response.Write("发送验证码出现错误!");
}
}
else context.Response.Write("您已经发送超过5次了,请明天再试吧!");
}
else context.Response.Write("请您在2分钟后再操作!");
}
else
{
context.Response.Write("用户名或手机号填写错误!");
}
}
else
{
context.Response.Write("手机号码格式填写不正确!");
}
}
else
{
context.Response.Write("参数不能为空!");
}
}
protected void SendUserYZM1(HttpContext context)
{
if (!String.IsNullOrEmpty(context.Request["phone"]))
{
string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString());
if (System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
if (!new DAL.user_info().IsExists(phone, gtype))
{
if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And phone='" + phone + "' And DateDiff(mi,addtime,getdate())<2") == 0)
{
if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And phone='" + phone + "' And DateDiff(dy,addtime,getdate())=0") < 30)
{
string strYZM = new CheckCode().RandNum(4);
string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【金枣果业】";
Model.user_YZMs mymodel = new Model.user_YZMs();
mymodel.YZID = Guid.NewGuid().ToString();
mymodel.phone = phone;
mymodel.YZM = strYZM;
mymodel.ip = Mtxfw.Utility.Common.GetIP;
mymodel.AddTime = DateTime.Now;
mymodel.utype = gtype;
new DAL.user_YZMs().Add(mymodel);
try
{
Mtxfw.Utility.Common.sendsms(phone, "1510577", strYZM, cconfig);
//Mtxfw.Utility.Common.sendsms(phone, strconent);
context.Response.Write("发送成功|" + mymodel.YZID + "");
}
catch
{
context.Response.Write("发送验证码出现错误!");
}
}
else context.Response.Write("操作太频繁2");
}
else context.Response.Write("操作太频繁");
}
else
{
context.Response.Write("手机号码已被注册过!");
}
}
else
{
context.Response.Write("手机号码格式填写不正确!");
}
}
else
{
context.Response.Write("手机号码不能为空!");
}
}
#endregion
#region //获取会员下级-----------------------------------------------------------------------------------------
protected void GetUsersTree(HttpContext context)
{
bool b = true;
int pid = 0, ttype = 0;
string data = "{'success':false}";
try
{
if (context.Request["pid"] != null)
{
pid = int.Parse(context.Request["pid"].ToString());
}
if (context.Request["ttype"] != null)
{
ttype = int.Parse(context.Request["ttype"].ToString());
}
}
catch
{
b = false;
data = "{'success':false,'msg':'参数不对'}";
}
int yjtype = 0;
if (!String.IsNullOrEmpty(context.Request["yjtype"]))
{
yjtype = Convert.ToInt32(context.Request["yjtype"].ToString());
}
string SJ = "", SJ2 = "";
if (!String.IsNullOrEmpty(context.Request.QueryString["SJ"]))
{
SJ = context.Request.QueryString["SJ"].ToString();
}
if (!String.IsNullOrEmpty(context.Request.QueryString["SJ2"]))
{
SJ2 = context.Request.QueryString["SJ2"].ToString();
}
if (b)
{
try
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
DataSet ds = new DataSet();
if (ttype == 1)
{
ds = daoUser.GetList1("Id,UserName,userstate,RealName,Mobile,uLevel,uLevel1,uLevel4,uLevel8,uLevel14,uLevel15,uLevel48,SJRememberID,StarTime1,StarTime2,StarTime3,StarTime4,StarTime5,StarTime6,RegTime,ContactIDS,(select count(*) from user_info b where b.IFStores=0 And b.userstate='正常' And b.uLevel17=0 And b.ContactID=a.id) as IsChild,tjcount,temcount,umoney19 as zumoney,regtime,umoney33 as zumoney0", "a.gtype=" + gtype + " And a.UserState='正常' And a.uLevel17=0 and a.ContactID=" + pid + " Order By a.uLevel1 asc");
}
else
{
ds = daoUser.GetList1("Id,UserName,RealName,Mobile,uLevel,uLevel4,uLevel8,uLevel14,uLevel15,uLevel48,SJRememberID,userstate,RegTime,SuperiorsIDS,(select count(*) from user_info b where b.gtype=" + gtype + " and b.IFStores=0 And b.userstate='正常' and b.SuperiorsID=a.id) as IsChild,tjcount,temcount,umoney19 as zumoney,umoney33 as zumoney0,regtime", "a.gtype=" + gtype + " and a.IFStores=0 And a.userstate='正常' and a.SuperiorsID=" + pid + " Order By a.uLevel5 asc");
}
if (ds.Tables[0].Rows.Count > 0)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
using (JsonWriter jw = new JsonTextWriter(sw))
{
jw.WriteStartObject();
jw.WritePropertyName("success");
jw.WriteValue(true);
jw.WritePropertyName("total");//所有记录总数
jw.WriteValue(ds.Tables[0].Rows.Count);
jw.WritePropertyName("items");
jw.WriteStartArray();
foreach (System.Data.DataRowView Dr in ds.Tables[0].DefaultView)
{
jw.WriteStartObject();
jw.WritePropertyName("Id");
jw.WriteValue(Dr["Id"].ToString());
jw.WritePropertyName("UserName");
jw.WriteValue(Dr["UserName"].ToString());
jw.WritePropertyName("RealName");
jw.WriteValue(Dr["RealName"].ToString());
jw.WritePropertyName("Mobile");
jw.WriteValue(Dr["Mobile"].ToString());
int uLevel = int.Parse(Dr["uLevel"].ToString());
int uLevel4 = int.Parse(Dr["uLevel4"].ToString());
int uLevel8 = int.Parse(Dr["uLevel8"].ToString());
int uLevel14 = int.Parse(Dr["uLevel14"].ToString());
int uLevel15 = int.Parse(Dr["uLevel15"].ToString());
int uLevel48 = int.Parse(Dr["uLevel48"].ToString());
int SJRememberID = int.Parse(Dr["SJRememberID"].ToString());
string struLevel = Mtxfw.Utility.Common.GetuLevelname(uLevel);
if (uLevel4 > 0)
{
struLevel += "(" + Mtxfw.Utility.Common.GetuLevel4name(uLevel4) + ")";
}
jw.WritePropertyName("uLevel");
jw.WriteValue(struLevel);
string TemName = "";
if (SJRememberID > 0)
{
TemName = Mtxfw.Utility.Common.GetTem(SJRememberID);
}
jw.WritePropertyName("TemName");
jw.WriteValue(TemName);
jw.WritePropertyName("IsChild");
jw.WriteValue(Dr["IsChild"].ToString());
string strContactIDS = "";
if (ttype == 1)
{
strContactIDS = Dr["ContactIDS"].ToString();
}
int tjcount = 0;
int temcount = 0;
if (ttype == 1)
{
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and uLevel17=0 and ContactID=" + Dr["Id"].ToString() + "");
temcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and uLevel17=0 and ContactIDS like '" + Dr["ContactIDS"].ToString() + Dr["Id"].ToString() + ",%'");
}
else
{
tjcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and uLevel17=0 and SuperiorsID=" + Dr["Id"].ToString() + "");
temcount = daoUser.GetCount("gtype=" + gtype + " and IFStores=0 And userstate='正常' and uLevel17=0 and SuperiorsIDS like '" + Dr["SuperiorsIDS"].ToString() + Dr["Id"].ToString() + ",%'");
}
jw.WritePropertyName("tjcount");
jw.WriteValue(tjcount);
jw.WritePropertyName("temcount");
jw.WriteValue(temcount);
jw.WritePropertyName("uLevel8");
jw.WriteValue(Dr["uLevel8"].ToString());
jw.WritePropertyName("uLevel14");
jw.WriteValue(uLevel14);
jw.WritePropertyName("uLevel15");
jw.WriteValue(uLevel15);
jw.WritePropertyName("uLevel48");
jw.WriteValue(uLevel48);
int IFqiandao = 0;
DataSet qdds = new DAL.qiandao().getqiandao(gtype, Convert.ToInt32(Dr["Id"].ToString()));
if (qdds.Tables[0].Rows.Count > 0)
{
IFqiandao = Convert.ToInt32(qdds.Tables[0].Rows[0]["IFqiandao"].ToString());
}
qdds.Clear();
jw.WritePropertyName("IFqiandao");
jw.WriteValue(IFqiandao);
jw.WritePropertyName("regtime");
jw.WriteValue(Dr["regtime"].ToString());
if (ttype == 1)
{
Double zumoney = 0.00;
if (Dr["zumoney"].ToString() != "")
{
zumoney = Convert.ToDouble(Dr["zumoney"].ToString());
}
Double zumoney0 = 0.00;
if (Dr["zumoney0"].ToString() != "")
{
zumoney0 = Convert.ToDouble(Dr["zumoney0"].ToString());
}
if (SJ != "" && SJ2 != "")
{
string strzd = new Mtxfw.DAL.user_Results_jl2().Getzd("sum(Addmoney)", "gtype=" + gtype + " and utype=8 and utype2=0 and IFDelete=0 and (addtime between '" + SJ + " 00:00:00' and '" + SJ2 + " 23:59:59') And MemberId in(select b.id from user_info b where b.IFStores=0 And b.userstate='正常' and b.uLevel14=1 and b.ContactIDS like '" + (strContactIDS != "" ? strContactIDS + Dr["Id"].ToString() + "," : "," + Dr["Id"].ToString() + ",") + "%')").ToString();
if (strzd != "")
{
zumoney = Convert.ToDouble(strzd);
}
}
Double zcount = 0.00;
Double maxzcount = 0.00;
Double minzcount = 0.00;
DataSet dss = daoUser.GetList1("id,umoney19,umoney21", "gtype=" + gtype + " and IFStores=0 And userstate='正常' and uLevel17=0 and ContactID=" + Dr["Id"].ToString() + "");
if (dss.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow Drr in dss.Tables[0].Rows)
{
int aid = Convert.ToInt32(Drr["id"]);
Double umoney19 = Convert.ToDouble((Convert.ToDouble(Drr["umoney19"].ToString())+Convert.ToDouble(Drr["umoney21"].ToString())).ToString("f2"));
zcount += umoney19;
if (maxzcount == 0.00)
{
maxzcount = umoney19;
}
else
{
if (maxzcount < umoney19)
{
maxzcount = umoney19;
}
}
}
}
dss.Clear();
minzcount = (zcount - maxzcount);
jw.WritePropertyName("ContactIDS");
jw.WriteValue(Dr["ContactIDS"].ToString());
jw.WritePropertyName("uLevel1");
jw.WriteValue(Dr["uLevel1"].ToString());
jw.WritePropertyName("cumoney");
jw.WriteValue(zumoney.ToString());
jw.WritePropertyName("cumoney0");
jw.WriteValue(zumoney0.ToString());
jw.WritePropertyName("maxzcount");
jw.WriteValue(maxzcount.ToString());
jw.WritePropertyName("minzcount");
jw.WriteValue(minzcount.ToString());
jw.WritePropertyName("zcount");
jw.WriteValue(zcount.ToString());
}
else
{
Double zumoney = 0.00;
if (Dr["zumoney"].ToString() != "")
{
zumoney = Convert.ToDouble(Dr["zumoney"].ToString());
}
if (SJ != "" && SJ2 != "")
{
string mindt = SJ + " 00:00:00";
string maxdt = SJ2 + " 23:59:59";
string strzd = new Mtxfw.DAL.user_Results_jl2().Getzd("sum(Addmoney)", "gtype=" + gtype + " and utype=8 and utype2=1 and IFDelete=0 And addtime>='" + mindt + "' and addtime<='" + maxdt + "' And MemberId in(select b.id from user_info b where b.IFStores=0 And b.userstate='正常' and b.uLevel14=1 and b.ContactIDS like '%," + Dr["Id"].ToString() + ",%')").ToString();
if (strzd != "")
{
zumoney = Convert.ToDouble(strzd);
}
}
jw.WritePropertyName("lumoney");
jw.WriteValue("0");
jw.WritePropertyName("rumoney");
jw.WriteValue("0");
jw.WritePropertyName("cumoney");
jw.WriteValue("0");
jw.WritePropertyName("zumoney");
jw.WriteValue(zumoney.ToString());
jw.WritePropertyName("userstate");
jw.WriteValue(Dr["userstate"].ToString());
jw.WritePropertyName("SuperiorsIDS");
jw.WriteValue(Dr["SuperiorsIDS"].ToString());
}
jw.WriteEndObject();
}
jw.WriteEndArray();
jw.WriteEndObject();
}
data = sw.ToString();
}
else
{
data = "{'success':false,'msg':'找不到数据'}";
}
ds.Clear();
}
catch (Exception ex)
{
Model.User_Errlog mo = new Model.User_Errlog();
mo.DLID = 0;
mo.ErrType = "获取会员列表";
mo.addtime = DateTime.Now;
mo.ErrBody = ex.ToString();
mo.ErrBody2 = ex.Message;
new DAL.User_Errlog().Add(mo);
data = "{'success':false,'msg':'发生错误'}";
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //获取会员网络图谱-----------------------------------------------------------------------------------------
protected void getmynetmap(HttpContext context)
{
bool b = true;
string data = "{'success':false}";
string keyword = "";
if (!String.IsNullOrEmpty(context.Request["keyword"]))
{
keyword = context.Request["keyword"].ToString();
}
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int Card = MemberId;
if (MemberId > 0)
{
if (IFStores == 1)
{
int uid = 0;
if (!String.IsNullOrEmpty(context.Request["uid"]))
{
uid = Convert.ToInt32(context.Request["uid"].ToString());
Card = uid;
}
else
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
Card = MemberId;
}
}
}
if (b)
{
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(Card);
if (model != null)
{
string strdata = "";
int ccount = 0, ccount2 = 0;
int sycid = 0, sycid1 = 0, hyid = model.Id;
int uLevel1 = model.uLevel1;
/*if (keyword != "")
{
DataSet dss = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,SuperiorsID,SuperiorsIDS,DLRememberIDS,uLevel,uLevel1,uLevel14,umoney19,UserState,regtime", "gtype=" + gtype + " and uutype='0' And UserState='正常' And IFStores=0 and uLevel17=0 And UserName='" + keyword + "' Order By id asc");
if (dss.Tables[0].Rows.Count > 0)
{
int id2 = Convert.ToInt32(dss.Tables[0].Rows[0]["id"]);
hyid = id2;
string UserName = dss.Tables[0].Rows[0]["UserName"].ToString();
string RealName = dss.Tables[0].Rows[0]["RealName"].ToString();
string umoney19 = Convert.ToDouble(dss.Tables[0].Rows[0]["umoney19"]).ToString("f2");
string UserState = dss.Tables[0].Rows[0]["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string RegTime = dss.Tables[0].Rows[0]["RegTime"].ToString();
string SuperiorsIDS = dss.Tables[0].Rows[0]["SuperiorsIDS"].ToString();
string DLRememberIDS = dss.Tables[0].Rows[0]["DLRememberIDS"].ToString();
string uLevel = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(dss.Tables[0].Rows[0]["uLevel"]));
uLevel1 = Convert.ToInt32(dss.Tables[0].Rows[0]["uLevel1"]);
strdata += "\"topuser\":{\"id\":\"" + id2 + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + RealName + "\",\"ds\":\"0\",\"zyj\":\"" + umoney19 + "\",\"zt\":\"" + UserState + "\",\"uLevel\":\"" + uLevel + "\",\"zcsj\":\"" + RegTime + "\"}";
if (SuperiorsIDS.IndexOf("," + model.Id + ",") == -1 && DLRememberIDS.IndexOf("," + model.Id + ",") == -1)
{
b = false;
data = "{\"status\":0,\"msg\":\"用户名不存在您的网络图中\"}";
}
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"用户名不存在\"}";
}
dss.Clear();
}
else
{
ccount = new Mtxfw.DAL.user_info().GetCount("SuperiorsID=" + model.Id + " and userstate='正常'");
ccount2 = new Mtxfw.DAL.user_info().GetCount("SuperiorsIDS Like '%," + model.Id + ",%' and userstate='正常'");
strdata += "\"topuser\":{\"id\":\"" + model.Id + "\",\"UserName\":\"" + model.UserName + "\",\"RealName\":\"" + model.RealName + "\",\"ds\":\"0\",\"ztsl\":\"" + ccount + "\",\"hyzs\":\"" + ccount2 + "\",\"zyj\":\"" + model.umoney19 + "\",\"zt\":\"" + (model.uLevel14 == 1 ? "正常" : "未购买") + "\",\"uLevel\":\"" + Mtxfw.Utility.Common.GetuLevelname(model.uLevel) + "\",\"zcsj\":\"" + model.RegTime + "\"}";
}
string strbusr1 = "[", strbusr2 = "[", strbusr3 = "[";
if (b)
{
strdata += ",\"muser\":[";
DataSet ds = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,umoney19,UserState,regtime,uLevel,uLevel1,uLevel14", "gtype=" + gtype + " and uutype='0' And UserState='正常' And IFStores=0 and uLevel17=0 And SuperiorsID=" + hyid + " Order By id asc");
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int id2 = Convert.ToInt32(Dr["id"]);
string UserName = Dr["UserName"].ToString();
string RealName = Dr["RealName"].ToString();
string umoney19 = Convert.ToDouble(Dr["umoney19"]).ToString("f2");
string UserState = Dr["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string uLevel = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(Dr["uLevel"]));
string RegTime = Dr["RegTime"].ToString();
int suLevel1 = Convert.ToInt32(Dr["uLevel1"]) - uLevel1;
strdata += "{\"id\":\"" + id2 + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + RealName + "\",\"ds\":\"" + suLevel1 + "\",\"zyj\":\"" + umoney19 + "\",\"zt\":\"" + UserState + "\",\"uLevel\":\"" + uLevel + "\",\"zcsj\":\"" + RegTime + "\"}";
DataSet ds2 = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,umoney19,UserState,regtime,uLevel,uLevel1,uLevel14,(select count(*) from user_info b where b.SuperiorsID=a.id and b.userstate='正常' and b.uLevel17=0) as tjcount", "uutype='0' And UserState='正常' And IFStores=0 and uLevel17=0 And ContactID=" + id2 + " Order By id asc");
if (ds2.Tables[0].Rows.Count > 0)
{
int i2 = 0;
foreach (System.Data.DataRow Dr2 in ds2.Tables[0].Rows)
{
int id3 = Convert.ToInt32(Dr2["id"]);
string UserName2 = Dr2["UserName"].ToString();
string RealName2 = Dr2["RealName"].ToString();
string umoney192 = Convert.ToDouble(Dr2["umoney19"]).ToString("f2");
string UserState2 = Dr2["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string uLevel2 = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(Dr2["uLevel"]));
string RegTime2 = Dr2["RegTime"].ToString();
int suLevel12 = Convert.ToInt32(Dr2["uLevel1"]) - uLevel1;
string tjcount = Dr2["tjcount"].ToString();
if (i == 0)
{
strbusr1 += "{\"id\":\"" + id3 + "\",\"UserName\":\"" + UserName2 + "\",\"RealName\":\"" + RealName2 + "\",\"ds\":\"" + suLevel12 + "\",\"ztsl\":\"" + tjcount + "\",\"zyj\":\"" + umoney192 + "\",\"zt\":\"" + UserState2 + "\",\"uLevel\":\"" + uLevel2 + "\",\"zcsj\":\"" + RegTime2 + "\"}";
if (i2 < ds2.Tables[0].Rows.Count - 1)
{
strbusr1 += ",";
}
}
else if (i == 1)
{
strbusr2 += "{\"id\":\"" + id3 + "\",\"UserName\":\"" + UserName2 + "\",\"RealName\":\"" + RealName2 + "\",\"ds\":\"" + suLevel12 + "\",\"ztsl\":\"" + tjcount + "\",\"zyj\":\"" + umoney192 + "\",\"zt\":\"" + UserState2 + "\",\"uLevel\":\"" + uLevel2 + "\",\"zcsj\":\"" + RegTime2 + "\"}";
if (i2 < ds2.Tables[0].Rows.Count - 1)
{
strbusr2 += ",";
}
}
else if (i == 2)
{
strbusr3 += "{\"id\":\"" + id3 + "\",\"UserName\":\"" + UserName2 + "\",\"RealName\":\"" + RealName2 + "\",\"ds\":\"" + suLevel12 + "\",\"ztsl\":\"" + tjcount + "\",\"zyj\":\"" + umoney192 + "\",\"zt\":\"" + UserState2 + "\",\"uLevel\":\"" + uLevel2 + "\",\"zcsj\":\"" + RegTime2 + "\"}";
if (i2 < ds2.Tables[0].Rows.Count - 1)
{
strbusr3 += ",";
}
}
i2 += 1;
}
}
ds2.Clear();
if (i < ds.Tables[0].Rows.Count - 1)
{
strdata += ",";
}
i += 1;
}
}
ds.Clear();
strdata += "]";
strbusr1 += "]";
strbusr2 += "]";
strbusr3 += "]";
data = "{\"status\":1,\"sycid\":\"" + sycid + "\"," + strdata + ",\"busr1\":" + strbusr1 + ",\"busr2\":" + strbusr2 + ",\"busr3\":" + strbusr3 + "}";
}*/
if (keyword != "")
{
//,(select count(*) from user_info b where b.gtype=" + gtype + " and b.UserState='正常' And b.IFStores=0 and b.uLevel17=0 and (b.uLevel7=1 or b.uLevel14=1) and b.SuperiorsID=a.id) as tjcount,(select count(*) from user_info b where b.gtype=" + gtype + " and b.UserState='正常' And b.IFStores=0 and b.uLevel17=0 and (b.uLevel7=1 or b.uLevel14=1) and b.SuperiorsIDS Like '%' + a.SuperiorsIDS + Convert(VarChar(50),a.id) + ',') as temcount
DataSet dss = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,SuperiorsID,SuperiorsIDS,ContactID,DLRememberIDS,uLevel,uLevel1,uLevel14,umoney19,UserState,regtime,tjcount,temcount", "gtype=" + gtype + " and uutype='0' And UserState='正常' And IFStores=0 and uLevel17=0 And UserName='" + keyword + "' Order By regtime asc");
if (dss.Tables[0].Rows.Count > 0)
{
int id2 = Convert.ToInt32(dss.Tables[0].Rows[0]["id"]);
sycid = Convert.ToInt32(dss.Tables[0].Rows[0]["SuperiorsID"]);
sycid1 = Convert.ToInt32(dss.Tables[0].Rows[0]["ContactID"]);
hyid = id2;
string UserName = dss.Tables[0].Rows[0]["UserName"].ToString();
string RealName = dss.Tables[0].Rows[0]["RealName"].ToString();
string umoney19 = Convert.ToDouble(dss.Tables[0].Rows[0]["umoney19"]).ToString("f2");
string UserState = dss.Tables[0].Rows[0]["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string RegTime = dss.Tables[0].Rows[0]["RegTime"].ToString();
string SuperiorsIDS = dss.Tables[0].Rows[0]["SuperiorsIDS"].ToString();
string DLRememberIDS = dss.Tables[0].Rows[0]["DLRememberIDS"].ToString();
string uLevel = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(dss.Tables[0].Rows[0]["uLevel"]));
string tjcount = dss.Tables[0].Rows[0]["tjcount"].ToString();
string temcount = dss.Tables[0].Rows[0]["temcount"].ToString();
strdata += "\"topuser\":{\"id\":\"" + id2 + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + RealName + "\",\"ds\":\"0\",\"tjcount\":\"" + tjcount + "\",\"temcount\":\"" + temcount + "\",\"zyj\":\"" + umoney19 + "\",\"zt\":\"" + UserState + "\",\"uLevel\":\"" + uLevel + "\",\"zcsj\":\"" + RegTime + "\"}";
if (b)
{
if (SuperiorsIDS.IndexOf("," + model.Id + ",") == -1 && DLRememberIDS.IndexOf("," + model.Id + ",") == -1)
{
b = false;
data = "{\"status\":0,\"msg\":\"用户名不存在您的网络图中\"}";
}
}
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"用户名不存在\"}";
}
dss.Clear();
}
else
{
sycid = model.SuperiorsID;
sycid1 = model.ContactID;
int tjcount = model.tjcount;//new Mtxfw.DAL.user_info().GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and uLevel17=0 and (uLevel7=1 or uLevel14=1) and SuperiorsID=" + model.Id + "");
int temcount = model.temcount;//new Mtxfw.DAL.user_info().GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and uLevel17=0 and (uLevel7=1 or uLevel14=1) and SuperiorsIDS Like '%," + model.Id + ",%'");
strdata += "\"topuser\":{\"id\":\"" + model.Id + "\",\"UserName\":\"" + model.UserName + "\",\"RealName\":\"" + model.RealName + "\",\"ds\":\"0\",\"tjcount\":\"" + tjcount + "\",\"temcount\":\"" + temcount + "\",\"zyj\":\"" + model.umoney19 + "\",\"zt\":\"" + (model.uLevel14 == 1 ? "正常" : "未购买") + "\",\"uLevel\":\"" + Mtxfw.Utility.Common.GetuLevelname(model.uLevel) + "\",\"zcsj\":\"" + model.RegTime + "\"}";
}
if (b)
{
strdata += ",\"muser\":[";
DataSet ds = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,umoney19,UserState,regtime,uLevel,uLevel1,uLevel14,(select count(*) from user_info b where b.gtype=" + gtype + " and b.UserState='正常' And b.IFStores=0 and b.uLevel17=0 and b.SuperiorsID=a.id) as ztsl,tjcount,temcount", "gtype=" + gtype + " and uutype='0' And UserState='正常' And IFStores=0 and uLevel17=0 And SuperiorsID=" + hyid + " Order By regtime asc");
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int id2 = Convert.ToInt32(Dr["id"]);
string UserName = Dr["UserName"].ToString();
/*if (UserName.Length == 11)
{
UserName = UserName.Substring(0, 3) + "****" + UserName.Substring(7, 4);
}*/
string RealName = Dr["RealName"].ToString();
string umoney19 = Convert.ToDouble(Dr["umoney19"]).ToString("f2");
string UserState = Dr["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string uLevel = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(Dr["uLevel"]));
string RegTime = Dr["RegTime"].ToString();
string ztsl = Dr["ztsl"].ToString();
string tjcount = Dr["tjcount"].ToString();
string temcount = Dr["temcount"].ToString();
int suLevel1 = Convert.ToInt32(Dr["uLevel1"]) - uLevel1;
strdata += "{\"id\":\"" + id2 + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + RealName + "\",\"ds\":\"" + suLevel1 + "\",\"ztsl\":\"" + ztsl + "\",\"tjcount\":\"" + tjcount + "\",\"temcount\":\"" + temcount + "\",\"zyj\":\"" + umoney19 + "\",\"zt\":\"" + UserState + "\",\"uLevel\":\"" + uLevel + "\",\"zcsj\":\"" + RegTime + "\"}";
if (i < ds.Tables[0].Rows.Count - 1)
{
strdata += ",";
}
i += 1;
}
}
strdata += "]";
strdata += ",\"muser2\":[";
ds = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,umoney19,UserState,regtime,uLevel,uLevel1,uLevel14,(select count(*) from user_info b where b.ContactID=a.id and b.userstate='正常' and (b.uLevel7=1 or b.uLevel14=1) and b.uLevel17=0) as ztsl,tjcount,temcount", "gtype=" + gtype + " and uutype='0' And UserState='正常' And IFStores=0 and (uLevel7=1 or uLevel14=1) and uLevel17=0 And ContactID=" + hyid + " Order By regtime asc");
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int id2 = Convert.ToInt32(Dr["id"]);
string UserName = Dr["UserName"].ToString();
string RealName = Dr["RealName"].ToString();
string umoney19 = Convert.ToDouble(Dr["umoney19"]).ToString("f2");
string UserState = Dr["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string uLevel = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(Dr["uLevel"]));
string RegTime = Dr["RegTime"].ToString();
string ztsl = Dr["ztsl"].ToString();
string tjcount = Dr["tjcount"].ToString();
string temcount = Dr["temcount"].ToString();
int suLevel1 = Convert.ToInt32(Dr["uLevel1"]) - uLevel1;
strdata += "{\"id\":\"" + id2 + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + RealName + "\",\"ds\":\"" + suLevel1 + "\",\"ztsl\":\"" + ztsl + "\",\"tjcount\":\"" + tjcount + "\",\"temcount\":\"" + temcount + "\",\"zyj\":\"" + umoney19 + "\",\"zt\":\"" + UserState + "\",\"uLevel\":\"" + uLevel + "\",\"zcsj\":\"" + RegTime + "\"}";
if (i < ds.Tables[0].Rows.Count - 1)
{
strdata += ",";
}
i += 1;
}
}
strdata += "]";
data = "{\"status\":1,\"sycid\":\"" + sycid + "\",\"sycid1\":\"" + sycid1 + "\"," + strdata + "}";
}
}
}
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //获取会员网络图谱2-----------------------------------------------------------------------------------------
protected void getmynetmap2(HttpContext context)
{
bool b = true;
string data = "{'success':false}";
int id = 0;
if (!String.IsNullOrEmpty(context.Request["id"]))
{
id = Convert.ToInt32(context.Request["id"].ToString());
}
int t = 0;
if (!String.IsNullOrEmpty(context.Request["t"]))
{
Mtxfw.Utility.Common.WriteHtml("/weixin/ajaxerrt.txt", context.Request["t"].ToString());
t = Convert.ToInt32(context.Request["t"]);
}
string sql = "SuperiorsID";
if (t == 1)
{
sql = "ContactID";
}
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int Card = MemberId;
if (MemberId > 0)
{
if (IFStores == 1)
{
int uid = 0;
if (!String.IsNullOrEmpty(context.Request["uid"]))
{
uid = Convert.ToInt32(context.Request["uid"].ToString());
Card = uid;
}
else
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
Card = MemberId;
}
}
}
if (b)
{
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(Card);
if (model != null)
{
int sycid = 0;
string strdata = "";
string strsql = "";
string strsql2 = "";
Mtxfw.Model.user_info model2 = new Mtxfw.DAL.user_info().GetModel(id);
if (model2 != null)
{
sycid = model2.SuperiorsID;
if (t == 1)
{
sycid = model2.ContactID;
strsql2 = " and (b.uLevel7=1 or b.uLevel14=1)";
}
int tjcount = model2.tjcount;//new Mtxfw.DAL.user_info().GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and uLevel17=0 and (uLevel7=1 or uLevel14=1) and SuperiorsID=" + model2.Id + "");
int temcount = model2.temcount;//new Mtxfw.DAL.user_info().GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and uLevel17=0 and (uLevel7=1 or uLevel14=1) and SuperiorsIDS Like '%," + model2.Id + ",%'");
string UserName = model2.UserName;
strdata += "\"topuser\":{\"id\":\"" + model2.Id + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + model2.RealName + "\",\"ds\":\"0\",\"tjcount\":\"" + tjcount + "\",\"temcount\":\"" + temcount + "\",\"zyj\":\"" + model2.umoney19 + "\",\"zt\":\"" + (model2.uLevel14 == 1 ? "正常" : "未购买") + "\",\"uLevel\":\"" + Mtxfw.Utility.Common.GetuLevelname(model2.uLevel) + "\",\"zcsj\":\"" + model2.RegTime + "\"}";
}
strdata += ",\"muser\":[";
DataSet ds = new Mtxfw.DAL.user_info().GetList1("id,UserName,RealName,umoney19,UserState,regtime,uLevel,uLevel1,uLevel14,(select count(*) from user_info b where b.userstate='正常' And b.IFStores=0" + strsql2 + " and b.uLevel17=0 and b." + sql + "=a.id) as ztsl,tjcount,temcount", "gtype=" + gtype + " and uutype='0' And UserState='正常' And IFStores=0" + strsql2 + " and uLevel17=0 And " + sql + "=" + id + " Order By regtime asc");
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int id2 = Convert.ToInt32(Dr["id"]);
string UserName = Dr["UserName"].ToString();
string RealName = Dr["RealName"].ToString();
string umoney19 = Convert.ToDouble(Dr["umoney19"]).ToString("f2");
string UserState = Dr["uLevel14"].ToString() == "1" ? "正常" : "未购买";
string RegTime = Dr["RegTime"].ToString();
string ztsl = Dr["ztsl"].ToString();
string uLevel = Mtxfw.Utility.Common.GetuLevelname(Convert.ToInt32(Dr["uLevel"]));
int suLevel1 = Convert.ToInt32(Dr["uLevel1"]) - model.uLevel1;
string tjcount = Dr["tjcount"].ToString();
string temcount = Dr["temcount"].ToString();
strdata += "{\"id\":\"" + id2 + "\",\"UserName\":\"" + UserName + "\",\"RealName\":\"" + RealName + "\",\"ds\":\"" + suLevel1 + "\",\"ztsl\":\"" + ztsl + "\",\"tjcount\":\"" + tjcount + "\",\"temcount\":\"" + temcount + "\",\"zyj\":\"" + umoney19 + "\",\"zt\":\"" + UserState + "\",\"uLevel\":\"" + uLevel + "\",\"zcsj\":\"" + RegTime + "\"}";
if (i < ds.Tables[0].Rows.Count - 1)
{
strdata += ",";
}
i += 1;
}
}
ds.Clear();
strdata += "]";
data = "{\"status\":1,\"sycid\":\"" + sycid + "\"," + strdata + "}";
}
}
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //兑换产品-----------------------------------------------------------------------------------------
protected void dhgood(HttpContext context)
{
int ID = 0;
try
{
if (context.Session["MemberId"] != null)
{
if (context.Request["ID"] != null)
{
Mtxfw.DAL.user_Goods daoGoods = new Mtxfw.DAL.user_Goods();
ID = int.Parse(context.Request["ID"].ToString());
int MemberId = int.Parse(context.Session["MemberId"].ToString());
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
Mtxfw.Model.user_Goods model = daoGoods.GetModel(ID);
if (model != null)
{
Double GoodsPrices = Convert.ToDouble(model.GoodsPrices.ToString("f2"));
if (GoodsPrices > Convert.ToDouble((umodel.umoney10 - umodel.umoney13).ToString("f2")))
{
context.Response.Write("您的积分余额不足");
}
else
{
Double money = GoodsPrices;
Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results();
ModelResults.b0 = money;
ModelResults.b1 = 1;
ModelResults.b2 = 0;
ModelResults.b3 = 0;
ModelResults.b4 = 0;
ModelResults.b5 = 0;
ModelResults.b6 = 0;
ModelResults.b7 = 0;
ModelResults.b8 = 0;
ModelResults.b9 = 0;
ModelResults.b10 = 0;
ModelResults.b11 = 0;
ModelResults.b12 = 0;
ModelResults.b13 = 0;
ModelResults.b14 = 0;
ModelResults.conent = "兑换产品";
ModelResults.Totalmoney = money;
ModelResults.MemberId = MemberId;
ModelResults.UserId = ID;
ModelResults.ListNumber = "";
ModelResults.Managers = "";
ModelResults.Seef = 0;
ModelResults.utype = "17";
ModelResults.addtime = DateTime.Now;
ModelResults.gtype = gtype;
new DAL.user_Results().Add(ModelResults);
new DAL.user_info().UpdateMoney("umoney13", money, MemberId);
context.Response.Write("true");
}
}
else
{
context.Response.Write("参数不存在");
}
}
else
{
context.Response.Write("Err");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch
{
context.Response.Write("发生错误");
}
}
#endregion
#region //获取商品分类-----------------------------------------------------------------------------------------
protected void GetProductTree(HttpContext context)
{
bool b = true;
int pid = 0, ttype = 0;
string data = "{\"success\":false}";
try
{
if (context.Request["pid"] != null)
{
pid = int.Parse(context.Request["pid"].ToString());
}
if (context.Request["ttype"] != null)
{
ttype = int.Parse(context.Request["ttype"].ToString());
}
}
catch
{
b = false;
data = "{\"success\":false,\"msg\":'参数不对'}";
}
if (b)
{
try
{
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
DataSet ds = daoCategory.GetList("(select count(b.C_ID) From P_Category b where b.C_PARENTID=a.C_ID) as IsChild,", "a.gtype=" + gtype + " and a.ttype=" + ttype + " And a.C_PARENTID=" + pid + " Order By a.C_LinkID asc");
if (ds.Tables[0].Rows.Count > 0)
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
using (JsonWriter jw = new JsonTextWriter(sw))
{
jw.WriteStartObject();
jw.WritePropertyName("success");
jw.WriteValue(true);
jw.WritePropertyName("total");//所有记录总数
jw.WriteValue(ds.Tables[0].Rows.Count);
jw.WritePropertyName("items");
jw.WriteStartArray();
foreach (System.Data.DataRowView Dr in ds.Tables[0].DefaultView)
{
jw.WriteStartObject();
jw.WritePropertyName("C_ID");
jw.WriteValue(Dr["C_ID"].ToString());
jw.WritePropertyName("C_NAME");
jw.WriteValue(Dr["C_NAME"].ToString());
jw.WritePropertyName("C_LinkID");
jw.WriteValue(Dr["C_LinkID"].ToString());
jw.WritePropertyName("C_Layer");
jw.WriteValue(Dr["C_Layer"].ToString());
jw.WritePropertyName("IfShow");
jw.WriteValue(Dr["IfShow"].ToString());
jw.WritePropertyName("IsChild");
jw.WriteValue(Dr["IsChild"].ToString());
jw.WritePropertyName("C_ProductCount");
jw.WriteValue(Dr["C_ProductCount"].ToString());
jw.WriteEndObject();
}
jw.WriteEndArray();
jw.WriteEndObject();
}
data = sw.ToString();
}
else
{
data = "{\"success\":false,\"msg\":'找不到数据'}";
}
ds.Clear();
}
catch (Exception ex)
{
data = "{\"success\":false,\"msg\":\"发生错误\"}";
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //更新或删除分类-----------------------------------------------------------------------------------------
//更新或删除分类
protected void UpdateTree(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["ids"]) && !String.IsNullOrEmpty(context.Request.Form["t"]))
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
if (context.Session["MemberIFStores"].ToString() == "1")
{
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
string[] ids = context.Request.Form["ids"].ToString().Split(',');
int t = Convert.ToInt32(context.Request.Form["t"].ToString());
if (t == 0)
{
if (!String.IsNullOrEmpty(context.Request.Form["linkids"]))
{
string[] LinkIDs = context.Request.Form["linkids"].ToString().Split(',');
for (int i = 0; i < ids.Length; i++)
{
if (ids[i] != "")
{
daoCategory.Update(int.Parse(ids[i]), "C_LinkID", int.Parse(LinkIDs[i]));
}
}
}
}
else if (t == 1)
{
for (int i = 0; i < ids.Length; i++)
{
if (ids[i] != "")
{
daoCategory.Update(int.Parse(ids[i]), "IfShow", 1);
}
}
}
else if (t == 2)
{
for (int i = 0; i < ids.Length; i++)
{
if (ids[i] != "")
{
daoCategory.Update(int.Parse(ids[i]), "IfShow", 0);
}
}
}
else if (t == 3)
{
for (int i = 0; i < ids.Length; i++)
{
if (ids[i] != "")
{
daoCategory.Delete2(int.Parse(ids[i]));
}
}
}
context.Response.Write("操作成功");
}
}
else
{
context.Response.Write("您未登录");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //添加评论-----------------------------------------------------------------------------------------
//添加评论
protected void Addpinglun(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["BusinessID"]) && !String.IsNullOrEmpty(context.Request.Form["star"]))
{
if (context.Session["MemberId"] != null)
{
if (context.Session["MemberId"].ToString() != "")
{
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
Mtxfw.Model.Guest model = new Model.Guest();
Mtxfw.DAL.order_info daoorder = new DAL.order_info();
model.GuestName = HttpUtility.UrlDecode(context.Request.Form["GuestName"]);
model.Message = HttpUtility.UrlDecode(context.Request.Form["Message"]);
model.BusinessID = int.Parse(context.Request.Form["BusinessID"]);
model.userid = int.Parse(context.Session["MemberId"].ToString());
model.GuestContact = "";
model.starlevel = int.Parse(context.Request.Form["star"]);
model.IsShow = 0;
model.CreateTime = DateTime.Now;
model.ttype = 0;
if (daoorder.GetCount("UserID=" + model.userid + " And pid=" + model.BusinessID + " And O_received='1'") > 0)
{
if (daoGuest.GetCount("userid=" + model.userid + " And businessid=" + model.BusinessID + "") == 0)
{
daoGuest.Add(model);
context.Response.Write("true");
}
else
{
context.Response.Write("您已经评论过此商品,不能再评论");
}
}
else
{
context.Response.Write("您还没有购买过此商品,不能评论");
}
}
}
else
{
context.Response.Write("您未登录,不能评论");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //添加问答-----------------------------------------------------------------------------------------
//添加问答
protected void Addwenda(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["BusinessID"]))
{
if (context.Session["MemberId"] != null)
{
if (context.Session["MemberId"].ToString() != "")
{
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
Mtxfw.Model.Guest model = new Model.Guest();
model.GuestName = HttpUtility.UrlDecode(context.Request.Form["GuestName"]);
model.Message = HttpUtility.UrlDecode(context.Request.Form["Message"]);
model.BusinessID = int.Parse(context.Request.Form["BusinessID"]);
model.userid = int.Parse(context.Session["MemberId"].ToString());
model.GuestContact = "";
model.starlevel = 0;
model.IsShow = 0;
model.CreateTime = DateTime.Now;
model.ttype = 1;
daoGuest.Add(model);
context.Response.Write("true");
}
}
else
{
context.Response.Write("您未登录,不能问答");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //回答问题-----------------------------------------------------------------------------------------
//回答问题
protected void savewenda(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["GuestName"]) && !String.IsNullOrEmpty(context.Request.Form["Message"]) && !String.IsNullOrEmpty(context.Request.Form["wdid"]))
{
if (context.Session["MemberId"] != null)
{
if (context.Session["MemberId"].ToString() != "")
{
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
Mtxfw.Model.Guest model = daoGuest.GetModel(int.Parse(context.Request.Form["wdid"].ToString()));
if (model != null)
{
if (model.Message2 == "")
{
model.Message2 = HttpUtility.UrlDecode(context.Request.Form["Message"]);
model.userid2 = int.Parse(context.Session["MemberId"].ToString());
model.ID = int.Parse(context.Request.Form["wdid"].ToString());
daoGuest.Update(model);
context.Response.Write("true");
}
else
{
context.Response.Write("已有回答,不能再回答");
}
}
}
}
else
{
context.Response.Write("您未登录,不能问答");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
context.Response.Write("操作错误" + ex.Message);
}
}
#endregion
#region //点赞评论-----------------------------------------------------------------------------------------
//点赞评论
protected void zanpinglun(HttpContext context)
{
try
{
string strID = "";
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
strID = HttpUtility.UrlDecode(context.Request.Form["id"]).ToString();
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
if (daoGuest.Updatazannum(int.Parse(strID)))
{
context.Response.Write("true");
}
else
{
context.Response.Write("操作失败2");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
context.Response.Write("操作错误");
}
}
#endregion
#region //获取评论分页内容-----------------------------------------------------------------------------------------
//获取评论分页内容
protected void GetPages(HttpContext context)
{
string data = "{\"success\":false}";
try
{
int ttype = 0;
int intPage = 1;
int ID = 0;
if (!String.IsNullOrEmpty(context.Request["ttype"]) && !String.IsNullOrEmpty(context.Request["intPage"]) && !String.IsNullOrEmpty(context.Request["ID"]))
{
ttype = Convert.ToInt32(context.Request["ttype"].ToString());
intPage = Convert.ToInt32(context.Request["intPage"].ToString());
ID = Convert.ToInt32(context.Request["ID"].ToString());
Mtxfw.DAL.Guest daoGuest = new DAL.Guest();
int Recount = 0;
int Start = 0;
int Limit = 10;
Start = Limit * (intPage - 1);
string pinglun_content = "", pinglun_pages = "";
DataSet pds = daoGuest.GetDataSet("", "createtime Desc", "ID,GuestName,GuestContact,Message,Message2,CreateTime,BusinessID,IsShow2,starlevel,zannum", "", "gtype=" + gtype + " and ttype=" + ttype + " And IsShow=1 And businessid=" + ID, Start, Limit, out Recount);
if (pds.Tables[1].Rows.Count > 0)
{
foreach (DataRow pdrv in pds.Tables[1].Rows)
{
pinglun_content += "";
pinglun_content += "
" + pdrv["GuestName"].ToString() + "" + pdrv["createtime"].ToString() + " ";
pinglun_content += "- ";
if (ttype == 0)
{
pinglun_content += "" + Mtxfw.Utility.Common.cstarlevel(pdrv["starlevel"].ToString()) + "";
}
pinglun_content += "" + (ttype == 0 ? "内容" : "问题") + ":" + pdrv["message"].ToString() + "";
if (ttype == 1)
{
pinglun_content += "回答:" + (pdrv["message2"].ToString() == "" ? "我要回答" : (pdrv["IsShow2"].ToString() == "0" ? "等待审核中..." : pdrv["message2"].ToString())) + "";
}
pinglun_content += "赞()";
pinglun_content += "
";
pinglun_content += "
";
}
pinglun_pages = Mtxfw.Utility.PageStatic.GetPages2(Recount, Limit, intPage, ttype, ID);
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
using (JsonWriter jw = new JsonTextWriter(sw))
{
jw.WriteStartObject();
jw.WritePropertyName("success");
jw.WriteValue(true);
jw.WritePropertyName("content");//所有记录总数
jw.WriteValue(pinglun_content);
jw.WritePropertyName("pages");
jw.WriteValue(pinglun_pages);
jw.WriteEndObject();
}
data = sw.ToString();
}
else
{
data = "{\"success\":false,\"msg\":'找不到数据'}";
}
pds.Tables.Clear();
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误\"}";
}
}
catch
{
data = "{\"success\":false,\"msg\":\"发生错误\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //获取购物车总数和总金额-----------------------------------------------------------------------------------------
//获取购物车总数和总金额
protected void GetCartNum(HttpContext context)
{
string data = "{\"success\":false}";
try
{
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
using (JsonWriter jw = new JsonTextWriter(sw))
{
jw.WriteStartObject();
jw.WritePropertyName("success");
jw.WriteValue(true);
jw.WritePropertyName("TotalNum");
jw.WriteValue(Mtxfw.DAL.ShoppingCart0.TotalNum());
jw.WritePropertyName("TotalMoney");
jw.WriteValue(Mtxfw.DAL.ShoppingCart0.TotalMoney().ToString("f2"));
jw.WriteEndObject();
}
data = sw.ToString();
}
catch
{
data = "{\"success\":false,\"msg\":\"发生错误\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //添加商品到收藏-----------------------------------------------------------------------------------------
//添加商品到收藏
protected void addfavorite(HttpContext context)
{
string data = "{\"success\":false,\"msg\":\"发生错误\"}";
try
{
if (!String.IsNullOrEmpty(context.Request["id"]))
{
if (context.Session["MemberId"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ProductID = Convert.ToInt32(context.Request["id"].ToString());
if (new Mtxfw.DAL.P_Product().GetCount("P_State='已处理' And P_ID=" + ProductID) > 0)
{
if (new Mtxfw.DAL.user_favorite().GetCount("ttype=0 and ProductID=" + ProductID + " And MemberId=" + MemberId) == 0)
{
Mtxfw.Model.user_favorite model = new Model.user_favorite();
model.ProductID = ProductID;
model.MemberId = MemberId;
model.ttype = 0;
model.gtype = gtype;
new Mtxfw.DAL.user_favorite().Add(model);
new Mtxfw.DAL.P_Product().Update(ProductID, "P_SCOrders", "1");
data = "{\"success\":true,\"msg\":\"添加成功\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"已经添加过,不用再添加\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误2\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"您未登录\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误\"}";
}
}
catch (Exception ex)
{
data = "{\"success\":false,\"msg\":\"发生错误\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //添加商品到喜欢-----------------------------------------------------------------------------------------
//添加商品到喜欢
protected void addxihuan(HttpContext context)
{
string data = "{\"success\":false,\"msg\":\"发生错误\"}";
try
{
if (!String.IsNullOrEmpty(context.Request["id"]))
{
if (context.Session["MemberId"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ProductID = Convert.ToInt32(context.Request["id"].ToString());
if (context.Session["addxihuan" + ProductID] == null)
{
if (new Mtxfw.DAL.P_Product().GetCount("P_State='已处理' And P_ID=" + ProductID) > 0)
{
new Mtxfw.DAL.P_Product().Update(ProductID, "P_Orders1", "1");
context.Session["addxihuan" + ProductID] = "0";
data = "{\"success\":true,\"msg\":\"添加成功\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误2\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"已经添加过,不用再添加\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"您未登录\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误\"}";
}
}
catch (Exception ex)
{
data = "{\"success\":false,\"msg\":\"发生错误\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //添加商品到购物车-----------------------------------------------------------------------------------------
//添加商品到购物车
protected void addcart(HttpContext context)
{
string data = "{\"success\":false}";
//data = "{\"success\":false,\"msg\":\"请下载APP再购买\"}";
try
{
if (!String.IsNullOrEmpty(context.Request["id"]))
{
string selcolor = "";
if (!String.IsNullOrEmpty(context.Request["selcolor"]))
{
selcolor = HttpUtility.UrlDecode(context.Request["selcolor"].ToString());
}
string guige = "";
if (!String.IsNullOrEmpty(context.Request["selguige"]))
{
guige = HttpUtility.UrlDecode(context.Request["selguige"].ToString());
}
int Num = 1;
if (!String.IsNullOrEmpty(context.Request["Num"]))
{
Mtxfw.Utility.Common.WriteHtml("/weixin/addcartNum.txt", context.Request["Num"].ToString().Trim());
Num = Convert.ToInt32(context.Request["Num"].ToString().Trim());
}
int at = 0;
if (!String.IsNullOrEmpty(context.Request["at"]))
{
Mtxfw.Utility.Common.WriteHtml("/weixin/addcartt.txt", context.Request["at"].ToString().Trim());
at = Convert.ToInt32(context.Request["at"].ToString().Trim());
}
string id = HttpUtility.UrlDecode(context.Request["id"].ToString());
DataSet ds = new Mtxfw.DAL.P_Product().GetList1("utype,P_Inventory,P_yanse", "P_State='已处理' And P_ID=" + id);
if (ds.Tables[0].Rows.Count > 0)
{
string utype = ds.Tables[0].Rows[0]["utype"].ToString();
string P_Inventory = ds.Tables[0].Rows[0]["P_Inventory"].ToString();
DataView dv = Mtxfw.DAL.ShoppingCart0.Getprod();
if (dv.Count > 0)
{
for (int j = 0; j <= dv.Count - 1; j++)
{
string prodid = dv.Table.Rows[j]["prodid"].ToString();
string utype2 = dv.Table.Rows[j]["utype"].ToString();
if (utype != utype2)
{
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
{
string str = HttpContext.Current.Request.Cookies["0x120xxx"].Value;
//Mtxfw.Utility.Common.WriteHtml("/weixin/addcart0.txt", str + ":" + id + ":" + selcolor + ":" + guige);
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
string strCookie = myCookie.Value;
string[] strACookie;
strACookie = strCookie.Split('|');
for (int i = 0; i < strACookie.LongLength - 1; i++)
{
string[] strA = strACookie[i].Split(',');
if (strA.LongLength > 1)
{
if (strA[0] == prodid)
{
Mtxfw.DAL.ShoppingCart0.UpdateProd(strA[0], "0", strA[2], strA[3]);
}
}
}
}
}
}
}
int kcun = 0;
if (guige != "")
{
Model.P_Guige gu = new DAL.P_Guige().GetModel(Convert.ToInt32(guige));
if (gu != null)
{
P_Inventory = gu.G_KC.ToString();
if (selcolor.Trim() != "")
{
string strcolor = gu.G_Color;
if (strcolor.Trim() != "")
{
if (strcolor.IndexOf(selcolor) != -1)
{
string[] acolors = strcolor.Split(',');
for (int j = 0; j < acolors.Length; j++)
{
if (acolors[j] != "")
{
var ac = acolors[j].Split('|');
if (ac[0] == selcolor)
{
if (ac.Length > 1)
{
if (ac[1] != "")
{
P_Inventory = ac[1];
}
}
}
}
}
}
}
}
}
}
if (P_Inventory != "")
{
kcun = Convert.ToInt32(P_Inventory);
}
if (kcun > Num)
{
if (HttpContext.Current.Request.Cookies["0x120xxx"] != null)
{
string str = HttpContext.Current.Request.Cookies["0x120xxx"].Value;
//Mtxfw.Utility.Common.WriteHtml("/weixin/addcart0.txt", str + ":" + id + ":" + selcolor + ":" + guige);
HttpCookie myCookie = HttpContext.Current.Request.Cookies["0x120xxx"];
string strCookie = myCookie.Value;
string[] strACookie;
strACookie = strCookie.Split('|');
for (int i = 0; i < strACookie.LongLength - 1; i++)
{
string[] strA = strACookie[i].Split(',');
if (strA.LongLength > 1)
{
if (strA[0] != "")
{
if (at == 1)
{
Mtxfw.DAL.ShoppingCart0.UpdateProd(strA[0], "0", strA[2], strA[3]);
}
else
{
string strzd = new Mtxfw.DAL.P_Product().Getzd("utype", "P_ID=" + Convert.ToInt32(strA[0])).ToString();
//Mtxfw.Utility.Common.WriteHtml("/weixin/addcart1.txt", strzd + ":" + utype);
if (strzd != "")
{
if (strzd != utype)
{
//Mtxfw.Utility.Common.WriteHtml("/weixin/addcart2.txt", strA[0] + ":" + strA[2] + ":" + strA[3]);
//Mtxfw.DAL.ShoppingCart0.RemoveProd(strA[0], strA[2], strA[3]);
Mtxfw.DAL.ShoppingCart0.UpdateProd(strA[0], "0", strA[2], strA[3]);
}
}
}
}
}
}
}
//Mtxfw.Utility.Common.WriteHtml("/weixin/addcart3.txt", id + ":" + Num + ":" + (selcolor != "" ? Mtxfw.Utility.Security.EncryptString(selcolor) : selcolor) + ":" + guige);
Mtxfw.DAL.ShoppingCart0.Addprod(id, Num, (selcolor != "" ? Mtxfw.Utility.Security.EncryptString(selcolor) : selcolor), guige);
data = "{\"success\":true,\"msg\":\"添加成功\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"库存不足,无法添加\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误2\"}";
}
ds.Clear();
}
else
{
data = "{\"success\":false,\"msg\":\"参数错误\"}";
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/addcartex.txt", ex.ToString());
data = "{\"success\":false,\"msg\":\"" + ex.Message + "\"}";
}
Utility.Common.WriteJson(context, data);
}
protected void addcart2(HttpContext context)
{
int ID = 0;
try
{
if (context.Session["MemberId"] != null)
{
if (context.Request["ID"] != null)
{
Mtxfw.DAL.user_Goods daoGoods = new Mtxfw.DAL.user_Goods();
ID = int.Parse(context.Request["ID"].ToString());
int MemberId = int.Parse(context.Session["MemberId"].ToString());
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
Mtxfw.Model.user_Goods model = daoGoods.GetModel(ID);
if (model != null)
{
if (model.utype == 3)
{
Mtxfw.DAL.ShoppingCart2.Addprod(context, ID.ToString(), 1);
context.Response.Write("添加成功");
}
else
{
context.Response.Write("参数错误");
}
}
else
{
context.Response.Write("参数不存在");
}
}
else
{
context.Response.Write("Err");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch
{
context.Response.Write("发生错误");
}
}
#endregion
#region //更新购物车-----------------------------------------------------------------------------------------
///
/// 更新购物车
///
protected void updatecart(HttpContext context)
{
bool b = true;
string ProductID = "";
string Num = "";
string selcolor = "";
string guige = "";
if (context.Request.Form["ProductID"] != null)
{
ProductID = context.Request.Form["ProductID"].ToString();
}
if (context.Request.Form["Num"] != null)
{
Num = context.Request.Form["Num"].ToString();
}
if (context.Request.Form["selcolor"] != null)
{
selcolor = HttpUtility.UrlDecode(context.Request.Form["selcolor"].ToString());
}
if (context.Request.Form["selguige"] != null)
{
guige = HttpUtility.UrlDecode(context.Request.Form["selguige"].ToString());
}
if (ProductID == "" || Num == "")
{
b = false;
context.Response.Write("0");
}
if (b)
{
string[] stra = ProductID.Split(',');
string[] strb = selcolor.Split(',');
string[] strc = guige.Split(',');
//Mtxfw.Utility.Common.WriteHtml("/weixin/updatecart.txt", ProductID + ":" + selcolor + ":" + guige);
bool bb = true;
for (int i = 0; i < stra.Length; i++)
{
if (stra[i] != "")
{
//string str = HttpContext.Current.Request.Cookies["0x120xxx"].Value;
//Mtxfw.Utility.Common.WriteHtml("/weixin/0x120xxx.txt", str + ":" + strb[i] + ":" + strc[i]);
Mtxfw.Model.P_Product model = new Mtxfw.DAL.P_Product().GetModel(Convert.ToInt32(stra[i]));
if (model != null)
{
int prodkc = 0;
if (guige != "")
{
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(Convert.ToInt32(guige));
if (gmodel != null)
{
prodkc = gmodel.G_KC;
string[] acolors = gmodel.G_Color.Split(',');
for (int j = 0; j < acolors.Length; j++)
{
if (acolors[j] != "")
{
var ac = acolors[j].Split('|');
if (ac[0] == selcolor)
{
if (ac.Length > 1)
{
if (ac[1] != "")
{
prodkc = Convert.ToInt32(ac[1]);
}
}
}
}
}
}
}
else
{
prodkc = model.P_Inventory;
}
if ((prodkc - Convert.ToInt32(Num)) >= 0)
{
Mtxfw.DAL.ShoppingCart0.UpdateProd(stra[i], Num, (strb[i] != "" ? Mtxfw.Utility.Security.EncryptString(strb[i]) : strb[i]), strc[i]);
}
else
{
bb = false;
}
}
}
}
if (bb)
{
context.Response.Write("1");
}
else
{
context.Response.Write("2");
}
}
}
protected void updatecart2(HttpContext context)
{
bool b = true;
string ProductID = "";
string Num = "";
if (context.Request.Form["ProductID"] != null)
{
ProductID = context.Request.Form["ProductID"].ToString();
}
if (context.Request.Form["Num"] != null)
{
Num = context.Request.Form["Num"].ToString();
}
if (ProductID == "" || Num == "")
{
b = false;
context.Response.Write("0");
}
if (b)
{
try
{
Mtxfw.Model.user_Goods model = new Mtxfw.DAL.user_Goods().GetModel(int.Parse(ProductID));
if (model != null)
{
if (model.utype == 3)
{
Mtxfw.DAL.ShoppingCart2.UpdateProd(context, ProductID, Num);
context.Response.Write("1");
}
}
}
catch (Exception err)
{
context.Response.Write(err);
}
}
}
#endregion
#region //删除图片-----------------------------------------------------------------------------------------
//删除图片
protected void DeletePic(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["pic"]))
{
if (context.Session["MemberIdMemberId"] != null || (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null))
{
if (context.Session["jiaoyouPhoto"] != null)
{
string pic = HttpUtility.UrlDecode(context.Request.Form["pic"].ToString());
context.Session["jiaoyouPhoto"] = context.Session["jiaoyouPhoto"].ToString().Replace(pic + "|", "");
if (File.Exists(context.Server.MapPath("/image/" + pic.Split(',')[0])))
{
File.Delete(context.Server.MapPath("/image/" + pic.Split(',')[0]));
}
context.Response.Write("删除成功");
}
else
{
context.Response.Write("超时退出,不能删除");
}
}
else
{
context.Response.Write("您未登录,不能删除");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //设置图片为封面-----------------------------------------------------------------------------------------
//设置图片为封面
protected void SetPic(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["pic"]))
{
if (context.Session["MemberIdMemberId"] != null || context.Session["MemberId"] != null)
{
if (context.Session["jiaoyouPhoto"] != null)
{
string pic = HttpUtility.UrlDecode(context.Request.Form["pic"].ToString());
context.Session["jiaoyouPhoto"] = pic + "|" + context.Session["jiaoyouPhoto"].ToString().Replace(pic + "|", "");
string imgurl = "";
string[] strjiaoyouPhotoA = context.Session["jiaoyouPhoto"].ToString().Split('|');
string stryanseoption = "";
if (context.Request.Form["yanse"] != "")
{
string stryanse = HttpUtility.UrlDecode(context.Request.Form["yanse"].ToString());
string[] Ayanse = stryanse.Split('|');
for (int i = 0; i < Ayanse.Length; i++)
{
if (Ayanse[i] != "")
{
string[] stra = Ayanse[i].Split('#');
stryanseoption += "";
}
}
}
for (int i = 0; i < strjiaoyouPhotoA.Length; i++)
{
if (strjiaoyouPhotoA[i] != "")
{
string[] strPhoto = strjiaoyouPhotoA[i].Split(',');
imgurl += "
删除";
if (i == 0)
{
imgurl += " 已设为封面";
}
else
{
imgurl += " 设为封面";
}
if (stryanseoption != "")
{
string stryanseoption2 = stryanseoption;
if (strPhoto.Length == 2)
{
if (strPhoto[1] != "")
{
stryanseoption2 = stryanseoption.Replace("value='" + strPhoto[1] + "'", "value='" + strPhoto[1] + "' selected");
}
}
imgurl += "
";
}
imgurl += "";
}
}
context.Response.Write(imgurl);
}
else
{
context.Response.Write("发生错误1");
}
}
else
{
context.Response.Write("您未登录");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //保存图片-----------------------------------------------------------------------------------------
//保存图片
protected void SavePic(HttpContext context)
{
try
{
if (context.Request.Form["sels"] != null && !String.IsNullOrEmpty(context.Request.Form["ID"]))
{
if (context.Session["MemberIdMemberId"] != null || context.Session["MemberId"] != null)
{
if (context.Session["jiaoyouPhoto"] != null)
{
string sels = HttpUtility.UrlDecode(context.Request.Form["sels"].ToString());
string[] asels = sels.Split('|');
string[] strjiaoyouPhotoA = context.Session["jiaoyouPhoto"].ToString().Split('|');
int UpdateID = Convert.ToInt32(context.Request.Form["ID"].ToString());
Mtxfw.Model.P_Product model = new Mtxfw.DAL.P_Product().GetModel(UpdateID);
if (model != null)
{
string strPhotos = "";
for (int i = 0; i < strjiaoyouPhotoA.Length; i++)
{
if (strjiaoyouPhotoA[i] != "")
{
string[] strPhoto = strjiaoyouPhotoA[i].Split(',');
if (sels != "")
{
try
{
strPhotos += strPhoto[0] + "," + asels[i] + "|";
}
catch
{
strPhotos += strPhoto[0] + "|";
}
}
else
{
strPhotos += strPhoto[0] + "|";
}
}
model.P_images = strPhotos;
new Mtxfw.DAL.P_Product().Update(model);
}
context.Response.Write("保存成功");
}
else
{
context.Response.Write("发生错误2");
}
}
else
{
context.Response.Write("发生错误1");
}
}
else
{
context.Response.Write("您未登录");
}
}
else
{
context.Response.Write("参数错误");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //保存配送地址-----------------------------------------------------------------------------------------
//保存配送地址
protected void saveaddress(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["name"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["phone"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["province"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["address"]))
{
int t = 0;
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
{
t = int.Parse(HttpUtility.UrlDecode(context.Request.Form["t"].ToString()).Trim());
}
string strname = HttpUtility.UrlDecode(context.Request.Form["name"].ToString()).Trim();
string strphone = HttpUtility.UrlDecode(context.Request.Form["phone"].ToString()).Trim();
string strprovince = HttpUtility.UrlDecode(context.Request.Form["province"].ToString()).Trim();
string straddress = HttpUtility.UrlDecode(context.Request.Form["address"].ToString());
bool b = true;
string strcity = "";
if (!String.IsNullOrEmpty(context.Request.Form["city"]))
{
strcity = HttpUtility.UrlDecode(context.Request.Form["city"].ToString()).Trim();
if (strcity != "")
{
strcity = strcity.Replace("null", "");
}
}
if (strcity == "")
{
if (new DAL.city().GetCount("ProvinceID='" + strprovince + "'") > 0)
{
b = false;
context.Response.Write("城市必须选择!");
}
}
string strcounty = "";
if (!String.IsNullOrEmpty(context.Request.Form["county"]))
{
strcounty = HttpUtility.UrlDecode(context.Request.Form["county"].ToString()).Trim();
if (strcounty != "")
{
strcounty = strcounty.Replace("null", "");
}
}
if (strcounty == "")
{
if (b)
{
if (new DAL.county().GetCount("CityID='" + strcity + "'") > 0)
{
b = false;
context.Response.Write("区县必须选择!");
}
}
}
string strpostalcode = "";
if (b)
{
if (t == 1)
{
strprovince = new DAL.province().GetProvinceID(strprovince);
strcity = new DAL.city().GetCityID(strcity);
strcounty = new DAL.county().GetCountyID(strcounty);
}
}
int addressid = 0;
if (!String.IsNullOrEmpty(context.Request.Form["addressid"]))
{
addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()).Trim());
}
if (b)
{
if (!String.IsNullOrEmpty(strname))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strname, @"[\u4e00-\u9fa5]"))
{
b = false;
context.Response.Write("联系人姓名填写不正确,只能输入中文!");
}
}
}
if (b)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (addressid > 0)
{
Model.user_address model = new DAL.user_address().GetModel(addressid);
if (model != null)
{
model.Contactname = strname;
model.Contacttel = strphone;
model.Province = strprovince;
model.City = strcity;
model.County = strcounty;
model.Address = straddress;
model.Zipcode = strpostalcode;
new DAL.user_address().Update(model);
context.Response.Write("true");
}
}
else
{
if (new DAL.user_address().GetCount("UserID=" + MemberId) < 5)
{
Model.user_address model = new Model.user_address();
model.Contactname = strname;
model.Contacttel = strphone;
model.Province = strprovince;
model.City = strcity;
model.County = strcounty;
model.Address = straddress;
model.Zipcode = strpostalcode;
model.Guests = "";
model.IFIndex = 0;
model.UserID = MemberId;
model.gtype = gtype;
model.Id = new DAL.user_address().Add(model);
new DAL.user_address().UpdateIFIndex(model.Id, model.UserID);
context.Response.Write("true");
}
else
{
context.Response.Write("最多只能添加5个地址");
}
}
}
}
else
{
context.Response.Write("您未登录");
}
}
}
else
{
context.Response.Write("地址不能为空");
}
}
else
{
context.Response.Write("省份必须选择");
}
}
else
{
context.Response.Write("联系电话不能为空");
}
}
else
{
context.Response.Write("联系人不能为空");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //删除配送地址-----------------------------------------------------------------------------------------
//删除配送地址
protected void deladdress(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["addressid"]))
{
int addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()).Trim());
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (addressid > 0)
{
Model.user_address model = new DAL.user_address().GetModel(addressid);
if (model != null)
{
if (model.UserID == MemberId)
{
new DAL.user_address().Delete(addressid, model.UserID);
context.Response.Write("true");
}
else
{
context.Response.Write("参数有误2");
}
}
else
{
context.Response.Write("参数有误");
}
}
}
}
else
{
context.Response.Write("您未登录");
}
}
else
{
context.Response.Write("联系人不能为空");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //设置配送地址-----------------------------------------------------------------------------------------
//设置配送地址
protected void setaddress(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["addressid"]))
{
int addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()).Trim());
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (addressid > 0)
{
Model.user_address model = new DAL.user_address().GetModel(addressid);
if (model != null)
{
if (model.UserID == MemberId)
{
new DAL.user_address().UpdateIFIndex(model.Id, model.UserID);
context.Response.Write("true");
}
else
{
context.Response.Write("参数有误2");
}
}
else
{
context.Response.Write("参数有误");
}
}
}
}
else
{
context.Response.Write("您未登录");
}
}
else
{
context.Response.Write("联系人不能为空");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //确认购买-----------------------------------------------------------------------------------------
//确认购买
protected void UserQRGM(HttpContext context)
{
DateTime dt = DateTime.Now;
try
{
Mtxfw.DAL.user_address daoaddress = new Mtxfw.DAL.user_address();
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
DAL.user_Results_jl2 daojl2 = new DAL.user_Results_jl2();
DAL.user_proxy daoproxy = new DAL.user_proxy();
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null && context.Session["MemberuLevel"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int MemberuLevel4 = int.Parse(context.Session["MemberuLevel"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
string strzd = daoUser.Getzd("uLevel4", "id=" + MemberId).ToString();
if (strzd != "")
{
MemberuLevel4 = Convert.ToInt32(strzd);
}
}
}
if (MemberId > 0)
{
string OrdersIDs = "", strzftitle = "消费券";
int addressid = 0, IsMoblie = 0;
bool b = true;
if (context.Request.Form["utype"] != null && context.Request.Form["addressid"] != null && context.Request.Form["OrdersIDs"] != null && context.Request.Form["IsMoblie"] != null && context.Request.Form["zftype"] != null)//
{
OrdersIDs = HttpUtility.UrlDecode(context.Request.Form["OrdersIDs"].ToString());
addressid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["addressid"].ToString()));
IsMoblie = int.Parse(HttpUtility.UrlDecode(context.Request.Form["IsMoblie"].ToString()));
int zftype = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zftype"].ToString()));
string UserName = "";
if (!String.IsNullOrEmpty(context.Request.Form["UserName"]))
{
UserName = HttpUtility.UrlDecode(context.Request.Form["UserName"].ToString().Trim());
}
string Guests = "";
if (!String.IsNullOrEmpty(context.Request["Guests"]))
{
Guests = HttpUtility.UrlDecode(context.Request["Guests"].ToString());
}
string Contactname = "", Contacttel = "", Address = "";
string province = "", city = "", county = "";
if (zftype == 0)
{
strzftitle = "奖金";
}
else if (zftype == 1)
{
strzftitle = "金豆";
}
else if (zftype == 2)
{
strzftitle = "微信支付";
if (b)
{
if (cconfig.FHEnable2 == "1")
{
b = false;
context.Response.Write("暂时不能使用微信支付!");
}
}
}
else if (zftype == 6)
{
strzftitle = "支付宝";
if (b)
{
if (cconfig.FHEnable2 == "1")
{
b = false;
context.Response.Write("暂时不能使用支付宝!");
}
}
}
else if (zftype == 3)
{
strzftitle = "奖金";
}
else if (zftype == 4)
{
strzftitle = "金豆";
}
else if (zftype == 5)
{
strzftitle = "微信支付";
if (b)
{
if (cconfig.FHEnable2 == "1")
{
b = false;
context.Response.Write("暂时不能使用微信支付!");
}
}
}
else if (zftype == 7)
{
strzftitle = "支付宝";
if (b)
{
if (cconfig.FHEnable2 == "1")
{
b = false;
context.Response.Write("暂时不能使用支付宝!");
}
}
}
else if (zftype == 8)
{
strzftitle = "代付";
}
string pwd = "";
if (b)
{
if (zftype != 5 && zftype != 7 && zftype != 8)
{
if (!String.IsNullOrEmpty(context.Request.Form["pwd"]))
{
pwd = HttpUtility.UrlDecode(context.Request.Form["pwd"].ToString());
}
else
{
b = false;
context.Response.Write("二级密码不能为空!");
}
}
}
int DFZH = 0;
if (b)
{
if (zftype == 8)
{
if (b)
{
if (UserName != "")
{
if (daoUser.GetCount("UserState='正常' And IFStores=0 And UserName='" + UserName + "'") == 0)
{
b = false;
context.Response.Write("代付账号不存在");
}
else
{
DFZH = Convert.ToInt32(daoUser.Getzd("id", "UserState='正常' And IFStores=0 And UserName='" + UserName + "'").ToString());
if (DFZH == MemberId)
{
b = false;
context.Response.Write("代付账号不能是自己");
}
}
}
//Mtxfw.Utility.Common.WriteHtml("/weixin/UserName.txt", UserName + "|" + DFZH);
}
}
}
if (b)
{
Model.user_address amodel = new DAL.user_address().GetModel(addressid);
if (amodel != null)
{
if (amodel.UserID != MemberId)
{
b = false;
context.Response.Write("地址错误2!");
}
else
{
if (!System.Text.RegularExpressions.Regex.IsMatch(amodel.Contactname, @"[\u4e00-\u9fa5]"))
{
b = false;
context.Response.Write("配送地址错误:联系人姓名填写不正确,只能输入中文!");
}
Contactname = amodel.Contactname;
Contacttel = amodel.Contacttel;
Address = amodel.Address;
province = amodel.Province;
city = amodel.City;
county = amodel.County;
if (province == "")
{
b = false;
context.Response.Write("配送地址错误:省份必须选择!");
}
else
{
if (new DAL.province().GetCount("ProvinceID='" + province + "'") == 0)
{
b = false;
context.Response.Write("配送地址错误:城市必须选择!");
}
}
if (b)
{
if (city != "")
{
city = city.Replace("null", "");
}
if (city == "")
{
if (new DAL.city().GetCount("ProvinceID='" + province + "'") > 0)
{
b = false;
context.Response.Write("配送地址错误:城市必须选择!");
}
}
}
if (b)
{
if (county != "")
{
county = county.Replace("null", "");
}
if (county == "")
{
if (new DAL.county().GetCount("CityID='" + city + "'") > 0)
{
b = false;
context.Response.Write("配送地址错误:区县必须选择!");
}
}
}
}
}
else
{
b = false;
context.Response.Write("地址错误!");
}
}
if (b)
{
if (Address.Trim() == "")
{
b = false;
context.Response.Write("地址不能为空!");
}
}
if (b)
{
if (OrdersIDs == "")
{
b = false;
context.Response.Write("ID不能为空!");
}
}
int ZprodNum = 0;
Double ZSubTotal = 0.00, ZSubTotal0 = 0.00, ZSubTotal1 = 0.00, ZSubTotal2 = 0.00, zyunfei = 0.00;
Double UserMoney = 0.00, UserMoney2 = 0.00;
string CFOIDs = "";
string[] ACFOIDs = new string[5];
DataView dv = new DataView();
string strYHJIds = "", YUserName = "", strProductName = "";
int SUserIDCount = 0;
int dContactID = 0;
if (b)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
IFStores = umodel.IFStores;
dContactID = umodel.ContactID;
YUserName = umodel.UserName;
UserMoney = Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("f2"));
UserMoney2 = Convert.ToDouble((umodel.umoney30).ToString("f2"));
if (zftype == 1)
{
UserMoney = Convert.ToDouble((umodel.umoney29).ToString("f2"));
}
else if (zftype == 4)
{
UserMoney = Convert.ToDouble((umodel.umoney29).ToString("f2"));
}
if (zftype != 5 && zftype != 7 && zftype != 8)
{
if (Mtxfw.Utility.Security.EncryptString(pwd) != umodel.Password2)
{
b = false;
context.Response.Write("二级密码错误!");
}
}
bool bb = true, bbb = true, bbbb = true;
string strkcname = "";
int utype = -1;
dv = Mtxfw.DAL.ShoppingCart0.Getprod();
if (dv.Count > 0)
{
for (int j = 0; j <= dv.Count - 1; j++)
{
string prodid = dv.Table.Rows[j]["prodid"].ToString();
if (OrdersIDs.IndexOf("," + prodid + ",") != -1)
{
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
if (CFOIDs == "")
{
CFOIDs = "," + SUserID + ",";
SUserIDCount += 1;
}
else
{
if (CFOIDs.IndexOf("," + SUserID + ",") == -1)
{
CFOIDs += SUserID + ",";
SUserIDCount += 1;
}
}
}
}
ACFOIDs = CFOIDs.Split(',');
int iusrcount = 0;
foreach (string stra in ACFOIDs)
{
if (stra != "")
{
iusrcount += 1;
Double ZL = 0;
for (int j = 0; j <= dv.Count - 1; j++)
{
string prodid = dv.Table.Rows[j]["prodid"].ToString();
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
if (OrdersIDs.IndexOf("," + prodid + ",") != -1 && stra == SUserID)
{
strProductName += dv.Table.Rows[j]["prodName"].ToString() + " ";
string prodNum = dv.Table.Rows[j]["prodNum"].ToString();
int TotalNum = Convert.ToInt32(dv.Table.Rows[j]["TotalNum"].ToString());
Double SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString());
Double prodPrice0 = Convert.ToDouble(dv.Table.Rows[j]["prodPrice0"].ToString());
Double prodPrice1 = Convert.ToDouble(dv.Table.Rows[j]["prodPrice1"].ToString());
Double prodPrice2 = Convert.ToDouble(dv.Table.Rows[j]["prodPrice2"].ToString());
int butype = Convert.ToInt32(dv.Table.Rows[j]["utype"].ToString());
string SPYH1 = dv.Table.Rows[j]["SPYH1"].ToString();
string qgproduct = dv.Table.Rows[j]["qgproduct"].ToString().ToLower();
if (utype != -1)
{
if (utype != butype)
{
bbb = false;
}
else
{
utype = butype;
}
}
else
{
utype = butype;
}
if (qgproduct == "true")
{
bbbb = false;
}
ZSubTotal += SubTotal;
ZSubTotal0 += (int.Parse(prodNum) * prodPrice0);
ZSubTotal1 += (int.Parse(prodNum) * prodPrice1);
ZSubTotal2 += (int.Parse(prodNum) * prodPrice2);
ZprodNum += int.Parse(prodNum);
ZL += Convert.ToDouble(SPYH1) * int.Parse(prodNum);
if (TotalNum < int.Parse(prodNum))
{
bb = false;
strkcname += dv.Table.Rows[j]["prodName"].ToString() + " ";
}
}
}
if (utype != 1 || utype != 4)
{
Double yunfei = 0.00;
if (ZL > 0.00 && ZSubTotal < Convert.ToDouble(Convert.ToDouble(cconfig.webMoney59).ToString("f2")))
{
if (ZL > 1.00)
{
int zzl = Convert.ToInt32(ZL.ToString().Split('.')[0]);
yunfei = (Convert.ToDouble(cconfig.webYHMoney) * ZprodNum + Convert.ToDouble(cconfig.webYHMoney2) * (zzl - 1 * ZprodNum));
}
else
{
yunfei = Convert.ToDouble(cconfig.webYHMoney) * ZprodNum;
}
if (!String.IsNullOrEmpty(province))
{
Mtxfw.Model.province pmodel = new DAL.province().GetModel(province);
if (pmodel != null)
{
if (ZL > 1.00)
{
int zzl = Convert.ToInt32(ZL.ToString().Split('.')[0]);
yunfei = (Convert.ToDouble(pmodel.YFMoney) * ZprodNum + Convert.ToDouble(pmodel.YFMoney2) * (zzl - 1 * ZprodNum));
}
else
{
yunfei = Convert.ToDouble(pmodel.YFMoney) * ZprodNum;
}
}
}
}
//Mtxfw.Utility.Common.WriteHtml("/weixin/yunfei.txt", yunfei + "|" + ZSubTotal + "|" + strProvince);
zyunfei += yunfei;
ZSubTotal += yunfei;
}
}
}
}
ZSubTotal = Convert.ToDouble(ZSubTotal.ToString("f2"));
ZSubTotal0 = Convert.ToDouble(ZSubTotal0.ToString("f2"));
ZSubTotal1 = Convert.ToDouble(ZSubTotal1.ToString("f2"));
ZSubTotal2 = Convert.ToDouble(ZSubTotal2.ToString("f2"));
Double money = Convert.ToDouble(ZSubTotal.ToString("f2"));
/*if (b)
{
if (utype == 0)
{
if (ZprodNum > 1)
{
b = false;
context.Response.Write("积分商品每次只能选购1件");
}
}
}*/
if (b)
{
if (!bb)
{
b = false;
context.Response.Write(strkcname + "库存不足");
}
}
if (b)
{
if (!bbb)
{
b = false;
context.Response.Write("此购物车包含不同商城商品请重新选择");
}
}
if (utype == 0 || utype == 1 || utype == 2 || utype == 7)
{
if (zftype != 0 && zftype != 2 && zftype != 3)
{
b = false;
context.Response.Write("支付方式选择错误!");
}
if (b)
{
if (Convert.ToDouble(ZSubTotal.ToString("f2")) <= 0.00)
{
b = false;
context.Response.Write("购买总金额必须不能小于0!");
}
else
{
if (utype == 1)
{
if ((Convert.ToInt32((ZSubTotal - zyunfei).ToString().Split('.')[0]) != Convert.ToInt32(cconfig.webMoney1)) && (Convert.ToInt32((ZSubTotal - zyunfei).ToString().Split('.')[0]) != Convert.ToInt32(cconfig.webMoney2)))
{
b = false;
context.Response.Write("购买总金额必须等于" + cconfig.webMoney1 + "或" + cconfig.webMoney2 + "!");
}
}
}
}
if (b)
{
if (zftype == 3)
{
if (b)
{
if (Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("f2")) < ZSubTotal)
{
b = false;
context.Response.Write("您的奖金余额不足!");
}
}
}
else if (zftype == 4)
{
if (Convert.ToDouble(umodel.umoney29.ToString("f2")) < Convert.ToDouble((ZSubTotal * 1000).ToString("f2")))
{
b = false;
context.Response.Write("您的金豆余额不足!");
}
}
}
}
else if (utype == 5)
{
if (zftype != 1)
{
b = false;
context.Response.Write("支付方式选择错误!");
}
if (b)
{
if (Convert.ToDouble(ZSubTotal.ToString("f2")) <= 0.00)
{
b = false;
context.Response.Write("购买总金额必须不能小于0!");
}
}
if (b)
{
if (zftype == 3)
{
if (b)
{
if (Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("f2")) < ZSubTotal)
{
b = false;
context.Response.Write("您的奖金余额不足!");
}
}
}
else if (zftype == 4)
{
if (Convert.ToDouble(umodel.umoney29.ToString("f2")) < Convert.ToDouble((ZSubTotal * 1000).ToString("f2")))
{
b = false;
context.Response.Write("您的金豆余额不足!");
}
}
}
}
else if (utype == 5)
{
if (b)
{
if (zftype != 0 && zftype != 1 && zftype != 2 && zftype != 6)
{
b = false;
context.Response.Write("支付方式选择错误!");
}
}
if (b)
{
if (Convert.ToDouble(ZSubTotal0.ToString("f2")) <= 0.00)
{
b = false;
context.Response.Write("购买总金额必须不能小于0!");
}
}
if (b)
{
if (zftype == 0)
{
if (b)
{
if (Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("f2")) < ZSubTotal)
{
b = false;
context.Response.Write("您的奖金余额不足!");
}
}
if (b)
{
if (Convert.ToDouble(umodel.umoney32.ToString("f2")) < ZSubTotal0)
{
b = false;
context.Response.Write("您的产品券余额不足!");
}
}
}
else if (zftype == 1)
{
if (b)
{
if (Convert.ToDouble(umodel.umoney29.ToString("f2")) < Convert.ToDouble((ZSubTotal * 1000).ToString("f2")))
{
b = false;
context.Response.Write("您的金豆余额不足!");
}
}
if (b)
{
if (Convert.ToDouble(umodel.umoney32.ToString("f2")) < ZSubTotal0)
{
b = false;
context.Response.Write("您的产品券余额不足!");
}
}
}
else if (zftype == 2 || zftype == 6)
{
if (b)
{
if (Convert.ToDouble(umodel.umoney32.ToString("f2")) < ZSubTotal0)
{
b = false;
context.Response.Write("您的产品券余额不足!");
}
}
}
}
}
else
{
if (b)
{
if (zftype != 0 && zftype != 1 && zftype != 2 && zftype != 6)
{
b = false;
context.Response.Write("支付方式选择错误!");
}
}
if (b)
{
if (Convert.ToDouble(ZSubTotal0.ToString("f2")) <= 0.00)
{
b = false;
context.Response.Write("购买总金额必须不能小于0!");
}
}
if (b)
{
if (zftype == 0)
{
if (b)
{
if (Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("f2")) < ZSubTotal)
{
b = false;
context.Response.Write("您的奖金余额不足!");
}
}
if (b)
{
if (Convert.ToDouble(umodel.umoney30.ToString("f2")) < ZSubTotal0)
{
b = false;
context.Response.Write("您的积分余额不足!");
}
}
}
else if (zftype == 1)
{
if (b)
{
if (Convert.ToDouble(umodel.umoney29.ToString("f2")) < Convert.ToDouble((ZSubTotal * 1000).ToString("f2")))
{
b = false;
context.Response.Write("您的金豆余额不足!");
}
}
if (b)
{
if (Convert.ToDouble(umodel.umoney30.ToString("f2")) < ZSubTotal0)
{
b = false;
context.Response.Write("您的积分余额不足!");
}
}
}
else if (zftype == 2 || zftype == 6)
{
if (b)
{
if (Convert.ToDouble(umodel.umoney30.ToString("f2")) < ZSubTotal0)
{
b = false;
context.Response.Write("您的积分余额不足!");
}
}
}
}
}
if (b)
{
int liveid = 0;
if (context.Session["liveid"] != null)
{
liveid = Convert.ToInt32(context.Session["liveid"].ToString());
}
Model.user_Results_jl2 mjl2;
string strorders = xorder(OrdersIDs, strYHJIds, dv, addressid, Contactname, Contacttel, province, city, county, Address, Guests, zftype, utype, ACFOIDs, MemberId, DFZH, gtype, liveid);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = dt;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "购买商品" + money + "元,支付方式:" + strzftitle;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
Mtxfw.DAL.ShoppingCart0.RemoveProd(OrdersIDs);
if (zftype == 2 || zftype == 5 || zftype == 6 || zftype == 7)
{
if (zftype == 2 || zftype == 6)
{
if (utype == 0)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney30 - ZSubTotal0);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 4;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney30", -ZSubTotal0, umodel.Id);
}
else if (utype == 5)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney32 - ZSubTotal0);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 5;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney32", -ZSubTotal0, umodel.Id);
}
}
if (money>0.00)
{
string PayID = dt.ToString("yyMMddHHmmssffff", DateTimeFormatInfo.InvariantInfo);
Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results();
ModelResults.b0 = money;
ModelResults.b1 = 0;
ModelResults.b2 = 0;
ModelResults.b3 = 0;
ModelResults.b4 = 0;
ModelResults.b5 = 0;
ModelResults.b6 = 0;
ModelResults.b7 = 0;
ModelResults.b8 = 0;
ModelResults.b9 = 0;
ModelResults.b10 = 0;
ModelResults.b11 = 0;
ModelResults.b12 = 0;
ModelResults.b13 = 0;
ModelResults.b14 = 0;
ModelResults.b15 = 0;
ModelResults.b16 = 0;
ModelResults.b17 = 0;
ModelResults.b18 = 0;
ModelResults.conent = "购买商品" + strProductName;
ModelResults.Totalmoney = money;
ModelResults.MemberId = MemberId;
ModelResults.UserId = 3;
ModelResults.ListNumber = PayID;
ModelResults.Managers = "5";
ModelResults.Seef = 0;
ModelResults.utype = "2";
ModelResults.addtime = dt;
ModelResults.gtype = gtype;
Int64 ResultId = daoResults.Add(ModelResults);
daoResults.UpdateOrderIds(strorders, ResultId);
if (zftype == 2 || zftype == 5)
{
context.Response.Write("跳转支付|/pay/wxpay.aspx?PayID=" + PayID);
}
else
{
context.Response.Write("跳转支付|/pay/alipay.aspx?PayID=" + PayID);
}
}
}
else
{
if (zftype == 0)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney - umodel.umoney17 - ZSubTotal);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 1;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney17", ZSubTotal, umodel.Id);
if (utype == 0)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney30 - ZSubTotal0);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 4;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney30", -ZSubTotal0, umodel.Id);
}
else
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney32 - ZSubTotal0);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 5;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney32", -ZSubTotal0, umodel.Id);
}
}
else if (zftype == 1)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal * 1000;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney29 - ZSubTotal * 1000);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal * 1000;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 3;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney29", -ZSubTotal * 1000, umodel.Id);
if (utype == 0)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney30 - ZSubTotal0);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 4;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney30", -ZSubTotal0, umodel.Id);
}
else
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney32 - ZSubTotal0);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 5;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney32", -ZSubTotal0, umodel.Id);
}
}
else if (zftype == 3)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney - umodel.umoney17 - ZSubTotal);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 1;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney17", ZSubTotal, umodel.Id);
}
else if (zftype == 4)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney29 - ZSubTotal);
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 3;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney29", -ZSubTotal, umodel.Id);
}
if (utype == 1)
{
Double pv = ZSubTotal;
int uLevel = 0;
if (ZSubTotal == Convert.ToDouble((Convert.ToDouble(cconfig.webMoney5) + zyunfei).ToString("f2")))
{
pv = Convert.ToDouble((ZSubTotal + zyunfei).ToString("f2"));
uLevel = 1;
}
if (ZSubTotal == Convert.ToDouble((Convert.ToDouble(cconfig.webMoney1) + zyunfei).ToString("f2")))
{
pv = Convert.ToDouble((ZSubTotal + zyunfei).ToString("f2"));
uLevel = 2;
}
if (ZSubTotal == Convert.ToDouble((Convert.ToDouble(cconfig.webMoney2) + zyunfei).ToString("f2")))
{
pv = Convert.ToDouble((ZSubTotal + zyunfei).ToString("f2"));
uLevel = 3;
}
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = pv;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = pv;
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 8;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
Int64 ResultID = daojl2.Add(mjl2);
Double cpjmoney = Convert.ToDouble(cconfig.webMoney42);
if (uLevel == 2)
{
cpjmoney = Convert.ToDouble(cconfig.webMoney24);
}
if (uLevel == 3)
{
cpjmoney = Convert.ToDouble(cconfig.webMoney4);
}
cpjmoney = Convert.ToDouble(cpjmoney.ToString("f2"));
if (cpjmoney > 0.00)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = cpjmoney;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umodel.umoney32 + cpjmoney;
mjl2.addtime = dt;
mjl2.BZContent = "购买商品赠送产品券";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 5;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney32", cpjmoney, umodel.Id);
}
int dyc = 0;
int SuperiorsID = umodel.SuperiorsID;
int uLevel0 = umodel.uLevel0;
string SuperiorsIDS = umodel.SuperiorsIDS;
int ContactID = umodel.ContactID;
int uLevel1 = umodel.uLevel1;
string ContactIDS = umodel.ContactIDS;
if (umodel.uLevel14 == 0)
{
//更新审核时间
daoUser.UpdateTime("regtime", dt, umodel.Id);
daoUser.UpdateuLevel("uLevel14", 1, umodel.Id);
dyc = 1;
}
if (umodel.uLevel7 == 1)
{
umodel.uLevel7 = 0;
daoUser.UpdateuLevel("uLevel7", umodel.uLevel7, umodel.Id);
}
umodel.umoney21 += pv;
umodel.umoney21 = Convert.ToDouble(umodel.umoney21.ToString("f2"));
daoUser.UpdateMoney("umoney20", pv, umodel.Id);
daoUser.UpdateMoney("umoney21", pv, umodel.Id);
if (umodel.uLevel < uLevel)
{
umodel.uLevel = uLevel;
daoUser.UpdateuLevel("uLevel", uLevel, umodel.Id);
}
//DAL.MemberStatistics.UpdteJJAndYJ(cconfig, umodel.Id, ResultID, ContactID, ContactIDS, SuperiorsID, SuperiorsIDS, uLevel, umodel.uLevel, uLevel0, uLevel1, umodel.uLevel2, umodel.uLevel4, umodel.uLevel7, umodel.uLevel20, umodel.umoney19, pv, umodel.UserName, province, city, county, dt, dyc, utype, gtype);
}
else
{
if (utype == 4)
{
if (liveid > 0)
{
new Mtxfw.DAL.user_live().addSel("csdd", 1, liveid);
new Mtxfw.DAL.user_live().addSel0("xsje", ZSubTotal, liveid);
}
}
else
{
if (umodel.uLevel14 == 0)
{
umodel.SuperiorsIDS = umodel.DLRememberIDS;
}
string[] AOrders0 = strorders.Split(',');
foreach (string stra in AOrders0)
{
if (stra != "")
{
DataSet ods= new DAL.order_product_info().GetList1("pid", "OrderId=" + int.Parse(stra));
if (ods.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow oDr in ods.Tables[0].Rows)
{
int productid = Convert.ToInt32(oDr["pid"].ToString());
Mtxfw.Model.P_Product pmodel = new Mtxfw.DAL.P_Product().GetModel(productid);
if (pmodel != null)
{
//Mtxfw.DAL.MemberStatistics.UpdtePHSCJJ(cconfig, umodel.Id, umodel.SuperiorsIDS, umodel.UserName, province, city, county, dt, gtype, ZSubTotal0, ZSubTotal1, ZSubTotal2, umodel.umoney30);
}
}
}
ods.Clear();
}
}
}
}
if (umodel.Province == "")
{
daoUser.UpdatePassword("Province", province, umodel.Id);
}
if (umodel.City == "")
{
daoUser.UpdatePassword("City", city, umodel.Id);
}
if (umodel.County == "")
{
daoUser.UpdatePassword("County", county, umodel.Id);
}
string[] AOrders = strorders.Split(',');
foreach (string stra in AOrders)
{
if (stra != "")
{
new DAL.order_info().UpdateqyState(0, "1", DateTime.Now, int.Parse(stra));
}
}
context.Session["IFPassword"] = 0;
context.Response.Write("操作成功|/Member_Orders_List.aspx");
}
}
}
}
}
else
{
context.Response.Write("参数错误");
}
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
Model.User_Errlog mo = new Model.User_Errlog();
mo.DLID = 0;
mo.ErrType = "购买商品";
mo.addtime = dt;
mo.ErrBody = ex.ToString();
mo.ErrBody2 = ex.Message;
new DAL.User_Errlog().Add(mo);
//context.Response.Write(ex.Message);
}
}
private int RandNum_CJ(int MinNum, int MaxNum)
{
Random rand = new Random();
int t = rand.Next(MinNum, MaxNum);
return t;
}
protected string xorder(string OrdersIDs, string strYHJIds, DataView dv, int addressid, string Contactname, string Contacttel, string strProvince, string strCity, string strCounty, string Address,string Guests, int ZFType, int ttype, string[] ACFOIDs, int UserID, int DFZH, int gtype,int pid)
{
Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
string strOrders = "";
foreach (string stra in ACFOIDs)
{
if (stra != "")
{
Double Totalprice = 0.00;
Double Totalprice0 = 0.00;
Double Totalprice1 = 0.00;
Double Totalprice2 = 0.00;
Double Totalprice3 = 0.00;
int Totalnum = 0;
int MemberId = Convert.ToInt32(stra);
DateTime dt = DateTime.Now;
string OID = dt.ToString("yyMMddhhmmssffff", DateTimeFormatInfo.InvariantInfo);
Double YFmoney = 0.00, ZSubTotal = 0.00;
Double ZL = 0.00;
for (int j = 0; j <= dv.Count - 1; j++)
{
string prodid = dv.Table.Rows[j]["prodid"].ToString();
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
if (OrdersIDs.IndexOf("," + prodid + ",") != -1 && stra == SUserID)
{
string prodNum = dv.Table.Rows[j]["prodNum"].ToString();
Double SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString());
Double prodPrice0 = Convert.ToDouble(dv.Table.Rows[j]["prodPrice0"].ToString());
Double prodPrice1 = Convert.ToDouble(dv.Table.Rows[j]["prodPrice1"].ToString());
Double prodPrice2 = Convert.ToDouble(dv.Table.Rows[j]["prodPrice2"].ToString());
string SPYH1 = dv.Table.Rows[j]["SPYH1"].ToString();
ZSubTotal = ZSubTotal + SubTotal;
Totalnum += int.Parse(prodNum);
Totalprice0 += (int.Parse(prodNum)* prodPrice0);
Totalprice2 += (int.Parse(prodNum) * prodPrice1);
Totalprice3 += (int.Parse(prodNum) * prodPrice2);
ZL += Convert.ToDouble(SPYH1) * int.Parse(prodNum);
}
}
Double yunfei = 0.00;
if (!String.IsNullOrEmpty(strProvince))
{
if (ttype == 0 || ttype == 2 || ttype == 5)
{
if (ZL > 0.00)
{
if (ZL > 1.00)
{
yunfei = (Convert.ToDouble(cconfig.webYHMoney) + Convert.ToDouble(cconfig.webYHMoney2) * (ZL - 1));
}
else
{
yunfei = Convert.ToDouble(cconfig.webYHMoney);
}
Mtxfw.Model.province pmodel = new DAL.province().GetModel(strProvince);
if (pmodel != null)
{
if (ZL > 1.00)
{
yunfei = (Convert.ToDouble(pmodel.YFMoney) + Convert.ToDouble(pmodel.YFMoney2) * (ZL - 1));
}
else
{
yunfei = Convert.ToDouble(pmodel.YFMoney);
}
}
}
}
}
YFmoney = yunfei;
Totalprice1 = YFmoney;
Totalprice = ZSubTotal + YFmoney;
if (ttype == 5)
{
Totalprice = YFmoney;
}
Model.order_info Modelorder = new Model.order_info();
Modelorder.pid = pid;
Modelorder.addressid = addressid;
Modelorder.orderid = OID;
Modelorder.Contactname = Contactname;
Modelorder.Contacttel = Contacttel;
Modelorder.Province = strProvince;
Modelorder.City = strCity;
Modelorder.County = strCounty;
Modelorder.Address = Address;
Modelorder.Zipcode = "";
Modelorder.Guests = Guests;
Modelorder.Totalprice = Totalprice;
Modelorder.Totalprice0 = Totalprice0;
Modelorder.Totalprice1 = Totalprice1;
Modelorder.Totalprice2 = Totalprice2;
Modelorder.Totalprice3 = Totalprice3;
Modelorder.Totalprice4 = 0;
Modelorder.Totalprice5 = 0;
Modelorder.Totalprice6 = 0;
Modelorder.Totalnum = Totalnum;
Modelorder.O_Submit = "1";
Modelorder.O_yhj = "";
Modelorder.UserID = UserID;
Modelorder.MemberId = DFZH;
Modelorder.selcolor = "";
Modelorder.guige = "";
Modelorder.utype = ZFType.ToString();
Modelorder.ttype = ttype;
Modelorder.gtype = gtype;
int OrderID = new Mtxfw.DAL.order_info().Add(Modelorder);
if (strOrders == "")
{
strOrders += OrderID.ToString();
}
else
{
strOrders += "," + OrderID.ToString();
}
for (int j = 0; j <= dv.Count - 1; j++)
{
string prodid = dv.Table.Rows[j]["prodid"].ToString();
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
string selcolor = dv.Table.Rows[j]["selcolor"].ToString();
string guige = dv.Table.Rows[j]["guige"].ToString();
string prodNum = dv.Table.Rows[j]["prodNum"].ToString();
string prodPrice = dv.Table.Rows[j]["prodPrice"].ToString();
string SubTotal = dv.Table.Rows[j]["SubTotal"].ToString();
if (OrdersIDs.IndexOf("," + prodid + ",") != -1 && stra == SUserID)
{
Mtxfw.Model.P_Product pmodel = daoProduct.GetModel(int.Parse(prodid));
if (pmodel != null)
{
Model.order_product_info opmodel = new Model.order_product_info();
opmodel.pid = pmodel.P_ID;
opmodel.orderid = OrderID;
opmodel.selcolor = selcolor;
opmodel.guige = guige;
opmodel.DJprice = Convert.ToDouble(prodPrice);
opmodel.Totalprice = Convert.ToDouble(SubTotal);
opmodel.Totalnum = Convert.ToInt32(prodNum);
opmodel.UserID = UserID;
opmodel.SubmitTime = DateTime.Now;
opmodel.utype = "0";
opmodel.gtype = gtype;
new DAL.order_product_info().Add(opmodel);
Mtxfw.DAL.ShoppingCart0.UpdateProd(prodid, "0", selcolor, guige);
if (guige != "")
{
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(Convert.ToInt32(guige));
if (gmodel != null)
{
int ZKC = 0;
bool IFKC = true;
string strcolors = gmodel.G_Color;
string[] acolors = gmodel.G_Color.Split(',');
for (int jj = 0; jj < acolors.Length; jj++)
{
if (acolors[jj] != "")
{
var ac = acolors[jj].Split('|');
if (ac.Length > 1)
{
if (ac[1] != "")
{
int intNum = Convert.ToInt32(ac[1]);
if (ac[0] == selcolor)
{
intNum = (intNum - Convert.ToInt32(prodNum));
if (intNum < 0)
{
intNum = 0;
}
strcolors = strcolors.Replace(ac[0] + "|" + ac[1], ac[0] + "|" + intNum);
}
ZKC += intNum;
IFKC = false;
}
}
}
}
gmodel.G_Color = strcolors;
if (IFKC)
{
gmodel.G_KC = gmodel.G_KC - Convert.ToInt32(prodNum);
}
else
{
gmodel.G_KC = ZKC;
}
new DAL.P_Guige().Update(gmodel);
}
}
else
{
new DAL.P_Product().UpdateInventory(pmodel.P_ID, -Convert.ToInt32(prodNum));
}
}
}
}
}
}
return strOrders;
}
#endregion
#region //开红包-----------------------------------------------------------------------------------------
protected void kaihongbao(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results baoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
bool b = true;
Int64 hongbaoid = 0;
if (!String.IsNullOrEmpty(context.Request.Form["hongbaoid"]))
{
hongbaoid = Convert.ToInt64(context.Request.Form["hongbaoid"].ToString());
}
else
{
b = false;
context.Response.Write("参数为空");
}
if (b)
{
Mtxfw.Model.user_Results rmodel = baoResults.GetModel(hongbaoid);
if (rmodel != null)
{
DateTime UpdateTime = DateTime.Now;
if (rmodel.Seef == 1)
{
b = false;
context.Response.Write("红包已领取过");
}
if (b)
{
if (rmodel.utype!="8")
{
b = false;
context.Response.Write("红包参数错误");
}
}
if (b)
{
if (rmodel.IFDelete == 1)
{
b = false;
context.Response.Write("红包已被删除");
}
}
if (b)
{
if (rmodel.MemberId != umodel.Id)
{
b = false;
context.Response.Write("不属于您的红包");
}
}
if (b)
{
if (rmodel.Seef == 0)
{
if (UpdateTime > rmodel.addtime.AddHours(Convert.ToInt32(cconfig.webMoney49)))
{
b = false;
context.Response.Write("红包已过期");
}
}
}
if (b)
{
baoResults.UpdateSeef(1, DateTime.Now, rmodel.Id);
string[] ASuperiorsIDS = (umodel.ContactIDS).Split(',');
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = umodel.Id;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "领取红包,金额:" + rmodel.b0.ToString();
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
else
{
context.Response.Write("参数错误");
}
}
}
else
{
context.Response.Write("登录参数错误");
}
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //开红包2-----------------------------------------------------------------------------------------
protected void kaihongbao2(HttpContext context)
{
string data = "{\"status\":0}";
try
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results baoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
bool b = true;
Int64 hongbaoid = 0;
if (!String.IsNullOrEmpty(context.Request["hongbaoid"]))
{
hongbaoid = Convert.ToInt64(context.Request["hongbaoid"].ToString());
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"参数为空!\"}";
}
if (b)
{
Mtxfw.Model.user_Results rmodel = baoResults.GetModel(hongbaoid);
if (rmodel != null)
{
DateTime UpdateTime = DateTime.Now;
if (b)
{
if (rmodel.utype != "8")
{
b = false;
data = "{\"status\":0,\"msg\":\"红包参数错误!\"}";
}
}
if (b)
{
if (rmodel.IFDelete == 1)
{
b = false;
data = "{\"status\":0,\"msg\":\"红包已被删除!\"}";
}
}
if (b)
{
if (rmodel.MemberId != umodel.Id)
{
b = false;
data = "{\"status\":0,\"msg\":\"不属于您的红包!\"}";
}
}
if (b)
{
if (rmodel.Seef == 0)
{
if (UpdateTime > rmodel.addtime.AddHours(Convert.ToInt32(cconfig.webMoney49)))
{
b = false;
data = "{\"status\":0,\"msg\":\"红包已过期!\"}";
}
}
}
if (b)
{
if (rmodel.Seef == 0)
{
rmodel.Seef = 1;
rmodel.seeftime = DateTime.Now;
baoResults.UpdateSeef(1, DateTime.Now, rmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = umodel.Id;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "领取红包,金额:" + rmodel.b0.ToString();
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
data = "{\"status\":1,\"RealName\":\"" + umodel.RealName + "\",\"b0\":\"" + rmodel.b0.ToString("f2") + "\",\"addtime\":\"" + rmodel.addtime.ToString("yyyy-MM-dd HH:mm:ss") + "\",\"addtime2\":\"" + rmodel.addtime.AddHours(Convert.ToInt32(cconfig.webMoney49)).ToString("yyyy-MM-dd HH:mm:ss") + "\",\"seeftime\":\"" + (rmodel.Seef == 1 ? rmodel.seeftime.ToString("yyyy-MM-dd HH:mm:ss") : "") + "\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
}
catch (Exception ex)
{
data = "{\"status\":0,\"msg\":\"" + ex.Message + "!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //取消订单-----------------------------------------------------------------------------------------
protected void qxorder(HttpContext context)
{
if (context.Session["MemberId"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "" || O_Payed == "0")
{
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList1("Totalnum,guige,selcolor", "utype='0' And orderid=" + ModelOrder.Id + " And IFDelete=0 Order By SubmitTime asc");
if (Ds_op.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow drv2 in Ds_op.Tables[0].Rows)
{
string selcolor = drv2["selcolor"].ToString();
int prodNum = Convert.ToInt32(drv2["Totalnum"]);
string guige = drv2["guige"].ToString();
if (guige != "")
{
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(Convert.ToInt32(guige));
if (gmodel != null)
{
int ZKC = 0;
bool IFKC = true;
string strcolors = gmodel.G_Color;
string[] acolors = gmodel.G_Color.Split(',');
for (int jj = 0; jj < acolors.Length; jj++)
{
if (acolors[jj] != "")
{
var ac = acolors[jj].Split('|');
if (ac.Length > 1)
{
if (ac[1] != "")
{
int intNum = Convert.ToInt32(ac[1]);
if (ac[0] == selcolor)
{
intNum = (intNum + Convert.ToInt32(prodNum));
strcolors = strcolors.Replace(ac[0] + "|" + ac[1], ac[0] + "|" + intNum);
}
ZKC += intNum;
IFKC = false;
}
}
}
}
gmodel.G_Color = strcolors;
if (IFKC)
{
gmodel.G_KC = gmodel.G_KC + Convert.ToInt32(prodNum);
}
else
{
gmodel.G_KC = ZKC;
}
new DAL.P_Guige().Update(gmodel);
}
}
}
}
Ds_op.Clear();
int ttype = ModelOrder.ttype;
Double Totalprice2 = Convert.ToDouble(ModelOrder.Totalprice2.ToString("f2"));
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(ModelOrder.UserID);
if (umodel != null)
{
if (ttype == 0 && Totalprice2 > 0.00)
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = Totalprice2;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney30 + Totalprice2);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "取消订单退回";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 4;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney30", Totalprice2, umodel.Id);
}
else if (ttype == 5 && Totalprice2 > 0.00)
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = Totalprice2;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney32 + Totalprice2);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "取消订单退回";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 5;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
new Mtxfw.DAL.user_info().UpdateMoney("umoney32", Totalprice2, umodel.Id);
}
}
baoorder.UpdateqyState(0, "-1", DateTime.Now, int.Parse(orderid));
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "取消订单,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("4");
}
}
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //申请退款-----------------------------------------------------------------------------------------
protected void sqthorder(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "1" && ModelOrder.O_Return == "0")
{
baoorder.UpdateqyState(3, "1", DateTime.Now, int.Parse(orderid));
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "申请退款,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("3");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //同意退款-----------------------------------------------------------------------------------------
protected void thclorder(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (context.Session["MemberIFStores"].ToString() == "1")
{
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "1" && ModelOrder.O_Return == "1" && ModelOrder.O_Returned == "0")
{
Double money = ModelOrder.Totalprice;
if (ModelOrder.utype == "2" || ModelOrder.utype == "3")
{
Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results();
ModelResults.b0 = money;
ModelResults.b1 = 0;
ModelResults.b2 = 0;
ModelResults.b3 = 0;
ModelResults.b4 = 0;
ModelResults.b5 = 0;
ModelResults.b6 = 0;
ModelResults.b7 = 0;
ModelResults.b8 = 0;
ModelResults.b9 = 0;
ModelResults.b10 = 0;
ModelResults.b11 = 0;
ModelResults.b12 = 0;
ModelResults.b13 = 0;
ModelResults.b14 = 0;
ModelResults.conent = "退款";
ModelResults.Totalmoney = money;
ModelResults.MemberId = ModelOrder.UserID;
ModelResults.UserId = 0;
ModelResults.ListNumber = ModelOrder.Contactname;
ModelResults.Managers = "";
ModelResults.Seef = 1;
ModelResults.utype = ModelOrder.utype == "3" ? "2" : "19";
ModelResults.addtime = DateTime.Now;
ModelResults.gtype = gtype;
Int64 ResultsID = daoResults.Add(ModelResults);
daoResults.UpdateSeef(1, DateTime.Now, ResultsID);
if (ModelOrder.utype == "3")
{
daouser.UpdateMoney("umoney12", money, ModelOrder.UserID);
}
else
{
daouser.UpdateMoney("umoney0", money, ModelOrder.UserID);
}
}
baoorder.UpdateqyState(4, "1", DateTime.Now, int.Parse(orderid));
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "同意退款,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //确认发货-----------------------------------------------------------------------------------------
protected void qyfhorder(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
bool b = true;
string orderids = "";
if (context.Request.Form["orderid"] != null)
{
orderids = context.Request.Form["orderid"].ToString();
}
if (orderids == "")
{
b = false;
context.Response.Write("1");
}
string kdcompay = "";
if (!String.IsNullOrEmpty(context.Request.Form["kdcompay"]))
{
kdcompay = HttpUtility.UrlDecode(context.Request.Form["kdcompay"].ToString());
}
else
{
b = false;
context.Response.Write("4");
}
string body = "";
if (kdcompay != "auto")
{
if (!String.IsNullOrEmpty(context.Request.Form["body"]))
{
body = HttpUtility.UrlDecode(context.Request.Form["body"].ToString());
}
else
{
b = false;
context.Response.Write("5");
}
}
string bz = "";
if (!String.IsNullOrEmpty(context.Request.Form["bz"]))
{
bz = HttpUtility.UrlDecode(context.Request.Form["bz"].ToString());
}
int num = 0;
if (!String.IsNullOrEmpty(context.Request.Form["num"]))
{
num = Convert.ToInt32(context.Request.Form["num"].ToString());
}
if (b)
{
if (num == 0)
{
b = false;
context.Response.Write("8");
}
}
if (b)
{
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
string[] aorderids = orderids.Split(',');
foreach (string orderid in aorderids)
{
if (orderid != "")
{
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
if (ModelOrder.IFDelete == 1)
{
b = false;
context.Response.Write("6");
}
if (b)
{
if (ModelOrder.O_Payed == "0")
{
b = false;
context.Response.Write("7");
}
}
if (b)
{
if ((ModelOrder.Totalnum - ModelOrder.pcount) < num)
{
b = false;
context.Response.Write("9");
}
}
}
else
{
b = false;
context.Response.Write("2");
}
}
}
if (b)
{
int ttype = 0;
int ifall = 0;
foreach (string orderid in aorderids)
{
if (orderid != "")
{
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
if (ModelOrder.O_Payed == "1"||ModelOrder.O_Payed == "2")
{
DateTime dt = DateTime.Now;
int state = 2;
if ((ModelOrder.pcount + num) >= ModelOrder.Totalnum)
{
state = 3;
ifall = 1;
}
baoorder.UpdateqyState(0, state.ToString(), dt, ModelOrder.Id);
baoorder.Updatesel("pcount", num, ModelOrder.Id);
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = ModelOrder.UserID;
mjl2.MemberId2 = ModelOrder.MemberId;
mjl2.Addmoney = num;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = 0;
mjl2.addtime = dt;
mjl2.BZContent = bz;
mjl2.PayID = kdcompay;
mjl2.OrdersIDs = body;
mjl2.OrdersID = ModelOrder.Id;
mjl2.utype = 33;
mjl2.utype2 = 0;
mjl2.Seef = 0;//0待收货 1已收货
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
ttype = ModelOrder.ttype;
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = dt;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认发货,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
if (ModelOrder.transaction_id != "" && ModelOrder.openid != "" && ModelOrder.ifxnhy == 0)
{
bool ifb = true;
DateTime dt1 = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
if (cconfig.webXaccess_token != "" && cconfig.webXaccess_token_time != "")
{
DateTime dt2 = Convert.ToDateTime(Convert.ToDateTime(cconfig.webXaccess_token_time).AddMinutes(100).ToString("yyyy-MM-dd HH:mm:ss"));
if (dt1 > dt2)
{
ifb = false;
}
}
else
{
ifb = false;
}
if (!ifb)
{
Mtxfw.Utility.WXaccess_token ac = Mtxfw.Utility.Common.getxaccess_token(cconfig.webXAppID, cconfig.webXAppSecret);
cconfig.webXaccess_token = ac.access_token;
cconfig.webXaccess_token_time = dt1.ToString("yyyy-MM-dd HH:mm:ss");
cconfig.Save();
}
string strproducts = new DAL.P_Product().Getzd("P_Name", "P_id=" + ModelOrder.pid).ToString();
if (strproducts == "")
{
strproducts = "测试商品";
}
string access_token = cconfig.webXaccess_token;
string order_key = "\"order_key\":{\"order_number_type\":2,\"transaction_id\":\"" + ModelOrder.transaction_id + "\"}";
int logistics_type = (kdcompay != "auto" ? 1 : 4);
int delivery_mode = 1;
string shipping_list = "\"shipping_list\":[";
shipping_list += "{\"tracking_no\":\"" + body + "\",\"express_company\":\"" + Mtxfw.Utility.Common.GetkdcompayPH(kdcompay) + "\",\"item_desc\":\"" + strproducts + "\",\"contact\":";
shipping_list += "{\"consignor_contact\":\"153****9828\",\"receiver_contact\":\"" + Mtxfw.Utility.Common.cphone(ModelOrder.Contacttel) + "\"}";
shipping_list += "}";
shipping_list += "]";
string upload_time = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss+08:00");
string payer = "\"payer\":{\"openid\":\"" + ModelOrder.openid + "\"}";
string paramString = "{" + order_key + ",\"logistics_type\":" + logistics_type + ",\"delivery_mode\":" + delivery_mode + "," + shipping_list + ",\"upload_time\":\"" + upload_time + "\"," + payer + "}";
string strResult = Mtxfw.Utility.Common.getPage2("https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token=" + access_token, "", "utf-8", true, true, paramString);
Model.User_Errlog mo = new Model.User_Errlog();
mo.DLID = 0;
mo.ErrType = "upload_shipping_info";
mo.addtime = DateTime.Now;
mo.ErrBody = paramString;
mo.ErrBody2 = strResult;
new DAL.User_Errlog().Add(mo);
if (strResult.IndexOf("\"errcode\"") != -1)
{
Mtxfw.Utility.return_upload_shipping_info remsg = (Mtxfw.Utility.return_upload_shipping_info)Mtxfw.Utility.Common.Fromreturn_upload_shipping_info(strResult);
if (remsg.errcode == 0)
{
baoorder.Updateifxnhy(1, ModelOrder.Id);
}
}
}
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(ModelOrder.UserID);
if (umodel != null)
{
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "订单发货通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/order-ico.png";
amodel.Content = "您的订单" + ModelOrder.orderid + "已经发货,请注意查收";
amodel.Paths = "orders.html";
amodel.Content2 = "";
amodel.Paths2 = "";
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 4;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = new Mtxfw.DAL.Article().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);
}
}
}
}
}
}
context.Response.Write(ifall == 1 ? "0" : "00");
}
}
}
}
else
{
context.Response.Write("3");
}
}
protected void sjqyfhorder(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
if (context.Session["MemberIFStores"].ToString() == "2")
{
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
string kdcompay = "";
if (!String.IsNullOrEmpty(context.Request.Form["kdcompay"]))
{
kdcompay = HttpUtility.UrlDecode(context.Request.Form["kdcompay"].ToString());
}
else
{
b = false;
context.Response.Write("4");
}
string body = "";
if (!String.IsNullOrEmpty(context.Request.Form["body"]))
{
body = HttpUtility.UrlDecode(context.Request.Form["body"].ToString());
}
else
{
b = false;
context.Response.Write("5");
}
string bz = "";
if (!String.IsNullOrEmpty(context.Request.Form["bz"]))
{
bz = HttpUtility.UrlDecode(context.Request.Form["bz"].ToString());
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder.MemberId == MemberId)
{
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "1")
{
baoorder.UpdateqyState(0, "2", DateTime.Now, int.Parse(orderid));
baoorder.UpdateqyState(1, "1", DateTime.Now, int.Parse(orderid));
baoorder.Updateyundanhao(body, kdcompay, bz, int.Parse(orderid));
context.Response.Write("0");
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //同意退货-----------------------------------------------------------------------------------------
protected void agreetoreturn(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
bool b = true;
string orderid = "";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = daoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
if (ModelOrder.O_Payed == "7")
{
DateTime dt = DateTime.Now;
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(ModelOrder.UserID);
if (umodel != null)
{
int Totalnum = ModelOrder.Totalnum;
int zsnum = ModelOrder.pcount;
int thnum = ModelOrder.ypcount;
int tuihuonum = ModelOrder.ypznum;
int addnum = (zsnum + thnum + tuihuonum);
int cenum = (Totalnum - addnum);
daoorder.Updatesel("pcount", -ModelOrder.pcount, ModelOrder.Id);
daoorder.Updatesel("ypcount", -ModelOrder.ypcount, ModelOrder.Id);
daoorder.Updatesel("ypznum", ModelOrder.Totalnum, ModelOrder.Id);
daoorder.Updatesel("ifxhpt", -ModelOrder.ifxhpt, ModelOrder.Id);
daoorder.Updatesel("ifpd", -ModelOrder.ifxnhy, ModelOrder.Id);
daoorder.Updatesel("ifbhzshy", 100, ModelOrder.Id);
daoorder.Updateselprice("Totalprice10", -ModelOrder.Totalprice10, ModelOrder.Id);
daoorder.Updatesel("ifxnhy", cenum, ModelOrder.Id);
daoorder.UpdateqyState(0, "6", dt, ModelOrder.Id);
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = ModelOrder.Totalprice;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney30 + ModelOrder.Totalprice);
mjl2.addtime = dt;
mjl2.BZContent = "退货";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 2;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
new DAL.user_info().UpdateMoney("umoney30", ModelOrder.Totalprice, umodel.Id);
umodel.umoney21 -= ModelOrder.Totalprice;
umodel.umoney21 = Convert.ToDouble(umodel.umoney21.ToString("f2"));
new DAL.user_info().UpdateMoney("umoney21", -ModelOrder.Totalprice, umodel.Id);
daoorder.UpdateIFDelete(1, dt.ToString(), "ttype=2 and IFDelete=0 and ptype=0 and UserID=" + ModelOrder.UserID + " and O_yhj='" + ModelOrder.Id + "'");
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "订单退货通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/order-ico.png";
amodel.Content = "您的订单" + ModelOrder.orderid + "门店已同意退货,请注意查收";
amodel.Paths = "orders.html";
amodel.Content2 = "";
amodel.Paths2 = "";
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 4;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = new Mtxfw.DAL.Article().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);
}
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "同意退货,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
context.Response.Write("0");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //不同意退货-----------------------------------------------------------------------------------------
protected void disagreetoreturn(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
bool b = true;
string orderid = "";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = daoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
if (ModelOrder.O_Payed == "7")
{
DateTime dt = DateTime.Now;
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(ModelOrder.UserID);
if (umodel != null)
{
if (ModelOrder.ifxnhy == 0)
{
daoorder.UpdateqyState(0, "4", dt, ModelOrder.Id);
}
else if (ModelOrder.ifxnhy == ModelOrder.Totalnum)
{
daoorder.UpdateqyState(0, "3", dt, ModelOrder.Id);
}
else
{
daoorder.UpdateqyState(0, "5", dt, ModelOrder.Id);
}
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "订单退货通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/order-ico.png";
amodel.Content = "您的订单" + ModelOrder.orderid + "门店不同意退货,请注意查收";
amodel.Paths = "orders.html";
amodel.Content2 = "";
amodel.Paths2 = "";
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 4;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = new Mtxfw.DAL.Article().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);
}
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "不同意退货,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
context.Response.Write("0");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //修改配送地址-----------------------------------------------------------------------------------------
//修改配送地址
protected void editaddress(HttpContext context)
{
try
{
if (!String.IsNullOrEmpty(context.Request.Form["name"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["phone"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["province"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["address"]))
{
if (!String.IsNullOrEmpty(context.Request.Form["orderid"]))
{
int t = 0;
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
{
t = int.Parse(HttpUtility.UrlDecode(context.Request.Form["t"].ToString()).Trim());
}
int IFUser = 0;
if (context.Request.Form["IFUser"] != null)
{
IFUser = Convert.ToInt32(context.Request.Form["IFUser"].ToString());
}
string strname = HttpUtility.UrlDecode(context.Request.Form["name"].ToString()).Trim();
string strphone = HttpUtility.UrlDecode(context.Request.Form["phone"].ToString()).Trim();
string strprovince = HttpUtility.UrlDecode(context.Request.Form["province"].ToString()).Trim();
string straddress = HttpUtility.UrlDecode(context.Request.Form["address"].ToString());
bool b = true;
string strcity = "";
if (!String.IsNullOrEmpty(context.Request.Form["city"]))
{
strcity = HttpUtility.UrlDecode(context.Request.Form["city"].ToString()).Trim();
}
else
{
if (new DAL.city().GetCount("ProvinceID='" + strprovince + "'") > 0)
{
b = false;
context.Response.Write("城市必须选择!");
}
}
string strcounty = "";
if (!String.IsNullOrEmpty(context.Request.Form["county"]))
{
strcounty = HttpUtility.UrlDecode(context.Request.Form["county"].ToString()).Trim();
}
else
{
if (b)
{
if (new DAL.county().GetCount("CityID='" + strcity + "'") > 0)
{
b = false;
context.Response.Write("区县必须选择!");
}
}
}
if (b)
{
if (t == 1)
{
strprovince = new DAL.province().GetProvinceID(strprovince);
strcity = new DAL.city().GetCityID(strcity);
strcounty = new DAL.county().GetCountyID(strcounty);
}
}
int orderid = int.Parse(HttpUtility.UrlDecode(context.Request.Form["orderid"].ToString()).Trim());
if (b)
{
if (!String.IsNullOrEmpty(strname))
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strname, @"[\u4e00-\u9fa5]"))
{
b = false;
context.Response.Write("联系人姓名填写不正确,只能输入中文!");
}
}
}
if (b)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
if (MemberId > 0)
{
if (orderid > 0)
{
if (IFUser == 1)
{
DataSet ds = new DAL.order_info().GetList1("id", "gtype=" + gtype + " and ttype=2 and ptype=0 and IFDelete=0 And (O_Payed='1') And UserId=" + orderid);
if (ds.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int id = int.Parse(Dr["id"].ToString());
Model.order_info ModelOrder = new DAL.order_info().GetModel(orderid);
if (ModelOrder != null)
{
ModelOrder.Contactname = strname;
ModelOrder.Contacttel = strphone;
ModelOrder.Province = strprovince;
ModelOrder.City = strcity;
ModelOrder.County = strcounty;
ModelOrder.Address = straddress;
new DAL.order_info().Update(ModelOrder);
new DAL.order_info().UpdateAddress0("", ModelOrder.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改配送地址,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
}
}
ds.Clear();
context.Response.Write("true");
}
else
{
Model.order_info ModelOrder = new DAL.order_info().GetModel(orderid);
if (ModelOrder != null)
{
ModelOrder.Contactname = strname;
ModelOrder.Contacttel = strphone;
ModelOrder.Province = strprovince;
ModelOrder.City = strcity;
ModelOrder.County = strcounty;
ModelOrder.Address = straddress;
new DAL.order_info().Update(ModelOrder);
new DAL.order_info().UpdateAddress0("", ModelOrder.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改配送地址,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("true");
}
}
}
}
}
else
{
context.Response.Write("权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
}
else
{
context.Response.Write("订单号不能为空");
}
}
else
{
context.Response.Write("地址不能为空");
}
}
else
{
context.Response.Write("省份必须选择");
}
}
else
{
context.Response.Write("联系电话不能为空");
}
}
else
{
context.Response.Write("联系人不能为空");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //修改物流-----------------------------------------------------------------------------------------
protected void editwl(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
string kdcompay = "";
if (!String.IsNullOrEmpty(context.Request.Form["kdcompay"]))
{
kdcompay = HttpUtility.UrlDecode(context.Request.Form["kdcompay"].ToString());
}
else
{
b = false;
context.Response.Write("4");
}
string body = "";
if (kdcompay != "auto")
{
if (!String.IsNullOrEmpty(context.Request.Form["body"]))
{
body = HttpUtility.UrlDecode(context.Request.Form["body"].ToString());
}
else
{
b = false;
context.Response.Write("5");
}
}
string bz = "";
if (!String.IsNullOrEmpty(context.Request.Form["bz"]))
{
bz = HttpUtility.UrlDecode(context.Request.Form["bz"].ToString());
}
if (b)
{
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
baoorder.Updateyundanhao(body, kdcompay, bz, int.Parse(orderid));
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改物流,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //取消发货-----------------------------------------------------------------------------------------
protected void cancelfh(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
baoorder.UpdateqyState(0, "1", DateTime.Now, int.Parse(orderid));
//baoorder.Updateyundanhao("", kdcompay, bz, int.Parse(orderid));
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "取消发货,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //确认代付-----------------------------------------------------------------------------------------
protected void qydforder(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.order_info daoOrder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.DAL.user_Results_jl2 daojl2 = new Mtxfw.DAL.user_Results_jl2();
Mtxfw.Model.user_info dlmodel = daoUser.GetModel(MemberId);
if (dlmodel != null)
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
int zftype = 0;
if (!String.IsNullOrEmpty(context.Request.Form["zftype"]))
{
zftype = int.Parse(HttpUtility.UrlDecode(context.Request.Form["zftype"].ToString()));
}
string strzftitle = "";
if (zftype == 0)
{
strzftitle = "注册币";
}
else if (zftype == 1)
{
strzftitle = "金币";
}
else if (zftype == 4)
{
strzftitle = "微信支付";
}
else
{
b = false;
context.Response.Write("7");
}
if (b)
{
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
}
if (b)
{
string O_Payed = "";
string province = "", city = "", county = "";
DateTime dt = DateTime.Now;
Mtxfw.Model.order_info ModelOrder = daoOrder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
O_Payed = ModelOrder.O_Payed;
province = ModelOrder.Province;
city = ModelOrder.City;
county = ModelOrder.County;
if (O_Payed == "0")
{
Double ZSubTotal = Convert.ToDouble(ModelOrder.Totalprice.ToString("f2"));
Double zyunfei = Convert.ToDouble(ModelOrder.Totalprice1.ToString("f2"));
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
if (zftype == 0 || zftype == 1)
{
if (zftype == 0)
{
if (Convert.ToDouble(dlmodel.umoney28.ToString("f2")) >= ZSubTotal)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = dlmodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = dlmodel.umoney28 - ZSubTotal;
mjl2.addtime = dt;
mjl2.BZContent = "代付订单号:" + ModelOrder.orderid;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 2;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney28", -ZSubTotal, dlmodel.Id);
}
else
{
b = false;
context.Response.Write("6");
}
}
else
{
if (Convert.ToDouble((dlmodel.umoney - dlmodel.umoney17).ToString("f2")) >= ZSubTotal)
{
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = dlmodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -ZSubTotal;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = dlmodel.umoney - dlmodel.umoney17 - ZSubTotal;
mjl2.addtime = dt;
mjl2.BZContent = "代付订单号:" + ModelOrder.orderid;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 1;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney17", ZSubTotal, dlmodel.Id);
}
else
{
b = false;
context.Response.Write("7");
}
}
if (b)
{
daoOrder.UpdateqyState(0, "1", DateTime.Now, int.Parse(orderid));
Mtxfw.Model.user_info umodel = daoUser.GetModel(ModelOrder.UserID);
if (umodel != null)
{
int utype = ModelOrder.ttype;
if (utype == 1)
{
Double pv = ZSubTotal;
int uLevel = 0;
if (ZSubTotal == Convert.ToDouble((Convert.ToDouble(cconfig.webMoney1) + zyunfei).ToString("f2")))
{
pv = Convert.ToDouble((ZSubTotal + zyunfei).ToString("f2"));
uLevel = 1;
}
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = pv;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = pv;
mjl2.addtime = dt;
mjl2.BZContent = "购买商品,总金额:" + ZSubTotal;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 8;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
Int64 ResultID = daojl2.Add(mjl2);
int dyc = 0;
int SuperiorsID = umodel.SuperiorsID;
int uLevel0 = umodel.uLevel0;
string SuperiorsIDS = umodel.SuperiorsIDS;
int ContactID = umodel.ContactID;
int uLevel1 = umodel.uLevel1;
string ContactIDS = umodel.ContactIDS;
if (umodel.uLevel14 == 0)
{
//更新审核时间
daoUser.UpdateTime("regtime", dt, umodel.Id);
daoUser.UpdateuLevel("uLevel14", 1, umodel.Id);
dyc = 1;
}
if (umodel.uLevel7 == 1)
{
umodel.uLevel7 = 0;
daoUser.UpdateuLevel("uLevel7", umodel.uLevel7, umodel.Id);
}
umodel.umoney21 += pv;
umodel.umoney21 = Convert.ToDouble(umodel.umoney21.ToString("f2"));
daoUser.UpdateMoney("umoney20", pv, umodel.Id);
daoUser.UpdateMoney("umoney21", pv, umodel.Id);
if (umodel.uLevel < uLevel)
{
umodel.uLevel = uLevel;
daoUser.UpdateuLevel("uLevel", uLevel, umodel.Id);
}
//DAL.MemberStatistics.UpdteJJAndYJ(cconfig, umodel.Id, ResultID, ContactID, ContactIDS, SuperiorsID, SuperiorsIDS, uLevel, umodel.uLevel, uLevel0, uLevel1, umodel.uLevel2, umodel.uLevel4, umodel.uLevel7, umodel.uLevel20, umodel.umoney19, pv, umodel.UserName, province, city, county, dt, dyc, utype, gtype);
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认代付," + strzftitle + ",订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
else
{
string strProductName = "";
string strorders = ModelOrder.Id.ToString();
System.Data.DataSet Ds_op = daoorderproduct.GetList1("(Select P_NAME from P_Product b where b.P_ID=a.pid) as prodName", "utype='0' And orderid=" + ModelOrder.Id + " And IFDelete=0 Order By SubmitTime asc");
if (Ds_op.Tables[0].Rows.Count > 0)
{
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
{
string prodName2 = Ds_op.Tables[0].Rows[l]["prodName"].ToString();
strProductName += prodName2 + " ";
}
}
string PayID = dt.ToString("yyMMddHHmmssffff", DateTimeFormatInfo.InvariantInfo);
Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results();
ModelResults.b0 = ZSubTotal;
ModelResults.b1 = 0;
ModelResults.b2 = 0;
ModelResults.b3 = 0;
ModelResults.b4 = 0;
ModelResults.b5 = 0;
ModelResults.b6 = 0;
ModelResults.b7 = 0;
ModelResults.b8 = 0;
ModelResults.b9 = 0;
ModelResults.b10 = 0;
ModelResults.b11 = 0;
ModelResults.b12 = 0;
ModelResults.b13 = 0;
ModelResults.b14 = 0;
ModelResults.b15 = 0;
ModelResults.b16 = 0;
ModelResults.b17 = 0;
ModelResults.b18 = 0;
ModelResults.conent = "购买商品" + strProductName;
ModelResults.Totalmoney = ZSubTotal;
ModelResults.MemberId = MemberId;
ModelResults.UserId = 3;
ModelResults.ListNumber = PayID;
ModelResults.Managers = "5";
ModelResults.Seef = 0;
ModelResults.utype = "2";
ModelResults.addtime = dt;
ModelResults.gtype = gtype;
Int64 ResultId = daoResults.Add(ModelResults);
daoResults.UpdateOrderIds(strorders, ResultId);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认代付," + strzftitle + ",订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("跳转支付|/pay/wxpay.aspx?PayID=" + PayID);
}
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("4");
}
}
}
else
{
context.Response.Write("5");
}
}
}
else
{
context.Response.Write("3");
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/err.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region //设为已付款-----------------------------------------------------------------------------------------
protected void setorder(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (context.Session["MemberIFStores"].ToString() == "1")
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.order_info OrderModel = baoorder.GetModel(int.Parse(orderid));
O_Payed = OrderModel.O_Payed;
DateTime dt = DateTime.Now;
if (O_Payed == "" || O_Payed == "0")
{
baoorder.UpdateqyState(0, "1", dt, int.Parse(orderid));
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + OrderModel.Id + " Order By SubmitTime asc");
if (Ds_op.Tables[0].Rows.Count > 0)
{
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
{
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
}
}
Ds_op.Clear();
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "取消发货,订单号" + OrderModel.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //确认已付款-----------------------------------------------------------------------------------------
protected void setorder0(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (context.Session["MemberIFStores"].ToString() == "1")
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.order_info OrderModel = baoorder.GetModel(int.Parse(orderid));
O_Payed = OrderModel.O_Payed;
DateTime dt = DateTime.Now;
if (O_Payed == "" || O_Payed == "0")
{
baoorder.UpdateqyState(0, "1", dt, int.Parse(orderid));
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("", "utype='0' And orderid=" + OrderModel.Id + " Order By SubmitTime asc");
if (Ds_op.Tables[0].Rows.Count > 0)
{
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
{
int P_pid = int.Parse(Ds_op.Tables[0].Rows[l]["pid"].ToString());
int P_Totalnum = int.Parse(Ds_op.Tables[0].Rows[l]["Totalnum"].ToString());
new Mtxfw.DAL.P_Product().UpdateInventory(P_pid, -P_Totalnum);
}
}
Ds_op.Clear();
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "取消发货,订单号" + OrderModel.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //设为已兑换-----------------------------------------------------------------------------------------
protected void setorder1(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (context.Session["MemberIFStores"].ToString() == "1")
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "" || O_Payed == "0")
{
Double UserMoney = 0.00;
Mtxfw.Model.user_info ModelUser = daouser.GetModel(ModelOrder.UserID);
if (ModelUser != null)
{
UserMoney = ModelUser.umoney0;
}
if (ModelOrder.Totalprice <= UserMoney)
{
daouser.UpdateMoney("umoney0", -ModelOrder.Totalprice, ModelOrder.UserID);
baoorder.UpdateqyState(0, "1", DateTime.Now, int.Parse(orderid));
//Mtxfw.DAL.MemberStatistics.JiangLiFP(ModelOrder.orderid, ModelOrder.pid.ToString(), ModelOrder.UserID, ModelOrder.Totalprice);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "取消发货,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("4");
}
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //去付款-----------------------------------------------------------------------------------------
protected void payorder(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"].ToString());
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info();
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
if (ModelOrder.IFDelete == 0)
{
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "0")
{
Double Totalprice = Convert.ToDouble(ModelOrder.Totalprice.ToString("f2"));
Double Totalprice2 = Convert.ToDouble(ModelOrder.Totalprice2.ToString("f2"));
if (ModelOrder.utype == "2")
{
Totalprice = Convert.ToDouble((Totalprice - Totalprice2).ToString("f2"));
}
string strProductName = "";
System.Data.DataSet Ds_op = daoorderproduct.GetList1("(Select P_NAME from P_Product b where b.P_ID=a.pid) as prodName", "utype='0' And orderid=" + ModelOrder.Id + " And IFDelete=0 Order By SubmitTime asc");
if (Ds_op.Tables[0].Rows.Count > 0)
{
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
{
string prodName2 = Ds_op.Tables[0].Rows[l]["prodName"].ToString();
strProductName += prodName2 + " ";
}
}
Mtxfw.Model.user_info umodel = daouser.GetModel(ModelOrder.UserID);
if (umodel != null)
{
DateTime dt = DateTime.Now;
string PayID = dt.ToString("yyMMddHHmmssffff", DateTimeFormatInfo.InvariantInfo);
Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results();
ModelResults.b0 = Totalprice;
ModelResults.b1 = 0;
ModelResults.b2 = 0;
ModelResults.b3 = 0;
ModelResults.b4 = 0;
ModelResults.b5 = 0;
ModelResults.b6 = 0;
ModelResults.b7 = 0;
ModelResults.b8 = 0;
ModelResults.b9 = 0;
ModelResults.b10 = 0;
ModelResults.b11 = 0;
ModelResults.b12 = 0;
ModelResults.b13 = 0;
ModelResults.b14 = 0;
ModelResults.b15 = 0;
ModelResults.b16 = 0;
ModelResults.b17 = 0;
ModelResults.b18 = 0;
ModelResults.conent = "购买商品" + strProductName;
ModelResults.Totalmoney = Totalprice;
ModelResults.MemberId = MemberId;
ModelResults.UserId = 3;
ModelResults.ListNumber = PayID;
ModelResults.Managers = "5";
ModelResults.Seef = 0;
ModelResults.utype = "2";
ModelResults.addtime = dt;
ModelResults.gtype = gtype;
Int64 ResultId = daoResults.Add(ModelResults);
daoResults.UpdateOrderIds(ModelOrder.Id.ToString(), ResultId);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "去付款" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("跳转支付|/pay/?PayID=" + PayID);
}
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("订单已被删除");
}
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //确认收货-----------------------------------------------------------------------------------------
protected void qyshorder(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "2")
{
DateTime dt = DateTime.Now;
baoorder.UpdateqyState(0, "3", dt, int.Parse(orderid));
if (ModelOrder.ttype == 0 || ModelOrder.ttype == 2 || ModelOrder.ttype == 8)
{
string RealName = daoUser.Getzd("RealName", "id=" + ModelOrder.UserID).ToString();
if (ModelOrder.MemberId > 0)
{
Mtxfw.Model.user_info umodel0 = daoUser.GetModel(ModelOrder.MemberId);
if (umodel0 != null)
{
Double zmoney = Convert.ToDouble(ModelOrder.Totalprice4.ToString("f2"));
if (Convert.ToDouble(umodel0.umoney40.ToString("f2")) < zmoney)
{
zmoney = Convert.ToDouble(umodel0.umoney40.ToString("f2"));
}
if (zmoney > 0.00)
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel0.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -zmoney;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel0.umoney40 - zmoney);
mjl2.addtime = dt;
mjl2.BZContent = RealName + "确认收货,成本";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 16;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
umodel0.umoney40 -= zmoney;
//减少买家余额
daoUser.UpdateMoney("umoney40", -zmoney, umodel0.Id);
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel0.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = zmoney;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel0.umoney41 + zmoney);
mjl2.addtime = dt;
mjl2.BZContent = RealName + "确认收货,成本";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 17;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
umodel0.umoney41 += zmoney;
//减少买家余额
daoUser.UpdateMoney("umoney41", zmoney, umodel0.Id);
}
}
}
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认收货,订单号" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("1");
}
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //删除订单-----------------------------------------------------------------------------------------
protected void deleteorder(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
if (context.Session["MemberIFStores"].ToString() == "1")
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
bool b = true;
string orderid = "0";
if (context.Request.Form["orderid"] != null)
{
orderid = context.Request.Form["orderid"].ToString();
}
if (orderid == "")
{
b = false;
context.Response.Write("1");
}
if (b)
{
string O_Payed = "";
Mtxfw.DAL.order_info baoorder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.user_info daouser = new Mtxfw.DAL.user_info();
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
Mtxfw.Model.order_info ModelOrder = baoorder.GetModel(int.Parse(orderid));
if (ModelOrder != null)
{
O_Payed = ModelOrder.O_Payed;
if (O_Payed == "1" || O_Payed == "2" || O_Payed == "3")
{
if (ModelOrder.utype == "3")
{
/*Mtxfw.Model.user_info umodel = daouser.GetModel(ModelOrder.UserID);
if (umodel != null)
{
Double money = ModelOrder.Totalprice;
Double money2 = Convert.ToDouble(ModelOrder.Totalprice2.ToString("f2"));
if (money2 > 0.00)
{
money = money - money2;
}
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
if (ModelOrder.addressid == 0)
{
Double umoney28 = (umodel.umoney28 - umodel.umoney29);
mjl2.MemberId = ModelOrder.UserID;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney28 + money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "删除订单,退回款项";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 2;
mjl2.utype2 = 0;
mjl2.Seef = 0;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
daouser.UpdateMoney("umoney29", -money, ModelOrder.UserID);
}
else
{
Double umoney36 = (umodel.umoney36);
mjl2.MemberId = ModelOrder.UserID;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney36 + money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "删除订单,退回款项";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 2;
mjl2.utype2 = 0;
mjl2.Seef = 0;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
daouser.UpdateMoney("umoney36", money, ModelOrder.UserID);
}
mjl2 = new Model.user_Results_jl2();
if (money2 > 0.00)
{
Double umoney = (umodel.umoney - umodel.umoney17);
mjl2.MemberId = ModelOrder.UserID;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money2;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umoney + money2;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "删除订单,退回款项";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 1;
mjl2.utype2 = 0;
mjl2.Seef = 0;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
daouser.UpdateMoney("umoney17", -money2, ModelOrder.UserID);
}
}*/
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "删除订单" + ModelOrder.orderid;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
baoorder.UpdateIFDelete(1, DateTime.Now.ToString(), int.Parse(orderid));
context.Response.Write("0");
}
else
{
baoorder.UpdateIFDelete(1, DateTime.Now.ToString(), int.Parse(orderid));
context.Response.Write("0");
}
}
}
else
{
context.Response.Write("2");
}
}
}
else
{
context.Response.Write("3");
}
}
#endregion
#region //是否已扫码付款成功-----------------------------------------------------------------------------------------
protected void iswxpayed(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null)
{
Mtxfw.DAL.user_Results daoResults = new Mtxfw.DAL.user_Results();
bool b = true;
string BillNoe = "0";
if (context.Request.Form["BillNoe"] != null)
{
BillNoe = HttpUtility.UrlDecode(context.Request.Form["BillNoe"]).ToString();
Mtxfw.Model.user_Results ReModel = daoResults.GetModel2(2, BillNoe);
if (ReModel != null)
{
if (ReModel.Seef == 1)
{
context.Response.Write("0");
}
else
{
context.Response.Write("1");
}
}
else
{
context.Response.Write("2");
}
}
else
{
context.Response.Write("3");
}
}
else
{
context.Response.Write("您未登录");
}
}
#endregion
#region //设置当前显示数据类型-----------------------------------------------------------------------------------------
protected void setttype(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberIFStores"] != null && !String.IsNullOrEmpty(context.Request.Form["ttype"]))
{
int ttype = Convert.ToInt32(context.Request.Form["ttype"]);
context.Session["Memberttype"] = ttype;
context.Response.Write("0");
}
}
#endregion
#region 充值金额
//充值金额
protected void onchongzhi(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["t"]) && !String.IsNullOrEmpty(context.Request.Form["id"]) && !String.IsNullOrEmpty(context.Request.Form["je"]) && !String.IsNullOrEmpty(context.Request.Form["Body"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int t = Convert.ToInt32(context.Request.Form["t"]);
int id = Convert.ToInt32(context.Request.Form["id"]);
Double je = Convert.ToDouble(Convert.ToDouble(context.Request.Form["je"].ToString().Trim()).ToString("f4"));
String Body = HttpUtility.UrlDecode(context.Request.Form["Body"]).Trim();
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
bool b = true;
if (t < 0 || t > 28)
{
b = false;
context.Response.Write("参数错误!");
}
if (b)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(id);
if (umodel != null)
{
if (t == 0)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney22 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney22", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改枣乐积分,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 1)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney - umodel.umoney17 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney17", -money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改余额,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 2)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney29 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney29", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改广告劵,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 3)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney30 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney30", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改兑换劵,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 4)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney31 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney31", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改补贴劵,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 5)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney33 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney33", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改活力值,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 6)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney29 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney29", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改流量积分,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 7)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney35 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney35", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改烧伤值,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 9)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney28 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney28", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改增值积分,用户名:" + umodel.UserName + ",数量:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 10)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney26 - umodel.umoney27 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney27", -money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改赠送枣劵,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 11)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney28 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney28", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改可用枣券,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 14)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney34 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney34", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改KSD,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 15)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney39 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney39", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改货款扣税,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 16)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney40 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney40", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改冻结余额,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 17)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney41 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney41", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改解冻余额,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 18)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney36 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney36", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改广告值,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 19)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney37 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney37", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改增值积分,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 21)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney16 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney16", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改激活码,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 22)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney15 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney15", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改推广名额,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 23)
{
Double money = je;
daoUser.UpdateMoney2("umoney42", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改门店让利,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 24)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = money;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney46", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改可用积分,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 26)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney47 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney47", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改补贴劵,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 27)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney48 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney48", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改权益值,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
else if (t == 28)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney52 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = Body;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney52", money, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改补贴值,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
context.Response.Write("0");
}
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 清空金额
//清空金额
protected void qingkong(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["t"]) && !String.IsNullOrEmpty(context.Request.Form["id"]) && !String.IsNullOrEmpty(context.Request.Form["je"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int t = Convert.ToInt32(context.Request.Form["t"]);
int id = Convert.ToInt32(context.Request.Form["id"]);
Double je = Convert.ToDouble(Convert.ToDouble(context.Request.Form["je"]).ToString("f2"));
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
bool b = true;
if (t < 0 || t > 9)
{
b = false;
context.Response.Write("参数错误!");
}
if (b)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(id);
if (umodel != null)
{
if (t == 6)
{
Double money = je;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney18 - money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "后台清空";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = t;
mjl2.utype2 = 0;
mjl2.Seef = 0;
mjl2.seeftime = DateTime.Now;
daojl2.Add(mjl2);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "清空烧伤值,用户名:" + umodel.UserName + ",金额:" + money;
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
}
context.Response.Write("0");
}
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 保存分红金额
//保存分红金额
protected void onSaveFHJS(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int t = 0;
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
{
t = Convert.ToInt32(context.Request.Form["t"]);
}
Double FHMoney = 0.00;
if (!String.IsNullOrEmpty(context.Request.Form["FHMoney"]))
{
FHMoney = Convert.ToDouble(context.Request.Form["FHMoney"]);
}
if (t == 3)
{
new Mtxfw.DAL.user_jjfp().Updatecount0("count8", FHMoney, gtype, 0);
}
else if (t == 2)
{
new Mtxfw.DAL.user_jjfp().Updatecount0("count6", FHMoney, gtype, 0);
}
else if (t == 1)
{
new Mtxfw.DAL.user_jjfp().Updatecount0("count4", FHMoney, gtype, 0);
}
else
{
new Mtxfw.DAL.user_jjfp().Updatecount0("count2", FHMoney, gtype, 0);
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "保存分红金额" + FHMoney;
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("您无权限");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 保存增值积分初始数量和价格
//保存增值积分初始数量和价格
protected void onSaveHHJSJE(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
int t = 0;
if (!String.IsNullOrEmpty(context.Request.Form["t"]))
{
t = Convert.ToInt32(context.Request.Form["t"]);
}
Decimal FHMoney = 0;
if (!String.IsNullOrEmpty(context.Request.Form["FHMoney"]))
{
FHMoney = Convert.ToDecimal(context.Request.Form["FHMoney"]);
}
Decimal FHMoney0 = 0;
if (!String.IsNullOrEmpty(context.Request.Form["FHMoney0"]))
{
FHMoney0 = Convert.ToDecimal(context.Request.Form["FHMoney0"]);
}
Decimal jg = Convert.ToDecimal((FHMoney / FHMoney0).ToString("0.########"));
new DAL.user_zzjf().Updatecount(FHMoney, jg, FHMoney0, gtype);
Model.user_zzjf_log mlog = new Model.user_zzjf_log();
mlog.num = FHMoney;
mlog.zznum = FHMoney;
mlog.zzjg = jg;
mlog.zzjf = FHMoney0;
mlog.xzjf = FHMoney0;
mlog.addtime = DateTime.Now;
mlog.seef = -1;
mlog.seeftime = DateTime.Now;
mlog.gtype = gtype;
new DAL.user_zzjf_log().Add(mlog);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "保存增值积分初始资金" + FHMoney.ToString() + "和积分" + FHMoney0.ToString();
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("您无权限");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 奖金结算
//奖金结算
protected void onFHJS(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
DateTime dt = DateTime.Now;
bool b = true;
Double FHMoney = 0.00;
if (!String.IsNullOrEmpty(context.Request.Form["FHMoney"]))
{
FHMoney = Convert.ToDouble(Convert.ToDouble(context.Request.Form["FHMoney"]).ToString("f2"));
}
Double FHMoney0 = 0.00;
if (!String.IsNullOrEmpty(context.Request.Form["FHMoney0"]))
{
FHMoney0 = Convert.ToDouble(Convert.ToDouble(context.Request.Form["FHMoney0"]).ToString("f2"));
}
if (b)
{
int ifcj = 0;
if (!String.IsNullOrEmpty(context.Request.Form["ifcj"]))
{
ifcj = Convert.ToInt32(context.Request.Form["ifcj"].ToString());
}
if (ifcj == 0)
{
if (new Mtxfw.DAL.user_jjfp().GetCount("TType=1 And DateDiff(day,addtime,'" + dt + "')=0") > 0)
{
b = false;
context.Response.Write("今日已分红过");
}
}
}
if (b)
{
int addweek = Mtxfw.Utility.Common.GetWeekOfYear(dt);
DayOfWeek day = dt.DayOfWeek;
string dayString = day.ToString().ToLower();
if (dayString == "sunday")
{
addweek -= 1;
}
int addmonth = Convert.ToInt32((addweek / 4).ToString().Split('.')[0]);
if (addweek % 4 != 0)
{
addmonth += 1;
}
int ns = dt.Year - 2018;
if (ns > 0)
{
addweek += ns * 52;
addmonth += ns * 13;
}
Mtxfw.Model.user_jjfp jjfpmodel = new Mtxfw.Model.user_jjfp();
jjfpmodel.count1 = 0;
jjfpmodel.count2 = 0;
jjfpmodel.count3 = 0;
jjfpmodel.count4 = 0;
jjfpmodel.count5 = 0;
jjfpmodel.count6 = 0;
jjfpmodel.count7 = 0;
jjfpmodel.count8 = 0;
jjfpmodel.addweek = addweek;
jjfpmodel.addmonth = addmonth;
jjfpmodel.addweektime1 = dt;
jjfpmodel.addweektime2 = dt;
jjfpmodel.TType = 1;
jjfpmodel.addtime = dt;
jjfpmodel.zjnum = "";
int jjfpid = new Mtxfw.DAL.user_jjfp().Add(jjfpmodel);
Mtxfw.DAL.MemberStatistics.FHJS(jjfpid, dt, cconfig, gtype, FHMoney, FHMoney0);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "分红结算";
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
else
{
context.Response.Write("您无权限");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/onHBJSerr.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region 积分支付成本结算
//积分支付成本结算
protected void onFHJS0(HttpContext context)
{
try
{
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();
DAL.business_info daobusiness = new DAL.business_info();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
//if (!String.IsNullOrEmpty(context.Request.Form["FHMoney"]))
//{
//Double FHMoney = Convert.ToDouble(context.Request.Form["FHMoney"]);
DateTime dt = DateTime.Now;
bool b = true;
if (b)
{
int ifcj = 0;
if (!String.IsNullOrEmpty(context.Request.Form["ifcj"]))
{
ifcj = Convert.ToInt32(context.Request.Form["ifcj"].ToString());
}
if (ifcj == 0)
{
if (new Mtxfw.DAL.user_jjfp().GetCount("TType=2 And DateDiff(day,addtime,'" + dt + "')=0") > 0)
{
b = false;
context.Response.Write("今日已结算过");
}
}
}
if (b)
{
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "积分支付成本结算";
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
//}
}
else
{
context.Response.Write("您无权限");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/onHBJSerr.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
public object Fromhuifupayresult1Json(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
public object FromhuifuresultJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
public object FromhuifubasicdataresultJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
public object FromhuifucardlistJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize>(json);
}
public object Fromhuifuresult1Json(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
public object Fromhuifuresult2Json(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
#endregion
#region 添加规格
//添加规格
protected void addguige(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["gg"]) && !String.IsNullOrEmpty(context.Request.Form["jg"]) && !String.IsNullOrEmpty(context.Request.Form["jf"]) && !String.IsNullOrEmpty(context.Request.Form["zl"]) && !String.IsNullOrEmpty(context.Request.Form["kc"]) && !String.IsNullOrEmpty(context.Request.Form["pid"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int MemberuLevel29 = 0;
if (context.Session["MemberuLevel29"] != null)
{
MemberuLevel29 = int.Parse(context.Session["MemberuLevel29"].ToString());
}
int pid = Convert.ToInt32(context.Request.Form["pid"]);
string gg = context.Request.Form["gg"].ToString();
string strjg = context.Request.Form["jg"].ToString();
string strjg0 = "";
if (!String.IsNullOrEmpty(context.Request.Form["jg0"]))
{
strjg0 = context.Request.Form["jg0"].ToString();
}
string strjg1 = "";
if (!String.IsNullOrEmpty(context.Request.Form["jg1"]))
{
strjg1 = context.Request.Form["jg1"].ToString();
}
string strjg2 = "";
if (!String.IsNullOrEmpty(context.Request.Form["jg2"]))
{
strjg2 = context.Request.Form["jg2"].ToString();
}
string strjg3 = "";
if (!String.IsNullOrEmpty(context.Request.Form["jg3"]))
{
strjg3 = context.Request.Form["jg3"].ToString();
}
string tihuodians = "";
if (!String.IsNullOrEmpty(context.Request.Form["tihuodians"]))
{
tihuodians = context.Request.Form["tihuodians"].ToString();
}
string strjg4 = "";
string strjg5 = "";
string strjg6 = "";
string strjg7 = "";
string strjg8= "";
if (MemberuLevel29 == 0)
{
if (!String.IsNullOrEmpty(context.Request.Form["jg4"]))
{
strjg4 = context.Request.Form["jg4"].ToString();
}
if (!String.IsNullOrEmpty(context.Request.Form["jg5"]))
{
strjg5 = context.Request.Form["jg5"].ToString();
}
if (!String.IsNullOrEmpty(context.Request.Form["jg6"]))
{
strjg6 = context.Request.Form["jg6"].ToString();
}
if (!String.IsNullOrEmpty(context.Request.Form["jg7"]))
{
strjg7 = context.Request.Form["jg7"].ToString();
}
if (!String.IsNullOrEmpty(context.Request.Form["jg8"]))
{
strjg8 = context.Request.Form["jg8"].ToString();
}
}
string strjf = context.Request.Form["jf"].ToString();
string strzl = context.Request.Form["zl"].ToString();
string strkc = context.Request.Form["kc"].ToString();
string colors = "", images = "";
if (!String.IsNullOrEmpty(context.Request.Form["colors"]))
{
colors = context.Request.Form["colors"].ToString();
}
if (!String.IsNullOrEmpty(context.Request.Form["images"]))
{
images = context.Request.Form["images"].ToString();
}
int kc = 0;
int id = 0;
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
id = Convert.ToInt32(context.Request.Form["id"]);
}
bool b = true;
Double jg = 0.00;
Double jg0 = 0.00;
Double jg1 = 0.00;
Double jg2 = 0.00;
Double jg3 = 0.00;
Double jg4 = 0.00;
Double jg5 = 0.00;
Double jg6 = 0.00;
Double jg7 = 0.00;
Double jg8 = 0.00;
Double jf = 0.00;
Double zl = 0.00;
if (strjg2 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg2, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg2, @"^-?\d+$"))
{
b = false;
context.Response.Write("零售价格式不正确");
}
}
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg, @"^-?\d+$"))
{
b = false;
context.Response.Write("会员价格式不正确");
}
if (strjg0 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg0, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg0, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg1 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg1, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg1, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg3 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg3, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg3, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg4 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg4, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg4, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg5 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg5, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg5, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg6 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg6, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg6, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg7 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg7, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg7, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (strjg8 != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjg8, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjg8, @"^-?\d+$"))
{
b = false;
context.Response.Write("格式不正确");
}
}
if (!System.Text.RegularExpressions.Regex.IsMatch(strzl, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strzl, @"^-?\d+$"))
{
b = false;
context.Response.Write("重量格式不正确");
}
if (strjf != "")
{
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strjf, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strjf, @"^-?\d+$"))
{
b = false;
context.Response.Write("积分格式不正确");
}
}
}
if (b)
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strkc, @"^-?\d+$"))
{
b = false;
context.Response.Write("库存格式不正确");
}
}
if (b)
{
jg = Convert.ToDouble(Convert.ToDouble(strjg).ToString("f2"));
if (strjg0 != "")
{
jg0 = Convert.ToDouble(Convert.ToDouble(strjg0).ToString("f2"));
}
if (strjg1 != "")
{
jg1 = Convert.ToDouble(Convert.ToDouble(strjg1).ToString("f2"));
}
if (strjg2 != "")
{
jg2 = Convert.ToDouble(Convert.ToDouble(strjg2).ToString("f2"));
}
if (strjg3 != "")
{
jg3 = Convert.ToDouble(Convert.ToDouble(strjg3).ToString("f2"));
}
if (MemberuLevel29 == 0)
{
if (strjg4 != "")
{
jg4 = Convert.ToDouble(Convert.ToDouble(strjg4).ToString("f2"));
}
if (strjg5 != "")
{
jg5 = Convert.ToDouble(Convert.ToDouble(strjg5).ToString("f2"));
}
if (strjg6 != "")
{
jg6 = Convert.ToDouble(Convert.ToDouble(strjg6).ToString("f2"));
}
if (strjg7 != "")
{
jg7 = Convert.ToDouble(Convert.ToDouble(strjg7).ToString("f2"));
}
if (strjg8 != "")
{
jg8 = Convert.ToDouble(Convert.ToDouble(strjg8).ToString("f2"));
}
}
if (strjf != "")
{
jf = Convert.ToDouble(Convert.ToDouble(strjf).ToString("f2"));
}
zl = Convert.ToDouble(Convert.ToDouble(strzl).ToString("f2"));
kc = Convert.ToInt32(strkc);
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
if (new DAL.P_Guige().GetCount("G_PID='" + pid + "' And G_ID=" + id) > 0)
{
Mtxfw.Model.P_Guige model = new DAL.P_Guige().GetModel(id);
if (model != null)
{
model.G_Name = gg;
model.G_JG = jg;
model.G_JG0 = jg0;
model.G_JG1 = jg1;
model.G_JG2 = jg2;
model.G_JG3 = jg3;
if (MemberuLevel29 == 0)
{
model.G_JG4 = jg4;
model.G_JG5 = jg5;
model.G_JG6 = jg6;
model.G_JG7 = jg7;
model.G_JG8 = jg8;
}
model.G_JF = jf;
model.G_ZL = zl;
model.G_Color = colors;
int ZKC = 0;
bool IFKC = true;
string[] acolors = model.G_Color.Split(',');
for (int jj = 0; jj < acolors.Length; jj++)
{
if (acolors[jj] != "")
{
var ac = acolors[jj].Split('|');
if (ac.Length > 1)
{
if (ac[1] != "")
{
int intNum = Convert.ToInt32(ac[1]);
ZKC += intNum;
IFKC = false;
}
}
}
}
if (!IFKC)
{
model.G_KC = ZKC;
}
else
{
model.G_KC = kc;
}
model.G_tihuodian = tihuodians;
model.G_Images = images;
new DAL.P_Guige().Update(model);
context.Response.Write("保存成功");
}
}
else
{
if (new DAL.P_Guige().GetCount("G_PID='" + pid + "' And G_Name='" + gg + "'") > 0)
{
b = false;
context.Response.Write("规格已经存在");
}
else
{
Mtxfw.Model.P_Guige model = new Model.P_Guige();
model.G_PID = pid;
model.G_Name = gg;
model.G_JG = jg;
model.G_JG0 = jg0;
model.G_JG1 = jg1;
model.G_JG2 = jg2;
model.G_JG3 = jg3;
model.G_JG4 = jg4;
model.G_JG5 = jg5;
model.G_JG6 = jg6;
model.G_JG7 = jg7;
model.G_JG8 = jg8;
model.G_JF = jf;
model.G_ZL = zl;
model.G_Color = colors;
int ZKC = 0;
bool IFKC = true;
string[] acolors = model.G_Color.Split(',');
for (int jj = 0; jj < acolors.Length; jj++)
{
if (acolors[jj] != "")
{
var ac = acolors[jj].Split('|');
if (ac.Length > 1)
{
if (ac[1] != "")
{
int intNum = Convert.ToInt32(ac[1]);
ZKC += intNum;
IFKC = false;
}
}
}
}
if (!IFKC)
{
model.G_KC = ZKC;
}
else
{
model.G_KC = kc;
}
model.G_tihuodian = tihuodians;
model.G_Images = images;
model.ttype = 0;
model.MemberId = 0;
int returnid = new DAL.P_Guige().Add(model);
context.Response.Write("returnid=" + returnid);
}
}
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 删除规格
//删除规格
protected void delguige(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
new DAL.P_Guige().Delete(id);
context.Response.Write("删除成功");
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 添加运费模板
//添加运费模板
protected void addYunFei(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel18 = 0;
if (context.Session["MemberuLevel18"] != null)
{
uLevel18 = int.Parse(context.Session["MemberuLevel18"].ToString());
}
if (IFStores == 1 || (IFStores == 0 && uLevel18 == 2))
{
if (!String.IsNullOrEmpty(context.Request.Form["utype"]) && !String.IsNullOrEmpty(context.Request.Form["ifallregions"]) && !String.IsNullOrEmpty(context.Request.Form["firstweight"]) && !String.IsNullOrEmpty(context.Request.Form["firstfreight"]) && !String.IsNullOrEmpty(context.Request.Form["contweight"]) && !String.IsNullOrEmpty(context.Request.Form["contfreight"]) && !String.IsNullOrEmpty(context.Request.Form["pid"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int utype = Convert.ToInt32(context.Request.Form["utype"]);
int pid = Convert.ToInt32(context.Request.Form["pid"]);
int ifallregions = Convert.ToInt32(context.Request.Form["ifallregions"].ToString());
string selectarea = "";
if (!String.IsNullOrEmpty(context.Request.Form["selectarea"]))
{
selectarea = context.Request.Form["selectarea"].ToString();
}
string strfirstweight = context.Request.Form["firstweight"].ToString();
string strfirstfreight = context.Request.Form["firstfreight"].ToString();
string strcontweight = context.Request.Form["contweight"].ToString();
string strcontfreight = context.Request.Form["contfreight"].ToString();
int id = 0;
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
id = Convert.ToInt32(context.Request.Form["id"]);
}
string utitle = "首件", utitle0 = "续件";
if (utype == 1)
{
utitle = "首重";
utitle0 = "续重";
}
if (utype == 2)
{
utitle = "首体积";
utitle0 = "续体积";
}
bool b = true;
Double firstweight = 0.00;
Double firstfreight = 0.00;
Double contweight = 0.00;
Double contfreight = 0.00;
if (strfirstweight != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strfirstweight, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strfirstweight, @"^-?\d+$"))
{
b = false;
context.Response.Write(utitle + "格式不正确");
}
}
if (!System.Text.RegularExpressions.Regex.IsMatch(strfirstfreight, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strfirstfreight, @"^-?\d+$"))
{
b = false;
context.Response.Write("运费格式不正确");
}
if (strcontweight != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strcontweight, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strcontweight, @"^-?\d+$"))
{
b = false;
context.Response.Write(utitle0 + "格式不正确");
}
}
if (!System.Text.RegularExpressions.Regex.IsMatch(strcontfreight, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strcontfreight, @"^-?\d+$"))
{
b = false;
context.Response.Write("续费格式不正确");
}
if (b)
{
firstweight = Convert.ToDouble(Convert.ToDouble(strfirstweight).ToString("f4"));
firstfreight = Convert.ToDouble(Convert.ToDouble(strfirstfreight).ToString("f4"));
contweight = Convert.ToDouble(Convert.ToDouble(strcontweight).ToString("f4"));
contfreight = Convert.ToDouble(Convert.ToDouble(strcontfreight).ToString("f4"));
}
if (b)
{
if (new DAL.freighttemplate_freight().GetCount("fid='" + pid + "' And ID=" + id) > 0)
{
Mtxfw.Model.freighttemplate_freight model = new DAL.freighttemplate_freight().GetModel(id);
if (model != null)
{
model.ifallregions = ifallregions;
model.regions = selectarea;
model.firstweight = firstweight;
model.firstfreight = firstfreight;
model.contweight = contweight;
model.contfreight = contfreight;
new DAL.freighttemplate_freight().Update(model);
context.Response.Write("保存成功");
}
}
else
{
Mtxfw.Model.freighttemplate_freight model = new Model.freighttemplate_freight();
model.fid = pid;
model.ifallregions = ifallregions;
model.regions = selectarea;
model.firstweight = firstweight;
model.firstfreight = firstfreight;
model.contweight = contweight;
model.contfreight = contfreight;
int returnid = new DAL.freighttemplate_freight().Add(model);
context.Response.Write("returnid=" + returnid);
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您的权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
#endregion
#region 删除运费模板
//删除运费模板
protected void delYunFei(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel18 = 0;
if (context.Session["MemberuLevel18"] != null)
{
uLevel18 = int.Parse(context.Session["MemberuLevel18"].ToString());
}
if (IFStores == 1 || (IFStores == 0 && uLevel18 == 2))
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
new DAL.freighttemplate_freight().Delete(id);
context.Response.Write("删除成功");
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您的权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
#endregion
#region 添加包邮设置
//添加包邮设置
protected void addFree(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel18 = 0;
if (context.Session["MemberuLevel18"] != null)
{
uLevel18 = int.Parse(context.Session["MemberuLevel18"].ToString());
}
if (IFStores == 1 || (IFStores == 0 && uLevel18 == 2))
{
if (!String.IsNullOrEmpty(context.Request.Form["freetype"]) && !String.IsNullOrEmpty(context.Request.Form["selectarea"]) && !String.IsNullOrEmpty(context.Request.Form["pid"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int freetype = Convert.ToInt32(context.Request.Form["freetype"]);
int pid = Convert.ToInt32(context.Request.Form["pid"]);
string selectarea = context.Request.Form["selectarea"].ToString();
string strfullpiece = "";
string strfullyuan = "";
bool b = true;
int id = 0;
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
id = Convert.ToInt32(context.Request.Form["id"]);
}
if (freetype == 0)
{
if (!String.IsNullOrEmpty(context.Request.Form["fullpiece"]))
{
strfullpiece = context.Request.Form["fullpiece"].ToString();
}
else
{
b = false;
context.Response.Write("满件\\重量\\体积不能为空");
}
}
if (b)
{
if (freetype == 1)
{
if (!String.IsNullOrEmpty(context.Request.Form["fullyuan"]))
{
strfullyuan = context.Request.Form["fullyuan"].ToString();
}
else
{
b = false;
context.Response.Write("满元金额不能为空");
}
}
}
if (b)
{
if (freetype == 2)
{
if (!String.IsNullOrEmpty(context.Request.Form["fullpiece"]))
{
strfullpiece = context.Request.Form["fullpiece"].ToString();
}
else
{
b = false;
context.Response.Write("满件\\重量\\体积不能为空");
}
if (b)
{
if (!String.IsNullOrEmpty(context.Request.Form["fullyuan"]))
{
strfullyuan = context.Request.Form["fullyuan"].ToString();
}
else
{
b = false;
context.Response.Write("满元金额不能为空");
}
}
}
}
Double fullpiece = 0.00;
Double fullyuan = 0.00;
if (b)
{
if (strfullpiece != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strfullpiece, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strfullpiece, @"^-?\d+$"))
{
b = false;
context.Response.Write("满件\\重量\\体积格式不正确");
}
if (b)
{
fullpiece = Convert.ToDouble(Convert.ToDouble(strfullpiece).ToString("f4"));
}
}
}
if (b)
{
if (strfullyuan != "")
{
if (!System.Text.RegularExpressions.Regex.IsMatch(strfullyuan, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(strfullyuan, @"^-?\d+$"))
{
b = false;
context.Response.Write("满元金额格式不正确");
}
if (b)
{
fullyuan = Convert.ToDouble(Convert.ToDouble(strfullyuan).ToString("f4"));
}
}
}
if (b)
{
if (new DAL.freighttemplate_free().GetCount("fid='" + pid + "' And ID=" + id) > 0)
{
Mtxfw.Model.freighttemplate_free model = new DAL.freighttemplate_free().GetModel(id);
if (model != null)
{
model.regions = selectarea;
model.freetype = freetype;
model.fullpiece = fullpiece;
model.fullyuan = fullyuan;
new DAL.freighttemplate_free().Update(model);
context.Response.Write("保存成功");
}
}
else
{
Mtxfw.Model.freighttemplate_free model = new Model.freighttemplate_free();
model.fid = pid;
model.regions = selectarea;
model.freetype = freetype;
model.fullpiece = fullpiece;
model.fullyuan = fullyuan;
int returnid = new DAL.freighttemplate_free().Add(model);
context.Response.Write("returnid=" + returnid);
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您的权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
#endregion
#region 删除包邮设置
//删除包邮设置
protected void delFree(HttpContext context)
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel18 = 0;
if (context.Session["MemberuLevel18"] != null)
{
uLevel18 = int.Parse(context.Session["MemberuLevel18"].ToString());
}
if (IFStores == 1 || (IFStores == 0 && uLevel18 == 2))
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
new DAL.freighttemplate_free().Delete(id);
context.Response.Write("删除成功");
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您的权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
#endregion
#region 添加任务说明
//添加任务说明
protected void addrwsm(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["gg"]) && !String.IsNullOrEmpty(context.Request.Form["pid"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int pid = Convert.ToInt32(context.Request.Form["pid"]);
string gg = HttpUtility.UrlDecode(context.Request.Form["gg"].ToString());
int id = 0;
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
id = Convert.ToInt32(context.Request.Form["id"]);
}
bool b = true;
if (b)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
if (new DAL.Article().GetCount("ID=" + id) > 0)
{
Mtxfw.Model.Article model = new DAL.Article().GetModel(id);
if (model != null)
{
model.Content = gg;
new DAL.Article().Update(model);
context.Response.Write("保存成功");
}
}
else
{
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
model.senderid = 0;
model.receiverid = 0;
model.Title = "任务说明";
model.ParentID = 16;
model.CategoryId = pid.ToString();//DropType.SelectedItem.Value
model.AddTime = DateTime.Now;
model.Author = "";
model.Content = gg;
model.Paths = "";
model.Content2 = "";
model.Paths2 = "";
model.media_id = "";
model.thumb_media_id = "";
model.wtype = 0;
model.wtype2 = 0;
model.LinkID = 0;
model.Seef = 0;
model.KeyWords = "";
model.gtype = gtype;
int returnid = new DAL.Article().Add(model);
context.Response.Write("returnid=" + returnid);
}
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 删除任务说明
//删除任务说明
protected void delrwsm(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
new DAL.Article().Delete(id);
context.Response.Write("删除成功");
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 审核任务说明
//审核任务说明
protected void seefrwsm(HttpContext context)
{
try
{
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();
Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
if (!String.IsNullOrEmpty(context.Request.Form["t"])&& !String.IsNullOrEmpty(context.Request.Form["id"]))
{
int t = Convert.ToInt32(context.Request.Form["t"]);
int id = Convert.ToInt32(context.Request.Form["id"]);
Mtxfw.Model.user_Results mr = daoResults.GetModel(id);
if (mr != null)
{
string atitle = daoArt.Getzd("title", "parentid=18 and Id=" + mr.hasRead).ToString();
if (t == 0)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId);
if (umodel != null)
{
DateTime dt = DateTime.Now;
daoResults.UpdateSeef(2, dt, mr.Id);
bool IFJS = true;
DataSet ds = daoArt.GetList1("id,(select top 1 b.seef from user_Results b where b.utype=6 And b.IFDelete=0 And b.MemberId=" + umodel.Id + " and b.hasRead=" + mr.hasRead + " and b.Sended=convert(varchar(50),a.id) and b.ListNumber='" + mr.ListNumber + "') as seef", "parentid=16 And categoryid='" + mr.hasRead + "'");
if (ds.Tables[0].Rows.Count > 0)
{
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int G_ID = int.Parse(Dr["id"].ToString());
string seef = Dr["seef"].ToString();
if (seef != "2")
{
IFJS = false;
}
}
}
ds.Clear();
if (IFJS)
{
daoResults.UpdateSeef(2, dt, Convert.ToInt64(mr.OrderIds));
Double money = mr.b0;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = money;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney29 + money);
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "完成任务";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 3;
mjl2.utype2 = 0;
mjl2.Seef = 0;
mjl2.seeftime = DateTime.Now;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney29", money, umodel.Id);
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "任务进度通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/renwu-ico.png";
amodel.Content = "您的任务【" + atitle + "】已完成";
amodel.Paths = "myrenwu_uploadpic.html";
amodel.Content2 = "";
amodel.Paths2 = mr.ListNumber;
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 5;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
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);
}
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "审核通过任务,ID为" + mr.Id + ",用户名为" + umodel.UserName + ",时间为" + mr.addtime;
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
}
}
if (t == 1)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId);
if (umodel != null)
{
daoResults.UpdateSeef(-1, DateTime.Now, mr.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "审核不合格任务,ID为" + mr.Id + ",用户名为" + umodel.UserName + ",时间为" + mr.addtime;
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel.Id;
amodel.Title = "任务进度通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/renwu-ico.png";
amodel.Content = "您的任务【" + atitle + "】有内容审核不合格";
amodel.Paths = "myrenwu_uploadpic.html";
amodel.Content2 = "";
amodel.Paths2 = mr.ListNumber;
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 5;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
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 (t == 2)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(mr.MemberId);
if (umodel != null)
{
daoResults.UpdateIFDelete(1, DateTime.Now.ToString(), mr.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "取消审核任务,ID为" + mr.Id + ",用户名为" + umodel.UserName + ",时间为" + mr.addtime;
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
}
}
}
context.Response.Write("删除成功");
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 保存颜色
//保存颜色
protected void savecolor(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (context.Request.Form["colors"] != null && !String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
string colors = context.Request.Form["colors"].ToString();
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(id);
if (gmodel != null)
{
gmodel.G_Color = colors;
int ZKC = 0;
bool IFKC = true;
string[] acolors = gmodel.G_Color.Split(',');
for (int jj = 0; jj < acolors.Length; jj++)
{
if (acolors[jj] != "")
{
var ac = acolors[jj].Split('|');
if (ac.Length > 1)
{
if (ac[1] != "")
{
int intNum = Convert.ToInt32(ac[1]);
ZKC += intNum;
IFKC = false;
}
}
}
}
if (!IFKC)
{
gmodel.G_KC = ZKC;
}
new DAL.P_Guige().Update(gmodel);
context.Response.Write("保存成功");
}
else
{
context.Response.Write("保存成功");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 保存提货点
//保存提货点
protected void savetihuodian(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (context.Request.Form["tihuodians"] != null && !String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
string tihuodians = context.Request.Form["tihuodians"].ToString();
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(id);
if (gmodel != null)
{
gmodel.G_tihuodian = tihuodians;
new DAL.P_Guige().Update(gmodel);
context.Response.Write("保存成功");
}
else
{
context.Response.Write("保存成功");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 保存图片
//保存图片
protected void saveimage(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (context.Request.Form["images"] != null && !String.IsNullOrEmpty(context.Request.Form["id"]))
{
int id = Convert.ToInt32(context.Request.Form["id"]);
string images = context.Request.Form["images"].ToString();
Mtxfw.Model.P_Guige model = new DAL.P_Guige().GetModel(id);
if (model != null)
{
model.G_Images = images;
new DAL.P_Guige().Update(model);
context.Response.Write("保存成功");
}
else
{
context.Response.Write("保存成功");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region //快递查询-----------------------------------------------------------------------------------------
protected void kdchaxun(HttpContext context)
{
bool b = true;
string kdgs = "";
string ydh = "";
string data = "{\"success\":false}";
if (!String.IsNullOrEmpty(context.Request["kdgs"]))
{
kdgs = context.Request["kdgs"].ToString();
}
else
{
b = false;
data = "{\"success\":false,\"msg\":'参数不对'}";
}
if (!String.IsNullOrEmpty(context.Request["ydh"]))
{
ydh = context.Request["ydh"].ToString();
}
else
{
b = false;
data = "{\"success\":false,\"msg\":'参数不对2'}";
}
string mobile = "";
if (kdgs == "sf" && !String.IsNullOrEmpty(context.Request["mobile"]))
{
mobile = HttpUtility.UrlDecode(context.Request["mobile"].ToString());
}
if (b)
{
string strResult = "";
try
{
strResult = Mtxfw.Utility.Common.GetKDXX(ydh, kdgs, mobile);
Mtxfw.Utility.Common.WriteHtml("/weixin/kdchaxun.txt", strResult);
if (strResult.IndexOf("success") != -1)
{
if (strResult.IndexOf("未查询到快递物流数据") == -1)
{
kdchaxun kd = (kdchaxun)FromkdJson(strResult);
if (kd.code == 200 && kd.success)
{
}
else
{
b = false;
data = "{\"success\":false,\"msg\":\"" + kd.msg + "\"}";
}
if (b)
{
kdchaxun0 kd0 = (kdchaxun0)FromkdJson0(strResult);
int status = 0;
if (kd0.data.logisticsStatusDesc.IndexOf("已收件") != -1 || kd0.data.logisticsStatusDesc.IndexOf("已收寄") != -1)
{
status = 1;
}
if (kd0.data.logisticsStatusDesc.IndexOf("已到达") != -1 || kd0.data.logisticsStatusDesc.IndexOf("已发往") != -1 || kd0.data.logisticsStatusDesc.IndexOf("正发往") != -1 || kd0.data.logisticsStatusDesc.IndexOf("上一站") != -1 || kd0.data.logisticsStatusDesc.IndexOf("下一站") != -1 || kd0.data.logisticsStatusDesc.IndexOf("已进行") != -1 || kd0.data.logisticsStatusDesc.IndexOf("已在") != -1 || kd0.data.logisticsStatusDesc.IndexOf("运输中") != -1)
{
status = 2;
}
if (kd0.data.logisticsStatusDesc.IndexOf("派件") != -1 || kd0.data.logisticsStatusDesc.IndexOf("派送") != -1)
{
status = 3;
}
if (kd0.data.logisticsStatusDesc.IndexOf("签收") != -1 || kd0.data.logisticsStatusDesc.IndexOf("已暂存") != -1 || kd0.data.logisticsStatusDesc.IndexOf("已送达") != -1 || kd0.data.logisticsStatusDesc.IndexOf("代收") != -1)
{
status = 4;
}
int Count = kd0.data.logisticsTraceDetails.Count;
StringBuilder sb = new StringBuilder();
StringWriter sw = new StringWriter(sb);
using (JsonWriter jw = new JsonTextWriter(sw))
{
jw.WriteStartObject();
jw.WritePropertyName("success");
jw.WriteValue(true);
DateTime dt1 = Mtxfw.Utility.Common.To13DateTime(kd0.data.logisticsTraceDetails[0].time);
DateTime dt2 = Mtxfw.Utility.Common.To13DateTime(kd0.data.logisticsTraceDetails[Count - 1].time);
TimeSpan t = dt2.Subtract(dt1);
string times = "";
if (t.Days > 0)
{
times = t.Days + "天" + t.Hours + "小时";
}
else
{
times = t.Hours + "小时";
}
jw.WritePropertyName("times");
jw.WriteValue(times);
jw.WritePropertyName("items");
jw.WriteStartArray();
string strtimes = "";
for (int i = 0; i < Count; i++)
{
string strremark = "[" + kd0.data.logisticsTraceDetails[i].areaName + "]" + kd0.data.logisticsTraceDetails[i].desc.Replace(" ", "").Trim();
string dt = Mtxfw.Utility.Common.To13DateTime(kd0.data.logisticsTraceDetails[i].time).ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo);
string sj = Mtxfw.Utility.Common.To13DateTime(kd0.data.logisticsTraceDetails[i].time).ToString("HH:mm", System.Globalization.DateTimeFormatInfo.InvariantInfo);
if (strtimes != "" && strtimes != dt)
{
jw.WriteEndArray();
jw.WriteEndObject();
}
if (strtimes == "" || strtimes != dt)
{
jw.WriteStartObject();
jw.WritePropertyName("ddate");
jw.WriteValue(dt);
jw.WritePropertyName("lists");
jw.WriteStartArray();
jw.WriteStartObject();
jw.WritePropertyName("datetime");
jw.WriteValue(sj);
jw.WritePropertyName("remark");
jw.WriteValue(strremark);
jw.WriteEndObject();
}
else
{
jw.WriteStartObject();
jw.WritePropertyName("datetime");
jw.WriteValue(sj);
jw.WritePropertyName("remark");
jw.WriteValue(strremark);
jw.WriteEndObject();
}
strtimes = dt;
}
if (Count > 0)
{
jw.WriteEndArray();
jw.WriteEndObject();
}
jw.WriteEndArray();
jw.WritePropertyName("status");//状态
jw.WriteValue(status);
jw.WriteEndObject();
}
data = sw.ToString();
}
}
else
{
data = "{\"success\":false,\"msg\":\"未查询到快递物流数据\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"超时,未能成功获取内容\"}";
}
}
catch (Exception ex)
{
data = "{\"success\":false,\"msg\":\"发生错误\"}";
}
}
Utility.Common.WriteJson(context, data);
}
public object FromkdJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
public object FromkdJson0(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
return js.Deserialize(json);
}
#endregion
#region 上传图片
///
/// 上传图片
///
protected void UploadPicture(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
string imgurl = "";
if (context.Request.Files["Photo"] != null)
{
string strContentType = context.Request.Files["Photo"].ContentType.ToLower();
int intContentLength = context.Request.Files["Photo"].ContentLength;
if (Mtxfw.Utility.Common.hasType(cconfig.webUpType.Split(','), strContentType))
{
if (intContentLength <= 102400 * 50)
{
string FileName, FileType, Folders;
Folders = cconfig.webUpPath;
Folders = "/Files/grimage/" + context.Session["MemberId"].ToString() + "/";
//创建保存位置
if (!Directory.Exists(context.Server.MapPath(Folders)))
{
Directory.CreateDirectory(context.Server.MapPath(Folders));
}
FileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Millisecond.ToString();
FileType = context.Request.Files["Photo"].FileName.Substring(context.Request.Files["Photo"].FileName.LastIndexOf(".")).ToLower();
string strFilePath = Folders + FileName + FileType;
context.Request.Files["Photo"].SaveAs(context.Server.MapPath(strFilePath));
imgurl = Folders + FileName + FileType + "|" + Folders + FileName + FileType;
if (!Mtxfw.Utility.Common.IsAllowedExtension(context.Server.MapPath(strFilePath)))
{
File.Delete(context.Server.MapPath(strFilePath));
imgurl = "0";
}
}
else
{
imgurl = "1";
}
}
else
{
imgurl = "0";
}
context.Response.Write(imgurl);
}
else
{
context.Response.Write("00");
}
}
else
{
context.Response.Write("000");
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region 确认支付
//确认支付
protected void qydk(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]) && !String.IsNullOrEmpty(context.Request.Form["uploadpic"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
String uploadpic = "";
if (!String.IsNullOrEmpty(context.Request.Form["uploadpic"]))
{
uploadpic = HttpUtility.UrlDecode(context.Request.Form["uploadpic"]).Trim();
}
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
bool b = true;
Mtxfw.Model.user_Results rmodel = daoResults.GetModel(ViewID);
if (rmodel != null)
{
if (b)
{
Mtxfw.Model.user_info umodel2 = daoUser.GetModel(rmodel.MemberId);
if (umodel2 != null)
{
rmodel.Managers = uploadpic;
daoResults.Updatepaytime(2, DateTime.Now, uploadpic, rmodel.Id);
Mtxfw.Model.user_info umodel0 = new Mtxfw.DAL.user_info().GetModel(rmodel.UserId);
if (umodel0 != null)
{
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel0.Id;
amodel.Title = "支付通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/order-ico.png";
amodel.Content = "您的订单已确认支付,请查看详情!";
amodel.Paths = "yydd_view.html?id=" + rmodel.Id;
amodel.Content2 = "";
amodel.Paths2 = "";
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 4;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = daoArt.Add(amodel).ToString();
if (umodel0.registrationId != "")
{
List RegistrationIDList = new List();
RegistrationIDList.Add(umodel0.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);
}
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认支付,信息ID:" + rmodel.Id;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
}
else
{
context.Response.Write("权限不足");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 重新上传图片
//重新上传图片
protected void uploadpic(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]) && !String.IsNullOrEmpty(context.Request.Form["uploadpic"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
String uploadpic = "";
if (!String.IsNullOrEmpty(context.Request.Form["uploadpic"]))
{
uploadpic = HttpUtility.UrlDecode(context.Request.Form["uploadpic"]).Trim();
}
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 0)
{
bool b = true;
Mtxfw.Model.user_Results rmodel = daoResults.GetModel(ViewID);
if (rmodel != null)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
if (umodel.uLevel8 == 1)
{
b = false;
context.Response.Write("您的账户已被封!");
}
DateTime dt1;
DateTime dt2;
if (rmodel.Seef != 2)
{
b = false;
context.Response.Write("参数错误");
}
if (b)
{
if (Convert.ToInt32(rmodel.b8) == 1)
{
if (rmodel.UserId != MemberId)
{
b = false;
context.Response.Write("参数错误2");
}
if (b)
{
dt1 = rmodel.seeftime.AddHours(Convert.ToInt32(cconfig.webMoney32));
dt2 = DateTime.Now;
if (dt1 < dt2)
{
b = false;
context.Response.Write("已超时不能重新上传正确图片");
}
}
if (b)
{
Mtxfw.Model.user_info umodel2 = daoUser.GetModel(rmodel.MemberId);
if (umodel2 != null)
{
rmodel.Managers = uploadpic;
daoResults.UpdateManagers(rmodel.Managers, rmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "重新上传正确图片,信息号码:" + (Convert.ToInt32(rmodel.b8) == 0 ? "T" : "J") + rmodel.Id;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
else
{
if (rmodel.MemberId != MemberId)
{
b = false;
context.Response.Write("参数错误2");
}
if (b)
{
dt1 = rmodel.seeftime.AddHours(Convert.ToInt32(cconfig.webMoney32));
dt2 = DateTime.Now;
if (dt1 < dt2)
{
b = false;
context.Response.Write("已超时不能重新上传正确图片");
}
}
if (b)
{
Mtxfw.Model.user_info umodel2 = daoUser.GetModel(rmodel.UserId);
if (umodel2 != null)
{
rmodel.Managers = uploadpic;
daoResults.UpdateManagers(rmodel.Managers, rmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "重新上传正确图片,信息号码:" + (Convert.ToInt32(rmodel.b8) == 0 ? "T" : "J") + rmodel.Id;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
}
}
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 确认收到
//确认收到
protected void qysk(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
Mtxfw.Model.user_Results rmodel = daoResults.GetModel(ViewID);
if (rmodel != null)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(rmodel.MemberId);
if (umodel != null)
{
daoResults.UpdateSeef(3, DateTime.Now, rmodel.Id);
Mtxfw.Model.user_info umodel0 = new Mtxfw.DAL.user_info().GetModel(rmodel.UserId);
if (umodel0 != null)
{
Mtxfw.Model.Article amodel = new Mtxfw.Model.Article();
amodel.senderid = 0;
amodel.receiverid = umodel0.Id;
amodel.Title = "收款通知";
amodel.ParentID = 30;
amodel.CategoryId = "0";
amodel.AddTime = DateTime.Now;
amodel.Author = "../image/order-ico.png";
amodel.Content = "您的订单已确认收款,请查看详情!";
amodel.Paths = "yydd_view.html?id=" + rmodel.Id;
amodel.Content2 = "";
amodel.Paths2 = "";
amodel.KeyWords = "";
amodel.media_id = "";
amodel.thumb_media_id = "";
amodel.wtype = 4;
amodel.wtype2 = 0;
amodel.LinkID = 1;
amodel.Seef = 0;
amodel.gtype = gtype;
string dataid = daoArt.Add(amodel).ToString();
if (umodel0.registrationId != "")
{
List RegistrationIDList = new List();
RegistrationIDList.Add(umodel0.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);
}
}
Double jjmoney = (rmodel.b0 * 0.02);
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel0.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = jjmoney;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umodel0.umoney23 + jjmoney;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "完成交易";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 11;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney23", jjmoney, umodel0.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认收款,信息ID:" + rmodel.Id;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
}
}
else
{
context.Response.Write("权限不足");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 确认扣除转卖积分
//确认扣除转卖积分
protected void qykclc(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (IFStores == 1)
{
Mtxfw.Model.user_Results rmodel = daoResults.GetModel(ViewID);
if (rmodel != null)
{
if (rmodel.Seef == 1&&rmodel.b8.ToString()=="1")
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(rmodel.MemberId);
if (umodel != null)
{
Mtxfw.Model.user_info umodel0 = new Mtxfw.DAL.user_info().GetModel(rmodel.UserId);
if (umodel0 != null)
{
Double kcje = Convert.ToDouble((rmodel.b0 * Convert.ToDouble(cconfig.webMoney46) / 100).ToString("f2"));//Convert.ToDouble(Convert.ToDouble(cconfig.webMoney30).ToString("f2"));
Double jlje = Convert.ToDouble((rmodel.b0 * Convert.ToDouble(cconfig.webMoney46) / 100).ToString("f2"));
if (kcje > 0.00)
{
DateTime dt = DateTime.Now;
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel0.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -kcje;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel0.umoney30 - kcje);
mjl2.addtime = dt;
mjl2.BZContent = "超时未支付扣除";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 2;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney30", -kcje, umodel0.Id);
mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = jlje;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (umodel.umoney - umodel.umoney17 + jlje);
mjl2.addtime = dt;
mjl2.BZContent = "对方超时未支付奖励";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 1;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
daojl2.Add(mjl2);
daoUser.UpdateMoney("umoney17", -jlje, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "确认扣除买家 " + umodel0.UserName + " 转卖积分 " + kcje + ",信息ID:" + rmodel.Id;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("扣除百分比为0");
}
}
else
{
context.Response.Write("参数错误2");
}
}
else
{
context.Response.Write("参数错误");
}
}
else
{
context.Response.Write("请不要重复提交");
}
}
}
else
{
context.Response.Write("权限不足");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 举报
//举报
protected void jubao(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
String JuBaoType = HttpUtility.UrlDecode(context.Request.Form["JuBaoType"]).Trim();
String JuBaoBody = HttpUtility.UrlDecode(context.Request.Form["JuBaoBody"]).Trim();
bool b = true;
Regex R1 = new Regex(@"<([\S\s\n\t]*?)>");
Match M1 = R1.Match(JuBaoBody);
if (M1.Success)
{
b = false;
context.Response.Write("内容不能包含HTML代码!");
}
if (b)
{
JuBaoBody = HttpUtility.HtmlEncode(JuBaoBody);
if (MemberId > 0)
{
Model.user_Results mo = daoResults.GetModel(ViewID);
if (mo != null)
{
Mtxfw.Model.user_info ModelUser = daoUser.GetModel(mo.MemberId);
if (ModelUser != null)
{
Mtxfw.Model.user_info ModelUser2 = daoUser.GetModel(MemberId);
if (ModelUser2 != null)
{
if (mo.Seef != 3)
{
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
model.senderid = ModelUser2.Id;
model.receiverid = (ModelUser2.Id == mo.MemberId ? mo.UserId : mo.MemberId); ;
model.Title = JuBaoType;
model.ParentID = 34;
model.CategoryId = mo.Id.ToString();
model.AddTime = DateTime.Now;
model.Author = mo.ListNumber;
model.Content = JuBaoBody;
model.Paths = "";
model.Content2 = "";
model.Paths2 = "";
model.KeyWords = "";
model.media_id = mo.ListNumber;
model.thumb_media_id = "";
model.wtype = 0;
model.wtype2 = 0;
model.LinkID = 0;
model.Seef = 0;
model.gtype = gtype;
new Mtxfw.DAL.Article().Add(model);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = ModelUser2.Id;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "举报" + ModelUser.UserName + ",信息号码:" + (mo.ListNumber == "0" ? "T" : "J") + mo.Id + ",举报内容:" + JuBaoBody;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write(0);
}
else
{
context.Response.Write("此单已完成,不能再举报");
}
}
}
}
}
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 撤销交流
//撤销交流
protected void qxjy(HttpContext context)
{
try
{
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();
//context.Response.Write("暂时不可撤单");
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (MemberId > 0)
{
Model.user_Results rmodel = daoResults.GetModel(ViewID);
if (rmodel != null)
{
if (rmodel.MemberId == MemberId)
{
if (rmodel.Seef == 0)
{
if (rmodel.IFDelete == 0)
{
if (Convert.ToInt32(rmodel.b8.ToString().Split('.')[0]) == 1)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(rmodel.MemberId);
if (umodel != null)
{
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = rmodel.b0;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = umodel.umoney29 + rmodel.b0;
mjl2.addtime = DateTime.Now;
mjl2.BZContent = "撤单";
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = 3;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = DateTime.Now;
mjl2.gtype = gtype;
new DAL.user_Results_jl2().Add(mjl2);
daoUser.UpdateMoney("umoney29", rmodel.b0, umodel.Id);
new DAL.user_Results_jl2().UpdateSel("IFDelete", 1, "IFDeleteTime", DateTime.Now, "utype=10 And IFDelete=0 And PayID='" + rmodel.Id + "'");
}
}
daoResults.UpdateIFDelete(1, DateTime.Now.ToString(), rmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "撤单,信息号码:" + (Convert.ToInt32(rmodel.b8) == 0 ? "T" : "J") + rmodel.Id;
logmodel.UType = 0;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
context.Response.Write("0");
}
else
{
context.Response.Write("已撤单不可重复操作");
}
}
else
{
context.Response.Write("已交流不可撤单");
}
}
else
{
context.Response.Write("参数错误3");
}
}
else
{
context.Response.Write("参数错误2");
}
}
else
{
context.Response.Write("参数错误");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 匹配交流
//匹配交流
protected void ppjy(HttpContext context)
{
try
{
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();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]) && !String.IsNullOrEmpty(context.Request.Form["selid"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
Int64 selid = Convert.ToInt64(context.Request.Form["selid"].ToString());
if (MemberId > 0)
{
Model.user_Results rmodel = daoResults.GetModel(ViewID);
if (rmodel != null)
{
if (rmodel.Seef == 0)
{
if (rmodel.IFDelete == 0)
{
if (Convert.ToInt32(rmodel.b8.ToString().Split('.')[0]) == 1)
{
if (rmodel.Seef > 0)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(rmodel.MemberId);
if (umodel != null)
{
bool b = true;
if (b)
{
if (selid <= 0)
{
b = false;
context.Response.Write("选择错误!");
}
}
Model.user_Results rmodel0 = daoResults.GetModel(selid);
if (rmodel0 != null)
{
Int32 b14 = Convert.ToInt32(rmodel0.b14.ToString().Split('.')[0]);
if (b14 > 0)
{
b = false;
context.Response.Write("订单号码"+ rmodel0.Id + "已匹配过!");
}
if (b)
{
Int64 TResultId = rmodel.Id;
Int32 TMemberId = rmodel.MemberId;
Double Tb0 = rmodel.b0;
Double Tb1 = rmodel.b1;
Double Tb2 = rmodel.b2;
DateTime Taddtime = rmodel.addtime;
string Managers = rmodel.Managers;
string TUserName = umodel.UserName;
string TRealName = umodel.RealName;
string TPhone = umodel.Phone;
DateTime dt = DateTime.Now;
Int64 JResultId = rmodel0.Id;
Int32 JMemberId = rmodel0.MemberId;
Double Jb0 = Convert.ToDouble(rmodel0.b0.ToString("f2"));
Double Jb1 = Convert.ToDouble(rmodel0.b1.ToString("f2"));
Double Jb2 = Convert.ToDouble(rmodel0.b2.ToString("f2"));
DateTime Jaddtime = rmodel0.addtime;
Mtxfw.Model.user_info umodel0 = daoUser.GetModel(JMemberId);
if (umodel0 != null)
{
string JUserName = umodel0.UserName;
string JRealName = umodel0.RealName;
string JPhone = umodel0.Phone;
daoResults.Updatejdtime(1, dt, Jaddtime, JMemberId, JResultId.ToString(), TResultId);
int yyq = Convert.ToInt32(cconfig.webMoney69);
if (yyq == 0)
{
daoResults.Updatemoney("b11", 1, "id=" + TResultId);
}
else
{
daoResults.Updatemoney("b11", 0, "id=" + TResultId);
DateTime yyqdt = dt.AddMinutes(yyq);
if (cconfig.webMoney70 == "hour")
{
yyqdt = dt.AddHours(yyq);
}
else if (cconfig.webMoney70 == "day")
{
yyqdt = dt.AddDays(yyq);
}
daoResults.Updatepaytime(yyqdt, TResultId);
}
daoResults.Updatemoney("b5", 0, "id=" + TResultId);
daoResults.Updatemoney("b14", 1, "id=" + JResultId);//更新已匹配标志
if (Managers != "")
{
daoResults.UpdateSeef(1, dt, Convert.ToInt64(Managers));
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "选择匹配订单,ID:" + TResultId + ",买家为" + JUserName + "[" + JRealName + "],卖家为" + TUserName + "[" + TRealName + "]";
logmodel.UType = 0;
new DAL.User_CZ_log().Add(logmodel);
}
context.Response.Write("0");
}
}
}
}
else
{
context.Response.Write("订单已匹配过");
}
}
else
{
context.Response.Write("参数错误4");
}
}
else
{
context.Response.Write("卖出单已删除,不可操作!");
}
}
else
{
context.Response.Write("卖出单已匹配过,不可重复操作!");
}
}
else
{
context.Response.Write("参数错误2");
}
}
else
{
context.Response.Write("参数错误");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 后台登录会员系统
//后台登录会员系统
protected void GoToMemberId(HttpContext context)
{
try
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
if (!String.IsNullOrEmpty(context.Request.Form["id"]))
{
int MemberId = Convert.ToInt32(context.Session["MemberId"].ToString());
int ViewID = Convert.ToInt32(context.Request.Form["id"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (MemberId > 0 && IFStores == 1)
{
string MemberJS = "";
if (context.Session["MemberJS"] != null)
{
MemberJS = context.Session["MemberJS"].ToString();
}
if (MemberJS.IndexOf("登录会员后台") != -1)
{
context.Session["GoToMemberId"] = ViewID;
Mtxfw.Model.user_info umodel = daoUser.GetModel(ViewID);
if (umodel != null)
{
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "登录会员后台,会员:" + umodel.UserName;
logmodel.UType = 1;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
}
context.Response.Write("0");
}
else
{
context.Response.Write("权限错误");
}
}
else
{
context.Response.Write("参数错误");
}
}
else
{
context.Response.Write("参数为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
//context.Response.Write(ex.Message);
}
}
#endregion
#region 上传视频
//上传视频
protected void videofile_post(HttpContext context)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
DAL.User_CZ_log daolog = new DAL.User_CZ_log();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
IFStores = 0;
}
}
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
bool b = true;
if (context.Request.Files["videofile"] != null && context.Request["yvideo"] != null)
{
string yvideo = context.Request["yvideo"].ToString();
string strContentType = context.Request.Files["videofile"].ContentType.ToLower();
int intContentLength = context.Request.Files["videofile"].ContentLength;
string strFilePath = "";
string savePathto = "";
string FileName, FileType, Folders;
string ReturnPics = "";
Folders = "/Files/grimage/" + context.Session["MemberId"].ToString() + "/";
if (b)
{
if (strContentType.IndexOf("mp4") != -1)
{
if (intContentLength <= 1002400 * 30)
{
//创建保存位置
if (!Directory.Exists(context.Server.MapPath(Folders)))
{
Directory.CreateDirectory(context.Server.MapPath(Folders));
}
FileName = DateTime.Now.ToString("yyyyMMddHHmmss");
FileType = context.Request.Files["videofile"].FileName.Substring(context.Request.Files["videofile"].FileName.LastIndexOf(".")).ToLower();
strFilePath = Folders + FileName + FileType;
context.Request.Files["videofile"].SaveAs(context.Server.MapPath(strFilePath));
if (!Mtxfw.Utility.Common.IsAllowedExtension(context.Server.MapPath(strFilePath)))
{
try
{
File.Delete(context.Server.MapPath(strFilePath));
}
catch
{
}
b = false;
context.Response.Write("上传文件错误!");
}
}
else
{
b = false;
context.Response.Write("上传不能大于30M!");
}
}
else
{
b = false;
context.Response.Write("只能上传.mp4格式文件!");
}
}
if (b)
{
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "上传视频:" + strFilePath;
logmodel.UType = 1;
logmodel.gtype = gtype;
daolog.Add(logmodel);
context.Response.Write("ReturnPics=" + strFilePath + "|" + ReturnPics);
}
}
else
{
context.Response.Write("参数为空!");
}
}
else
{
context.Response.Write("参数错误2!");
}
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("您未登录!");
}
}
///
/// 使用ffMpeg.exe截取视频图片(第一帧)
/// *需在Web.config的appSettings节点中配置ffmpeg.exe的路径*
/// **
///
/// 视频路径
/// 保存的图片宽度
/// 保存的图片高度
/// 保存后的图片路径(去除基路径)
public string CatchImg(HttpContext cxt, string vedioPath, int saveImgWidth, int saveImgHeight, string Folders)
{
string ffmpeg = cxt.Server.MapPath(ConfigurationManager.AppSettings["ffmpeg"]);
if ((!System.IO.File.Exists(vedioPath)))
{
return "";
}
string saveImgSize = string.Format("{0}x{1}", saveImgWidth, saveImgHeight);
ProcessStartInfo startInfo = new ProcessStartInfo(ffmpeg);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
string saveImgPath = cxt.Server.MapPath(Folders + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg");
startInfo.Arguments = string.Format(" -i \"{0}\" -y -f image2 -ss 3 -s \"{1}\" \"{2}\"", vedioPath, saveImgSize, saveImgPath);
System.Diagnostics.Process.Start(startInfo);
saveImgPath = "/" + saveImgPath.Replace(AppDomain.CurrentDomain.BaseDirectory, "").Replace("\\", "/");
return saveImgPath;
}
///
/// 使用ffMpeg.exe读取宽和高
/// *需在Web.config的appSettings节点中配置ffmpeg.exe的路径*
/// **
///
/// 原视频路径
/// 保存后的图片路径(去除基路径)
///
/// 获取视频的帧宽度和帧高度
///
/// mov文件的路径
/// null表示获取宽度或高度失败
public void GetWidtAndHeight(HttpContext cxt, string vedioPath)
{
string ffmpeg = cxt.Server.MapPath(ConfigurationManager.AppSettings["ffmpeg"]);
ProcessStartInfo startInfo = new ProcessStartInfo(ffmpeg);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.Arguments = string.Format(" -i \"{0}\" -ab 56 -ar 22050 -b 500 -r 15 -s", vedioPath);
System.Diagnostics.Process.Start(startInfo);
}
///
/// 使用ffMpeg.exe转换成.flv
/// *需在Web.config的appSettings节点中配置ffmpeg.exe的路径*
/// **
///
/// 原视频路径
/// 保存视频路径
/// 保存的视频宽度
/// 保存的视频高度
/// 保存后的图片路径(去除基路径)
public void ConvertVideo(HttpContext cxt, string vedioPath, string vedioPathto, int saveWidth, int saveHeight)
{
string ffmpeg = cxt.Server.MapPath(ConfigurationManager.AppSettings["ffmpeg"]);
string saveSize = string.Format("{0}x{1}", saveWidth, saveHeight);
ProcessStartInfo startInfo = new ProcessStartInfo(ffmpeg);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.Arguments = string.Format(" -i \"{0}\" -ab 56 -ar 22050 -b 500 -r 15 -s \"{1}\" \"{2}\"", vedioPath, saveSize, vedioPathto);
System.Diagnostics.Process.Start(startInfo);
}
#endregion
#region 增加视频
//增加视频
protected void addvideo(HttpContext context)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
DAL.User_CZ_log daolog = new DAL.User_CZ_log();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (IFStores == 1)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
bool b = true;
if (!String.IsNullOrEmpty(context.Request["video"])&& !String.IsNullOrEmpty(context.Request["file_id"]))
{
string video = HttpUtility.UrlDecode(context.Request["video"].ToString());
string file_id = HttpUtility.UrlDecode(context.Request["file_id"].ToString());
if (b)
{
// 必要步骤:
// 实例化一个认证对象,入参需要传入腾讯云账户密钥对 SecretId,SecretKey。
// 本示例采用从环境变量读取的方式,则需要在环境变量中先设置这两个值。
// 您也可以直接将密钥对写入代码中,但是注意不要复制、上传或分享代码,以免泄露密钥对危及您的财产安全。
Credential cred = new Credential
{
SecretId = cconfig.AccessKeyId,
SecretKey = cconfig.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);
DescribeMediaInfosRequest req = new DescribeMediaInfosRequest();
req.FileIds = new string[1];
req.FileIds[0] = file_id;
req.Filters = new string[2];
req.Filters[0] = "basicInfo";
req.Filters[1] = "metaData";
DescribeMediaInfosResponse res = client.DescribeMediaInfosSync(req);
// 输出 JSON 格式的字符串回包
Mtxfw.Utility.Common.WriteHtml("/weixin/DescribeMediaInfos1.txt", AbstractModel.ToJsonString(res) + "|" + res.RequestId);
Int64 duration = 0;
UInt64 file_size = 0;
Int64 width = 0, height = 0;
try
{
duration = Convert.ToInt64(res.MediaInfoSet[0].MetaData.Duration.ToString().Split('.')[0]);
file_size = Convert.ToUInt64(res.MediaInfoSet[0].MetaData.Size);
if (res.MediaInfoSet[0].MetaData.Width != null)
{
width = Convert.ToInt64(res.MediaInfoSet[0].MetaData.Width);
}
if (res.MediaInfoSet[0].MetaData.Height != null)
{
height = Convert.ToInt64(res.MediaInfoSet[0].MetaData.Height);
}
}
catch
{
}
DAL.user_livefile daofile = new DAL.user_livefile();
Mtxfw.Model.user_livefile fmodel = new Model.user_livefile();
fmodel.MemberId = 0;
fmodel.liveid = 0;
fmodel.stream_id = "";
fmodel.channel_id = "";
fmodel.file_id = file_id;
fmodel.file_format = "mp4";
fmodel.start_time = 0;
fmodel.end_time = 0;
fmodel.duration = duration;
fmodel.width = width;
fmodel.height = height;
fmodel.file_size = file_size;
fmodel.stream_param = "";
fmodel.video_url = video;
fmodel.seef = 0;
fmodel.LinkID = 0;
fmodel.ttype = 1;
fmodel.addtime = DateTime.Now;
fmodel.gtype = gtype;
daofile.Add(fmodel);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "上传视频:" + file_id;
logmodel.UType = 1;
logmodel.gtype = gtype;
daolog.Add(logmodel);
context.Response.Write("0");
}
}
else
{
context.Response.Write("参数为空!");
}
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("权限不足!");
}
}
else
{
context.Response.Write("您未登录!");
}
}
#endregion
#region 删除视频
//删除视频
protected void delvideo(HttpContext context)
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
DAL.User_CZ_log daolog = new DAL.User_CZ_log();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
IFStores = 0;
}
}
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
bool b = true;
if (!String.IsNullOrEmpty(context.Request["file_id"]))
{
string file_id = context.Request["file_id"].ToString();
if (b)
{
try
{
// 必要步骤:
// 实例化一个认证对象,入参需要传入腾讯云账户密钥对 SecretId,SecretKey。
// 本示例采用从环境变量读取的方式,则需要在环境变量中先设置这两个值。
// 您也可以直接将密钥对写入代码中,但是注意不要复制、上传或分享代码,以免泄露密钥对危及您的财产安全。
Credential cred = new Credential
{
SecretId = cconfig.AccessKeyId,
SecretKey = cconfig.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/ajaxTencentCloudDelete.txt", AbstractModel.ToJsonString(res) + "|" + res.RequestId);
}
catch
{
}
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = MemberId;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "删除视频ID:" + file_id;
logmodel.UType = 1;
logmodel.gtype = gtype;
daolog.Add(logmodel);
context.Response.Write("0");
}
}
else
{
context.Response.Write("参数为空!");
}
}
else
{
context.Response.Write("参数错误2!");
}
}
else
{
context.Response.Write("参数错误!");
}
}
else
{
context.Response.Write("您未登录!");
}
}
#endregion
#region //获取聊天信息-----------------------------------------------------------------------------------------
protected void getinfos(HttpContext context)
{
bool b = true;
int t = 0;
string data = "{'success':false}";
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
if (MemberId > 0)
{
if (!String.IsNullOrEmpty(context.Request["t"]) && !String.IsNullOrEmpty(context.Request["senderid"]) && !String.IsNullOrEmpty(context.Request["receiverid"]))
{
t = int.Parse(context.Request["t"].ToString());
int senderid = int.Parse(context.Request["senderid"].ToString());
int receiverid = int.Parse(context.Request["receiverid"].ToString());
if (b)
{
try
{
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
DAL.Article daoArticle = new DAL.Article();
string groupby = "";
string strOrder = "addtime desc";
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("gtype=" + gtype + " and ParentID=21 and wtype=" + t);
sb.Append(" And ((senderid=" + senderid + " And receiverid=" + receiverid + ") Or (senderid=" + receiverid + " And receiverid=" + senderid + "))");
String SJ = context.Request["startsj"];
if (!String.IsNullOrEmpty(SJ))
{
sb.Append("and addtime 0)
{
System.Text.StringBuilder sb2 = new System.Text.StringBuilder();
StringWriter sw = new StringWriter(sb2);
using (JsonWriter jw = new JsonTextWriter(sw))
{
jw.WriteStartObject();
jw.WritePropertyName("success");
jw.WriteValue(true);
jw.WritePropertyName("total");//所有记录总数
jw.WriteValue(ds.Tables[1].Rows.Count);
jw.WritePropertyName("items");
jw.WriteStartArray();
foreach (System.Data.DataRow Dr in ds.Tables[1].Rows)
{
int id = Convert.ToInt32(Dr["id"]);
int CategoryId = Convert.ToInt32(Dr["CategoryId"]);
int userid = Convert.ToInt32(Dr["senderid"]);
int hasRead = Convert.ToInt32(Dr["hasRead"]);
string content = Dr["content"].ToString();
string addtime = Dr["addtime"].ToString();
string realname = Dr["realname"].ToString();
string realname2 = Dr["realname2"].ToString();
string UserPic = Dr["UserPic"].ToString();
string UserPic2 = Dr["UserPic2"].ToString();
if (CategoryId == 0)
{
Mtxfw.Utility.emojiconsConfig econfig = new Mtxfw.Utility.emojiconsConfig();
string pattern2 = @"\[(.*?)\]";
Regex R2 = new Regex(pattern2);
Match M2 = R2.Match(content);
while (M2.Success)
{
string group = M2.Groups[1].ToString();
string gdata = econfig.getData("[" + group + "]");
if (group != "" && gdata != "")
{
content = content.Replace("[" + group + "]", "
");
}
M2 = M2.NextMatch();
}
}
if (CategoryId == 2)
{
if (content.IndexOf(".gif") == -1)
{
content = "
";
}
else
{
content = "
";
}
}
jw.WriteStartObject();
jw.WritePropertyName("id");
jw.WriteValue(id);
jw.WritePropertyName("CategoryId");
jw.WriteValue(CategoryId);
jw.WritePropertyName("userid");
jw.WriteValue(userid);
jw.WritePropertyName("ncname");
jw.WriteValue(senderid == userid ? (userid == 0 ? "客服" : realname) : (userid == 0 ? "客服" : realname2));
jw.WritePropertyName("avatar");
jw.WriteValue(senderid == userid ? (userid == 0 ? "/images/myico10.png" : (UserPic == "" ? "/images/logo.png" : UserPic)) : (userid == 0 ? "/images/myico10.png" : (UserPic2 == "" ? "/images/logo.png" : UserPic2)));
jw.WritePropertyName("content");
jw.WriteValue((CategoryId == 0) ? content.Replace("\n","").Replace("\r", "") : content);//
jw.WritePropertyName("addtime");
jw.WriteValue(addtime);
jw.WriteEndObject();
}
jw.WriteEndArray();
jw.WriteEndObject();
}
data = sw.ToString();
}
else
{
data = "{'success':false,'msg':'找不到数据'}";
}
ds.Clear();
}
catch (Exception ex)
{
Model.User_Errlog mo = new Model.User_Errlog();
mo.DLID = 0;
mo.ErrType = "获取车险信息";
mo.addtime = DateTime.Now;
mo.ErrBody = ex.ToString();
mo.ErrBody2 = ex.Message;
new DAL.User_Errlog().Add(mo);
data = "{'success':false,'msg':'发生错误'}";
}
}
}
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region 上传聊天信息
///
/// 上传聊天信息
///
protected void addinfoto(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (!String.IsNullOrEmpty(context.Request["addbody"]) || context.Request.Files["Photo"] != null)
{
string body = HttpUtility.UrlDecode(context.Request["addbody"].ToString());
int receiverid = 0;
bool b = true;
if (!String.IsNullOrEmpty(context.Request["receiverid"]))
{
receiverid = Convert.ToInt32(context.Request["receiverid"]);
}
else
{
b = false;
context.Response.Write("接收者ID错误");
}
string strFilePath = "";
if (b)
{
if (context.Request.Files["Photo"] != null)
{
string strContentType = context.Request.Files["Photo"].ContentType.ToLower();
int intContentLength = context.Request.Files["Photo"].ContentLength;
if (intContentLength > 0)
{
if (strContentType.IndexOf("jpg") != -1 || strContentType.IndexOf("jpeg") != -1 || strContentType.IndexOf("gif") != -1 || strContentType.IndexOf("png") != -1 || strContentType.IndexOf("bmp") != -1)
{
if (intContentLength <= 102400 * 30)
{
string FileName, FileType, Folders;
Folders = cconfig.webUpPath;
Folders = "/Files/grimage/" + context.Session["MemberId"].ToString() + "/";
//创建保存位置
if (!Directory.Exists(context.Server.MapPath(Folders)))
{
Directory.CreateDirectory(context.Server.MapPath(Folders));
}
FileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Millisecond.ToString();
FileType = context.Request.Files["Photo"].FileName.Substring(context.Request.Files["Photo"].FileName.LastIndexOf(".")).ToLower();
strFilePath = Folders + FileName + FileType;
context.Request.Files["Photo"].SaveAs(context.Server.MapPath(strFilePath));
if (!Mtxfw.Utility.Common.IsAllowedExtension(context.Server.MapPath(strFilePath)))
{
File.Delete(context.Server.MapPath(strFilePath));
b = false;
context.Response.Write("上传图片有问题");
}
}
else
{
b = false;
context.Response.Write("上传图片太大");
}
}
else
{
b = false;
context.Response.Write("只能上传图片");
}
}
}
}
if (b)
{
if (body != "")
{
Mtxfw.Model.Article Amodel = new Mtxfw.Model.Article();
Amodel.senderid = 0;
Amodel.receiverid = receiverid;
Amodel.Title = "客服消息";
Amodel.ParentID = 21;
Amodel.CategoryId = "0";//t=0 文本信息 1语音信息 2图片信息 3视频信息 4位置
Amodel.AddTime = DateTime.Now;
Amodel.Author = "";
Amodel.Content = body;
Amodel.Paths = "";
Amodel.Content2 = "";
Amodel.Paths2 = "";
Amodel.KeyWords = "";
Amodel.media_id = "";
Amodel.thumb_media_id = "";
Amodel.wtype = 0;//ttype=0 客服信息 1私聊信息 2群聊信息
Amodel.wtype2 = 0;//语音或视频多少秒
Amodel.LinkID = 0;
Amodel.Seef = 0;
Amodel.gtype = gtype;
int artid = new DAL.Article().Add(Amodel);
}
if (strFilePath != "")
{
Mtxfw.Model.Article Amodel = new Mtxfw.Model.Article();
Amodel.senderid = 0;
Amodel.receiverid = receiverid;
Amodel.Title = "客服消息";
Amodel.ParentID = 21;
Amodel.CategoryId = "2";//t=0 文本信息 1语音信息 2图片信息 3视频信息 4位置
Amodel.AddTime = DateTime.Now;
Amodel.Author = "";
Amodel.Content = strFilePath;
Amodel.Paths = "";
Amodel.Content2 = "";
Amodel.Paths2 = "";
Amodel.KeyWords = "";
Amodel.media_id = "";
Amodel.thumb_media_id = "";
Amodel.wtype = 0;//ttype=0 客服信息 1私聊信息 2群聊信息
Amodel.wtype2 = 0;//语音或视频多少秒
Amodel.LinkID = 0;
Amodel.Seef = 0;
Amodel.gtype = gtype;
int artid = new DAL.Article().Add(Amodel);
}
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
model.senderid = 0;
model.receiverid = receiverid;
model.Title = "客服消息";
model.ParentID = 30;
model.CategoryId = "0";
model.AddTime = DateTime.Now;
model.Author = "../image/kfserver.png";
model.Content = "您有新的客服消息";
model.Paths = "kf.html";
model.Content2 = "";
model.Paths2 = "";
model.KeyWords = "";
model.media_id = "";
model.thumb_media_id = "";
model.wtype = 9;
model.wtype2 = 0;
model.LinkID = 0;
model.Seef = 0;
model.gtype = gtype;
string dataid = new DAL.Article().Add(model).ToString();
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(receiverid);
if (umodel != null)
{
if (umodel.registrationId != "")
{
List RegistrationIDList = new List();
RegistrationIDList.Add(umodel.registrationId);
string title = model.Title;
string strMsg = model.Content;
bool is_production = true;
string strLog = "";
new Jiguang.JPush.JPushV3().SendPushV2(RegistrationIDList, title, dataid, strMsg, is_production, out strLog);
}
}
context.Response.Write("0");
}
}
else
{
context.Response.Write("内容或图片不能为空");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region 删除聊天信息
///
/// 删除聊天信息
///
protected void delcxinfo(HttpContext context)
{
try
{
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
if (!String.IsNullOrEmpty(context.Request["delids"]))
{
string delids = HttpUtility.UrlDecode(context.Request["delids"].ToString());
string[] adelids = delids.Split(',');
foreach (string str in adelids)
{
if (str != "")
{
Mtxfw.Model.Article Amodel = new DAL.Article().GetModel(Convert.ToInt32(str));
if (Amodel != null)
{
new DAL.Article().Delete(Amodel.id);
}
}
}
context.Response.Write("0");
}
else
{
context.Response.Write("内容不能为空");
}
}
else
{
context.Response.Write("权限不足");
}
}
else
{
context.Response.Write("您未登录");
}
}
catch (Exception ex)
{
Mtxfw.Utility.Common.WriteHtml("/weixin/weixin.txt", ex.ToString());
//context.Response.Write(ex.Message);
}
}
#endregion
#region //获取直播聊天列表-----------------------------------------------------------------------------------------
///
/// 获取直播聊天列表
///
protected void getlive_chat(HttpContext context)
{
string data = "{\"status\":0}";
int liveid = 0;
if (!String.IsNullOrEmpty(context.Request["liveid"]))
{
liveid = Convert.ToInt32(context.Request["liveid"].ToString());
}
DAL.Article daoArt = new DAL.Article();
DAL.user_live daolive = new DAL.user_live();
bool b = true;
if (b)
{
Mtxfw.Model.user_live lmodel = daolive.GetModel(liveid);
if (lmodel != null)
{
string strdata = "";
string strsql = "gtype=" + gtype + " and ParentID=21 And categoryid='" + liveid + "'";
if (!String.IsNullOrEmpty(context.Request["endtime"]))
{
DateTime endtime = Convert.ToDateTime(context.Request["endtime"].ToString());
strsql += " And addtime>convert(DateTime,'" + endtime + "')";
}
else
{
if (!String.IsNullOrEmpty(context.Request["onlineid"]))
{
int onlineid = Convert.ToInt32(context.Request["onlineid"]);
string strzd = new DAL.user_live_online().Getzd("addtime", "gtype=" + gtype + " and liveid=" + liveid + " and MemberId=" + onlineid).ToString();
if (strzd != "")
{
strsql += " And addtime>convert(DateTime,'" + strzd + "')";
}
}
else
{
string strzd = new DAL.user_live().Getzd("StartTime", "id=" + liveid + "").ToString();
if (strzd != "")
{
strsql += " And addtime>convert(DateTime,'" + strzd + "')";
}
}
}
string groupby = "";
string strOrder = "addtime desc";
int Start = 0;
int Limit = 5;
if (!String.IsNullOrEmpty(context.Request["Start"]))
{
Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString()));
}
Int32 Recount = 0;
DataSet ds = daoArt.GetDataSet(groupby, strOrder, "id,addtime,content,senderid,(Select NCName From user_info b Where b.id=senderid) as NCName,(Select UserPic From user_info b Where b.id=senderid) as img", "", strsql + "", Start, Limit, out Recount);
int dtcount = Recount;
if (ds.Tables[1].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[1].Rows)
{
int aid = Convert.ToInt32(Dr["id"]);
int uid = Convert.ToInt32(Dr["senderid"]);
string aaddtime = Dr["addtime"].ToString();
string acontent = Dr["content"].ToString();
string ncname = Dr["NCName"].ToString();
string aimg = Dr["img"].ToString();
if (aimg != "")
{
aimg = Mtxfw.Utility.Common.GetCoverPic(aimg.Split('|')[0], "40x40", "cut");
}
Mtxfw.Utility.emojiconsConfig econfig = new Mtxfw.Utility.emojiconsConfig();
string pattern2 = @"\[(.*?)\]";
Regex R2 = new Regex(pattern2);
Match M2 = R2.Match(acontent);
while (M2.Success)
{
string group = M2.Groups[1].ToString();
string gdata = econfig.getData("[" + group + "]");
if (group != "" && gdata != "")
{
acontent = acontent.Replace("[" + group + "]", "
");
}
M2 = M2.NextMatch();
}
strdata += "{\"id\":\"" + aid + "\",\"userid\":\"" + uid + "\",\"addtime\":\"" + aaddtime + "\",\"content\":\"" + Mtxfw.Utility.Common.ReplaceString(acontent) + "\",\"ncname\":\"" + ncname + "\",\"avatar\":\"" + aimg + "\"";
strdata += "}";
if (i != ds.Tables[1].Rows.Count - 1)
{
strdata += ",";
}
i += 1;
}
}
ds.Clear();
string strdata1 = "";
ds = new DAL.P_Product().GetList1("P_ID,P_NAME,P_images", "gtype=" + gtype + " And P_State=N'已处理' And IFDelete=0 And P_ID in(" + lmodel.productids + ") And (Select count(c.G_ID) From P_Guige c where c.G_PID=P_ID And c.G_KC>0)>0");
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
string id = Dr["P_ID"].ToString();
string name = Dr["P_NAME"].ToString();
string pic = Dr["P_images"].ToString();
if (pic != "")
{
pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "220x220", "cut");
}
string P_VIP_P = "";
string strzd = new Mtxfw.DAL.P_Guige().Getzd("min(G_JG2)", "ttype=0 And G_PID=" + id + "").ToString();
if (strzd != "")
{
P_VIP_P = Convert.ToDouble(strzd).ToString("f2");
}
strdata1 += "{\"id\":\"" + id + "\",\"name\":\"" + name + "\",\"hyje\":\"" + P_VIP_P + "\",\"image\":\"" + pic + "\"}";
if (i != ds.Tables[0].Rows.Count - 1)
{
strdata1 += ",";
}
i += 1;
}
}
ds.Clear();
string strdata2 = "";
int onlinecount = new DAL.user_live_online().GetCount("gtype=" + gtype + " and liveid=" + liveid + " and isonline=0 And addtime>convert(datetime,'" + lmodel.StartTime + "')");
ds = new DAL.user_live_online().GetList1("top 20 id,MemberId,(Select NCName From user_info b Where b.Id=a.MemberId) as NCName,(Select UserPic From user_info b Where b.Id=a.MemberId) as UserPic", "gtype=" + gtype + " and liveid=" + liveid + " and isonline=0 And addtime>convert(datetime,'" + lmodel.StartTime + "')");
if (ds.Tables[0].Rows.Count > 0)
{
int i = 0;
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
string id = Dr["id"].ToString();
string MemberId = Dr["MemberId"].ToString();
string name = Dr["NCName"].ToString();
string pic = Dr["UserPic"].ToString();
if (pic != "")
{
pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "40x40", "cut");
}
strdata2 += "{\"id\":\"" + id + "\",\"MemberId\":\"" + MemberId + "\",\"name\":\"" + name + "\",\"pic\":\"" + pic + "\"}";
if (i != ds.Tables[0].Rows.Count - 1)
{
strdata2 += ",";
}
i += 1;
}
}
ds.Clear();
data = "{\"status\":1,\"data\":[" + strdata + "],\"data1\":[" + strdata1 + "],\"data2\":[" + strdata2 + "],\"onlinecount\":\"" + onlinecount + "\",\"seef\":\"" + lmodel.seef + "\"}";
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //退出直播间-----------------------------------------------------------------------------------------
///
/// 退出直播间
///
protected void logoutliveplay(HttpContext context)
{
string data = "{\"status\":0}";
bool b = true;
Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
if (!String.IsNullOrEmpty(context.Request["liveid"]) && !String.IsNullOrEmpty(context.Request["rid"]))
{
int id = Convert.ToInt32(context.Request["liveid"].ToString());
int rid = Convert.ToInt32(context.Request["rid"].ToString());
int MemberId = 0;
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
}
string ncname = "";
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
if (umodel != null)
{
if (umodel.NCName != "")
{
ncname = umodel.NCName;
}
else
{
ncname = umodel.RealName;
}
}
}
DAL.user_live daolive = new DAL.user_live();
if (b)
{
Mtxfw.Model.user_live_online onmodel = new DAL.user_live_online().GetModel(rid);
if (onmodel != null)
{
if (onmodel.liveid == id)
{
DateTime dt = DateTime.Now;
if (MemberId > 0)
{
new DAL.user_live_online().Update(1, dt, gtype, id, MemberId);
}
else
{
string IP = "";
new DAL.user_live_online().Update(1, dt, gtype, id, IP, dt);
}
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
model.senderid = 0;
model.receiverid = 0;
model.Title = "直播信息";
model.ParentID = 21;
model.CategoryId = id.ToString();
model.AddTime = dt;
model.Author = "";
model.Content = MemberId > 0 ? ncname + " 退出直播间" : "来自" + onmodel.dz + "的朋友 退出直播间";
model.Paths = "";
model.Content2 = "";
model.Paths2 = "";
model.KeyWords = "";
model.media_id = "";
model.thumb_media_id = "";
model.wtype = 0;
model.wtype2 = 0;
model.LinkID = 0;
model.Seef = 0;
model.gtype = gtype;
new DAL.Article().Add(model);
data = "{\"status\":0,\"msg\":\"已退出直播间!\"}";
}
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"找不到ID!\"}";
}
}
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //修改昵称-----------------------------------------------------------------------------------------
///
/// 修改昵称
///
protected void editNCName(HttpContext context)
{
string data = "{\"status\":0}";
bool b = true;
int MemberId = 0;
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
string NCName = HttpUtility.UrlDecode(context.Request["NCName"].ToString());
DAL.user_info daoUser = new DAL.user_info();
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
if (b)
{
daoUser.UpdatePassword("NCName", NCName, umodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = umodel.Id;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "修改了昵称";
logmodel.UType = 3;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
data = "{\"status\":1,\"msg\":\"修改成功!\"}";
}
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //获取在线人数数据-----------------------------------------------------------------------------------------
///
/// 获取在线人数数据
///
protected void getlive_onlinelist(HttpContext context)
{
string data = "{\"status\":0}";
int MemberId = 0;
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (!String.IsNullOrEmpty(context.Request["liveid"]))
{
int liveid = Convert.ToInt32(context.Request["liveid"].ToString());
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (model != null)
{
string strsql = " And liveid=" + liveid;
string strdata = "";
strdata += "\"data\":[";
string groupby = "";
string strOrder = "addtime Desc";
int Start = 0;
int Limit = 10;
if (!String.IsNullOrEmpty(context.Request["Start"]))
{
Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString()));
}
Int32 Recount = 0;
DataSet ds = new Mtxfw.DAL.user_live_online().GetDataSet(groupby, strOrder, "MemberId,(Select NCName From user_info b Where b.id=MemberId) as NCName,(Select UserPic From user_info b Where b.id=MemberId) as img", "", "gtype=" + gtype + " and isonline=1" + strsql + "", Start, Limit, out Recount);
if (ds.Tables[1].Rows.Count > 0)
{
int j = 0;
foreach (System.Data.DataRow drv2 in ds.Tables[1].Rows)
{
string uid = drv2["MemberId"].ToString();
string ncname = drv2["NCName"].ToString();
string aimg = drv2["img"].ToString();
if (aimg != "")
{
aimg = Mtxfw.Utility.Common.GetCoverPic(aimg.Split('|')[0], "40x40", "cut");
}
strdata += "{\"id\":\"" + uid + "\",\"name\":\"" + ncname + "\",\"image\":\"" + aimg + "\"}";
strdata += ",";
j += 1;
}
if (strdata.Substring(strdata.Length - 1, 1) == ",")
{
strdata = strdata.Substring(0, strdata.Length - 1);
}
}
ds.Clear();
strdata += "]";
data = "{\"status\":1," + strdata + "}";
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数不能为空!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"登录参数错误!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //直播聊天-----------------------------------------------------------------------------------------
///
/// 直播聊天
///
protected void live_chat(HttpContext context)
{
string data = "{\"status\":0}";
bool b = true;
int MemberId = 0;
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
DAL.Article daoArt = new DAL.Article();
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
if (!String.IsNullOrEmpty(context.Request["liveid"]) && !String.IsNullOrEmpty(context.Request["body"]))
{
int liveid = Convert.ToInt32(context.Request["liveid"].ToString());
string body = HttpUtility.UrlDecode(context.Request["body"].ToString());
if (b)
{
if (umodel.NCName == "")
{
b = false;
data = "{\"status\":0,\"msg\":\"您还没有设置昵称!\"}";
}
}
if (b)
{
Mtxfw.Model.user_live lmodel = new Mtxfw.DAL.user_live().GetModel(liveid);
if (lmodel != null)
{
DateTime dt = DateTime.Now;
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
model.senderid = umodel.Id;
model.receiverid = lmodel.MemberId;
model.Title = "直播聊天";
model.ParentID = 21;
model.CategoryId = lmodel.Id.ToString();
model.AddTime = dt;
model.Author = "";
model.Content = body;
model.Paths = "";
model.Content2 = "";
model.Paths2 = "";
model.KeyWords = "";
model.media_id = "";
model.thumb_media_id = "";
model.wtype = 0;
model.wtype2 = 0;
model.LinkID = 0;
model.Seef = 0;
model.gtype = gtype;
daoArt.Add(model);
new Mtxfw.DAL.user_live().addSel("lzhd", 1, lmodel.Id);
data = "{\"status\":1,\"msg\":\"保存成功\"}";
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数为空\"}";
}
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //购买直播礼物-----------------------------------------------------------------------------------------
///
/// 购买直播礼物
///
protected void purchaselivegift(HttpContext context)
{
string data = "{\"status\":0}";
bool b = true;
int MemberId = 0;
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
DAL.Article daoArt = new DAL.Article();
DAL.user_Results daoResults = new DAL.user_Results();
Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
if (!String.IsNullOrEmpty(context.Request["liveid"]) && !String.IsNullOrEmpty(context.Request["id"]) && !String.IsNullOrEmpty(context.Request["paytype"]))
{
int liveid = Convert.ToInt32(context.Request["liveid"].ToString());
int id = Convert.ToInt32(context.Request["id"].ToString());
int paytype = Convert.ToInt32(context.Request["paytype"].ToString());
if (b)
{
if (umodel.NCName == "")
{
b = false;
data = "{\"status\":0,\"msg\":\"您还没有设置昵称!\"}";
}
}
if (b)
{
Mtxfw.Model.user_Goods gmodel = new Mtxfw.DAL.user_Goods().GetModel(id);
if (gmodel != null)
{
int utype = 1;
Double cutumoney = Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("f2"));
string selumoney = "umoney17";
Double prices = Convert.ToDouble((gmodel.GoodsPrices).ToString("f2"));
if (paytype == 2)
{
utype = 3;
cutumoney = Convert.ToDouble((umodel.umoney30).ToString("f2"));
selumoney = "umoney30";
prices = Convert.ToDouble((gmodel.GoodsPrices * 1000).ToString("f2"));
if (prices > cutumoney)
{
b = false;
data = "{\"status\":0,\"msg\":\"金豆余额不足!\"}";
}
}
else if (paytype == 1)
{
if (prices > cutumoney)
{
b = false;
data = "{\"status\":0,\"msg\":\"奖金余额不足!\"}";
}
}
if (b)
{
Mtxfw.Model.user_live lmodel = new Mtxfw.DAL.user_live().GetModel(liveid);
if (lmodel != null)
{
Mtxfw.Model.user_info umodel2 = new Mtxfw.DAL.user_info().GetModel(lmodel.MemberId);
if (umodel2 != null)
{
if (paytype == 1 || paytype == 2)
{
DateTime dt = DateTime.Now;
Mtxfw.Model.Article model = new Mtxfw.Model.Article();
model.senderid = umodel.Id;
model.receiverid = lmodel.MemberId;
model.Title = "直播礼物";
model.ParentID = 21;
model.CategoryId = lmodel.Id.ToString();
model.AddTime = dt;
model.Author = "";
model.Content = "赠送礼物:
";
model.Paths = "";
model.Content2 = "";
model.Paths2 = "";
model.KeyWords = "";
model.media_id = "";
model.thumb_media_id = "";
model.wtype = 0;
model.wtype2 = 0;
model.LinkID = 0;
model.Seef = 0;
model.gtype = gtype;
daoArt.Add(model);
Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2();
mjl2.MemberId = umodel.Id;
mjl2.MemberId2 = 0;
mjl2.Addmoney = -prices;
mjl2.Cutmoney = 0;
mjl2.Totalmoney = (cutumoney - prices);
mjl2.addtime = dt;
mjl2.BZContent = "购买直播礼物,总金额:" + prices;
mjl2.PayID = "";
mjl2.OrdersIDs = "";
mjl2.OrdersID = 0;
mjl2.utype = utype;
mjl2.utype2 = 0;
mjl2.Seef = -1;
mjl2.seeftime = dt;
mjl2.gtype = gtype;
new Mtxfw.DAL.user_Results_jl2().Add(mjl2);
//减少买家余额
if (paytype == 2)
{
new Mtxfw.DAL.user_info().UpdateMoney(selumoney, -prices, umodel.Id);
}
else
{
new Mtxfw.DAL.user_info().UpdateMoney(selumoney, prices, umodel.Id);
}
new Mtxfw.DAL.user_live().addSel("lzhd", 1, lmodel.Id);
Model.User_CZ_log logmodel = new Model.User_CZ_log();
logmodel.MemberId = umodel.Id;
logmodel.AddTime = DateTime.Now;
logmodel.IP = Mtxfw.Utility.Common.GetIP;
logmodel.Body = "给" + umodel2.NCName + "赠送了礼物";
logmodel.UType = 3;
logmodel.gtype = gtype;
new DAL.User_CZ_log().Add(logmodel);
data = "{\"status\":1,\"msg\":\"购买成功\"}";
}
else
{
string orderInfo = "";
DateTime dt = DateTime.Now;
string PayID = dt.ToString("yyMMddHHmmssffff", DateTimeFormatInfo.InvariantInfo);
Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results();
ModelResults.b0 = prices;
ModelResults.b1 = gmodel.Id;
ModelResults.b2 = lmodel.Id;
ModelResults.b3 = lmodel.MemberId;
ModelResults.b4 = 0;
ModelResults.b5 = 0;
ModelResults.b6 = 0;
ModelResults.b7 = 0;
ModelResults.b8 = 0;
ModelResults.b9 = 0;
ModelResults.b10 = 0;
ModelResults.b11 = 0;
ModelResults.b12 = 0;
ModelResults.b13 = 0;
ModelResults.b14 = 0;
ModelResults.b15 = 0;
ModelResults.b16 = 0;
ModelResults.b17 = 0;
ModelResults.b18 = 0;
ModelResults.conent = "购买直播礼物";
ModelResults.Totalmoney = prices;
ModelResults.MemberId = umodel.Id;
ModelResults.UserId = 3;
ModelResults.ListNumber = PayID;
ModelResults.Managers = "5";
ModelResults.Seef = 0;
ModelResults.utype = "2";
ModelResults.addtime = dt;
ModelResults.gtype = gtype;
Int64 ResultId = daoResults.Add(ModelResults);
data = "{\"status\":1,\"payurl\":\"/pay/alipay.aspx?PayID="+ ResultId + "\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误\"}";
}
}
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数为空\"}";
}
}
else
{
b = false;
data = "{\"status\":0,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //关注-----------------------------------------------------------------------------------------
///
/// 关注
///
protected void guangzhu(HttpContext context)
{
string data = "{\"status\":0}";
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (!String.IsNullOrEmpty(context.Request["uid"]))
{
int uid = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["uid"].ToString()));
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (model != null)
{
if (model.Id != uid)
{
int acount = new DAL.user_favorite().GetCount("gtype=" + gtype + " and ttype=3 and ProductID=" + uid + " and MemberId=" + model.Id);
if (acount == 0)
{
Mtxfw.Model.user_info model2 = new Mtxfw.DAL.user_info().GetModel(uid);
if (model2 != null)
{
Model.user_favorite fmodel = new Model.user_favorite();
fmodel.ProductID = uid;
fmodel.MemberId = model.Id;
fmodel.ttype = 3;
fmodel.gtype = gtype;
new DAL.user_favorite().Add(fmodel);
data = "{\"status\":1,\"msg\":\"关注成功!\"}";
}
}
else
{
new DAL.user_favorite().Delete("gtype=" + gtype + " and ttype=3 and ProductID=" + uid + " and MemberId=" + model.Id);
data = "{\"status\":1,\"msg\":\"取消关注成功!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"不能关注自己!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误2!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //点赞直播间-----------------------------------------------------------------------------------------
///
/// 点赞直播间
///
protected void dzlive(HttpContext context)
{
string data = "{\"status\":0}";
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (!String.IsNullOrEmpty(context.Request["liveid"]))
{
int liveid = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["liveid"].ToString()));
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (model != null)
{
int acount = new DAL.user_favorite().GetCount("gtype=" + gtype + " and ttype=2 and ProductID=" + liveid + " and MemberId=" + model.Id);
if (acount == 0)
{
Model.user_favorite fmodel = new Model.user_favorite();
fmodel.ProductID = liveid;
fmodel.MemberId = model.Id;
fmodel.ttype = 2;
fmodel.gtype = gtype;
new DAL.user_favorite().Add(fmodel);
int dzcount = new DAL.user_favorite().GetCount("gtype=" + gtype + " and ttype=2 and ProductID=" + liveid);
data = "{\"status\":1,\"msg\":\"点赞成功!\",\"dzcount\":\"" + dzcount + "\"}";
}
else
{
new DAL.user_favorite().Delete("gtype=" + gtype + " and ttype=2 and ProductID=" + liveid + " and MemberId=" + model.Id);
int dzcount = new DAL.user_favorite().GetCount("gtype=" + gtype + " and ttype=2 and ProductID=" + liveid);
data = "{\"status\":0,\"msg\":\"取消点赞成功!\",\"dzcount\":\"" + dzcount + "\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误2!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //点击产品或分享次数-----------------------------------------------------------------------------------------
///
/// 点击产品或分享次数
///
protected void orderlive(HttpContext context)
{
string data = "{\"status\":0}";
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = Convert.ToInt32(context.Session["MemberId"]);
int IFStores = Convert.ToInt32(context.Session["MemberIFStores"]);
if (IFStores == 1)
{
int GoToMemberId = 0;
if (context.Session["GoToMemberId"] != null)
{
GoToMemberId = int.Parse(context.Session["GoToMemberId"].ToString());
}
if (GoToMemberId > 0)
{
MemberId = GoToMemberId;
}
}
if (MemberId > 0)
{
if (!String.IsNullOrEmpty(context.Request["liveid"]) && !String.IsNullOrEmpty(context.Request["t"]))
{
int liveid = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["liveid"].ToString()));
int t = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["t"].ToString()));
Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(MemberId);
if (model != null)
{
if (t == 1)
{
new Mtxfw.DAL.user_live().addSel("fxcs", 1, liveid);
}
else
{
new Mtxfw.DAL.user_live().addSel("spdj", 1, liveid);
}
data = "{\"status\":1,\"msg\":\"操作成功!\"}";
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误2!\"}";
}
}
else
{
data = "{\"status\":0,\"msg\":\"参数错误!\"}";
}
}
}
else
{
data = "{\"status\":0,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region //检查app版本更新-----------------------------------------------------------------------------------------
///
/// 检查app版本更新
///
protected void CheckAPPVersion(HttpContext context)
{
string data = "{\"status\":0}";
string strdata = "";
DateTime dt = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
int plat = 1, IFupdate = 0, ifvideo = 0;
if (!String.IsNullOrEmpty(context.Request["ifvideo"]))
{
if (System.Text.RegularExpressions.Regex.IsMatch(context.Request["ifvideo"].ToString(), @"^-?\d+$"))
{
ifvideo = Convert.ToInt32(context.Request["ifvideo"].ToString());
}
}
string version = "";
if (!String.IsNullOrEmpty(context.Request["plat"]))
{
if (context.Request["plat"].ToString() != "null")
{
plat = Convert.ToInt32(context.Request["plat"].ToString());
}
}
if (!String.IsNullOrEmpty(context.Request["version"]))
{
version = context.Request["version"].ToString().Trim();
//Mtxfw.Utility.Common.WriteHtml("/weixin/version.txt", version);
}
if (version != "" && version != "0.0.6" && (plat == 0 || plat == 1 || plat == 2) && ifvideo == 0)
{
string[] aversion = cconfig.webQQ.Split(',');
if (aversion.Length == 3)
{
if (aversion[plat] != "" && aversion[plat] != version)
{
IFupdate = 1;
}
}
}
else
{
Mtxfw.Utility.Common.WriteHtml("/weixin/noversion.txt", version + "|" + plat);
}
strdata += ",\"IFupdate\":\"" + IFupdate + "\",\"updatemsg\":\"" + cconfig.webWeiXin + "\",\"appUpdateUrl\":\"" + cconfig.webUpdateBL + "\",\"ReDataMM\":\"" + cconfig.ReDataMM + "\",\"apiurl\":\"" + cconfig.webUrl + "\"";
data = "{\"status\":1" + strdata + "}";
Utility.Common.WriteJson(context, data);
}
#endregion
#region 保存视频路径
//保存视频路径
protected void savefileId(HttpContext context)
{
string data = "{\"success\":false}";
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int MemberId = int.Parse(context.Session["MemberId"].ToString());
if (IFStores == 1)
{
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
bool b = true;
if (!String.IsNullOrEmpty(context.Request.Form["url"]) && !String.IsNullOrEmpty(context.Request.Form["fileId"]))
{
string video = context.Request.Form["url"].ToString();
string fileId = context.Request.Form["fileId"].ToString();
string videofileIds = "";
if (context.Session["videofileIds"] != null)
{
videofileIds = context.Session["videofileIds"].ToString();
}
if (videofileIds == "")
{
videofileIds = fileId + "|" + video;
}
else
{
videofileIds += "," + fileId + "|" + video;
}
context.Session["videofileIds"] = videofileIds;
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.AddDays(360), 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;
}
data = "{\"success\":true,\"video\":\"" + video + "\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"参数为空!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误2!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"success\":false,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region 导出商品数据
//导出商品数据
protected void dcproductdata(HttpContext context)
{
string data = "{\"success\":false}";
Mtxfw.DAL.order_info daoOrder = new Mtxfw.DAL.order_info();
Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
bool b = true;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
String key = HttpUtility.UrlDecode(context.Request["key"]);
String state = HttpUtility.UrlDecode(context.Request["state"]);
int ttype = 0;
if (!String.IsNullOrEmpty(context.Request["ttype"]))
{
ttype = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["ttype"]));
}
int cls = -1;
if (!String.IsNullOrEmpty(context.Request["cls"]))
{
cls = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["cls"]));
}
sb.Append("gtype=" + gtype + "");
if (ttype == -1)
{
sb.Append(" and utype='0' and P_UserID>0");
}
else
{
sb.Append(" and utype='" + ttype + "'");
}
sb.Append(" And IFDelete=0 and P_UserID=0");
if (cls > -1)
{
sb.Append("and (P_CATEGORY=" + cls + " Or P_CATEGORYs like '%," + cls + ",%')");
}
int clstype = ttype;
if (ttype == -1 || ttype == 5)
{
clstype = 0;
}
if (!String.IsNullOrEmpty(state))
{
if (state != "-1")
{
if (state == "已处理" || state == "未处理")
{
sb.Append("and P_State='" + state + "'");
}
if (state == "推荐")
{
sb.Append("and P_COMMENDF=1");
}
if (state == "限时抢购")
{
sb.Append("and P_qgproduct=1");
}
if (state == "热销")
{
sb.Append("and P_ppproduct=1");
}
if (state == "特色优选")
{
sb.Append("and P_jpproduct=1");
}
if (state == "每日上新")
{
sb.Append("and P_cjproduct=1");
}
if (state == "置顶")
{
sb.Append("and P_IFTop=1");
}
}
}
if (!String.IsNullOrEmpty(key))
{
sb.Append("and P_NAME like '%" + key + "%' or P_bianhao like '%" + key + "%'");
}
string strFile = "";
string strOrder = " Order By P_HITED Desc";
DataSet ds = daoProduct.GetList("", sb.ToString() + strOrder);
if (ds.Tables[0].Rows.Count > 0)
{
FileInfo fileinfo = new FileInfo(context.Server.MapPath("/App_Data/productdata.xls"));
if (fileinfo.Exists)
{
strFile = ConfigurationManager.AppSettings["Dw_Data"] + "productdata" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls";
fileinfo.CopyTo(context.Server.MapPath(strFile), true);
string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + context.Server.MapPath(strFile) + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection myconn = new OleDbConnection(ConnStr);
//打开数据库的连接
if (myconn.State == 0)
{
myconn.Open();
}
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
string Id = Dr["P_Id"].ToString();
string CategoryName = daoCategory.GetCategoryName(clstype, Dr["P_CATEGORYs"].ToString());
string P_NAME = Dr["P_NAME"].ToString();
string P_bianhao = Dr["P_bianhao"].ToString();
string P_ADDATE = Dr["P_ADDATE"].ToString();
string P_State = Dr["P_State"].ToString();
string strje = getje(Convert.ToDouble(Dr["P_VIP_P"]), Convert.ToInt32(Dr["P_Inventory"]), Convert.ToInt32(Dr["P_ID"]));
OleDbCommand mycmd = new OleDbCommand("insert into [商品表$]([商品分类],[商品名称],[商品编号],[价格/库存],[添加时间],[状态]) values('" + CategoryName + "','" + P_NAME + "','" + P_bianhao + "','" + strje + "','" + P_ADDATE + "','" + P_State + "')", myconn);
mycmd.CommandType = CommandType.Text;
//执行操作(访问数据库)
mycmd.ExecuteNonQuery();
}
//关闭数据库的连接
myconn.Close();
}
}
ds.Clear();
if (strFile != "")
{
data = "{\"success\":true,\"msg\":\"导出成功!\",\"strFile\":\"" + strFile + "\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"暂无数据可导出!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误2!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"success\":false,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
protected string getje(Double je, int P_Inventory, int id)
{
string strje = "";
DataSet ds = new DAL.P_Guige().GetList("ttype=0 And G_PID=" + id);
if (ds.Tables[0].Rows.Count > 0)
{
strje += "";
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
int G_ID = int.Parse(Dr["G_ID"].ToString());
string G_Name = Dr["G_Name"].ToString();
Double G_JG = Double.Parse(Dr["G_JG"].ToString());
Double G_JF = Double.Parse(Dr["G_JF"].ToString());
int G_KC = int.Parse(Dr["G_KC"].ToString());
strje += G_Name + ":" + G_JG + "元/" + G_KC + " ";
}
strje += "";
}
else
{
strje += je.ToString("f2") + "元/" + P_Inventory;
}
ds.Clear();
return strje;
}
#endregion
#region 导出订单数据
//导出订单数据
protected void dcorderdata(HttpContext context)
{
string data = "{\"success\":false}";
Mtxfw.DAL.order_info daoOrder = new Mtxfw.DAL.order_info();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
bool b = true;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
String key = HttpUtility.UrlDecode(context.Request["key"]);
String state = HttpUtility.UrlDecode(context.Request["state"]);
String stype = HttpUtility.UrlDecode(context.Request["stype"]);
String SJ = HttpUtility.UrlDecode(context.Request["SJ"]);
String SJ2 = HttpUtility.UrlDecode(context.Request["SJ2"]);
sb.Append("IFDelete=0 and (Select Count(id) From User_info b where b.id=UserId)>0");
int t = 1;
if (!String.IsNullOrEmpty(context.Request["t"]))
{
t = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["t"]));
sb.Append(" and ttype0=" + t);
}
int paytype = -1;
if (!String.IsNullOrEmpty(context.Request["paytype"]))
{
paytype = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["paytype"]));
}
int peitype = -1;
if (!String.IsNullOrEmpty(context.Request["peitype"]))
{
peitype = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["peitype"]));
}
if (paytype > -1)
{
sb.Append(" and utype=" + paytype);
}
if (peitype > -1)
{
sb.Append(" and peitype=" + peitype);
}
if (!String.IsNullOrEmpty(state))
{
if (state != "-2")
{
sb.Append(" and O_Payed='" + state + "'");
}
}
if (!String.IsNullOrEmpty(key))
{
if (!String.IsNullOrEmpty(stype))
{
if (stype == "0")
{
sb.Append(" and MemberId in (select id from user_info b where b.IFStores=0 and (b.UserName like '%" + key + "%'))");
}
else if (stype == "1")
{
sb.Append(" and UserID in (select id from user_info b where b.IFStores=0 and (b.UserName like '%" + key + "%'))");
}
else if (stype == "2")
{
sb.Append(" and orderid like '%" + key + "%'");
}
else if (stype == "3")
{
sb.Append(" and Contactname like '%" + key + "%'");
}
else if (stype == "4")
{
sb.Append(" and Contacttel like '%" + key + "%'");
}
else if (stype == "5")
{
sb.Append(" and yundanhao like '%" + key + "%'");
}
}
else
{
if (!System.Text.RegularExpressions.Regex.IsMatch(key, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$"))
{
sb.Append("and (orderid like '%" + key + "%' Or Contactname like '%" + key + "%' Or Contacttel like '%" + key + "%' Or yundanhao like '%" + key + "%' Or UserID in (select id from user_info b where b.IFStores=0 and (b.UserName like '%" + key + "%' or b.realname like '%" + key + "%')))");
}
else
{
sb.Append("and (Contacttel like '%" + key + "%' Or UserID in (select id from user_info b where b.IFStores=0 and (b.UserName like '%" + key + "%')))");
}
}
}
if (!String.IsNullOrEmpty(SJ) && !String.IsNullOrEmpty(SJ2))
{
sb.Append(" and (O_SubmitDate between '" + SJ + " 00:00:00' and '" + SJ2 + " 23:59:59') ");
}
string strFile = "";
string strOrder = " Order By O_SubmitDate asc";
DataSet ds = daoOrder.GetList1("Id,ttype,utype,ptype,peitype,Contactname,Province,City,County,Address,Address0,Contacttel,Guests, refundstatus, refund_channel, user_received_account, success_time,Totalnum,pcount,ypcount,ypznum,Totalprice, O_ReturnReason,(select UserName from user_info c where c.ID=a.UserID) as UserName,(select RealName from user_info c where c.ID=a.UserID) as RealName,O_SubmitDate,orderid,yundanhao,O_Payed,O_Payed_Date,O_Shipped,O_Shipped_Date,O_received,O_received_Date,kdcompay,O_Seef", sb.ToString() + strOrder);
if (ds.Tables[0].Rows.Count > 0)
{
FileInfo fileinfo = new FileInfo(context.Server.MapPath("/App_Data/orderdata.xls"));
if (fileinfo.Exists)
{
strFile = ConfigurationManager.AppSettings["Dw_Data"] + "orderdata" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".xls";
fileinfo.CopyTo(context.Server.MapPath(strFile), true);
string ConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + context.Server.MapPath(strFile) + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection myconn = new OleDbConnection(ConnStr);
//打开数据库的连接
if (myconn.State == 0)
{
myconn.Open();
}
foreach (System.Data.DataRow Dr in ds.Tables[0].Rows)
{
string Id = Dr["Id"].ToString();
string utype = Dr["utype"].ToString();
string ttype0 = Dr["ttype"].ToString();
string strttype = Mtxfw.Utility.Common.GetOrderType(Convert.ToInt32(ttype0));
string zftype = Mtxfw.Utility.Common.GetPayType(Convert.ToInt32(utype));
int ptype = Convert.ToInt32(Dr["ptype"].ToString());
int peitype0 = Convert.ToInt32(Dr["peitype"].ToString());
string Contactname = Dr["Contactname"].ToString().Replace("'", "");
string Address0 = Dr["Address0"].ToString();
string Address = new DAL.province().GetProvince(Dr["Province"].ToString()) + new DAL.city().GetCity(Dr["City"].ToString()) + new DAL.county().GetCounty(Dr["County"].ToString()) + Dr["Address"].ToString();
string Contacttel = Dr["Contacttel"].ToString().Replace("'", "");
string UserName = Dr["UserName"].ToString();
string RealName = Dr["RealName"].ToString().Replace("'", "");
string O_SubmitDate = Dr["O_SubmitDate"].ToString();
string orderid = Dr["orderid"].ToString();
string kdcompay = Dr["kdcompay"].ToString().Replace("'", "");
string yundanhao = Dr["yundanhao"].ToString().Replace("'", "");
string O_Payed = Dr["O_Payed"].ToString();
string O_Payed_Date = Dr["O_Payed_Date"].ToString();
string O_Shipped = Dr["O_Shipped"].ToString();
string O_Shipped_Date = Dr["O_Shipped_Date"].ToString();
string O_received = Dr["O_received"].ToString();
string O_received_Date = Dr["O_received_Date"].ToString();
string Guests = Dr["Guests"].ToString();
int refundstatus = Convert.ToInt32(Dr["refundstatus"].ToString());
string refund_channel = Dr["refund_channel"].ToString();
string user_received_account = Dr["user_received_account"].ToString();
string success_time = Dr["success_time"].ToString();
int O_Seef = Convert.ToInt32(Dr["O_Seef"].ToString());
int Totalnum = Convert.ToInt32(Dr["Totalnum"].ToString());
int zsnum = Convert.ToInt32(Dr["pcount"].ToString());
int thnum = Convert.ToInt32(Dr["ypcount"].ToString());
int tuihuonum = Convert.ToInt32(Dr["ypznum"].ToString());
int dqynum = (Totalnum - zsnum - thnum - tuihuonum);
Double Totalprice = Convert.ToDouble(Convert.ToDouble(Dr["Totalprice"]).ToString("f2"));
string O_ReturnReason = Dr["O_ReturnReason"].ToString();
string[] aStatus = Mtxfw.Utility.Common.GetOrderStatus(ttype0, Id, orderid, ptype, peitype0, O_SubmitDate, O_Payed, O_Payed_Date, O_Shipped, O_Shipped_Date, O_received, O_received_Date, kdcompay, yundanhao, Contacttel, Guests, refundstatus, refund_channel, user_received_account, success_time, O_Seef, Totalprice, O_ReturnReason, 1);
if (ttype0 == "1" && O_received == "1")
{
Address = Address0;
}
string strStatus = aStatus[0];
string strProducts = "";
System.Data.DataSet Ds_op = new Mtxfw.DAL.order_product_info().GetList("(Select P_NAME from P_Product b where b.P_ID=a.pid) as prodName,", "utype='0' And orderid=" + Id + " And IFDelete=0 Order By SubmitTime asc");
if (Ds_op.Tables[0].Rows.Count > 0)
{
for (int l = 0; l < Ds_op.Tables[0].Rows.Count; l++)
{
string prodName2 = Ds_op.Tables[0].Rows[l]["prodName"].ToString();
string guige2 = Ds_op.Tables[0].Rows[l]["guige"].ToString();
string Totalnum2 = Ds_op.Tables[0].Rows[l]["Totalnum"].ToString();
if (strProducts.IndexOf(prodName2) == -1)
{
if (guige2 != "")
{
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(Convert.ToInt32(guige2));
if (gmodel != null)
{
prodName2 += gmodel.G_Name;
}
}
strProducts += prodName2 + " " + Totalnum2 + " ";
}
else
{
string strguige = "";
if (guige2 != "")
{
Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(Convert.ToInt32(guige2));
if (gmodel != null)
{
strguige = gmodel.G_Name;
}
}
strguige += " " + Totalnum2 + " ";
strProducts = strProducts.Replace(prodName2, prodName2 + strguige);
}
}
}
Ds_op.Clear();
if (strProducts.Length >= 250)
{
strProducts = strProducts.Substring(0, 250) + "...";
}
OleDbCommand mycmd;
mycmd = new OleDbCommand("insert into [订单表$]([订单类型],[支付方式],[收货人],[地址],[联系方式],[购买账号],[姓名],[购买产品],[购买时间],[订单编号],[数量],[金额],[快递单号],[状态]) values('" + strttype + "','" + zftype + "','" + Contactname + "','" + Address + "','" + Contacttel + "','" + UserName + "','" + RealName + "','" + strProducts + "','" + O_SubmitDate + "','" + orderid + "','" + Totalnum + "','" + Totalprice.ToString("f2") + "','" + yundanhao + "','" + strStatus + "')", myconn);
mycmd.CommandType = CommandType.Text;
//执行操作(访问数据库)
mycmd.ExecuteNonQuery();
}
//关闭数据库的连接
myconn.Close();
}
}
ds.Clear();
if (strFile != "")
{
data = "{\"success\":true,\"msg\":\"导出成功!\",\"strFile\":\"" + strFile + "\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"暂无数据可导出!\"}";
//Mtxfw.Utility.Common.WriteHtml("/weixin/sb.txt", sb.ToString());
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误2!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"success\":false,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
#region 删除图片
//删除图片
protected void deleteimage(HttpContext context)
{
string data = "{\"success\":false}";
Mtxfw.DAL.order_info daoOrder = new Mtxfw.DAL.order_info();
if (context.Session["MemberId"] != null && context.Session["MemberName"] != null && context.Session["MemberIFStores"] != null)
{
int MemberId = int.Parse(context.Session["MemberId"].ToString());
int IFStores = int.Parse(context.Session["MemberIFStores"].ToString());
int uLevel16 = 0;
if (context.Session["MemberuLevel16"] != null)
{
uLevel16 = int.Parse(context.Session["MemberuLevel16"].ToString());
}
if (IFStores == 1 || uLevel16 == 2)
{
if (MemberId > 0)
{
Mtxfw.Model.user_info umodel = new DAL.user_info().GetModel(MemberId);
if (umodel != null)
{
bool b = true;
if (b)
{
data = "{\"success\":true,\"msg\":\"删除成功!\"}";
}
else
{
data = "{\"success\":false,\"msg\":\"删除失败!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误2!\"}";
}
}
else
{
data = "{\"success\":false,\"msg\":\"登录参数错误!\"}";
}
}
}
else
{
data = "{\"success\":false,\"msg\":\"您未登录!\"}";
}
Utility.Common.WriteJson(context, data);
}
#endregion
public object FromvcmsgJson(string json)
{
JavaScriptSerializer js = new JavaScriptSerializer();
js.MaxJsonLength = Int32.MaxValue;
return js.Deserialize(json);
}
public bool IsReusable { get { return false; } }
}
public class kdchaxun
{
public int code { get; set; }
public bool success { get; set; }
public String msg { get; set; }
}
public class kdchaxun0
{
public int code { get; set; }
public bool success { get; set; }
public kdchaxun1 data { get; set; }
}
public class kdchaxun1
{
public String number { get; set; }
public String expressCompanyName { get; set; }
public List logisticsTraceDetails { get; set; }
public String logisticsStatusDesc { get; set; }
}
public class kdchaxun2
{
public string areaName { get; set; }
public long time { get; set; }
public string desc { get; set; }
}
public class sfzsmyz
{
public sfzsmyz0 resp { get; set; }
}
public class sfzsmyz0
{
public string code { get; set; }
public string desc { get; set; }
}
public class return_vcmsg
{
public int success { get; set; }
public String msg { get; set; }
}
}