using System; using System.Collections.Generic; using System.Web; using System.Text; using System.Data; using System.Data.SqlClient; using System.IO; using System.Net; using System.Web.SessionState; using System.Text.RegularExpressions; using System.Configuration; using System.Globalization; using System.Diagnostics; using Newtonsoft.Json; using System.Web.Script.Serialization; using System.Drawing; using ThoughtWorks.QRCode.Codec; using ThoughtWorks.QRCode.Codec.Data; using ThoughtWorks.QRCode.Codec.Util; using System.Web.Security; using System.Security.Cryptography; using TencentCloud.Common; using TencentCloud.Common.Profile; using TencentCloud.Vod.V20180717; using TencentCloud.Vod.V20180717.Models; using VodSDK; using ThoughtWorks.QRCode.Codec.Reader; using Mtxfw.shop; namespace Mtxfw.VipSite { /// /// Ajax 处理页面 /// public class apiajax : IHttpHandler, IRequiresSessionState { private Mtxfw.Utility.Config config = new Mtxfw.Utility.Config(""); DAL.user_info daoUser = new DAL.user_info(); DAL.user_guanzhu daoguanzhu = new DAL.user_guanzhu(); DAL.user_Results daoResults = new DAL.user_Results(); DAL.user_Results_jl2 daojl2 = new DAL.user_Results_jl2(); DAL.user_Results_jl daojl = new DAL.user_Results_jl(); DAL.P_Category daoCategory = new DAL.P_Category(); DAL.P_Product daoProduct = new DAL.P_Product(); DAL.P_Guige daoGuige = new DAL.P_Guige(); Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info(); Mtxfw.DAL.order_product_info daoorderproduct = new Mtxfw.DAL.order_product_info(); DAL.qiandao daoqiandao = new DAL.qiandao(); Mtxfw.DAL.user_proxy daoproxy = new Mtxfw.DAL.user_proxy(); DAL.Article daoArt = new DAL.Article(); DAL.user_live daolive = new DAL.user_live(); DAL.User_CZ_log daolog = new DAL.User_CZ_log(); DAL.user_Goods daoGoods = new DAL.user_Goods(); DAL.user_Goods_lb daolb = new DAL.user_Goods_lb(); DAL.user_jjfp daojjfp = new DAL.user_jjfp(); DAL.user_zzjf daozzjf = new DAL.user_zzjf(); DAL.user_zzjf_log daozzjflog = new DAL.user_zzjf_log(); DAL.business_info daobusiness = new DAL.business_info(); DAL.User_openids daoopenids = new DAL.User_openids(); DAL.user_BusinessHours daoHours = new DAL.user_BusinessHours(); DAL.user_RestDay daoRestDay = new DAL.user_RestDay(); DAL.freighttemplate daoftem = new DAL.freighttemplate(); DAL.freighttemplate_freight daofreight = new DAL.freighttemplate_freight(); DAL.freighttemplate_free daofree = new DAL.freighttemplate_free(); public int gtype = 0, ifweb = 0, ifwxapp = 0; public void ProcessRequest(HttpContext context) { String strData = ""; try { if (context.Request.QueryString.AllKeys.Length > 0) { foreach (string key in context.Request.QueryString.AllKeys) { if (!String.IsNullOrEmpty(key)) { strData += "&" + key + "=" + context.Request.QueryString[key].ToString(); } } } } catch (Exception err) { Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "xapiajax0"; mo.addtime = DateTime.Now; mo.ErrBody = strData; mo.ErrBody2 = err.ToString(); new DAL.User_Errlog().Add(mo); } try { if (context.Request.Form.Count > 0) { foreach (var key in context.Request.Form.Keys) { strData += "&" + key + ":" + context.Request.Form[key.ToString()].ToString(); } } } catch (Exception err) { Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "xapiajax1"; mo.addtime = DateTime.Now; mo.ErrBody = strData; mo.ErrBody2 = err.ToString(); new DAL.User_Errlog().Add(mo); } string data = "{\"status\":0,\"msg\":\"请求失败\"}"; try { //context.Response.ContentType = "text/plain"; //context.Response.ContentType = "application/json"; //context.Response.Cache.SetCacheability(HttpCacheability.NoCache); /*using (var reader = new System.IO.StreamReader(context.Request.InputStream)) { String xmlData = reader.ReadToEnd(); if (!string.IsNullOrEmpty(xmlData)) { Mtxfw.Utility.Common.WriteHtml("/weixin/action.txt", context.Request["action"] + "|" + xmlData); } }*/ //Mtxfw.Utility.Common.WriteHtml("/weixin/action.txt", context.Request["action"]); string hostname = context.Request.Url.Host; bool ifb = true; if (!String.IsNullOrEmpty(context.Request["userId"])) { if (context.Request["userId"].ToString() != "null") { if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["userId"].ToString(), @"^-?\d+$")) { ifb = false; } } } if (!String.IsNullOrEmpty(context.Request["LoginId"])) { if (context.Request["LoginId"].ToString() != "null") { if (context.Request["LoginId"].ToString().Length != 36) { ifb = false; } } } if (!String.IsNullOrEmpty(context.Request["t"])) { if (context.Request["t"].ToString() != "null") { if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["t"].ToString(), @"^-?\d+$")) { ifb = false; } } } 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 (!String.IsNullOrEmpty(context.Request["viewId"])) { if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["viewId"].ToString(), @"^-?\d+$")) { ifb = false; } } if (!String.IsNullOrEmpty(context.Request["tguid"])) { if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["tguid"].ToString(), @"^-?\d+$")) { ifb = false; } } if (!String.IsNullOrEmpty(context.Request["poid"])) { if (!System.Text.RegularExpressions.Regex.IsMatch(context.Request["poid"].ToString(), @"^-?\d+$")) { ifb = false; } } if (!String.IsNullOrEmpty(context.Request["CartId"])) { if (context.Request["CartId"].ToString() != "null") { if (context.Request["CartId"].ToString().Length != 36) { ifb = false; } } } if (!String.IsNullOrEmpty(context.Request["ifweb"])) { if (System.Text.RegularExpressions.Regex.IsMatch(context.Request["ifweb"].ToString(), @"^-?\d+$")) { ifweb = Convert.ToInt32(context.Request["ifweb"]); } } if (!String.IsNullOrEmpty(context.Request["ifwxapp"])) { if (System.Text.RegularExpressions.Regex.IsMatch(context.Request["ifwxapp"].ToString(), @"^-?\d+$")) { ifwxapp = Convert.ToInt32(context.Request["ifwxapp"]); } } //Mtxfw.Utility.Common.WriteHtml("/weixin/action0.txt", context.Request["action"] + "|" + context.Request["UserId"].ToString() + "|" + context.Request["LoginId"].ToString() + "|" + context.Request["CartId"].ToString()); if (ifb) { //方式 switch (context.Request["action"]) { case "getcode": data = getcode(context); break; case "sendphonecode": data = sendphonecode(context); break; case "sendphonecode0": data = sendphonecode0(context); break; case "sendsmphonecode": data = sendsmphonecode(context); break; case "sendphonecode1": data = sendphonecode1(context); break; case "sendphonecode2": data = sendphonecode2(context); break; case "GetYZPhone": data = GetYZPhone(context); break; //case "register": data = register(context); break; case "login": data = login(context); break; case "otclogin": data = otclogin(context); break; case "otclogin0": data = otclogin0(context); break; case "logout": data = logout(context); break; case "updateonline": data = updateonline(context); break; case "forgetPassword": data = forgetPassword(context); break; case "uploadImage": data = uploadImage(context); break; case "uploadavatar": data = uploadavatar(context); break; case "uploadFile": data = uploadFile(context); break; case "GetUgcUploadSign": data = GetUgcUploadSign(context); break; case "addvideo": data = addvideo(context); break; case "sendmsg": data = sendmsg(context); break; case "getchatlist": data = getchatlist(context); break; case "delchat": data = delchat(context); break; case "updateisplayed": data = updateisplayed(context); break; case "getuserinfo": data = getuserinfo(context); break; case "updateUserInfo": data = updateUserInfo(context); break; case "updateSMRZInfo": data = updateSMRZInfo(context); break; case "getbusinessinfo": data = getbusinessinfo(context); break; case "updatebusinessinfo": data = updatebusinessinfo(context); break; case "appupdatebusiness": data = appupdatebusiness(context); break; case "getbusinessinfo0": data = getbusinessinfo0(context); break; case "updatebusinessinfo0": data = updatebusinessinfo0(context); break; case "appzjfws": data = appzjfws(context); break; case "appadv": data = appadv(context); break; case "appcompay": data = appcompay(context); break; case "getupvideodata": data = getupvideodata(context); break; case "uploadvideo": data = uploadvideo(context); break; case "getupvideolist": data = getupvideolist(context); break; case "getvideodetail": data = getvideodetail(context); break; case "getappadvlist": data = getappadvlist(context); break; case "qytfll": data = qytfll(context); break; case "gettflllist": data = gettflllist(context); break; case "getggsplist": data = getggsplist(context); break; case "getvideoproductlist": data = getvideoproductlist(context); break; case "dzvideo": data = dzvideo(context); break; case "guangzhu": data = guangzhu(context); break; case "sharevideo": data = sharevideo(context); break; case "videoreward": data = videoreward(context); break; case "plvideo": data = plvideo(context); break; case "getpllist": data = getpllist(context); break; case "zixunvideo": data = zixunvideo(context); break; case "getzixunlist": data = getzixunlist(context); break; case "updatebankinfo": data = updatebankinfo(context); break; case "updatealipay": data = updatealipay(context); break; case "updateweixinpay": data = updateweixinpay(context); break; case "updateqbaddress": data = updateqbaddress(context); break; case "updateyed": data = updateyed(context); break; case "getappdeclaration": data = getappdeclaration(context); break; case "appdeclaration": data = appdeclaration(context); break; case "getsysmsglist": data = getsysmsglist(context); break; case "getqyjslist": data = getqyjslist(context); break; case "getftsclist": data = getftsclist(context); break; case "getjkzslist": data = getjkzslist(context); break; case "getmessage": data = getmessage(context); break; case "delmessage": data = delmessage(context); break; case "sethasRead": data = sethasRead(context); break; case "getxsxtlist": data = getxsxtlist(context); break; case "getxsxtLBlist": data = getxsxtLBlist(context); break; case "liuyan": data = liuyan(context); break; case "getsysmsgdetail": data = getsysmsgdetail(context); break; case "getyyddlist": data = getyyddlist(context); break; case "getyyddview": data = getyyddview(context); break; case "zhuanshou_tihou": data = zhuanshou_tihou(context); break; case "qytuihuo": data = qytuihuo(context); break; case "shimingrenzheng": data = shimingrenzheng(context); break; case "editNCName": data = editNCName(context); break; case "getdianpuinfo": data = getdianpuinfo(context); break; case "updatedianpuinfo": data = updatedianpuinfo(context); break; case "getproductslist": data = getproductslist(context); break; case "getlive_onlinelist": data = getlive_onlinelist(context); break; case "getlive_chat": data = getlive_chat(context); break; case "live_chat": data = live_chat(context); break; case "getvideo_chat": data = getvideo_chat(context); break; case "video_chat": data = video_chat(context); break; case "purchaselivegift": data = purchaselivegift(context); break; case "getbilllist": data = getbilllist(context); break; case "getzzjfdata": data = getzzjfdata(context); break; case "getzzjf_log": data = getzzjf_log(context); break; case "getqwzzjf_log": data = getqwzzjf_log(context); break; case "qymczzjf": data = qymczzjf(context); break; case "getmyzlorders": data = getmyzlorders(context); break; case "onwtzz": data = onwtzz(context); break; case "getmydhorders": data = getmydhorders(context); break; case "onwtzs": data = onwtzs(context); break; case "getjianjinlist": data = getjianjinlist(context); break; case "getjianjinmlist": data = getjianjinmlist(context); break; case "getmyincome": data = getmyincome(context); break; case "getmrxsddl": data = getmrxsddl(context); break; case "getindexdata": data = getindexdata(context); break; case "getksddata": data = getksddata(context); break; case "watchvideo": data = watchvideo(context); break; case "lingqujiangli": data = lingqujiangli(context); break; case "watchvideo0": data = watchvideo0(context); break; case "lingqujiangli0": data = lingqujiangli0(context); break; case "watchvideo1": data = watchvideo1(context); break; case "collectorder": data = collectorder(context); break; case "jhtyb": data = jhtyb(context); break; case "getjhtyblist": data = getjhtyblist(context); break; case "getrqlist": data = getrqlist(context); break; case "getshopdata": data = getshopdata(context); break; case "getBusinessdata": data = getBusinessdata(context); break; case "gettaskdata": data = gettaskdata(context); break; case "gettaskvideodata": data = gettaskvideodata(context); break; case "getkpvideodata": data = getkpvideodata(context); break; case "getggbdata": data = getggbdata(context); break; case "getqiandaodata": data = getqiandaodata(context); break; case "bqiandao": data = bqiandao(context); break; case "getmydata": data = getmydata(context); break; case "getmybusinessdata": data = getmybusinessdata(context); break; case "updatePaypush": data = updatePaypush(context); break; case "getmybusiness_smlog": data = getmybusiness_smlog(context); break; case "getPaypushdata": data = getPaypushdata(context); break; case "getmybusinessdata0": data = getmybusinessdata0(context); break; case "getmyproducts": data = getmyproducts(context); break; case "getbusinessview": data = getbusinessview(context); break; case "getBusinessHoursdata": data = getBusinessHoursdata(context); break; case "addBusinessHours": data = addBusinessHours(context); break; case "updateBusinessHours": data = updateBusinessHours(context); break; case "DelBusinessHours": data = DelBusinessHours(context); break; case "getRestDaydata": data = getRestDaydata(context); break; case "addRestDay": data = addRestDay(context); break; case "updateRestDay": data = updateRestDay(context); break; case "DelRestDay": data = DelRestDay(context); break; case "checkupdate": data = checkupdate(context); break; case "chongzhi": data = chongzhi(context); break; case "chongzhi0": data = chongzhi0(context); break; case "getothershopdata": data = getothershopdata(context); break; case "getothershopdata0": data = getothershopdata0(context); break; case "getshopcategory": data = getshopcategory(context); break; case "getshoplist": data = getshoplist(context); break; case "getwxshoplist": data = getwxshoplist(context); break; case "getshopsearch": data = getshopsearch(context); break; case "getshopview": data = getshopview(context); break; case "addcart": data = addcart(context); break; case "addfavorite": data = addfavorite(context); break; case "getshopcart": data = getshopcart(context); break; case "getshopcart2": data = getshopcart2(context); break; case "updatecart": data = updatecart(context); break; case "qygm": data = qygm(context); break; case "getyunfei": data = getyunfei(context); break; case "car_pay_sign": data = car_pay_sign(context); break; case "getIFPayed": data = getIFPayed(context); break; case "gethongbao": data = gethongbao(context); break; case "LQHongBao": data = LQHongBao(context); break; case "getfriend_scircle": data = getfriend_scircle(context); break; case "getmy2wm": data = getmy2wm(context); break; case "zhuanzhang": data = zhuanzhang(context); break; case "zhuanhuan": data = zhuanhuan(context); break; case "GetUserName2": data = GetUserName2(context); break; case "tixian": data = tixian(context); break; //case "mslczc": data = mslczc(context); break; case "gmtb": data = gmtb(context); break; case "hfcz": data = hfcz(context); break; case "getzhuanzhanglist": data = getzhuanzhanglist(context); break; case "getzhuanhuanlist": data = getzhuanhuanlist(context); break; case "getzhuanchulist": data = getzhuanchulist(context); break; case "getchongzhilist": data = getchongzhilist(context); break; case "gettixianlist": data = gettixianlist(context); break; case "getgmtblist": data = getgmtblist(context); break; case "gethfczlist": data = gethfczlist(context); break; case "getmyfavoritelist": data = getmyfavoritelist(context); break; case "delfavorite": data = delfavorite(context); break; case "getmyfriendlist": data = getmyfriendlist(context); break; case "addfriend": data = addfriend(context); break; case "getmessagelist": data = getmessagelist(context); break; case "setToRead": data = setToRead(context); break; case "sendmessage": data = sendmessage(context); break; case "getorderslist": data = getorderslist(context); break; case "gettaskorderdata": data = gettaskorderdata(context); break; case "getordersinfo": data = getordersinfo(context); break; case "hxorder": data = hxorder(context); break; case "qyshorder": data = qyshorder(context); break; case "payorder": data = payorder(context); break; case "qyfhorder": data = qyfhorder(context); break; case "editwl": data = editwl(context); break; case "editaddress": data = editaddress(context); break; case "cancelfh": data = cancelfh(context); break; case "kdchaxun": data = kdchaxun(context); break; case "getAddress": data = getAddress(context); break; case "getZTAddress": data = getZTAddress(context); break; case "setDefaultAddress": data = setDefaultAddress(context); break; case "deleteAddress": data = deleteAddress(context); break; case "addAddress": data = addAddress(context); break; case "updateAddress": data = updateAddress(context); break; case "CancelOrder": data = CancelOrder(context); break; case "editpwd": data = editpwd(context); break; case "editpwd2": data = editpwd2(context); break; case "editphone": data = editphone(context); break; case "adddongtai": data = adddongtai(context); break; case "getdongtailist": data = getdongtailist(context); break; case "dianzandt": data = dianzandt(context); break; case "getdongtaiview": data = getdongtaiview(context); break; case "adddongtaipl": data = adddongtaipl(context); break; case "getmydongtailist": data = getmydongtailist(context); break; case "getmyguangzhulist": data = getmyguangzhulist(context); break; case "getjuanlist": data = getjuanlist(context); break; case "getjuancount": data = getjuancount(context); break; case "getServerMsg": data = getServerMsg(context); break; case "getxieyi": data = getxieyi(context); break; case "getmynetmap": data = getmynetmap(context); break; case "getmynetmap2": data = getmynetmap2(context); break; case "getnewyj": data = getnewyj(context); break; case "getbusiness_info": data = getbusiness_info(context); break; case "get2wm": data = get2wm(context); break; case "checkcode": data = checkcode(context); break; case "checkpwd2": data = checkpwd2(context); break; case "getpaylog": data = getpaylog(context); break; case "getpaydata": data = getpaydata(context); break; case "savepay": data = savepay(context); break; case "getqiandao": data = getqiandao(context); break; case "qiandao": data = qiandao(context); break; case "getScanner": data = getScanner(context); break; case "getusers": data = getusers(context); break; case "getorders": data = getorders(context); break; case "getrwbdata": data = getrwbdata(context); break; case "getrwbdetails": data = getrwbdetails(context); break; case "acceptms": data = acceptms(context); break; case "acceptzengsong": data = acceptzengsong(context); break; case "getsmpaydata": data = getsmpaydata(context); break; case "getopenid": data = getopenid(context); break; case "bindphone": data = bindphone(context); break; case "smpay": data = smpay(context); break; case "getsmjflog": data = getsmjflog(context); break; case "getsmhbdata": data = getsmhbdata(context); break; case "lqsmhb": data = lqsmhb(context); break; case "cancelaccount": data = cancelaccount(context); break; } if (context.Request["action"] == "getordersinfo") { Mtxfw.Utility.Common.WriteHtml("/weixin/apiajax.txt", data); } } Utility.Common.WriteJson(context, data); } catch (Exception err) { Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "xapiajax2"; mo.addtime = DateTime.Now; mo.ErrBody = strData; mo.ErrBody2 = err.ToString(); new DAL.User_Errlog().Add(mo); //Mtxfw.Utility.Common.WriteHtml("/weixin/apiajaxerr.txt", err.ToString()); } } #region //获取验证码----------------------------------------------------------------------------------------- /// /// 获取验证码 /// protected string getcode(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["yzid"])) { string yzid = HttpUtility.UrlDecode(context.Request["yzid"].ToString()); new DAL.user_code().Delete(yzid); } string strNum = Mtxfw.Utility.Common.RandNum(4); string strIP = ""; Model.user_code mymodel = new Model.user_code(); mymodel.YZID = Guid.NewGuid().ToString(); mymodel.YZM = strNum; mymodel.ip = strIP; mymodel.AddTime = DateTime.Now; mymodel.utype = 0; new DAL.user_code().Add(mymodel); string yzcode = Mtxfw.Utility.Security.EncryptString(strNum).Replace("+","_"); data = "{\"status\":1,\"yzid\":\"" + mymodel.YZID + "\",\"yzcode\":\"" + yzcode + "\",\"YZEnable\":\"" + config.FHEnable4 + "\"}"; return data; } #endregion #region //发送手机验证码----------------------------------------------------------------------------------------- /// /// 发送手机验证码 /// protected string sendphonecode(HttpContext context) { string data = "{\"status\":0}"; int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString().Trim()); } if (!String.IsNullOrEmpty(context.Request["phone"]) && !String.IsNullOrEmpty(context.Request["yzcodeid"]) && !String.IsNullOrEmpty(context.Request["code"])) { string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString()); string yzcodeid = HttpUtility.UrlDecode(context.Request["yzcodeid"].ToString()); string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); bool b = true; if (config.FHEnable4 == "1") { b = false; data = "{\"status\":0,\"msg\":\"暂时不能发送短信!\"}"; } if (b) { if (t == 0) { //b = false; //data = "{\"status\":0,\"msg\":\"短信未开通!\"}"; if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}")) { b = false; data = "{\"status\":0,\"msg\":\"手机号码格式填写不正确!\"}"; } } else { if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { b = false; data = "{\"status\":0,\"msg\":\"邮箱格式填写不正确!\"}"; } } } if (b) { if (yzcodeid.Length != 36) { b = false; data = "{\"status\":0,\"msg\":\"验证参数错误!\"}"; } } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(code, @"^-?\d+$")) { b = false; data = "{\"status\":0,\"msg\":\"图形验证码填写不正确!\"}"; } } 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; data = "{\"status\":0,\"msg\":\"图形验证码已失效!\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"图形验证码错误!\"}"; } } if (b) { if (!daoUser.IsExists(phone, gtype)) { string strIP = Mtxfw.Utility.Common.GetIP; if (new DAL.user_YZMs().GetCount("utype=0 And DateDiff(hour,addtime,getdate())<2 and ip='" + strIP + "'") < 20) { 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 = "您好!您的" + (t == 0 ? "手机" : "邮箱") + "验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【银花优选】"; try { Model.user_YZMs mymodel = new Model.user_YZMs(); mymodel.YZID = Guid.NewGuid().ToString(); mymodel.phone = phone; mymodel.YZM = strYZM; mymodel.ip = strIP; mymodel.AddTime = DateTime.Now; mymodel.utype = gtype; mymodel.IFEnable = 0; new DAL.user_YZMs().Add(mymodel); if (t == 0) { Mtxfw.Utility.Common.sendsms(phone, "2537210", strYZM, config); //Mtxfw.Utility.Common.sendsms(phone, strconent); } else { Mtxfw.Utility.Common.SendEmail(phone, "银花优选系统验证码", strconent); } context.Session["GLRandNum"] = ""; data = "{\"status\":1,\"msg\":\"发送成功\",\"yzid\":\"" + mymodel.YZID + "\"}"; } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/sendphonecode.txt", err.ToString()); data = "{\"status\":0,\"msg\":\"发送验证码出现错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"操作太频繁2!\"}"; } } else { data = "{\"status\":0,\"msg\":\"操作太频繁!\"}"; } } else { data = "{\"status\":0,\"msg\":\"你的操作太频繁!\"}"; } } else { data = "{\"status\":0,\"msg\":\"此"+ (t == 0?"手机号码":"邮箱") + "已经注册过!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"" + (t == 0 ? "手机号码" : "邮箱") + "不能为空!\"}"; } return data; } /// /// 发送手机验证码 /// protected string sendphonecode0(HttpContext context) { string data = "{\"status\":0}"; int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString().Trim()); } if (!String.IsNullOrEmpty(context.Request["phone"])) { string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString()); bool b = true; if (config.FHEnable4 == "1") { b = false; data = "{\"status\":0,\"msg\":\"暂时不能发送短信!\"}"; } if (b) { if (t == 0) { //b = false; //data = "{\"status\":0,\"msg\":\"短信未开通!\"}"; if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}")) { b = false; data = "{\"status\":0,\"msg\":\"手机号码格式填写不正确!\"}"; } } else { if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { b = false; data = "{\"status\":0,\"msg\":\"邮箱格式填写不正确!\"}"; } } } if (b) { Mtxfw.Model.user_info umodel; if (t == 0) { umodel = daoUser.GetModel(phone, phone, gtype); } else { umodel = daoUser.GetModel0(phone, 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); daoUser.UpdatePhoneTime(strYZM, DateTime.Now, umodel.Id); string strconent = "您好!您的" + (t == 0 ? "手机" : "邮箱") + "验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【银花优选】"; try { if (t == 0) { Mtxfw.Utility.Common.sendsms(umodel.Phone, "2537210", strYZM, config); //Mtxfw.Utility.Common.sendsms(umodel.Phone, strconent); } else { Mtxfw.Utility.Common.SendEmail(phone, "银花优选系统验证码", strconent); } data = "{\"status\":1,\"msg\":\"发送成功!\"}"; } catch { data = "{\"status\":0,\"msg\":\"发送验证码出现错误!\"}"; } } else data = "{\"status\":0,\"msg\":\"您已经发送超过30次了,请明天再试吧!\"}"; } else data = "{\"status\":0,\"msg\":\"请您在2分钟后再操作!\"}"; } else { data = "{\"status\":0,\"msg\":\"此" + (t == 0 ? "手机号码" : "邮箱") + "不存在!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"" + (t == 0 ? "手机号码" : "邮箱") + "不能为空!\"}"; } return data; } /// /// 发送手机验证码 /// protected string sendsmphonecode(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["dltype"]) && !String.IsNullOrEmpty(context.Request["openid"]) && !String.IsNullOrEmpty(context.Request["phone"])) { int dltype = Convert.ToInt32(context.Request["dltype"].ToString()); string openid = HttpUtility.UrlDecode(context.Request["openid"].ToString()); string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString()); bool b = true; if (config.FHEnable4 == "1") { b = false; data = "{\"status\":0,\"msg\":\"暂时不能发送短信!\"}"; } if (b) { if (daoUser.GetCount("IFStores=0 and Phone='" + phone + "' and openid" + (dltype == 3 ? "1" : dltype == 2 ? "0" : "") + "<>''") > 0) { b = false; data = "{\"status\":0,\"msg\":\"此手机号已绑定别的设备!\"}"; } } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}")) { b = false; data = "{\"status\":0,\"msg\":\"手机号码格式填写不正确!\"}"; } } if (b) { Mtxfw.Model.user_info umodel = daoUser.GetModelbyopenid(openid, dltype); 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); daoUser.UpdatePhoneTime(strYZM, DateTime.Now, umodel.Id); string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【银花优选】"; try { Mtxfw.Utility.Common.sendsms(phone, "2537210", strYZM, config); data = "{\"status\":1,\"msg\":\"发送成功!\"}"; } catch { data = "{\"status\":0,\"msg\":\"发送验证码出现错误!\"}"; } } else data = "{\"status\":0,\"msg\":\"您已经发送超过30次了,请明天再试吧!\"}"; } else data = "{\"status\":0,\"msg\":\"请您在2分钟后再操作!\"}"; } else { data = "{\"status\":0,\"msg\":\"openid不存在!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } /// /// 发送手机验证码 /// protected string sendphonecode1(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = context.Request["LoginId"].ToString(); Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { bool b = true; if (config.FHEnable4 == "1") { b = false; data = "{\"status\":0,\"msg\":\"暂时不能发送短信!\"}"; } if (b) { if (umodel.LoginId == LoginId) { if (b) { 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); daoUser.UpdatePhoneTime(strYZM, DateTime.Now, umodel.Id); string strconent = "您好!您的" + (umodel.Phone != "" ? "手机" : "邮箱") + "验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【银花优选】"; try { if (umodel.Phone != "") { Mtxfw.Utility.Common.sendsms(umodel.Phone, "2537210", strYZM, config); //Mtxfw.Utility.Common.sendsms(umodel.Phone, strconent); } else { Mtxfw.Utility.Common.SendEmail(umodel.Email, "银花优选系统验证码", strconent); } data = "{\"status\":1,\"msg\":\"发送成功!\"}"; } catch { data = "{\"status\":0,\"msg\":\"发送验证码出现错误!\"}"; } } else data = "{\"status\":0,\"msg\":\"您已经发送超过30次了,请明天再试吧!\"}"; } else data = "{\"status\":0,\"msg\":\"请您在2分钟后再操作!\"}"; return data; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } /// /// 发送手机验证码 /// protected string sendphonecode2(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = context.Request["LoginId"].ToString(); Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { bool b = true; if (config.FHEnable4 == "1") { b = false; data = "{\"status\":0,\"msg\":\"暂时不能发送短信!\"}"; } if (b) { if (umodel.LoginId == LoginId) { 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}")) { b = false; data = "{\"status\":0,\"msg\":\"手机号码格式填写不正确!\"}"; } if (b) { 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); daoUser.UpdatePhoneTime(strYZM, DateTime.Now, umodel.Id); string strconent = "您好!您的手机验证码为" + strYZM + ",此验证码30分钟内有效,请及时验证!【银花优选】"; try { Mtxfw.Utility.Common.sendsms(umodel.Phone, "2537210", strYZM, config); //Mtxfw.Utility.Common.sendsms(phone, strconent); data = "{\"status\":1,\"msg\":\"发送成功!\"}"; } catch { data = "{\"status\":0,\"msg\":\"发送验证码出现错误!\"}"; } } else data = "{\"status\":0,\"msg\":\"您已经发送超过30次了,请明天再试吧!\"}"; } else data = "{\"status\":0,\"msg\":\"请您在2分钟后再操作!\"}"; } } else { data = "{\"status\":0,\"msg\":\"手机号码不能为空!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取注册是否需要验证码标志----------------------------------------------------------------------------------------- /// /// 获取注册是否需要验证码标志 /// protected string GetYZPhone(HttpContext context) { string data = "{\"status\":0}"; data = "{\"status\":1,\"YZEnable\":\"" + config.FHEnable4 + "\"}"; return data; } #endregion #region //注册会员----------------------------------------------------------------------------------------- /// /// 注册会员 /// protected string register(HttpContext context) { DAL.user_info daoUser = new DAL.user_info(); string data = "{\"status\":0}"; int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString().Trim()); } if (!String.IsNullOrEmpty(context.Request["phone"]) && !String.IsNullOrEmpty(context.Request["name"]) && !String.IsNullOrEmpty(context.Request["password"]) && !String.IsNullOrEmpty(context.Request["password2"])) { int uLevel = 0; string invoicebody = "", strgoods = ""; int invoice = 0; string username = HttpUtility.UrlDecode(context.Request["phone"].ToString()); string password = HttpUtility.UrlDecode(context.Request["password"].ToString()); string password2 = password;// HttpUtility.UrlDecode(context.Request["password2"].ToString()); string realname = HttpUtility.UrlDecode(context.Request["name"].ToString()); string phone = ""; string email = ""; string sfz = ""; string Province = ""; string City = "", County = ""; string strmailingaddress = ""; string bankaddress = ""; if (t == 0) { phone = username; } else { email = username; } int ContactID = 0, uLevel1 = 0, uLevel5 = 0, SJRememberID=0; string ContactIDS = "", DLRememberIDS = "", strContactID = ""; DateTime dt = DateTime.Now; bool b = true; if (!System.Text.RegularExpressions.Regex.IsMatch(realname, @"^[\u4e00-\u9fa5a-zA-Z]+$")) { b = false; data = "{\"status\":0,\"msg\":\"真实姓名填写不正确,只能输入中文和字母!\"}"; } if (b) { if (!String.IsNullOrEmpty(context.Request.Form["yqm"])) { string stryqm = HttpUtility.UrlDecode(context.Request.Form["yqm"].ToString()).Trim(); if (!Regex.IsMatch(stryqm, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$")) { int yContactID = Convert.ToInt32(Mtxfw.Utility.Security.decrypt(Convert.ToInt32(stryqm))); SqlDataReader dr = daoUser.GetUserName(gtype, yContactID); if (dr.HasRows) { if (dr.Read()) { strContactID = dr["UserName"].ToString(); ContactID = int.Parse(dr["Id"].ToString()); ContactIDS = dr["ContactIDS"].ToString(); DLRememberIDS = dr["DLRememberIDS"].ToString(); uLevel1 = int.Parse(dr["uLevel1"].ToString()); } } dr.Close(); } else { b = false; data = "{\"status\":0,\"msg\":\"邀请码错误,不能是手机号!\"}"; } } else { if (b) { b = false; data = "{\"status\":0,\"msg\":\"请输入邀请码!\"}"; } } } if (b) { if (ContactID == 0) { b = false; data = "{\"status\":0,\"msg\":\"邀请码错误!\"}"; } } string strtitle = "手机号码", strtitle0 = "手机"; if (b) { if (t == 0) { if (!Regex.IsMatch(username, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$")) { b = false; data = "{\"status\":0,\"msg\":\""+ strtitle + "格式填写不正确!\"}"; } } else { strtitle = "电子邮箱"; strtitle0 = "电子邮箱"; if (!System.Text.RegularExpressions.Regex.IsMatch(username, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { b = false; data = "{\"status\":0,\"msg\":\"邮箱格式填写不正确!\"}"; } } } if (b) { if (daoUser.IsExists(username, gtype)) { b = false; data = "{\"status\":0,\"msg\":\""+ strtitle + "被其它用户占用!\"}"; } } string YZID = ""; if (config.FHEnable4 == "0") { if (b) { if (!String.IsNullOrEmpty(context.Request.Form["YZID"])) { YZID = HttpUtility.UrlDecode(context.Request.Form["YZID"].ToString()); } else { b = false; data = "{\"status\":0,\"msg\":\"请先发送" + strtitle0 + "验证码!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request.Form["code"])) { string verifyCode = HttpUtility.UrlDecode(context.Request.Form["code"].ToString()); if (b) { if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + username + "' And YZM='" + verifyCode + "'") == 0) { b = false; data = "{\"status\":0,\"msg\":\"" + strtitle0 + "验证码不正确!\"}"; } } if (b) { if (new DAL.user_YZMs().GetCount("utype=" + gtype + " And YZID='" + YZID + "' And phone='" + username + "' And YZM='" + verifyCode + "' And DateDiff(mi,addtime,getdate())<=30") == 0) { b = false; data = "{\"status\":0,\"msg\":\"" + strtitle0 + "验证码已经失效!\"}"; } } } else { b = false; data = "{\"status\":0,\"msg\":\"" + strtitle0 + "验证码不能为空!\"}"; } } } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(password, @"^[A-Za-z0-9_]+$") || password.Length < 6 || password.Length > 16) { b = false; data = "{\"status\":0,\"msg\":\"登录密码输入不正确,密码由6-16位数字、字母、下划线组成!\"}"; } } /*if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(password2, @"^[A-Za-z0-9_]+$") || password2.Length < 6 || password2.Length > 16) { b = false; data = "{\"status\":0,\"msg\":\"安全密码输入不正确,密码由6-16位数字、字母、下划线组成!\"}"; } } if (b) { if (password == password2) { b = false; data = "{\"status\":0,\"msg\":\"登录密码不能跟安全密码相同!\"}"; } }*/ if (b) { Double umoney20 = 0; Double umoney21 = umoney20; string strMemberCard = (daoUser.GetMaxMemberCard(gtype) + 1).ToString(); Mtxfw.Model.user_info model = new Mtxfw.Model.user_info(); model.MemberCard = strMemberCard; model.UserName = username; model.Password = Mtxfw.Utility.Security.EncryptString(password); model.Password2 = Mtxfw.Utility.Security.EncryptString(password2); model.RealName = realname; model.NCName = ""; model.UserPic = ""; model.Sex = ""; model.SFZ = sfz; model.CSDate = ""; model.Mobile = ""; model.Phone = phone; model.Email = email; model.Province = Province; model.City = City; model.County = County; model.MailingAddress = strmailingaddress; model.PostalCode = bankaddress; model.QQ = ""; 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.ProductName = strgoods; model.UserState = "正常";//(hytype == 2 ? "未审核" : "正常") model.RegTime = DateTime.Now; model.RegTime2 = DateTime.Now; /*SqlDataReader Dr = daoUser.GetUserId(Text_RememberID.Text); if (Dr.Read()) { RememberID = int.Parse(Dr["Id"].ToString()); RememberIDS = Dr["RememberIDS"].ToString(); } Dr.Close();*/ model.RememberID = 0; model.RememberIDS = ""; model.SuperiorsID = 0; model.SuperiorsIDS = ""; 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 = 0; model.uLevel1 = (uLevel1 + 1); model.uLevel3 = 0; model.uLevel5 = uLevel5; model.utype = "0"; 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.gtype = gtype; model.Id = daoUser.Add(model); daojjfp.UpdateBcount("count1", 1, 0, 0); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = 0; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb==0?"app":"web") + "注册会员,用户名:" + model.UserName + ",姓名:" + model.RealName + ",推荐人:" + strContactID; logmodel.UType = 1; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"注册成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } return data; } #endregion #region //会员登录----------------------------------------------------------------------------------------- /// /// 会员登录 /// protected string login(HttpContext context) { Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); string data = "{\"status\":0}"; int ttype = 0; //Mtxfw.Utility.Common.WriteHtml("/weixin/ttype.txt", context.Request["ttype"].ToString() + "|" + context.Request["plat"].ToString()); if (!String.IsNullOrEmpty(context.Request["ttype"])) { ttype = Convert.ToInt32(context.Request["ttype"].ToString()); } bool b = true; 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(); } if (version != "" && version != "0.0.6" && (plat == 0 || plat == 1 || plat == 2) && ifvideo == 0) { string[] aversion = config.webQQ.Split(','); if (aversion.Length == 3) { if (aversion[plat] != "" && aversion[plat] != version) { IFupdate = 1; } } } string registrationId = ""; if (!String.IsNullOrEmpty(context.Request["registrationId"])) { if (context.Request["registrationId"].ToString() != "null") { registrationId = context.Request["registrationId"].ToString(); } } if (b) { if (IFupdate == 1) { b = false; data = "{\"status\":0,\"msg\":\"有新的版本,您必须更新才能登录\",\"updatemsg\":\"" + config.webWeiXin + "\",\"UpdateBL\":\"" + config.webUpdateBL + "\"}"; } } if (b) { string username = "", password = "", yzid = ""; if (ttype == 0) { if (!String.IsNullOrEmpty(context.Request["username"]) && !String.IsNullOrEmpty(context.Request["password"])) { username = HttpUtility.UrlDecode(context.Request["username"].ToString()); password = HttpUtility.UrlDecode(context.Request["password"].ToString()); } else { b = false; data = "{\"status\":0,\"msg\":\"用户名或密码不能为空!\"}"; } if (b) { if (config.CloseEnable == "1" && username != "13000000001") { b = false; data = "{\"status\":0,\"msg\":\"" + config.CloseMsg + "\"}"; } } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(password, @"^[A-Za-z0-9_]+$") || password.Length < 6 || password.Length > 16) { b = false; data = "{\"status\":0,\"msg\":\"密码输入不正确,密码由6-16位数字、字母、下划线组成!\"}"; } } if (b) { int MemberId = 0; int IFStores = 0; int IFUpUserName = 0; int uutype = 0; string MemberJS = ""; string realname = ""; string MemberCard = ""; 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 IFEditBank = 0; int IFPhone = 0; int ProductShipped = 0; Double umoney = 0.00; Double umoney20 = 0.00; Double umoney15 = 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, username, Mtxfw.Utility.Security.EncryptString(password), 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 (IFStores != 1) { string IP = (MemberId == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); string Country = ""; try { Mtxfw.Utility.IPScanner IPScanner = new Mtxfw.Utility.IPScanner(); IPScanner.IP = IP; IPScanner.DataPath = context.Server.MapPath("/App_Data/qqwry.dat"); IPScanner.IPLocation(); if (IPScanner.Country != null) { Country = IPScanner.Country; } if (MemberId == 8714) { Country = "浙江省温州市"; } } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/IPLocationerr0.txt", err.ToString()); } string LoginId = Guid.NewGuid().ToString(); DateTime dt = DateTime.Now; Model.User_OnLine model = new Model.User_OnLine(); model.SessionId = LoginId; model.MemberId = MemberId; model.DLID = 1; model.ZDLID = 0; model.GDID = 0; model.FGSID = 0; model.InTime = dt; model.IsOnline = 1; model.IP = IP; model.MAC = Country; model.UserType = 0; model.gtype = gtype; new DAL.User_OnLine().Add(model); daoUser.UpdateuLevel("opentype2", 0, MemberId); daoUser.UpdateLogins(model.IP, LoginId, MemberId, 0); if (registrationId != "") { daoUser.UpdatePassword("registrationId", registrationId, MemberId); } string strdata = ""; Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId); if (umodel != null) { strdata = returndata(umodel); } data = "{\"status\":1,\"msg\":\"登录成功!正在进入系统...\",\"userId\":\"" + MemberId + "\",\"LoginId\":\"" + LoginId + "\"," + strdata + ",\"webbank\":\"" + config.webbank + "\"}"; } else data = "{\"status\":0,\"msg\":\"您的账户不能在此登录!\"}"; } else data = "{\"status\":0,\"msg\":\"您的账户不能登录!\"}"; } else data = "{\"status\":0,\"msg\":\"用户名或密码错误!\"}"; } } else { if (!String.IsNullOrEmpty(context.Request["username"]) && !String.IsNullOrEmpty(context.Request["password"])) { username = HttpUtility.UrlDecode(context.Request["username"].ToString()); password = HttpUtility.UrlDecode(context.Request["password"].ToString()); } else { b = false; data = "{\"status\":0,\"msg\":\"手机号码或验证码不能为空!\"}"; } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(username, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$") && !System.Text.RegularExpressions.Regex.IsMatch(username, @"^[09]+\d{8}") && !System.Text.RegularExpressions.Regex.IsMatch(username, @"^[00886]+[09]+\d{8}") && !System.Text.RegularExpressions.Regex.IsMatch(username, @"^[00886]+[-]+[09]+\d{8}")) { b = false; data = "{\"status\":0,\"msg\":\"手机号码格式填写不正确!\"}"; } } if (b) { Mtxfw.Model.user_info umodel = daoUser.GetModelbyPhone(username, gtype); if (umodel != null) { if (umodel.PhoneNumber.ToLower() != password) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码不正确!\"}"; } if (b) { DateTime dt1 = DateTime.Now; DateTime dt2 = umodel.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码已经失效!\"}"; } } if (b) { if (umodel.IFBecomeBusiness == 0) { if (umodel.uutype == "0") { string IP = (umodel.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); string Country = ""; try { Mtxfw.Utility.IPScanner IPScanner = new Mtxfw.Utility.IPScanner(); IPScanner.IP = IP; IPScanner.DataPath = context.Server.MapPath("/App_Data/qqwry.dat"); IPScanner.IPLocation(); if (IPScanner.Country != null) { Country = IPScanner.Country; } if (umodel.Id == 8714) { Country = "浙江省温州市"; } } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/IPLocationerr0.txt", err.ToString()); } string LoginId = Guid.NewGuid().ToString(); DateTime dt = DateTime.Now; Model.User_OnLine model = new Model.User_OnLine(); model.SessionId = LoginId; model.MemberId = umodel.Id; model.DLID = 1; model.ZDLID = 0; model.GDID = 0; model.FGSID = 0; model.InTime = dt; model.IsOnline = 1; model.IP = IP; model.MAC = Country; model.UserType = 0; new DAL.User_OnLine().Add(model); daoUser.UpdateuLevel("opentype2", 0, umodel.Id); daoUser.UpdateLogins(model.IP, LoginId, umodel.Id, 0); daoUser.UpdatePhoneTime3("", umodel.Id); string strdata = returndata(umodel); data = "{\"status\":1,\"msg\":\"登录成功!正在进入系统...\",\"userId\":\"" + umodel.Id + "\",\"LoginId\":\"" + LoginId + "\"," + strdata + ",\"webbank\":\"" + Mtxfw.Utility.Common.ReplaceString(config.webbank) + "\"}"; } else data = "{\"status\":0,\"msg\":\"您的账户不能在此登录!\"}"; } else data = "{\"status\":0,\"msg\":\"您的账户不能登录!\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"手机号码不存在!\"}"; } } } } return data; } #endregion #region //OTC会员登录----------------------------------------------------------------------------------------- /// /// OTC会员登录 /// protected string otclogin(HttpContext context) { Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); string data = "{\"status\":0}"; bool b = true; if (b) { string username = "", password = "", timestamp = "", sign = ""; if (!String.IsNullOrEmpty(context.Request["username"]) && !String.IsNullOrEmpty(context.Request["password"]) && !String.IsNullOrEmpty(context.Request["timestamp"]) && !String.IsNullOrEmpty(context.Request["sign"])) { username = HttpUtility.UrlDecode(context.Request["username"].ToString()); password = HttpUtility.UrlDecode(context.Request["password"].ToString()); timestamp = context.Request["timestamp"].ToString(); sign = context.Request["sign"].ToString(); } else { b = false; data = "{\"status\":0,\"msg\":\"用户名或密码不能为空!\"}"; } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(password, @"^[A-Za-z0-9_]+$") || password.Length < 6 || password.Length > 16) { b = false; data = "{\"status\":0,\"msg\":\"密码输入不正确,密码由6-16位数字、字母、下划线组成!\"}"; } } if (b) { string strq = "&username=" + username + "&password=" + password + "×tamp=" + timestamp; if (!Mtxfw.Utility.AlipayMD5.Verify(strq, sign, config.AccessKeySecret,"utf-8")) { b = false; data = "{\"status\":0,\"msg\":\"签名错误!\"}"; } } if (b) { int MemberId = 0; int IFStores = 0; int IFUpUserName = 0; int uutype = 0; string MemberJS = ""; string realname = ""; string MemberCard = ""; 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 IFEditBank = 0; int IFPhone = 0; int ProductShipped = 0; Double umoney = 0.00; Double umoney20 = 0.00; Double umoney15 = 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, username, Mtxfw.Utility.Security.EncryptString(password), 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 (IFStores != 1) { Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId); if (umodel != null) { if (config.FHEnable == "0" && umodel.uLevel18 != 2) { data = "{\"status\":0,\"msg\":\"您的账户未实名!\"}"; } else { string strdata = "\"data\":["; DataSet ds = daojl2.GetList1("Cutmoney,Totalmoney,addtime,seef,seeftime", "gtype=" + gtype + " and utype=12 and utype2=3 And IFDelete=0 and MemberId=" + umodel.Id + ""); if (ds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { string Cutmoney = Convert.ToDouble(Dr["Cutmoney"]).ToString(); string Totalmoney = Convert.ToDouble(Dr["Totalmoney"]).ToString("f2"); string addtime = Dr["addtime"].ToString(); int seef = Convert.ToInt32(Dr["seef"]); string seeftime = Dr["seeftime"].ToString(); strdata += "{\"num\":\"" + Cutmoney + "\",\"money\":\"" + Totalmoney + "\",\"addtime\":\"" + addtime + "\",\"seef\":\"" + seef + "\",\"seeftime\":\"" + seeftime + "\"}"; strdata += ","; } if (strdata.Substring(strdata.Length - 1, 1) == ",") { strdata = strdata.Substring(0, strdata.Length - 1); } } ds.Clear(); strdata += "]"; data = "{\"status\":1,\"msg\":\"登录成功!\",\"id\":\"" + umodel.Id + "\",\"UserName\":\"" + umodel.UserName + "\",\"Password\":\"" + umodel.Password + "\",\"Password2\":\"" + umodel.Password2 + "\",\"RealName\":\"" + umodel.RealName + "\",\"SFZ\":\"" + umodel.SFZ + "\",\"RegTime\":\"" + umodel.RegTime + "\",\"RegTime2\":\"" + umodel.RegTime2 + "\",\"KHName\":\"" + umodel.ProductName + "\",\"BankName\":\"" + umodel.RealName2 + "\",\"BankCard\":\"" + umodel.Phone2 + "\",\"BankKHH\":\"" + umodel.PostalCode + "\",\"AliAccount\":\"" + umodel.AliAccount + "\",\"AliName\":\"" + umodel.AliName + "\",\"aliimage\":\"" + umodel.aliimage + "\",\"weixinimage\":\"" + umodel.weixinimage + "\",\"qbaddress\":\"" + umodel.qbaddress + "\",\"QBTime\":\"" + umodel.QBTime + "\"," + strdata + "}"; } } } else data = "{\"status\":0,\"msg\":\"您的账户不能在此登录!\"}"; } else data = "{\"status\":0,\"msg\":\"您的账户不能登录!\"}"; } else data = "{\"status\":0,\"msg\":\"用户名或密码错误!\"}"; } } return data; } #endregion #region //OTC会员一键登录----------------------------------------------------------------------------------------- /// /// OTC会员一键登录 /// protected string otclogin0(HttpContext context) { Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); string data = "{\"status\":0}"; bool b = true; if (b) { int userId = 0; string LoginId = "", timestamp = "", sign = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["timestamp"]) && !String.IsNullOrEmpty(context.Request["sign"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); timestamp = context.Request["timestamp"].ToString(); sign = context.Request["sign"].ToString(); } else { b = false; data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } if (b) { string strq = "&userId=" + userId + "&LoginId=" + LoginId + "×tamp=" + timestamp; if (!Mtxfw.Utility.AlipayMD5.Verify(strq, sign, config.AccessKeySecret, "utf-8")) { b = false; data = "{\"status\":0,\"msg\":\"签名错误!\"}"; } } if (b) { Mtxfw.Model.user_info umodel = daoUser.GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { if (config.FHEnable == "0" && umodel.uLevel18 != 2) { data = "{\"status\":0,\"msg\":\"您的账户未实名!\"}"; } else { data = "{\"status\":1,\"msg\":\"登录成功!\",\"id\":\"" + umodel.Id + "\",\"UserName\":\"" + umodel.UserName + "\",\"Password\":\"" + umodel.Password + "\",\"Password2\":\"" + umodel.Password2 + "\",\"RealName\":\"" + umodel.RealName + "\",\"SFZ\":\"" + umodel.SFZ + "\",\"RegTime\":\"" + umodel.RegTime + "\",\"RegTime2\":\"" + umodel.RegTime2 + "\",\"KHName\":\"" + umodel.ProductName + "\",\"BankName\":\"" + umodel.RealName2 + "\",\"BankCard\":\"" + umodel.Phone2 + "\",\"BankKHH\":\"" + umodel.PostalCode + "\",\"AliAccount\":\"" + umodel.AliAccount + "\",\"AliName\":\"" + umodel.AliName + "\",\"aliimage\":\"" + umodel.aliimage + "\",\"weixinimage\":\"" + umodel.weixinimage + "\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } } return data; } #endregion #region //会员退出----------------------------------------------------------------------------------------- /// /// 会员退出 /// protected string logout(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); daoUser.UpdateLogoutTime(userId, LoginId, 0); DateTime MemberDLSJ = DateTime.Now; if (context.Session["MemberDLSJ"] != null) { MemberDLSJ = Convert.ToDateTime(context.Session["MemberDLSJ"].ToString()); } new DAL.User_OnLine().Update(gtype, LoginId, userId, MemberDLSJ); data = "{\"status\":1,\"msg\":\"退出成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新会员登录状态----------------------------------------------------------------------------------------- /// /// 更新会员登录状态 /// protected string updateonline(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); new DAL.User_OnLine().Update0(gtype, LoginId, userId); if (daoUser.GetCount("gtype=" + gtype + " and id=" + userId + " And LoginId='" + LoginId + "'") > 0) { data = "{\"status\":1,\"msg\":\"已登录!\"}"; } else { data = "{\"status\":2,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //忘记密码----------------------------------------------------------------------------------------- /// /// 忘记密码 /// protected string forgetPassword(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["phone"]) && !String.IsNullOrEmpty(context.Request["code"]) && !String.IsNullOrEmpty(context.Request["password"])) { string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString()); string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); string password = HttpUtility.UrlDecode(context.Request["password"].ToString()); int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString().Trim()); } string strtitle = "手机号码", strtitle0 = "手机"; if (t == 1) { strtitle = "邮箱"; strtitle0 = "邮箱"; } bool b = true; if (t == 0) { if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$") && !System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[09]+\d{8}") && !System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[00886]+[09]+\d{8}") && !System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[00886]+[-]+[09]+\d{8}")) { b = false; data = "{\"status\":0,\"msg\":\"手机号码格式填写不正确!\"}"; } } else { if (!System.Text.RegularExpressions.Regex.IsMatch(phone, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { b = false; data = "{\"status\":0,\"msg\":\"邮箱格式填写不正确!\"}"; } } if (b) { Mtxfw.Model.user_info umodel = null; if (t == 0) { umodel = daoUser.GetModel(phone, phone, gtype); } else { umodel = daoUser.GetModel0(phone, phone, gtype); } if (umodel != null) { if (umodel.PhoneNumber.ToLower() != code) { b = false; data = "{\"status\":0,\"msg\":\"" + strtitle0 + "验证码不正确!\"}"; } if (b) { DateTime dt1 = DateTime.Now; DateTime dt2 = umodel.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"" + strtitle0 + "验证码已经失效!\"}"; } } if (b) { daoUser.UpdatePassword("password", Mtxfw.Utility.Security.EncryptString(password), umodel.Id); new Mtxfw.DAL.user_info().UpdatePhoneTime3("", umodel.Id); data = "{\"status\":1,\"msg\":\"重置密码成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"" + strtitle + "输入不正确!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //上传图片----------------------------------------------------------------------------------------- /// /// 上传图片 /// protected string uploadImage(HttpContext context) { string data = "{\"status\":0}"; if (context.Request.Files.Count > 0 && !String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string FileName, FileType, Folders; Folders = config.webUpPath; Folders = "/Files/grimage/" + model.Id + "/"; //创建保存位置 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[0].FileName.Substring(context.Request.Files[0].FileName.LastIndexOf(".")).ToLower(); string strContentType = context.Request.Files[0].ContentType.ToLower(); string strFilePath = Folders + FileName + FileType; int intContentLength = context.Request.Files[0].ContentLength; if (Mtxfw.Utility.Common.hasType(config.webUpType.Split(','), strContentType)) { if (intContentLength <= 102400 * 100) { try { context.Request.Files[0].SaveAs(context.Server.MapPath(strFilePath)); if (!Mtxfw.Utility.Common.IsAllowedExtension(context.Server.MapPath(strFilePath))) { File.Delete(context.Server.MapPath(strFilePath)); } else { if (t == 1) { if (model.uploadimages != "") { model.uploadimages += "|" + strFilePath; daoUser.Updateuploadimages(model.uploadimages, model.Id); } else { model.uploadimages = strFilePath; daoUser.Updateuploadimages(model.uploadimages, model.Id); } } else { model.uploadimage = strFilePath; daoUser.UpdatePassword("uploadimage", strFilePath, model.Id); } data = "{\"status\":1,\"msg\":\"上传成功!\",\"url\":[\"" + Mtxfw.Utility.Common.GetCoverPic(strFilePath, "100x100", "cut") + "\",\"" + strFilePath + "\"]}"; } } catch (Exception err) { data = "{\"status\":0,\"msg\":\"上传失败!\"}"; } } else { data = "{\"status\":0,\"msg\":\"只能上传小于10M的图片!\"}"; } } else { data = "{\"status\":0,\"msg\":\"只能上传图片" + strContentType + "!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } private Stream GetPostedFileSteam(HttpContext context) { if (context.Request.Browser.Browser == "IE" && context.Request.Files != null && context.Request.Files.Count > 0) { var postedFile = context.Request.Files[0]; return postedFile.InputStream; } else { return context.Request.InputStream; } } /// /// 字节流转换成图片 /// /// 要转换的字节流 /// 转换得到的Image对象 public static Image BytToImg(byte[] byt) { MemoryStream ms = new MemoryStream(byt); Image img = Image.FromStream(ms); return img; } public byte[] StreamToBytes(Stream stream) { byte[] bytes = new byte[stream.Length]; stream.Read(bytes, 0, bytes.Length); // 设置当前流的位置为流的开始 stream.Seek(0, SeekOrigin.Begin); return bytes; } /*private System.Drawing.Imaging.ImageFormat GetImageFormat() { switch (FileUpload_Image.PostedFile.ContentType) { case "image/bmp": return System.Drawing.Imaging.ImageFormat.Bmp; case "image/gif": return System.Drawing.Imaging.ImageFormat.Gif; case "image/pjpeg": case "image/jpeg": return System.Drawing.Imaging.ImageFormat.Jpeg; case "image/tiff": return System.Drawing.Imaging.ImageFormat.Tiff; case "image/x-png": return System.Drawing.Imaging.ImageFormat.Png; default: return null; } }*/ #endregion #region //上传头像----------------------------------------------------------------------------------------- /// /// 上传头像 /// protected string uploadavatar(HttpContext context) { string data = "{\"status\":0}"; if (context.Request.Files.Count > 0 && !String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string strContentType = context.Request.Files[0].ContentType.ToLower(); int intContentLength = context.Request.Files[0].ContentLength; if (Mtxfw.Utility.Common.hasType(config.webUpType.Split(','), strContentType)) { if (intContentLength <= 102400 * 100) { Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string FileName, FileType, Folders; Folders = config.webUpPath; Folders = "/Files/grimage/" + model.Id + "/"; //创建保存位置 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[0].FileName.Substring(context.Request.Files[0].FileName.LastIndexOf(".")).ToLower(); string strFilePath = Folders + FileName + FileType; try { context.Request.Files[0].SaveAs(context.Server.MapPath(strFilePath)); if (!Mtxfw.Utility.Common.IsAllowedExtension(context.Server.MapPath(strFilePath))) { File.Delete(context.Server.MapPath(strFilePath)); } else { if (model.UserPic != "") { try { File.Delete(context.Server.MapPath(model.UserPic)); } catch (Exception err) { } } model.uploadimage = strFilePath; model.UserPic = config.webUrl + strFilePath; new Mtxfw.DAL.user_info().Update(model); data = "{\"status\":1,\"msg\":\"上传成功!\",\"url\":[\"" + Mtxfw.Utility.Common.GetCoverPic(strFilePath, "100x100", "cut") + "\",\"" + strFilePath + "\"]}"; } } catch (Exception err) { data = "{\"status\":0,\"msg\":\"上传失败!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"只能上传小于10M的图片!\"}"; } } else { data = "{\"status\":0,\"msg\":\"只能上传图片" + strContentType + "!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //上传文件----------------------------------------------------------------------------------------- /// /// 上传文件 /// protected string uploadFile(HttpContext context) { string data = "{\"status\":0}"; if (context.Request.Files["file1"] != null && !String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"]); } Mtxfw.Model.user_info model = daoUser.GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string FileName, FileType, Folders; Folders = config.webUpPath; Folders = "/Files/grimage/" + model.Id + "/"; //创建保存位置 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["file1"].FileName.Substring(context.Request.Files["file1"].FileName.LastIndexOf(".")).ToLower(); string strFilePath = Folders + FileName + FileType; int intContentLength = context.Request.Files["file1"].ContentLength; if (intContentLength < 102400 * 200) { context.Request.Files["file1"].SaveAs(context.Server.MapPath(strFilePath)); if (!Mtxfw.Utility.Common.IsAllowedExtension(context.Server.MapPath(strFilePath))) { File.Delete(context.Server.MapPath(strFilePath)); data = "{\"status\":0,\"msg\":\"上传格式不正确!\",\"url\":\"" + strFilePath + "\"}"; } else { if (t == 0) { string cutFilePath = strFilePath; if (config.webMoney80 != "" && config.webMoney80 != "0") { cutFilePath = CutVideo(context, strFilePath, Convert.ToInt32(config.webMoney80), Folders); if (cutFilePath == "") { cutFilePath = strFilePath; } } data = "{\"status\":1,\"msg\":\"上传成功\",\"url\":\"" + cutFilePath + "\"}"; } else { VodUploadClient client = new VodUploadClient(config.AccessKeyId, config.AccessKeySecret); VodUploadRequest request = new VodUploadRequest(); request.ClassId = 659337; request.MediaFilePath = context.Server.MapPath(strFilePath); try { // 将原来的同步调用: // VodUploadResponse response = client.Upload("ap-beijing", request); // 替换为异步调用并等待结果: VodUploadResponse response = client.Upload("ap-beijing", request).GetAwaiter().GetResult(); //string strImgPath = CatchImg(context, context.Server.MapPath(strFilePath), 720, 1280, Folders); string strUploadFile = ""; if (context.Session["UploadFileVideo"] != null) { strUploadFile = context.Session["UploadFileVideo"].ToString() + "," + strFilePath + "|" + response.FileId; } else { strUploadFile = strFilePath + "|" + response.FileId; } context.Session["UploadFileVideo"] = strUploadFile; //Mtxfw.Utility.Common.WriteHtml("/weixin/uploadFile.txt", response.FileId +"|" + response.MediaUrl + "|" + strImgPath); data = "{\"status\":1,\"msg\":\"上传成功!\",\"FileId\":\"" + response.FileId + "\",\"url\":\"" + response.MediaUrl + "\"}"; } catch (Exception err) { //Mtxfw.Utility.Common.WriteHtml("/weixin/uploadFileerr.txt", err.ToString()); try { File.Delete(context.Server.MapPath(strFilePath)); } catch { } data = "{\"status\":0,\"msg\":\"上传失败!\"}"; } //data = "{\"status\":1,\"msg\":\"上传成功\",\"url\":\"" + strFilePath + "\"}"; } } } else { data = "{\"status\":0,\"msg\":\"只能上传小于20M的文件!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } /// /// 使用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的路径* /// ** /// /// 视频路径 /// 保存的秒数 /// 保存后的路径(去除基路径) public string CutVideo(HttpContext cxt, string vedioPath, int s, string Folders) { string ffmpeg = cxt.Server.MapPath(ConfigurationManager.AppSettings["ffmpeg"]); if ((!System.IO.File.Exists(vedioPath))) { return ""; } ProcessStartInfo startInfo = new ProcessStartInfo(ffmpeg); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; string saveImgPath = cxt.Server.MapPath(Folders + DateTime.Now.ToString("yyyyMMddHHmmss") + ".mp4"); startInfo.Arguments = string.Format("-ss 00:00:00 -i \"{0}\" -to 00:00:{1} -c:v copy -c:a copy \"{2}\"", vedioPath, s, saveImgPath); System.Diagnostics.Process.Start(startInfo); saveImgPath = "/" + saveImgPath.Replace(AppDomain.CurrentDomain.BaseDirectory, "").Replace("\\", "/"); return saveImgPath; } #endregion #region //派发签名服务----------------------------------------------------------------------------------------- /// /// 派发签名服务 /// protected string GetUgcUploadSign(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = daoUser.GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string Signature = ""; string secretId = config.AccessKeyId; long currentTimeStamp = Mtxfw.Utility.Common.CreatenTimestamp(DateTime.Now); long expireTime = Mtxfw.Utility.Common.CreatenTimestamp(DateTime.Now.AddHours(24)); string random = Mtxfw.Utility.Common.RandNum(6); long classId = 659337; string strkey = "secretId=" + secretId + "¤tTimeStamp=" + currentTimeStamp + "&expireTime=" + expireTime + "&random=" + random + "&classId=" + classId + "&storageRegion=ap-beijing"; byte[] bytesSign = hash_hmac_byte(strkey, config.AccessKeySecret); byte[] byteContent = System.Text.Encoding.Default.GetBytes(strkey); byte[] nCon = new byte[bytesSign.Length + byteContent.Length]; bytesSign.CopyTo(nCon, 0); byteContent.CopyTo(nCon, bytesSign.Length); Signature = Convert.ToBase64String(nCon); Mtxfw.Utility.Common.WriteHtml("/weixin/GetUgcUploadSign.txt", strkey + "|" + Signature); data = "{\"status\":1,\"sign\":\"" + Signature + "\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } private byte[] hash_hmac_byte(string signatureString, string secretKey) { var enc = Encoding.UTF8; HMACSHA1 hmac = new HMACSHA1(enc.GetBytes(secretKey)); hmac.Initialize(); byte[] buffer = enc.GetBytes(signatureString); return hmac.ComputeHash(buffer); } #endregion #region //增加视频到推荐视频----------------------------------------------------------------------------------------- /// /// 增加视频到推荐视频 /// protected string addvideo(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["videourl"]) && !String.IsNullOrEmpty(context.Request["file_id"]) && !String.IsNullOrEmpty(context.Request["pic"]) && !String.IsNullOrEmpty(context.Request["qx"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string videourl = HttpUtility.UrlDecode(context.Request["videourl"].ToString()); string file_id = HttpUtility.UrlDecode(context.Request["file_id"].ToString()); string title = HttpUtility.UrlDecode(context.Request["title"].ToString()); string pic = HttpUtility.UrlDecode(context.Request["pic"].ToString()); int qx = Convert.ToInt32(context.Request["qx"].ToString()); Mtxfw.Model.user_info umodel = daoUser.GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { Int64 duration = 0; UInt64 file_size = 0; Int64 width = 0, height = 0; // 必要步骤: // 实例化一个认证对象,入参需要传入腾讯云账户密钥对 SecretId,SecretKey。 // 本示例采用从环境变量读取的方式,则需要在环境变量中先设置这两个值。 // 您也可以直接将密钥对写入代码中,但是注意不要复制、上传或分享代码,以免泄露密钥对危及您的财产安全。 Credential cred = new Credential { SecretId = config.AccessKeyId, SecretKey = config.AccessKeySecret }; // 实例化一个 client 选项,可选的,没有特殊需求可以跳过 ClientProfile clientProfile = new ClientProfile(); // 指定签名算法(默认为 HmacSHA256) clientProfile.SignMethod = ClientProfile.SIGN_SHA1; // 非必要步骤 // 实例化一个客户端配置对象,可以指定超时时间等配置 HttpProfile httpProfile = new HttpProfile(); // SDK 默认使用 POST 方法。 // 如果您一定要使用 GET 方法,可以在这里设置。GET 方法无法处理一些较大的请求。 httpProfile.ReqMethod = "POST"; // SDK 有默认的超时时间,非必要请不要进行调整。 // 如有需要请在代码中查阅以获取最新的默认值。 httpProfile.Timeout = 30; // 请求连接超时时间,单位为秒,默认值为60 // SDK 会自动指定域名。通常无需指定域名,但如果您访问的是金融区的服务,则必须手动指定域名。 // 例如云服务器的上海金融区域名:cvm.ap-shanghai-fsi.tencentcloudapi.com // 代理服务器,当您的环境下有代理服务器时设定 httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY"); clientProfile.HttpProfile = httpProfile; // 实例化要请求产品(以 CVM 为例)的 client 对象 // 第二个参数是地域信息,可以直接填写字符串 ap-guangzhou,或者引用预设的常量,clientProfile 是可选的 VodClient client = new VodClient(cred, "ap-beijing", clientProfile); try { 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/DescribeMediaInfos2.txt", AbstractModel.ToJsonString(res)); 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 (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/UploadFileVideoerr2.txt", err.ToString()); } DAL.user_livefile daofile = new DAL.user_livefile(); Mtxfw.Model.Article model = new Mtxfw.Model.Article(); model.senderid = umodel.Id; model.receiverid = 0; model.Title = title; model.ParentID = 29; model.CategoryId = "0";//DropType.SelectedItem.Value model.AddTime = DateTime.Now; model.Author = pic; model.Content = ""; model.Paths = videourl; 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; model.id = daoArt.Add(model); daoArt.UpdateuSel("hasRead", qx, model.id); Mtxfw.Model.user_livefile fmodel = new Model.user_livefile(); fmodel.MemberId = umodel.Id; fmodel.liveid = model.id; 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 = videourl; fmodel.seef = 0; fmodel.LinkID = 0; fmodel.ttype = 2; fmodel.addtime = DateTime.Now; fmodel.gtype = gtype; daofile.Add(fmodel); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = userId; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb==0?"app":"web") + "增加视频到推荐视频:" + file_id; logmodel.UType = 1; logmodel.gtype = gtype; daolog.Add(logmodel); if (context.Session["UploadFileVideo"] != null) { string[] aUploadFile = context.Session["UploadFileVideo"].ToString().Split(','); foreach(string uploadfile in aUploadFile) { if (uploadfile != "") { try { string[] aa = uploadfile.Split('|'); if (aa[1] != file_id) { DeleteMediaRequest dreq = new DeleteMediaRequest(); dreq.FileId = aa[1]; DeleteMediaResponse dres = client.DeleteMediaSync(dreq); } if (aa.Length>2) { File.Delete(context.Server.MapPath(aa[2])); } File.Delete(context.Server.MapPath(aa[0])); }catch(Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/UploadFileVideoerr.txt", err.ToString()); } } } } data = "{\"status\":1,\"msg\":\"保存成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //发送聊天信息----------------------------------------------------------------------------------------- /// /// 发送聊天信息 /// protected string sendmsg(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); bool b = true; int ttype = 0, t = 0; if (!String.IsNullOrEmpty(context.Request["ttype"])) { ttype = Convert.ToInt32(context.Request["ttype"].ToString()); } else { b = false; data = "{\"status\":0,\"msg\":\"参数不能为空0!\"}"; } if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString()); } else { b = false; data = "{\"status\":0,\"msg\":\"参数不能为空1!\"}"; } string body = ""; if (!String.IsNullOrEmpty(context.Request["body"])) { body = HttpUtility.UrlDecode(context.Request["body"].ToString()); } else { b = false; data = "{\"status\":0,\"msg\":\"参数不能为空2!\"}"; } int receiverid = 0; if (!String.IsNullOrEmpty(context.Request["receiverid"])) { receiverid = Convert.ToInt32(context.Request["receiverid"].ToString()); } if (b) { Mtxfw.Model.user_info model = daoUser.GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { //string realname = (model.Sex == "男" ? "Mr." : "Miss.") + (model.RealName == "" ? "" : model.RealName.Substring(0, 1)); int m = 0; if (t == 1 || t == 3) { try { m = Mtxfw.Utility.Common.GetDurationByShellClass(context.Server.MapPath(body)); } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/ShellClass.txt", err.ToString()); } } Mtxfw.Model.Article Amodel = new Mtxfw.Model.Article(); Amodel.senderid = model.Id; Amodel.receiverid = receiverid; Amodel.Title = (ttype == 0 ? "客服信息" : ttype == 1 ? "私聊信息" : "群聊信息"); Amodel.ParentID = 21; Amodel.CategoryId = t.ToString();//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 = ttype;//ttype=0 客服信息 1私聊信息 2群聊信息 Amodel.wtype2 = m;//语音或视频多少秒 Amodel.LinkID = 0; Amodel.Seef = 0; Amodel.gtype = model.gtype; int artid = new DAL.Article().Add(Amodel); Mtxfw.Model.user_info umodel = daoUser.GetModel(Amodel.receiverid); if (umodel != null) { Mtxfw.Model.Article amodel = new Mtxfw.Model.Article(); amodel.senderid = model.Id; amodel.receiverid = umodel.Id; amodel.Title = "客服信息"; amodel.ParentID = 30; amodel.CategoryId = artid.ToString(); amodel.AddTime = DateTime.Now; amodel.Author = "../image/chat-ico.png"; amodel.Content = (t == 1 ? "语音信息" : (t == 2 ? "图片信息" : (t == 3 ? "视频信息" : (t == 4 ? "位置" : body)))); amodel.Paths = "kf.html"; amodel.Content2 = ""; amodel.Paths2 = ""; amodel.KeyWords = ""; amodel.media_id = ""; amodel.thumb_media_id = ""; amodel.wtype = 9; amodel.wtype2 = 0; amodel.LinkID = 1; amodel.Seef = 0; amodel.gtype = gtype; daoArt.Add(amodel); } data = "{\"status\":1,\"msg\":\"提交成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取聊天列表----------------------------------------------------------------------------------------- /// /// 获取聊天列表 /// protected string getchatlist(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["ttype"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int ttype = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["ttype"].ToString())); int receiverid = 0; if (!String.IsNullOrEmpty(context.Request["receiverid"])) { receiverid = Convert.ToInt32(context.Request["receiverid"].ToString()); } int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString()); } Mtxfw.Model.user_info umodel = daoUser.GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { string strdata = ""; string groupby = ""; string strOrder = "addtime desc,id desc"; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("gtype=" + gtype + " and ParentID=21 and wtype=" + ttype + ""); sb.Append(" And ((senderid=" + umodel.Id + " And receiverid=" + receiverid + " And LinkID=0) Or (senderid=" + receiverid + " And receiverid=" + umodel.Id + " And seef=0))"); String SJ = context.Request["startsj"]; if (!String.IsNullOrEmpty(SJ)) { sb.Append("and addtime 0) { int i = 0; foreach (System.Data.DataRow Dr in ds.Tables[1].Rows) { int id = Convert.ToInt32(Dr["id"]); int CategoryId = Convert.ToInt32(Dr["CategoryId"]); int seconds = Convert.ToInt32(Dr["wtype2"]); int userid = Convert.ToInt32(Dr["senderid"]); int areceiverid = Convert.ToInt32(Dr["receiverid"]); int hasRead = Convert.ToInt32(Dr["hasRead"]); string content = Dr["content"].ToString(); string addtime = Dr["addtime"].ToString(); string aRealName = Dr["RealName"].ToString(); string UserPic = Dr["UserPic"].ToString().Trim(); 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(); } } string minpic = ""; if (CategoryId == 2) { string FileType = content.Substring(content.LastIndexOf(".")).ToLower(); if (FileType != ".gif") { minpic = config.webUrl + Mtxfw.Utility.Common.GetCoverPic(content, "1000x1000", "cut"); } else { minpic = config.webUrl + content; } content = config.webUrl + content; } strdata += "{\"id\":\"" + id + "\",\"userid\":\"" + userid + "\",\"name\":\"" + aRealName + "\",\"avatar\":\"" + (userid == 0? "/image/kfserver.png" : (UserPic == "" ? "" : config.webUrl + Mtxfw.Utility.Common.GetCoverPic(UserPic, "40x40", "cut"))) + "\",\"CategoryId\":\"" + CategoryId + "\",\"content\":\"" + (CategoryId == 0?content.Replace("\n", "").Replace("\r", "") : content) + "\",\"addtime\":\"" + addtime + "\",\"seconds\":\"" + seconds + "\",\"minpic\":\"" + minpic + "\",\"isplayed\":\"" + hasRead + "\"}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误2\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } return data; } #endregion #region //删除聊天信息----------------------------------------------------------------------------------------- /// /// 删除聊天信息 /// protected string delchat(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["delids"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string delids = context.Request["delids"].ToString(); Mtxfw.Model.user_info model = daoUser.GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string[] adelids = delids.Split(','); foreach (string str in adelids) { if (str != "") { Mtxfw.Model.Article Amodel = daoArt.GetModel(Convert.ToInt32(str)); if (Amodel.senderid == model.Id || Amodel.receiverid == model.Id) { if (Amodel.receiverid == model.Id) { daoArt.UpdateuSel("Seef", 1, Amodel.id); daoArt.Delete("gtype=" + gtype + " and ParentID=30 And wtype=7 And receiverid=" + model.Id + " And CategoryId='" + Amodel.id + "'"); } else { daoArt.UpdateuSel("LinkID", 1, Amodel.id); } } } } data = "{\"status\":1,\"msg\":\"删除成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新已读标志----------------------------------------------------------------------------------------- /// /// 更新已读标志 /// protected string updateisplayed(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); Mtxfw.Model.user_info model = daoUser.GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { Mtxfw.Model.Article Amodel = daoArt.GetModel(id); if (Amodel.receiverid == model.Id) { daoArt.UpdateuSel("hasRead", 1, Amodel.id); } data = "{\"status\":1,\"msg\":\"更新成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取会员信息----------------------------------------------------------------------------------------- /// /// 获取会员信息 /// protected string getuserinfo(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { int infoId = 0; if (!String.IsNullOrEmpty(context.Request["infoId"])) { infoId = Convert.ToInt32(context.Request["infoId"]); } if (infoId > 0) { data = "{\"status\":0,\"msg\":\"不能查看会员详情!\"}"; /*Mtxfw.Model.user_info model2 = new Mtxfw.DAL.user_info().GetModel(infoId); if (model2 != null) { if (model2.SuperiorsIDS.IndexOf("," + model.Id + ",") != -1 || model2.ContactIDS.IndexOf("," + model.Id + ",") != -1) { data = "{\"status\":1,\"msg\":\"获取成功!\",\"user\":{\"avatar\":\"" + (model2.UserPic == "" ? "" : Mtxfw.Utility.Common.GetCoverPic(model2.UserPic, "100x100", "cut")) + "\",\"username\":\"" + model2.UserName + "\",\"realname\":\"" + model2.RealName + "\",\"ncname\":\"" + model2.NCName + "\",\"phone\":\"" + model2.Phone + "\",\"sfz\":\"" + model2.SFZ + "\",\"bankname\":\"" + model2.RealName2 + "\",\"bankcard\":\"" + model2.Phone2 + "\",\"bankaddress\":\"" + model2.MTZNLConent + "\",\"alipay\":\"" + model2.BBSConent + "\",\"weixin\":\"" + model2.CompanyContact + "\",\"gender\":\"" + model2.Sex + "\",\"birthday\":\"" + model2.CSDate + "\",\"Province\":\"" + model2.Province + "\",\"City\":\"" + model2.City + "\",\"County\":\"" + model2.County + "\"}}"; } else { data = "{\"status\":0,\"msg\":\"不是你的所属会员不能查看!\"}"; } }*/ } else { data = "{\"status\":1,\"msg\":\"获取成功!\",\"user\":{\"ifupuser\":\"" + model.uLevel18 + "\",\"avatar\":\"" + (model.UserPic == "" ? "" : Mtxfw.Utility.Common.cminimage(model.UserPic)) + "\",\"yavatar\":\"" + model.UserPic + "\",\"username\":\"" + model.UserName + "\",\"realname\":\"" + model.RealName + "\",\"sfzimage\":\"" + (model.PayEWMPic1 == "" ? "" : Mtxfw.Utility.Common.cminimage(model.PayEWMPic1)) + "\",\"sfzimage0\":\"" + (model.PayEWMPic2 == "" ? "" : Mtxfw.Utility.Common.cminimage(model.PayEWMPic2)) + "\",\"ncname\":\"" + model.NCName + "\",\"phone\":\"" + model.Phone + "\",\"sfz\":\"" + model.SFZ + "\",\"khname\":\"" + model.ProductName + "\",\"bankname\":\"" + model.RealName2 + "\",\"bankcard\":\"" + model.Phone2 + "\",\"bankaddress\":\"" + model.PostalCode + "\",\"AliAccount\":\"" + model.AliAccount + "\",\"AliName\":\"" + model.AliName + "\",\"aliimage\":\"" + (model.aliimage == "" ? "" : Mtxfw.Utility.Common.cmaximage(model.aliimage)) + "\",\"weixinimage\":\"" + (model.weixinimage == "" ? "" : Mtxfw.Utility.Common.cmaximage(model.weixinimage)) + "\",\"yaliimage\":\"" + model.aliimage + "\",\"yweixinimage\":\"" + model.weixinimage + "\",\"qbaddress\":\"" + model.qbaddress + "\",\"yedAccount\":\"" + model.yedAccount + "\",\"yedName\":\"" + model.yedName + "\",\"yedimage\":\"" + (model.yedimage == "" ? "" : Mtxfw.Utility.Common.cmaximage(model.yedimage)) + "\",\"gender\":\"" + model.Sex + "\",\"birthday\":\"" + model.CSDate + "\",\"Province\":\"" + model.Province + "\",\"City\":\"" + model.City + "\",\"County\":\"" + model.County + "\",\"address\":\"" + model.MailingAddress + "\"},\"webbank\":\"" + config.webbank + "\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新会员信息----------------------------------------------------------------------------------------- /// /// 更新会员信息 /// protected string updateUserInfo(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && context.Request["realname"] != null) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string realname = HttpUtility.UrlDecode(context.Request["realname"].ToString()); string sfz = ""; if (!String.IsNullOrEmpty(context.Request["sfz"])) { sfz = HttpUtility.UrlDecode(context.Request["sfz"].ToString()); } string ncname = ""; if (!String.IsNullOrEmpty(context.Request["ncname"])) { ncname = HttpUtility.UrlDecode(context.Request["ncname"].ToString()); } string Province = ""; if (!String.IsNullOrEmpty(context.Request["Province"])) { Province = HttpUtility.UrlDecode(context.Request["Province"].ToString()); } string City = "", County = "", address = ""; 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 (!String.IsNullOrEmpty(context.Request["address"])) { address = HttpUtility.UrlDecode(context.Request["address"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (realname == "") { b = false; data = "{\"status\":0,\"msg\":\"姓名不能为空!\"}"; } } if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(realname, @"^[\u4e00-\u9fa5a-zA-Z]+$")) { b = false; data = "{\"status\":0,\"msg\":\"真实姓名填写不正确,只能输入中文和字母!\"}"; } } if (b) { if (sfz != "") { if (!System.Text.RegularExpressions.Regex.IsMatch(sfz, @"^[a-zA-Z0-9]+$")) { b = false; data = "{\"status\":0,\"msg\":\"身份证号填写不正确,只能输入字母或数字!\"}"; } } } if (b) { if (ncname != "") { if (!System.Text.RegularExpressions.Regex.IsMatch(ncname, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$")) { b = false; data = "{\"status\":0,\"msg\":\"昵称填写不正确,只能输入中文和字母或数字!\"}"; } } } if (b) { if (Province != "") { if (Province.Length>10) { b = false; data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } } if (b) { if (City != "") { if (City.Length>10) { b = false; data = "{\"status\":0,\"msg\":\"参数错误0!\"}"; } } } if (b) { if (County != "") { if (County.Length>10) { b = false; data = "{\"status\":0,\"msg\":\"参数错误1!\"}"; } } } if (b) { if (address != "") { if (address.Length>100) { b = false; data = "{\"status\":0,\"msg\":\"地址填写太长!\"}"; } } } if (b) { model.RealName = realname; model.SFZ = sfz; model.Province = Province; model.City = City; model.County = County; model.MailingAddress = address; new Mtxfw.DAL.user_info().Update(model); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb==0?"app":"web") + "修改资料"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新实名认证信息----------------------------------------------------------------------------------------- /// /// 更新实名认证信息 /// protected string updateSMRZInfo(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["realname"]) && !String.IsNullOrEmpty(context.Request["sfz"]) && !String.IsNullOrEmpty(context.Request["ifuploadsfz"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string realname = HttpUtility.UrlDecode(context.Request["realname"].ToString()); string sfz = HttpUtility.UrlDecode(context.Request["sfz"].ToString()); int ifuploadsfz = Convert.ToInt32(context.Request["ifuploadsfz"].ToString()); string image0 = ""; string image1 = ""; bool b = true; if (ifuploadsfz == 1) { if (!String.IsNullOrEmpty(context.Request["image0"])) { image0 = HttpUtility.UrlDecode(context.Request["image0"].ToString()); } if (!String.IsNullOrEmpty(context.Request["image1"])) { image1 = HttpUtility.UrlDecode(context.Request["image1"].ToString()); } } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { if (b) { if (model.uLevel18 == 1) { b = false; data = "{\"status\":0,\"msg\":\"实名认证在审核中!\"}"; } } if (b) { if (model.uLevel18 == 2) { b = false; data = "{\"status\":0,\"msg\":\"已经实名认证过!\"}"; } } if (b) { if (daoUser.GetCount("IFStores=0 and uLevel18>0 and SFZ='"+ sfz + "'")>=Convert.ToInt32(config.webMoney44)) { b = false; data = "{\"status\":0,\"msg\":\"一个身份证号码最多只能认证"+ config.webMoney44 + "个账号!\"}"; } } if (b) { if (ifuploadsfz == 0) { string appid = "VlvDyiQIQSolIBoOB6JJ0XW4FIAGPi7S"; string timestamp = Mtxfw.Utility.Common.timeStamp(); string app_security = "R9CUAURtoFWmhKVd6pOoDAXrEgwB6Rgc"; string idcard = sfz; string name = realname; string strp = appid + "&" + timestamp + "&" + app_security; string sign = Mtxfw.Utility.Interface_WxPay.GetMD5(strp); string strq = "appid=" + appid + "×tamp=" + timestamp + "&app_security=" + app_security + "&sign="+ sign + "&idcard=" + idcard + "&name=" + name; string strResult = Mtxfw.Utility.Common.getPage2("https://api.shumaidata.com/v4/id_card/check", "", "utf-8", false, true, strq); Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "调用身份证检验接口"; mo.addtime = DateTime.Now; mo.ErrBody = strq; mo.ErrBody2 = strResult; new DAL.User_Errlog().Add(mo); if (strResult.IndexOf("\"success\"") != -1) { returnsfzcode rs = (returnsfzcode)FromsfzcodeJson(strResult); if (rs.success) { if (rs.data.result== 2) { b = false; data = "{\"status\":-1,\"msg\":\""+ rs.data.desc+ "\"}"; } else if (rs.data.result == 1) { b = false; data = "{\"status\":-1,\"msg\":\"" + rs.data.desc + "\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"身份证和姓名检验失败!\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"调用身份证检验接口错误!\"}"; } } } if (b) { DateTime dt = DateTime.Now; model.RealName = realname; model.SFZ = sfz; if (ifuploadsfz == 1) { model.PayEWMPic1 = image0; model.PayEWMPic2 = image1; } daoUser.Update(model); if (ifuploadsfz == 1) { daoUser.UpdateuLevel("uLevel18", 1, model.Id); daoUser.UpdatePassword("uploadimage", "", model.Id); } else { daoUser.UpdateuLevel("uLevel18",2, model.Id); /*Double gxzmoney = Convert.ToDouble(Convert.ToDouble(config.webMoney45).ToString("f2")); if (gxzmoney > 0.00) { Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = model.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = gxzmoney; mjl2.Cutmoney = 0; mjl2.Totalmoney = model.umoney31 + gxzmoney; mjl2.addtime = dt; mjl2.BZContent = "实名认证赠送"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 3; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); daoUser.UpdateMoney("umoney31", gxzmoney, model.Id); } Mtxfw.Model.user_info umodel0 = daoUser.GetModel(model.ContactID); if (umodel0 != null) { gxzmoney = Convert.ToDouble(Convert.ToDouble(config.webMoney46).ToString("f2")); if (gxzmoney > 0.00) { Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel0.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = gxzmoney; mjl2.Cutmoney = 0; mjl2.Totalmoney = umodel0.umoney31 + gxzmoney; mjl2.addtime = dt; mjl2.BZContent = model.RealName + "实名认证赠送"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 3; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); daoUser.UpdateMoney("umoney31", gxzmoney, umodel0.Id); } }*/ } Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = dt; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb == 0 ? "app" : "web") + "实名认证"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"提交成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取线下门店信息----------------------------------------------------------------------------------------- /// /// 获取线下门店信息 /// protected string getbusinessinfo(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string ClsID = "", name = "", xydm = "", phone = "", dgzh = "", frname = "", fridcard = "", province = "", city = "", county = "", address = "", xcoo = "", ycoo = "", range = "", bank = "", bankcard = "", bankname = "", khname = "", bankkhh="", image = "", image0 = "", image1 = "", image2 = "", image3 = "", minimage = "", minimage0 = "", minimage1 = "", minimage2 = "", minimage3 = ""; int ifedit = 1; int IFFill = 0; string Agentrading = ""; Mtxfw.Model.business_info bmodel = daobusiness.GetModelByUserId(0, model.Id); if (bmodel != null) { ClsID = bmodel.ClsID.ToString(); name = bmodel.CompanyName; xydm = bmodel.Industry; phone = bmodel.ContactPhone; dgzh = bmodel.ClsnName2; frname = bmodel.frname; fridcard = bmodel.fridcard; province = bmodel.Province; city = bmodel.City; county = bmodel.County; IFFill = bmodel.IFFill; Agentrading = bmodel.Agentrading; address = bmodel.Companyaddress; xcoo = bmodel.xcoo; ycoo = bmodel.ycoo; range = bmodel.BusinessRange; bank = bmodel.InternetSite; bankcard = bmodel.Busroutes; bankname = bmodel.Introduction; khname = bmodel.ContactPeople; bankkhh = bmodel.Introduction; image = (bmodel.picture != "" ? bmodel.picture.Split('|')[0] : ""); image0 = (bmodel.Businesslicense != "" ? bmodel.Businesslicense.Split('|')[0] : ""); image1 = (bmodel.TaxRegistration != "" ? bmodel.TaxRegistration.Split('|')[0] : ""); image2 = (bmodel.Introduction2 != "" ? bmodel.Introduction2.Split('|')[0] : ""); image3 = (bmodel.Introduction3 != "" ? bmodel.Introduction3.Split('|')[0] : ""); } minimage = Mtxfw.Utility.Common.cminimage(image); minimage0 = Mtxfw.Utility.Common.cminimage(image0); minimage1 = Mtxfw.Utility.Common.cminimage(image1); minimage2 = Mtxfw.Utility.Common.cminimage(image2); minimage3 = Mtxfw.Utility.Common.cminimage(image3); string strdata = ",\"clslist\":["; DataSet ds = daolb.GetList("gtype=" + gtype + " and utype=1 Order By LBLinkID"); int clsindex = 0; int index = 0; string clsname = ""; foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { string id = Dr["id"].ToString(); string lbname = Dr["LBName"].ToString(); strdata += "{\"id\":" + id + ",\"name\":\"" + lbname + "\"},"; if (id == ClsID) { clsindex = index; clsname = lbname; } index += 1; } ds.Clear(); if (strdata != "") { if (strdata.Substring(strdata.Length - 1, 1) == ",") { strdata = strdata.Substring(0, strdata.Length - 1); } } strdata += "]"; string showtitle = "", showbody = ""; ds = daoArt.GetList1("id,title,Content", "gtype=" + gtype + " and id=226606 Order by AddTime desc"); if (ds.Tables[0].Rows.Count > 0) { showtitle = ds.Tables[0].Rows[0]["title"].ToString(); showbody = ds.Tables[0].Rows[0]["Content"].ToString(); } ds.Clear(); Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config.qiniuAccessKey, config.qiniuSecretKey); Qiniu.Storage.PutPolicy putPolicy = new Qiniu.Storage.PutPolicy(); putPolicy.Scope = config.qiniuScope; string upToken = Qiniu.Util.Auth.CreateUploadToken(mac, putPolicy.ToJsonString()); data = "{\"status\":1,\"msg\":\"获取成功!\",\"ylmoney\":\"" + config.webMoney74 + "\",\"ylmoney0\":\"" + config.webMoney75 + "\",\"sjylmoney\":\"" + model.umoney42.ToString() + "\",\"webbank\":\"" + config.webbank + "\",\"showtitle\":\"" + showtitle + "\",\"showbody\":\"" + Mtxfw.Utility.Common.ReplaceString(showbody) + "\"" + strdata + ",\"clsindex\":\"" + clsindex + "\",\"clsname\":\"" + clsname + "\",\"name\":\"" + name + "\",\"xydm\":\"" + xydm + "\",\"phone\":\"" + phone + "\",\"dgzh\":\"" + dgzh + "\",\"frname\":\"" + frname + "\",\"fridcard\":\"" + fridcard + "\",\"province\":\"" + province + "\",\"city\":\"" + city + "\",\"county\":\"" + county + "\",\"IFFill\":\"" + IFFill + "\",\"Agentrading\":\"" + Agentrading + "\",\"address\":\"" + address + "\",\"xcoo\":\"" + xcoo + "\",\"ycoo\":\"" + ycoo + "\",\"range\":\"" + range + "\",\"bank\":\"" + bank + "\",\"bankcard\":\"" + bankcard + "\",\"bankname\":\"" + bankname + "\",\"khname\":\"" + khname + "\",\"bankkhh\":\"" + bankkhh + "\",\"image\":\"" + image + "\",\"image0\":\"" + image0 + "\",\"image1\":\"" + image2 + "\",\"image2\":\"" + image2 + "\",\"image3\":\"" + image3 + "\",\"minimage\":\"" + minimage + "\",\"minimage0\":\"" + minimage0 + "\",\"minimage1\":\"" + minimage1 + "\",\"minimage2\":\"" + minimage2 + "\",\"minimage3\":\"" + minimage3 + "\",\"ifedit\":\"" + ifedit + "\",\"upToken\":\"" + upToken + "\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新线下门店信息----------------------------------------------------------------------------------------- /// /// 更新线下门店信息 /// protected string updatebusinessinfo(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["clsid"]) && !String.IsNullOrEmpty(context.Request["name"]) && !String.IsNullOrEmpty(context.Request["tel"]) && !String.IsNullOrEmpty(context.Request["image0"]) && !String.IsNullOrEmpty(context.Request["image1"]) && !String.IsNullOrEmpty(context.Request["image2"]) && !String.IsNullOrEmpty(context.Request["image3"]) && !String.IsNullOrEmpty(context.Request["image4"]) && context.Request["image5"] != null && !String.IsNullOrEmpty(context.Request["province"]) && !String.IsNullOrEmpty(context.Request["city"]) && !String.IsNullOrEmpty(context.Request["address"]) && !String.IsNullOrEmpty(context.Request["accountname"]) && !String.IsNullOrEmpty(context.Request["bankname"]) && !String.IsNullOrEmpty(context.Request["bankcard"]) && !String.IsNullOrEmpty(context.Request["bankaddress"])) {// && !String.IsNullOrEmpty(context.Request["number"]) && !String.IsNullOrEmpty(context.Request["money"]) int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()).Trim(); int clsid = Convert.ToInt32(context.Request["clsid"].ToString()); //string stryl = HttpUtility.UrlDecode(context.Request["money"].ToString()).Trim(); Double ylmoney = 0.0000; string clsname = ""; if (clsid > 0) { clsname = daolb.Getzd("lbname", "id=" + clsid).ToString(); } /*string dgzh = ""; if (!String.IsNullOrEmpty(context.Request["dgzh"])) { dgzh = context.Request["dgzh"].ToString(); } string frname = ""; if (!String.IsNullOrEmpty(context.Request["frname"])) { frname = context.Request["frname"].ToString(); } string fridcard = ""; if (!String.IsNullOrEmpty(context.Request["fridcard"])) { fridcard = context.Request["fridcard"].ToString(); }*/ string email = ""; if (!String.IsNullOrEmpty(context.Request["email"])) { email = context.Request["email"].ToString(); } string name = HttpUtility.UrlDecode(context.Request["name"].ToString()).Trim(); string tel = HttpUtility.UrlDecode(context.Request["tel"].ToString()).Trim(); string number = "";// HttpUtility.UrlDecode(context.Request["number"].ToString()).Trim(); string image0 = HttpUtility.UrlDecode(context.Request["image0"].ToString()).Trim(); string image1 = HttpUtility.UrlDecode(context.Request["image1"].ToString()).Trim(); string image2 = HttpUtility.UrlDecode(context.Request["image2"].ToString()).Trim(); string image3 = HttpUtility.UrlDecode(context.Request["image3"].ToString()).Trim(); string image4 = HttpUtility.UrlDecode(context.Request["image4"].ToString()).Trim(); string image5 = HttpUtility.UrlDecode(context.Request["image5"].ToString()).Trim(); string province = HttpUtility.UrlDecode(context.Request["province"].ToString()).Trim(); string city = HttpUtility.UrlDecode(context.Request["city"].ToString()).Trim(); string county = ""; if (!String.IsNullOrEmpty(context.Request["county"])) { county = HttpUtility.UrlDecode(context.Request["county"].ToString()).Trim(); } int IFFill = 0; if (!String.IsNullOrEmpty(context.Request["IFFill"])) { IFFill = Convert.ToInt32(context.Request["IFFill"].ToString()); } string Agentrading = ""; if (!String.IsNullOrEmpty(context.Request["Agentrading"])) { Agentrading = HttpUtility.UrlDecode(context.Request["Agentrading"].ToString()).Trim(); } string address = HttpUtility.UrlDecode(context.Request["address"].ToString()).Trim(); string longitude = ""; if (!String.IsNullOrEmpty(context.Request["longitude"])) { longitude = HttpUtility.UrlDecode(context.Request["longitude"].ToString()).Trim(); } string latitude = ""; if (!String.IsNullOrEmpty(context.Request["latitude"])) { latitude = HttpUtility.UrlDecode(context.Request["latitude"].ToString()).Trim(); } string fwbody = ""; if (!String.IsNullOrEmpty(context.Request["fwbody"])) { fwbody = HttpUtility.UrlDecode(context.Request["fwbody"].ToString()).Trim(); } string accountname = HttpUtility.UrlDecode(context.Request["accountname"].ToString()).Trim(); string bankname = HttpUtility.UrlDecode(context.Request["bankname"].ToString()).Trim(); string bankcard = HttpUtility.UrlDecode(context.Request["bankcard"].ToString()).Trim(); string bankaddress = HttpUtility.UrlDecode(context.Request["bankaddress"].ToString()).Trim(); string Starttime = ""; int EndtimeType = 0; string Endtime = ""; if (!String.IsNullOrEmpty(context.Request["Starttime"])) { Starttime = HttpUtility.UrlDecode(context.Request["Starttime"].ToString()); } if (!String.IsNullOrEmpty(context.Request["EndtimeType"])) { EndtimeType = Convert.ToInt32(context.Request["EndtimeType"].ToString()); } if (!String.IsNullOrEmpty(context.Request["Endtime"])) { Endtime = HttpUtility.UrlDecode(context.Request["Endtime"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (config.JJBZRDHBEnable == "1") { b = false; data = "{\"status\":0,\"msg\":\"线下门店暂时关闭!\"}"; } if (b) { if (model.uLevel16 == 1) { b = false; data = "{\"status\":0,\"msg\":\"线下门店申请正在审核中!\"}"; } } if (b) { if (model.uLevel16 == 2) { b = false; data = "{\"status\":0,\"msg\":\"线下门店申请已通过!\"}"; } } /*if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(stryl, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(stryl, @"^-?\d+$")) { b = false; data = "{\"status\":0,\"msg\":\"门店让利格式有误"+ stryl + "!\"}"; } else { ylmoney = Convert.ToDouble(Convert.ToDouble(stryl).ToString("f4")); if (ylmoney < Convert.ToDouble(Convert.ToDouble(config.webMoney74).ToString("f4")) || ylmoney > Convert.ToDouble(Convert.ToDouble(config.webMoney75).ToString("f4"))) { b = false; data = "{\"status\":0,\"msg\":\"门店让利范围"+ config.webMoney74 +"至" + config.webMoney75 + "!\"}"; } } }*/ if (Starttime != "" && Endtime != "") { if (b) { try { DateTime sdt = DateTime.ParseExact(Starttime, "HH:mm:ss", null); } catch { b = false; data = "{\"status\":0,\"msg\":\"开始时间格式不对!\"}"; } } if (b) { try { DateTime edt = DateTime.ParseExact(Endtime, "HH:mm:ss", null); } catch { b = false; data = "{\"status\":0,\"msg\":\"结束时间格式不对!\"}"; } } if (b) { if (daoHours.GetCount("gtype=" + gtype + " and utype=0 and EndtimeType=" + EndtimeType + " and MemberId=" + model.Id + " and Starttime='" + Starttime + "' and Endtime='" + Endtime + "'") > 0) { b = false; data = "{\"status\":0,\"msg\":\"已存在此营业时间!\"}"; } } } if (b) { string FileName, FileType = ".png", Folders; Folders = config.webUpPath; Folders = "/Files/grimage/" + model.Id + "/"; 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(); string strFilePath = Folders + FileName + FileType; string[] auploadpic = image5.Split(','); if (auploadpic[0] == "data:image/png;base64") { try { var encodedImage = auploadpic[1]; var decodedImage = Convert.FromBase64String(encodedImage); System.IO.File.WriteAllBytes(context.Server.MapPath(strFilePath), decodedImage); } catch (Exception err0) { Mtxfw.Utility.Common.WriteHtml("/weixin/uploadImage1.txt", image5); } } if (latitude == "" || longitude != "" || latitude == "0" || longitude != "0" || latitude == "0.000000" || longitude != "0.000000") { string strResult = Mtxfw.Utility.Common.getPage2("https://restapi.amap.com/v3/geocode/geo?key=3c34bd03ab3407d8c3f9b0c741cbc9d1&address=" + new DAL.province().GetProvince(province) + new DAL.city().GetCity(city) + new DAL.county().GetCounty(county) + address + "&city=" + new DAL.city().GetCity(city), "", "utf-8", true, false, ""); if (strResult.IndexOf("status") != -1) { VipSite.amap_Result ar = (VipSite.amap_Result)Fromamap_ResultJson(strResult); if (ar.status == "1") { string[] location = ar.geocodes[0].location.Split(','); latitude = location[0]; longitude = location[1]; } else { Model.User_Errlog mo = new Model.User_Errlog(); mo.DLID = 0; mo.ErrType = "地理编码接口错误"; mo.addtime = DateTime.Now; mo.ErrBody = model.CompanyName; mo.ErrBody2 = strResult; new DAL.User_Errlog().Add(mo); } } } Mtxfw.Model.business_info bmodel = new Mtxfw.Model.business_info(); bmodel.CompanyName = name; bmodel.ClsID = clsid; bmodel.ClsnName = clsname; bmodel.frname = "";// frname; bmodel.fridcard = "";// fridcard; bmodel.email = email; bmodel.ClsID2 = 0; bmodel.ClsnName2 = "";// dgzh; bmodel.Province = province; bmodel.City = city; bmodel.County = county; bmodel.IFFill = IFFill; bmodel.Agentrading = Agentrading; bmodel.Industry = number; bmodel.Introduction2 = (image3.IndexOf("http") == -1 ? config.webUrl : "") + image3;//身份证正面 bmodel.Introduction3 = (image4.IndexOf("http") == -1 ? config.webUrl : "") + image4;//身份证背面 bmodel.picture = (image0.IndexOf("http") == -1 ? config.webUrl : "") + image0; bmodel.BusinessRange = fwbody;//服务内容 bmodel.Businesslicense = (image1.IndexOf("http") == -1 ? config.webUrl : "") + image1;//营业执照 bmodel.TaxRegistration = (image2.IndexOf("http") == -1 ? config.webUrl : "") + image2;//门头照片 bmodel.Companyaddress = address; bmodel.InternetSite = bankname;//银行名称 bmodel.Busroutes = bankcard;//银行卡号 bmodel.Introduction = bankaddress;//银行开户行 bmodel.ContactPeople = accountname;//银行开户人 bmodel.ContactPhone = tel;//联系电话 bmodel.ApplyTime = DateTime.Now; bmodel.CompanyId = "0";//0银花优选1普民慧2普惠生活 bmodel.Discount = (strFilePath.IndexOf("http") == -1 ? config.webUrl : "") + strFilePath; bmodel.xcoo = latitude; bmodel.ycoo = longitude; bmodel.utype = "0"; bmodel.gtype = gtype; bmodel.seef = 0; bmodel.ApplyState = ""; bmodel.UserId = model.Id; daobusiness.Add(bmodel); daoUser.UpdateuLevel("uLevel16", 1, model.Id); model.uLevel16 = 1; if (Starttime != "" && Endtime != "") { Model.user_BusinessHours bhmodel = new Model.user_BusinessHours(); bhmodel.MemberId = model.Id; bhmodel.Starttime = Starttime; bhmodel.EndtimeType = EndtimeType; bhmodel.Endtime = Endtime; bhmodel.utype = 0; bhmodel.addtime = DateTime.Now; bhmodel.gtype = 0; daoHours.Add(bhmodel); } Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "银花优选APP申请线下门店"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"提交成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //申请修改门店资料----------------------------------------------------------------------------------------- /// /// 申请修改门店资料 /// protected string appupdatebusiness(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["clsid"]) && !String.IsNullOrEmpty(context.Request["name"]) && !String.IsNullOrEmpty(context.Request["tel"]) && !String.IsNullOrEmpty(context.Request["image0"]) && !String.IsNullOrEmpty(context.Request["image1"]) && !String.IsNullOrEmpty(context.Request["image2"]) && !String.IsNullOrEmpty(context.Request["image3"]) && !String.IsNullOrEmpty(context.Request["image4"]) && !String.IsNullOrEmpty(context.Request["province"]) && !String.IsNullOrEmpty(context.Request["city"]) && !String.IsNullOrEmpty(context.Request["address"]) && !String.IsNullOrEmpty(context.Request["longitude"]) && !String.IsNullOrEmpty(context.Request["latitude"]) && !String.IsNullOrEmpty(context.Request["accountname"]) && !String.IsNullOrEmpty(context.Request["bankname"]) && !String.IsNullOrEmpty(context.Request["bankcard"]) && !String.IsNullOrEmpty(context.Request["bankaddress"])) {// && !String.IsNullOrEmpty(context.Request["number"]) && !String.IsNullOrEmpty(context.Request["money"]) int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()).Trim(); int clsid = Convert.ToInt32(context.Request["clsid"].ToString()); string clsname = ""; if (clsid > 0) { clsname = daolb.Getzd("lbname", "id=" + clsid).ToString(); } string name = HttpUtility.UrlDecode(context.Request["name"].ToString()).Trim(); string tel = HttpUtility.UrlDecode(context.Request["tel"].ToString()).Trim(); string number = HttpUtility.UrlDecode(context.Request["number"].ToString()).Trim(); string image0 = HttpUtility.UrlDecode(context.Request["image0"].ToString()).Trim(); string image1 = HttpUtility.UrlDecode(context.Request["image1"].ToString()).Trim(); string image2 = HttpUtility.UrlDecode(context.Request["image2"].ToString()).Trim(); string image3 = HttpUtility.UrlDecode(context.Request["image3"].ToString()).Trim(); string image4 = HttpUtility.UrlDecode(context.Request["image4"].ToString()).Trim(); string province = HttpUtility.UrlDecode(context.Request["province"].ToString()).Trim(); string city = HttpUtility.UrlDecode(context.Request["city"].ToString()).Trim(); string county = ""; if (!String.IsNullOrEmpty(context.Request["county"])) { county = HttpUtility.UrlDecode(context.Request["county"].ToString()).Trim(); } int IFFill = 0; if (!String.IsNullOrEmpty(context.Request["IFFill"])) { IFFill = Convert.ToInt32(context.Request["IFFill"].ToString()); } string Agentrading = ""; if (!String.IsNullOrEmpty(context.Request["Agentrading"])) { Agentrading = HttpUtility.UrlDecode(context.Request["Agentrading"].ToString()).Trim(); } string address = HttpUtility.UrlDecode(context.Request["address"].ToString()).Trim(); string longitude = HttpUtility.UrlDecode(context.Request["longitude"].ToString()).Trim(); string latitude = HttpUtility.UrlDecode(context.Request["latitude"].ToString()).Trim(); string fwbody = ""; if (!String.IsNullOrEmpty(context.Request["fwbody"])) { fwbody = HttpUtility.UrlDecode(context.Request["fwbody"].ToString()).Trim(); } string accountname = HttpUtility.UrlDecode(context.Request["accountname"].ToString()).Trim(); string bankname = HttpUtility.UrlDecode(context.Request["bankname"].ToString()).Trim(); string bankcard = HttpUtility.UrlDecode(context.Request["bankcard"].ToString()).Trim(); string bankaddress = HttpUtility.UrlDecode(context.Request["bankaddress"].ToString()).Trim(); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (config.JJBZRDHBEnable == "1") { b = false; data = "{\"status\":0,\"msg\":\"暂时不能修改门店资料!\"}"; } } if (b) { if (model.uLevel16 == 0) { b = false; data = "{\"status\":0,\"msg\":\"未申请线下门店!\"}"; } } if (b) { if (model.uLevel16 == 1) { b = false; data = "{\"status\":0,\"msg\":\"门店未审核!\"}"; } } /*if (b) { if (!System.Text.RegularExpressions.Regex.IsMatch(stryl, @"^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$") && !System.Text.RegularExpressions.Regex.IsMatch(stryl, @"^-?\d+$")) { b = false; data = "{\"status\":0,\"msg\":\"门店让利格式有误"+ stryl + "!\"}"; } else { ylmoney = Convert.ToDouble(Convert.ToDouble(stryl).ToString("f4")); if (ylmoney < Convert.ToDouble(Convert.ToDouble(config.webMoney74).ToString("f4")) || ylmoney > Convert.ToDouble(Convert.ToDouble(config.webMoney75).ToString("f4"))) { b = false; data = "{\"status\":0,\"msg\":\"门店让利范围"+ config.webMoney74 +"至" + config.webMoney75 + "!\"}"; } } }*/ if (b) { Mtxfw.Model.business_info busmodel = daobusiness.GetModelByUserId(0, model.Id); if (busmodel != null) { Mtxfw.Model.business_info bmodel = daobusiness.GetModelByUserId(3, model.Id); if (bmodel != null) { if (bmodel.seef == 0) { b = false; data = "{\"status\":0,\"msg\":\"上次申请修改未审核!\"}"; } } if (b) { bmodel = new Model.business_info(); bmodel.CompanyName = name; bmodel.ClsID = clsid; bmodel.ClsnName = clsname; bmodel.frname = "";// frname; bmodel.fridcard = "";// fridcard; bmodel.email = ""; bmodel.ClsID2 = 0; bmodel.ClsnName2 = "";// dgzh; bmodel.Province = province; bmodel.City = city; bmodel.County = county; bmodel.IFFill = IFFill; bmodel.Agentrading = Agentrading; bmodel.Industry = number; bmodel.Introduction2 = (image3.IndexOf("http") == -1 ? config.webUrl : "") + image3;//身份证正面 bmodel.Introduction3 = (image4.IndexOf("http") == -1 ? config.webUrl : "") + image4;//身份证背面 bmodel.picture = (image0.IndexOf("http") == -1 ? config.webUrl : "") + image0; bmodel.BusinessRange = fwbody;//服务内容 bmodel.Businesslicense = (image1.IndexOf("http") == -1 ? config.webUrl : "") + image1;//营业执照 bmodel.TaxRegistration = (image2.IndexOf("http") == -1 ? config.webUrl : "") + image2;//门头照片 bmodel.Companyaddress = address; bmodel.InternetSite = bankname;//银行名称 bmodel.Busroutes = bankcard;//银行卡号 bmodel.Introduction = bankaddress;//银行开户行 bmodel.ContactPeople = accountname;//银行开户人 bmodel.ContactPhone = tel;//联系电话 bmodel.ApplyTime = DateTime.Now; bmodel.CompanyId = "0";//0银花优选1普民慧2普惠生活 bmodel.Discount = ""; bmodel.xcoo = latitude; bmodel.ycoo = longitude; bmodel.utype = "3"; bmodel.gtype = gtype; bmodel.seef = 0; bmodel.ApplyState = ""; bmodel.UserId = model.Id; daobusiness.Add(bmodel); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "银花优选APP申请修改门店资料"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"提交成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误0!\"}"; } } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取线上门店信息----------------------------------------------------------------------------------------- /// /// 获取线上门店信息 /// protected string getbusinessinfo0(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string strdata = ",\"clslist\":["; DataSet ds = daoCategory.GetList("gtype=" + gtype + " and ttype=8 Order By C_LinkID"); foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { string id = Dr["C_ID"].ToString(); string name = Dr["C_NAME"].ToString(); strdata += "{\"id\":" + id + ",\"name\":\"" + name + "\"},"; } ds.Clear(); if (strdata != "") { if (strdata.Substring(strdata.Length - 1, 1) == ",") { strdata = strdata.Substring(0, strdata.Length - 1); } } strdata += "]"; string cutvideoseconds = config.webMoney117; Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config.qiniuAccessKey, config.qiniuSecretKey); Qiniu.Storage.PutPolicy putPolicy = new Qiniu.Storage.PutPolicy(); putPolicy.Scope = config.qiniuScope; string upToken = Qiniu.Util.Auth.CreateUploadToken(mac, putPolicy.ToJsonString()); data = "{\"status\":1,\"msg\":\"获取成功!\",\"upToken\":\"" + upToken + "\"" + strdata + "}"; } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新线上门店信息----------------------------------------------------------------------------------------- /// /// 更新线上门店信息 /// protected string updatebusinessinfo0(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["clsid"]) && !String.IsNullOrEmpty(context.Request["name"]) && !String.IsNullOrEmpty(context.Request["tel"]) && !String.IsNullOrEmpty(context.Request["number"]) && !String.IsNullOrEmpty(context.Request["image0"]) && !String.IsNullOrEmpty(context.Request["image1"]) && !String.IsNullOrEmpty(context.Request["image2"]) && !String.IsNullOrEmpty(context.Request["image3"]) && !String.IsNullOrEmpty(context.Request["image4"]) && !String.IsNullOrEmpty(context.Request["province"]) && !String.IsNullOrEmpty(context.Request["city"]) && !String.IsNullOrEmpty(context.Request["address"]) && !String.IsNullOrEmpty(context.Request["longitude"]) && !String.IsNullOrEmpty(context.Request["latitude"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()).Trim(); int clsid = Convert.ToInt32(context.Request["clsid"].ToString()); string clsname = ""; if (clsid > 0) { clsname = daoCategory.Getzd("C_NAME", "C_ID=" + clsid).ToString(); } string name = HttpUtility.UrlDecode(context.Request["name"].ToString()).Trim(); string tel = HttpUtility.UrlDecode(context.Request["tel"].ToString()).Trim(); string number = HttpUtility.UrlDecode(context.Request["number"].ToString()).Trim(); string image0 = HttpUtility.UrlDecode(context.Request["image0"].ToString()).Trim(); string image1 = HttpUtility.UrlDecode(context.Request["image1"].ToString()).Trim(); string image2 = HttpUtility.UrlDecode(context.Request["image2"].ToString()).Trim(); string image3 = HttpUtility.UrlDecode(context.Request["image3"].ToString()).Trim(); string image4 = HttpUtility.UrlDecode(context.Request["image4"].ToString()).Trim(); string province = HttpUtility.UrlDecode(context.Request["province"].ToString()).Trim(); string city = HttpUtility.UrlDecode(context.Request["city"].ToString()).Trim(); string county = ""; if (!String.IsNullOrEmpty(context.Request["county"])) { county = HttpUtility.UrlDecode(context.Request["county"].ToString()).Trim(); } string address = HttpUtility.UrlDecode(context.Request["address"].ToString()).Trim(); string longitude = HttpUtility.UrlDecode(context.Request["longitude"].ToString()).Trim(); string latitude = HttpUtility.UrlDecode(context.Request["latitude"].ToString()).Trim(); string fwbody = ""; if (!String.IsNullOrEmpty(context.Request["fwbody"])) { fwbody = HttpUtility.UrlDecode(context.Request["fwbody"].ToString()).Trim(); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (model.uLevel30 == 1) { b = false; data = "{\"status\":0,\"msg\":\"线上门店申请正在审核中!\"}"; } } if (b) { if (model.uLevel30 == 2) { b = false; data = "{\"status\":0,\"msg\":\"线上门店申请已通过!\"}"; } } if (b) { Mtxfw.Model.business_info bmodel = new Mtxfw.Model.business_info(); bmodel.CompanyName = name; bmodel.ClsID = clsid; bmodel.ClsnName = clsname; bmodel.ClsID2 = 0; bmodel.ClsnName2 = ""; bmodel.frname = ""; bmodel.fridcard = ""; bmodel.email = ""; bmodel.Province = province; bmodel.City = city; bmodel.County = county; bmodel.Industry = number; bmodel.Introduction2 = (image3.IndexOf("http") == -1 ? config.webUrl : "") + image3;//身份证正面 bmodel.Introduction3 = (image4.IndexOf("http") == -1 ? config.webUrl : "") + image4;//身份证背面 bmodel.picture = (image0.IndexOf("http") == -1 ? config.webUrl : "") + image0; bmodel.BusinessRange = fwbody;//服务内容 bmodel.Businesslicense = (image1.IndexOf("http") == -1 ? config.webUrl : "") + image1;//营业执照 bmodel.TaxRegistration = (image2.IndexOf("http") == -1 ? config.webUrl : "") + image2;//生产许可证 bmodel.Companyaddress = address; bmodel.InternetSite = ""; bmodel.Busroutes = ""; bmodel.Introduction = ""; bmodel.ContactPeople = model.RealName;//联系人 bmodel.ContactPhone = tel;//联系电话 bmodel.ApplyTime = DateTime.Now; bmodel.CompanyId = "0"; bmodel.Discount = ""; bmodel.xcoo = latitude; bmodel.ycoo = longitude; bmodel.utype = "2"; bmodel.gtype = gtype; bmodel.seef = 0; bmodel.ApplyState = ""; bmodel.UserId = model.Id; daobusiness.Add(bmodel); daoUser.UpdateuLevel("uLevel30", 1, model.Id); model.uLevel30 = 1; Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = "申请线上门店"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"提交成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //申请镇街服务商----------------------------------------------------------------------------------------- /// /// 申请镇街服务商 /// protected string appzjfws(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["tel"]) && !String.IsNullOrEmpty(context.Request["province"]) && !String.IsNullOrEmpty(context.Request["city"]) && !String.IsNullOrEmpty(context.Request["IFFill"]) && context.Request["Tradingarea"] != null && !String.IsNullOrEmpty(context.Request["address"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()).Trim(); string tel = HttpUtility.UrlDecode(context.Request["tel"].ToString()).Trim(); string province = HttpUtility.UrlDecode(context.Request["province"].ToString()).Trim(); string city = HttpUtility.UrlDecode(context.Request["city"].ToString()).Trim(); string county = ""; if (!String.IsNullOrEmpty(context.Request["county"])) { county = HttpUtility.UrlDecode(context.Request["county"].ToString()).Trim(); } int IFFill = Convert.ToInt32(context.Request["IFFill"].ToString()); string tradingarea = HttpUtility.UrlDecode(context.Request["Tradingarea"].ToString()).Trim(); string address = HttpUtility.UrlDecode(context.Request["address"].ToString()).Trim(); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (model.uLevel50 > 0) { b = false; data = "{\"status\":0,\"msg\":\"您已申请过镇街服务商!\"}"; } } if (b) { if (model.uLevel49 == 0) { b = false; data = "{\"status\":0,\"msg\":\"请先购买镇街服务商商品!\"}"; } } if (b) { if (province == "" || province == "-1") { b = false; data = "{\"status\":0,\"msg\":\"省份必须选择!\"}"; } if (b) { if (city == "" || city == "-1") { b = false; data = "{\"status\":0,\"msg\":\"城市必须选择!\"}"; } } if (b) { if (county == "" || county == "-1") { b = false; data = "{\"status\":0,\"msg\":\"区县必须选择!\"}"; } } if (b) { if (tradingarea != "") { if (daoproxy.GetCount("TType=1 And AgenLevel=2 And Agenprovince='" + province + "' And Agencity='" + city + "' And Agencounty='" + county + "' and Agentrading='" + tradingarea + "'") > 0) { b = false; data = "{\"status\":0,\"msg\":\"所选区域已经有镇街服务商!\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"街道/乡镇必须选择!\"}"; } } } if (b) { Mtxfw.Model.user_proxy pmodel = new Model.user_proxy(); pmodel.MemberId = model.Id; pmodel.ATel = tel; pmodel.AgenLevel = 2; pmodel.AgenCost = 0; pmodel.Agenprovince = province; pmodel.Agencity = city; pmodel.Agencounty = county; pmodel.IFFill = IFFill; pmodel.Agentrading = tradingarea; pmodel.AAddress = address; pmodel.latitude = 0; pmodel.longitude = 0; pmodel.IFJS = 1; pmodel.TType = 1; pmodel.gtype = 0; daoproxy.Add(pmodel); daoUser.UpdateuLevel("uLevel50", 1, model.Id); model.uLevel50 = 1; Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb == 0 ? "app" : "web") + "申请镇街服务商"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"提交成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //申请企业品牌展示----------------------------------------------------------------------------------------- /// /// 申请企业品牌展示 /// protected string appadv(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["viewId"]) && !String.IsNullOrEmpty(context.Request["guige"]) && !String.IsNullOrEmpty(context.Request["zftype"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()).Trim(); int viewId = Convert.ToInt32(context.Request["viewId"].ToString()); int guige = Convert.ToInt32(context.Request["guige"].ToString()); int zftype = Convert.ToInt32(context.Request["zftype"].ToString()); string name = ""; string tel = ""; string image1 = ""; string image2 = ""; string image3 = ""; string image4 = ""; string province = ""; string city = ""; string county = ""; string Tradingarea = ""; string address = ""; string longitude = ""; string latitude = ""; if (!String.IsNullOrEmpty(context.Request["province"])) { province = context.Request["province"].ToString(); } if (!String.IsNullOrEmpty(context.Request["city"])) { city = context.Request["city"].ToString(); } if (!String.IsNullOrEmpty(context.Request["county"])) { county = context.Request["county"].ToString(); } if (!String.IsNullOrEmpty(context.Request["Tradingarea"])) { Tradingarea = context.Request["Tradingarea"].ToString(); } if (!String.IsNullOrEmpty(context.Request["address"])) { address = context.Request["address"].ToString(); } Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { bool b = true; string strzftitle = "余额支付"; if (zftype == 2) { strzftitle = "微信支付"; } else if (zftype == 3) { strzftitle = "支付宝支付"; } else if (zftype == 6) { strzftitle = "佣金支付"; } else if (zftype == 7) { strzftitle = "KSD支付"; } Double jyjg = 0; if (zftype == 7) { jyjg = daojjfp.GetJYJG(); } Mtxfw.Model.P_Product pm = daoProduct.GetModel(viewId); if (pm != null) { Mtxfw.Model.P_Guige gmodel = new DAL.P_Guige().GetModel(guige); if (gmodel != null) { Double ZSubTotal = Convert.ToDouble(gmodel.G_JG.ToString("f2")); Double ZSubTotal2 = Convert.ToDouble(gmodel.G_JG2.ToString("f2")); Double ZSubTotal0 = Convert.ToDouble(gmodel.G_JG0.ToString("f2")); Double ZSubTotal1 = Convert.ToDouble(gmodel.G_JG1.ToString("f2")); int busid = 0; string strbus = daobusiness.Getzd("id", "utype=1 and UserId=" + umodel.Id + "").ToString(); if (strbus != "") { busid = Convert.ToInt32(strbus); } DateTime dt = DateTime.Now; Int64 ResultId = 0; string wx_nonceStr = ""; string reResult = ""; string PayID = dt.ToString("yyMMddHHmmss", DateTimeFormatInfo.InvariantInfo) + umodel.Id; int type = 0; if (pm.P_CATEGORYs.IndexOf(",140,") != -1) { type = 1;//释放广告积分广告视频 } if (pm.P_CATEGORYs.IndexOf(",141,") != -1) { type = 2;//释放贡献值广告视频 } if (pm.P_CATEGORYs.IndexOf(",142,") != -1) { type = 3;//赚贡献值广告视频 } if (pm.P_CATEGORYs.IndexOf(",245,") != -1) { type = 4;//短视频广告 } /*var video0 = ""; if (type < 4) { if (!String.IsNullOrEmpty(context.Request["video0"])) { video0 = HttpUtility.UrlDecode(context.Request["video0"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"未上传视频!\"}"; } }*/ if (b) { if (zftype == 0 || zftype == 6 || zftype == 7) { if (zftype == 0) { if (Convert.ToDouble(Convert.ToDouble((umodel.umoney - umodel.umoney17).ToString("0.####")).ToString("f2")) < ZSubTotal) { b = false; data = "{\"status\":0,\"msg\":\"您的" + strzftitle.Replace("支付", "") + "不足" + ZSubTotal.ToString() + "!\"}"; } } else if (zftype == 6) { if (Convert.ToDouble(Convert.ToDouble(umodel.umoney32.ToString("0.####")).ToString("f2")) < Convert.ToDouble((ZSubTotal).ToString("f2"))) { b = false; data = "{\"status\":0,\"msg\":\"您的" + strzftitle.Replace("支付", "") + "不足" + (ZSubTotal).ToString() + "!\"}"; } } else if (zftype == 7) { Double jyZSubTotal = ZSubTotal; if (Convert.ToDouble(jyjg.ToString("f2")) > 0.00) { jyZSubTotal = Convert.ToDouble((ZSubTotal / jyjg).ToString("f2")); } if (Convert.ToDouble(Convert.ToDouble(umodel.umoney34.ToString("0.####")).ToString("f2")) < Convert.ToDouble(jyZSubTotal.ToString("f2"))) { b = false; data = "{\"status\":0,\"msg\":\"您的" + strzftitle.Replace("支付", "") + "不足" + (jyZSubTotal).ToString() + "!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["pwd"])) { string pwd = HttpUtility.UrlDecode(context.Request["pwd"].ToString()); if (b) { if (umodel.Password != Mtxfw.Utility.Security.EncryptString(pwd)) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,安全密码不正确!\"}"; } } } else { b = false; data = "{\"status\":0,\"msg\":\"安全密码不能为空!\"}"; } } } } if (b) { Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0;//已展示次数 mjl2.Addmoney = ZSubTotal; mjl2.Cutmoney = ZSubTotal0;//贡献值 mjl2.Totalmoney = ZSubTotal2;//可上传视频次数 mjl2.addtime = dt; mjl2.BZContent = address; mjl2.PayID = PayID; mjl2.OrdersIDs = province + "|" + city + "|" + county; mjl2.OrdersID = busid; mjl2.utype = 11; mjl2.utype2 = type; mjl2.Seef = 0; mjl2.seeftime = dt; mjl2.gtype = gtype; Int64 jlid = daojl2.Add(mjl2); daojl2.UpdateMinNumber((pm.utype == "7" ? 1 : 0), jlid); daojl2.UpdateMaxNumber(Convert.ToInt32(ZSubTotal1.ToString().Split('.')[0]), jlid);//更新展示次数 if (zftype == 0 || zftype == 6 || zftype == 7) { daojl2.UpdateSeef("seef", 1, "seeftime", dt, jlid); daoUser.UpdateuLevel("uLevel28", Convert.ToInt32(ZSubTotal2.ToString().Split('.')[0]), umodel.Id); 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 = "申请企业品牌展示"; 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", ZSubTotal, umodel.Id); umodel.umoney17 += ZSubTotal; } else if (zftype == 6) { mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = -ZSubTotal; mjl2.Cutmoney = 0; mjl2.Totalmoney = (umodel.umoney32 - ZSubTotal); mjl2.addtime = dt; mjl2.BZContent = "申请企业品牌展示"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 4; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); //减少买家余额 daoUser.UpdateMoney("umoney32", -ZSubTotal, umodel.Id); } else if (zftype == 7) { Double jyZSubTotal = ZSubTotal; if (Convert.ToDouble(jyjg.ToString("f2")) > 0.00) { jyZSubTotal = Convert.ToDouble((ZSubTotal / jyjg).ToString("f2")); } mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = -jyZSubTotal; mjl2.Cutmoney = 0; mjl2.Totalmoney = (umodel.umoney34 - jyZSubTotal); mjl2.addtime = dt; mjl2.BZContent = "申请企业品牌展示"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 14; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); //减少买家余额 daoUser.UpdateMoney("umoney34", -jyZSubTotal, umodel.Id); } Double money = Convert.ToDouble(ZSubTotal.ToString("f2"));//流量积分 if (type == 4) { if (money > 0.00) { mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = money; mjl2.Cutmoney = 0; mjl2.Totalmoney = (umodel.umoney38 + money); mjl2.addtime = dt; mjl2.BZContent = "申请品牌展示"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 13; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); //减少买家余额 daoUser.UpdateMoney("umoney38", money, umodel.Id); umodel.umoney38 += money; } } Double money0 = Convert.ToDouble(ZSubTotal0.ToString("f2"));//贡献值 if (money0 > 0.00) { mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = money0; mjl2.Cutmoney = 0; mjl2.Totalmoney = (umodel.umoney31 + money0); mjl2.addtime = dt; mjl2.BZContent = "申请企业品牌展示赠送"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 3; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); mjl2 = new Model.user_Results_jl2(); daoUser.UpdateMoney("umoney31", money0, umodel.Id); } if (pm.utype == "7") { if (umodel.uLevel26 == 0) { daoUser.UpdateuLevel("uLevel26", 1, umodel.Id); } } string[] ASuperiorsIDS = (umodel.ContactIDS).Split(','); int uds = 1, uds0 = 1; for (int ak = ASuperiorsIDS.Length - 2; ak > 0; ak--) { if (ASuperiorsIDS[ak] != "") { // DataSet ds = daoUser.GetList1("ID,uLevel26", "gtype=" + gtype + " and UserState='正常' And IFStores=0 And uLevel17=0 And id=" + ASuperiorsIDS[ak]); if (ds.Tables[0].Rows.Count > 0) { int dID = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString()); int YuLevel26 = Convert.ToInt32(ds.Tables[0].Rows[0]["uLevel26"].ToString()); if (uds == 1) { Double bfb = Convert.ToDouble(config.webMoney34); if (pm.utype == "6") { bfb = Convert.ToDouble(config.webMoney48); } if (YuLevel26 == 1) { bfb = Convert.ToDouble(config.webMoney35); if (pm.utype == "6") { bfb = Convert.ToDouble(config.webMoney49); } uds0 += 1; } Double umoney4 = Convert.ToDouble(Convert.ToDouble((money * bfb / 100).ToString("0.####")).ToString("f2")); if (umoney4 > 0.0000) { daoUser.UpdateMoney("umoney4", umoney4, dID); DAL.MemberStatistics.Statistics(dt, dID, 0, jlid, 1, 0, 1, "来源" + umodel.RealName + "分享奖励", gtype); } } if (YuLevel26 == 1) { if (uds0 == 1) { Double bfb = (Convert.ToDouble(config.webMoney35) - Convert.ToDouble(config.webMoney34)); if (pm.utype == "6") { bfb = (Convert.ToDouble(config.webMoney49) - Convert.ToDouble(config.webMoney48)); } Double umoney4 = Convert.ToDouble(Convert.ToDouble((money * bfb / 100).ToString("0.####")).ToString("f2")); if (umoney4 > 0.0000) { daoUser.UpdateMoney("umoney4", umoney4, dID); DAL.MemberStatistics.Statistics(dt, dID, 0, jlid, 1, 0, 1, "来源" + umodel.RealName + "创客奖励", gtype); } } uds0 += 1; } uds += 1; } ds.Clear(); } } DataSet dds; if (Tradingarea != "") { dds = daoproxy.GetList1("MemberId", "gtype=" + gtype + " and TType=1 And seef=1 And AgenLevel=2 And Agenprovince='" + province + "' And Agencity='" + city + "' And AgenCounty='" + county + "' And Agentrading like '%" + Tradingarea + "%'"); if (dds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow drv in dds.Tables[0].Rows) { int dID = Convert.ToInt32(drv["MemberId"].ToString()); Double bfb = Convert.ToDouble(Convert.ToDouble(config.webMoney62).ToString("f2")); Double umoney4 = Convert.ToDouble(((bfb / 100) * money).ToString("f2")); if (umoney4 > 0.00) { daoUser.UpdateMoney("umoney4", umoney4, dID); DAL.MemberStatistics.Statistics(dt, dID, 0, jlid, 1, 0, 1, "来源" + umodel.RealName + "乡镇代理奖励", gtype); } } } dds.Clear(); } dds = daoproxy.GetList1("MemberId", "gtype=" + gtype + " and TType=1 And seef=1 And AgenLevel=3 And Agenprovince='" + province + "' And Agencity='" + city + "' And AgenCounty='" + county + "'"); if (dds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow drv in dds.Tables[0].Rows) { int dID = Convert.ToInt32(drv["MemberId"].ToString()); Double bfb = Convert.ToDouble(Convert.ToDouble(config.webMoney61).ToString("f2")); Double umoney4 = Convert.ToDouble(((bfb / 100) * money).ToString("f2")); if (umoney4 > 0.00) { daoUser.UpdateMoney("umoney4", umoney4, dID); DAL.MemberStatistics.Statistics(dt, dID, 0, jlid, 1, 0, 1, "来源" + umodel.RealName + "县代理奖励", gtype); } } } dds.Clear(); dds = daoproxy.GetList1("MemberId", "gtype=" + gtype + " and TType=1 And seef=1 And AgenLevel=4 And Agenprovince='" + province + "' And Agencity='" + city + "'"); if (dds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow drv in dds.Tables[0].Rows) { int dID = Convert.ToInt32(drv["MemberId"].ToString()); Double bfb = Convert.ToDouble(Convert.ToDouble(config.webMoney60).ToString("f2")); Double umoney4 = Convert.ToDouble(((bfb / 100) * money).ToString("f2")); if (umoney4 > 0.00) { daoUser.UpdateMoney("umoney4", umoney4, dID); DAL.MemberStatistics.Statistics(dt, dID, 0, jlid, 1, 0, 1, "来源" + umodel.RealName + "市代理奖励", gtype); } } } dds.Clear(); dds = daoproxy.GetList1("MemberId", "gtype=" + gtype + " and TType=1 And seef=1 And AgenLevel=5 And Agenprovince='" + province + "'"); if (dds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow drv in dds.Tables[0].Rows) { int dID = Convert.ToInt32(drv["MemberId"].ToString()); Double bfb = Convert.ToDouble(Convert.ToDouble(config.webMoney58).ToString("f2")); Double umoney4 = Convert.ToDouble(((bfb / 100) * money).ToString("f2"));// if (umoney4 > 0.00) { daoUser.UpdateMoney("umoney4", umoney4, dID); DAL.MemberStatistics.Statistics(dt, dID, 0, jlid, 1, 0, 1, "来源" + umodel.RealName + "省代理奖励", gtype); } } } dds.Clear(); } else { string strProductName = pm.P_NAME.Replace("%", "度"); string openid = umodel.openid; if (!String.IsNullOrEmpty(context.Request["openid"])) { openid = HttpUtility.UrlDecode(context.Request["openid"].ToString()); } Double JFZSubTotal = ZSubTotal; Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results(); ModelResults.b0 = JFZSubTotal; 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 = zftype; ModelResults.b18 = 2; ModelResults.conent = "购买商品" + strProductName; ModelResults.Totalmoney = JFZSubTotal; 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; ResultId = daoResults.Add(ModelResults); daoResults.UpdateOrderIds(jlid.ToString(), ResultId); string body = "购买商品" + strProductName; if (ifweb == 0) { if (zftype == 2) { SortedDictionary pay_dic = new SortedDictionary(); string appid = config.weixinAPP_ID; string mch_id = config.webPARTNER; string PARTNER_KEY = config.webPARTNER_KEY; wx_nonceStr = Mtxfw.Utility.Interface_WxPay.getNoncestr(); string timestamp = Mtxfw.Utility.Interface_WxPay.getTimestamp(); string notify_url = config.webwxnotify_url; string ip = Mtxfw.Utility.Common.GetIP; string total_fee = (JFZSubTotal * 100).ToString(); string trade_type = "APP"; pay_dic.Add("appid", appid); pay_dic.Add("mch_id", mch_id); pay_dic.Add("nonce_str", wx_nonceStr); pay_dic.Add("body", body); pay_dic.Add("out_trade_no", PayID); pay_dic.Add("total_fee", total_fee); pay_dic.Add("spbill_create_ip", ip); pay_dic.Add("notify_url", notify_url); pay_dic.Add("trade_type", trade_type); string get_PaySign = Mtxfw.Utility.Interface_WxPay.BuildRequest(pay_dic, PARTNER_KEY); reResult = ""; reResult += "" + appid + ""; reResult += "" + mch_id + ""; reResult += ""; reResult += "" + wx_nonceStr + ""; reResult += "" + body + ""; reResult += ""; reResult += ""; reResult += "" + PayID + ""; reResult += ""; reResult += "" + total_fee + ""; reResult += "" + ip + ""; reResult += ""; reResult += ""; reResult += ""; reResult += "" + notify_url + ""; reResult += "" + trade_type + ""; reResult += ""; reResult += ""; reResult += "" + get_PaySign + ""; reResult += ""; Mtxfw.Utility.Common.WriteHtml("/weixin/appreResult.txt", reResult.ToString()); } else { string URL = config.aliURL; string APP_ID = config.aliAPP_ID; string APP_PRIVATE_KEY = config.aliAPP_PRIVATE_KEY; string CHARSET = "UTF-8"; string notifyUrl = config.aliPAY_notify_url; Aop.Api.CertParams certParams = new Aop.Api.CertParams { AlipayPublicCertPath = context.Server.MapPath("/App_Data/alipaygyzs.crt"), AppCertPath = context.Server.MapPath("/App_Data/alipayyygyzs.crt"), RootCertPath = context.Server.MapPath("/App_Data/alipaygzs.crt") }; Aop.Api.IAopClient client = new Aop.Api.DefaultAopClient(URL, APP_ID, APP_PRIVATE_KEY, "json", "1.0", "RSA2", CHARSET, false, certParams); Aop.Api.Request.AlipayTradeAppPayRequest request = new Aop.Api.Request.AlipayTradeAppPayRequest(); //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 Aop.Api.Domain.AlipayTradeAppPayModel dmodel = new Aop.Api.Domain.AlipayTradeAppPayModel(); dmodel.Body = "" + strProductName + ""; dmodel.Subject = "购买商品"; dmodel.TotalAmount = JFZSubTotal.ToString("f2"); dmodel.ProductCode = "QUICK_MSECURITY_PAY"; dmodel.OutTradeNo = PayID; dmodel.TimeoutExpress = "30m"; request.SetNotifyUrl(notifyUrl); request.SetBizModel(dmodel); //这里和普通的接口调用不同,使用的是sdkExecute Aop.Api.Response.AlipayTradeAppPayResponse response = client.SdkExecute(request); //HttpUtility.HtmlEncode是为了输出到页面时防止被浏览器将关键参数html转义,实际打印到日志以及http传输不会有这个问题 reResult = "" + response.Body + ""; } } } Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = umodel.Id; logmodel.AddTime = dt; logmodel.IP = (umodel.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); logmodel.Body = (ifweb == 0 ? "app" : "web") + "申请企业品牌展示,支付方式:" + strzftitle; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); int ordercount = daoorder.GetCount("IFDelete=0 and UserId=" + umodel.Id + ""); string strdata = ""; umodel = daoUser.GetModel(userId); strdata = returndata(umodel); data = "{\"status\":1,\"msg\":\"" + ((zftype == 0 || zftype == 6 || zftype == 7) ? "下单成功" : (ifweb == 0 ? "支付中..." : "正在跳转支付中...")) + "\",\"reResult\":\"" + reResult + "\",\"ResultId\":\"" + (ifweb == 0 ? ResultId.ToString() : PayID) + "\",\"noncestr\":\"" + wx_nonceStr + "\",\"busid\":\"" + busid + "\"," + strdata + "}"; } } } else { data = "{\"status\":0,\"msg\":\"参数错误0!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //完善企业资料----------------------------------------------------------------------------------------- /// /// 完善企业资料 /// protected string appcompay(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()).Trim(); string name = ""; string tel = ""; string image1 = ""; string image2 = ""; string image3 = ""; string image4 = ""; string province = ""; string city = ""; string county = ""; string address = ""; string longitude = ""; string latitude = ""; Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { bool b = true; int busid = 0; string strbus = daobusiness.Getzd("id", "utype=1 and UserId=" + umodel.Id + "").ToString(); if (strbus != "") { busid = Convert.ToInt32(strbus); } DateTime dt = DateTime.Now; if (busid == 0) { if (!String.IsNullOrEmpty(context.Request["name"])) { name = HttpUtility.UrlDecode(context.Request["name"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"公司名称不能为空!\"}"; } if (b) { if (!String.IsNullOrEmpty(context.Request["tel"])) { tel = HttpUtility.UrlDecode(context.Request["tel"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"联系电话不能为空!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["image1"])) { image1 = HttpUtility.UrlDecode(context.Request["image1"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"营业执照必须上传!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["image2"])) { image2 = HttpUtility.UrlDecode(context.Request["image2"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"生产许可证必须上传!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["image3"])) { image3 = HttpUtility.UrlDecode(context.Request["image3"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"身份证正面必须上传!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["image4"])) { image4 = HttpUtility.UrlDecode(context.Request["image4"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"身份证反面必须上传!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["province"])) { province = HttpUtility.UrlDecode(context.Request["province"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"省份未选择!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["city"])) { city = HttpUtility.UrlDecode(context.Request["city"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"城市未选择!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["county"])) { county = HttpUtility.UrlDecode(context.Request["county"].ToString()).Trim(); } } if (b) { if (!String.IsNullOrEmpty(context.Request["address"])) { address = HttpUtility.UrlDecode(context.Request["address"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"详细地址不能为空!\"}"; } } if (b) { if (!String.IsNullOrEmpty(context.Request["longitude"]) && !String.IsNullOrEmpty(context.Request["latitude"])) { longitude = HttpUtility.UrlDecode(context.Request["longitude"].ToString()).Trim(); latitude = HttpUtility.UrlDecode(context.Request["latitude"].ToString()).Trim(); } else { b = false; data = "{\"status\":0,\"msg\":\"未标注地图!\"}"; } } } else { b = false; data = "{\"status\":0,\"msg\":\"已完善过企业资料!\"}"; } if (b) { Mtxfw.Model.business_info model = new Mtxfw.Model.business_info(); model.CompanyName = name; model.ClsID = 0; model.ClsnName = ""; model.ClsID2 = 0; model.ClsnName2 = ""; model.frname = ""; model.fridcard = ""; model.email = ""; model.Province = province; model.City = city; model.County = county; model.Industry = ""; model.Introduction2 = image3;//身份证正面 model.Introduction3 = image4;//身份证背面 model.Busroutes = ""; model.picture = ""; model.BusinessRange = "";//服务内容 model.Businesslicense = image1;//营业执照 model.TaxRegistration = image2;//生产许可证 model.Companyaddress = address; model.InternetSite = ""; model.Busroutes = ""; model.Introduction = ""; model.ContactPeople = umodel.RealName;//联系人 model.ContactPhone = tel;//联系电话 model.ApplyTime = DateTime.Now; model.CompanyId = "0"; model.Discount = ""; model.xcoo = latitude; model.ycoo = longitude; model.utype = "1"; model.gtype = gtype; model.seef = 0; model.ApplyState = ""; model.UserId = umodel.Id; busid = new DAL.business_info().Add(model); new DAL.business_info().UpdateSel("seef", 1, busid); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = umodel.Id; logmodel.AddTime = dt; logmodel.IP = (umodel.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); logmodel.Body = (ifweb == 0 ? "app" : "web") + "完善企业资料"; logmodel.UType = 0; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); string strdata = ""; umodel = daoUser.GetModel(userId); strdata = returndata(umodel); data = "{\"status\":1,\"msg\":\"提交成功\"," + strdata + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取上传视频数据----------------------------------------------------------------------------------------- /// /// 获取上传视频数据 /// protected string getupvideodata(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info umodel = daoUser.GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { string cutvideoseconds = config.webMoney117; Qiniu.Util.Mac mac = new Qiniu.Util.Mac(config.qiniuAccessKey, config.qiniuSecretKey); Qiniu.Storage.PutPolicy putPolicy = new Qiniu.Storage.PutPolicy(); putPolicy.Scope = config.qiniuScope; string upToken = Qiniu.Util.Auth.CreateUploadToken(mac, putPolicy.ToJsonString()); int ifytfg = 0; if (daobusiness.GetCount("utype=1 and UserId=" + userId + "") > 0) { ifytfg = 1; } int ifyscw = 0; if (umodel.uLevel28 <= 0) { ifyscw = 1; } data = "{\"status\":1,\"ifytfg\":" + ifytfg + ",\"ifyscw\":" + ifyscw + ",\"upToken\":\"" + upToken + "\",\"kupvideonum\":" + umodel.uLevel28 + ",\"cutvideoseconds\":\"" + cutvideoseconds + "\"}"; } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //上传企业视频----------------------------------------------------------------------------------------- /// /// 上传企业视频 /// protected string uploadvideo(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["t"]) && !String.IsNullOrEmpty(context.Request["videotitle"]) && !String.IsNullOrEmpty(context.Request["videofile"]) && !String.IsNullOrEmpty(context.Request["uploadpic"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int t = Convert.ToInt32(context.Request["t"].ToString()); string videotitle = HttpUtility.UrlDecode(context.Request["videotitle"].ToString()); string videofile = HttpUtility.UrlDecode(context.Request["videofile"].ToString()); string uploadpic = HttpUtility.UrlDecode(context.Request["uploadpic"].ToString()); string FileId = ""; if (!String.IsNullOrEmpty(context.Request["FileId"])) { FileId = HttpUtility.UrlDecode(context.Request["FileId"].ToString()); } Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { bool b = true; DateTime dt = DateTime.Now; int busid = 0; string strbus = daobusiness.Getzd("id", "utype=1 and UserId=" + umodel.Id + "").ToString(); if (strbus != "") { busid = Convert.ToInt32(strbus); } if (b) { if (busid == 0) { b = false; data = "{\"status\":0,\"msg\":\"你未申请投放广告!\"}"; } } if (b) { if (umodel.uLevel28 <= 0) { b = false; data = "{\"status\":0,\"msg\":\"可上传视频数量为0!\"}"; } } if (b) { if (FileId == "" && videofile.IndexOf("https://fv.pmhapp.cn/mdavideo/") == -1) { //Mtxfw.Utility.Common.WriteHtml("/weixin/uploadFileId.txt", FileId); VodUploadClient client = new VodUploadClient(config.AccessKeyId, config.AccessKeySecret); VodUploadRequest request = new VodUploadRequest(); request.ClassId = 659337; request.MediaFilePath = context.Server.MapPath(videofile); try { // 将原来的同步调用: // VodUploadResponse response = client.Upload("ap-beijing", request); // 替换为异步调用并等待结果: VodUploadResponse response = client.Upload("ap-beijing", request).GetAwaiter().GetResult(); videofile = response.MediaUrl; FileId = response.FileId; File.Delete(context.Server.MapPath(videofile)); } catch (Exception err) { Mtxfw.Utility.Common.WriteHtml("/weixin/uploadFileerr.txt", err.ToString()); } } Mtxfw.Model.Article model = new Mtxfw.Model.Article(); model.senderid = umodel.Id;//公司会员ID model.receiverid = 0; model.Title = videotitle; model.ParentID = (t == 4 ? 10 : (t == 3 ? 15 : t == 2 ? 14 : t == 1 ? 18 : 16)); model.CategoryId = busid.ToString(); model.AddTime = DateTime.Now; model.Author = uploadpic; model.Paths = videofile; model.Content = ""; model.Content2 = "";//商品IDS model.Paths2 = FileId;// model.KeyWords = "-1";//权限区域省份 model.media_id = "";//权限区域城市 model.thumb_media_id = "";//权限区域区县 model.wtype = 0; model.wtype2 = 0; string strzd = daoArt.Getzd("max(LinkID)", "ParentID=" + model.ParentID).ToString(); if (strzd != "") { model.LinkID = (Convert.ToInt32(strzd) + 1); } else { model.LinkID = 0; } model.Seef = 0; model.gtype = gtype; model.id = daoArt.Add(model); umodel.uLevel28 -= 1; daoUser.UpdateuLevel0("uLevel28", -1, 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 = 2; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"上传成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取上传视频记录----------------------------------------------------------------------------------------- /// /// 获取上传视频记录 /// protected string getupvideolist(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string strdata = ""; 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 = daoArt.GetDataSet(groupby, strOrder, "id,ParentID,title,Author,Paths,tfllmoney,zscs,gxzmoney,csday,seef", "", "gtype=" + gtype + " and senderid=" + model.Id + (t ==1? " and ParentID=10 and seef=1" : " and (ParentID=10 or ParentID=14 or ParentID=15 or ParentID=16 or ParentID=18)"), 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 id = Convert.ToInt32(Dr["id"]); int ParentID = Convert.ToInt32(Dr["ParentID"]); string name = Dr["title"].ToString(); string image = Dr["Author"].ToString(); string video = Dr["Paths"].ToString(); Double tfllmoney = Convert.ToDouble(Dr["tfllmoney"]); int zscs = Convert.ToInt32(Dr["zscs"]); Double gxzmoney = Convert.ToDouble(Dr["gxzmoney"]); int zxcs = Convert.ToInt32(Dr["csday"]); int seef = Convert.ToInt32(Dr["seef"]); int type = 0; string strtype = "开屏视频"; if (ParentID == 18) { type = 1; strtype = "释放流量积分视频"; } if (ParentID == 14) { type = 2; strtype = "释放贡献值视频"; } if (ParentID == 15) { type = 3; strtype = "赚贡献值视频"; } if (ParentID == 10) { type = 4; strtype = "短视频"; } name = ("[" + strtype + "]" + name); strdata += "{\"id\":\"" + id + "\",\"type\":\"" + type + "\",\"tfllmoney\":\"" + tfllmoney.ToString() + "\",\"zscs\":\"" + zscs + "\",\"gxzmoney\":\"" + gxzmoney.ToString() + "\",\"zxcs\":\"" + zxcs + "\",\"name\":\"" + name + "\",\"video\":\"" + Mtxfw.Utility.Common.cfileurl(video) + "\",\"image\":\"" + (image.IndexOf("http") != -1 ? image : Mtxfw.Utility.Common.GetCoverPic(image, "220x220", "cut")) + "\",\"seef\":\"" + (seef == 1 ? "已审核" : "未审核") + "\"}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); int ifytfg = 0; if (Start == 0) { if (daobusiness.GetCount("utype=1 and UserId=" + userId + "") > 0) { ifytfg = 1; } } data = "{\"status\":1,\"ifytfg\":" + ifytfg + ",\"data\":[" + strdata + "]," + returndata(model) + "}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } return data; } #endregion #region //获取申请企业品牌展示记录----------------------------------------------------------------------------------------- /// /// 获取申请企业品牌展示记录 /// protected string getappadvlist(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["t"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int t = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["t"].ToString())); if (t == 11) { Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string sql = " and seef=1"; string strdata = ""; string groupby = ""; string strOrder = "addtime desc,id desc"; int Start = 0; int Limit = 30; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds = new Mtxfw.DAL.user_Results_jl2().GetDataSet(groupby, strOrder, "id,utype2,MemberId2,MaxNumber,Addmoney,Cutmoney,Totalmoney,seef,addtime", "", "gtype=" + gtype + " and utype=" + t + " And IFDelete=0 and MemberId=" + model.Id + "" + sql, 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 id = Convert.ToInt32(Dr["id"]); int type = Convert.ToInt32(Dr["utype2"]); int MemberId2 = Convert.ToInt32(Dr["MemberId2"]); int MaxNumber = Convert.ToInt32(Dr["MaxNumber"]); string Addmoney = Convert.ToDouble(Convert.ToDouble(Dr["Addmoney"]).ToString("0.####")).ToString("f2"); string Cutmoney = Convert.ToDouble(Dr["Cutmoney"]).ToString("0.####"); string Totalmoney = Convert.ToDouble(Dr["Totalmoney"]).ToString("0.####"); int seef = Convert.ToInt32(Dr["seef"]); string addtime = Dr["addtime"].ToString(); strdata += "{\"id\":\"" + id + "\",\"type\":\"" + type + "\",\"money\":\"" + Addmoney + "\",\"gxz\":\"" + Cutmoney + "\",\"znum\":\"" + MaxNumber + "\",\"synum\":\"" + (MaxNumber - MemberId2) + "\",\"kscspnum\":\"" + Totalmoney + "\",\"seef\":\"" + (seef == 2 ? "已投放" : "未投放") + "\",\"addtime\":\"" + addtime + "\"}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误2\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } return data; } #endregion #region //获取视频详情----------------------------------------------------------------------------------------- /// /// 获取视频详情 /// protected string getvideodetail(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { Double tfllmoney = Convert.ToDouble(amodel.tfllmoney.ToString("f2"));//广告金额 Double zscs = amodel.zscs;//展示次数 Double gxzmoney = Convert.ToDouble(amodel.gxzmoney.ToString("f2"));//贡献值 data = "{\"status\":1,\"title\":\"" + amodel.Title + "\",\"video\":\"" + Mtxfw.Utility.Common.cfileurl(amodel.Paths) + "\",\"image\":\"" + (amodel.Author.IndexOf("http") != -1 ? amodel.Author : Mtxfw.Utility.Common.GetCoverPic(amodel.Author, "720x360", "cut")) + "\",\"tfllmoney\":\"" + tfllmoney.ToString() + "\",\"zscs\":\"" + zscs + "\",\"gxzmoney\":\"" + gxzmoney.ToString() + "\"}"; } else { data = "{\"status\":0,\"msg\":\"参数错误0\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } return data; } #endregion #region //投放流量----------------------------------------------------------------------------------------- /// /// 投放流量 /// protected string qytfll(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"]))// && !String.IsNullOrEmpty(context.Request["num"]) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); int num = 1; Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { bool b = true; string strzftitle = "流量券支付"; if (num <= 0) { b = false; data = "{\"status\":0,\"msg\":\"数量必须大于0!\"}"; } Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { DateTime dt = DateTime.Now; if (b) { if (amodel.ParentID != 10) { b = false; data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } if (b) { Double prodPrice = Convert.ToDouble((amodel.tfllmoney * num).ToString("f2"));//广告金额 int zscs = (amodel.zscs * num);//展示次数 //Double gxzmoney = Convert.ToDouble((amodel.gxzmoney * num).ToString("f2"));//贡献值 if (b) { if (Convert.ToDouble(Convert.ToDouble(umodel.umoney38.ToString("0.####")).ToString("f2")) < prodPrice) { b = false; data = "{\"status\":0,\"msg\":\"您的流量券余额不足" + prodPrice.ToString() + "!\"}"; } } if (b) { string orderid = dt.ToString("yyMMddHHmmss", DateTimeFormatInfo.InvariantInfo); Mtxfw.Model.user_Results ModelResults = new Mtxfw.Model.user_Results(); ModelResults.b0 = prodPrice; ModelResults.b1 = zscs;//共展示次数 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 = num; ModelResults.conent = amodel.Title; ModelResults.Totalmoney = prodPrice; ModelResults.MemberId = umodel.Id; ModelResults.UserId = id; ModelResults.ListNumber = orderid; ModelResults.Managers = ""; ModelResults.Seef = 0; ModelResults.utype = "7"; ModelResults.addtime = dt; ModelResults.gtype = gtype; Int64 Rid = daoResults.Add(ModelResults); daoArt.UpdateuSel0("csday", zscs, amodel.id); Model.user_Results_jl2 mjl2; mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = -prodPrice; mjl2.Cutmoney = 0; mjl2.Totalmoney = (umodel.umoney38 - prodPrice); mjl2.addtime = dt; mjl2.BZContent = "投放流量"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 13; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); //减少买家余额 daoUser.UpdateMoney("umoney38", -prodPrice, umodel.Id); umodel.umoney38 -= prodPrice; /*mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = umodel.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = gxzmoney; mjl2.Cutmoney = 0; mjl2.Totalmoney = (umodel.umoney31 + gxzmoney); mjl2.addtime = dt; mjl2.BZContent = "投放流量赠送"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 3; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = dt; mjl2.gtype = gtype; daojl2.Add(mjl2); //减少买家余额 daoUser.UpdateMoney("umoney31", gxzmoney, umodel.Id); umodel.umoney31 += gxzmoney;*/ 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 = "投放流量" + amodel.Title; logmodel.UType = 2; logmodel.gtype = gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"投放成功!\"," + returndata(umodel) + "}"; } } } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取投放流量记录--------------------------------------------------------------------------------- /// /// 获取投放流量记录 /// protected string gettflllist(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { /*string strdata = ""; string strsql = " and UserId=" + model.Id + " and ttype=4 And O_Payed>0"; string groupby = ""; string strOrder = "O_SubmitDate 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 = daoorder.GetDataSet(groupby, strOrder, "id,orderid,Totalprice,poid,pcount,O_Payed_Date,(select b.title from Article b where b.id=addressid) as ggmc", "", "gtype=" + gtype + " and IFDelete=0" + 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) { string O_Id = Dr["id"].ToString(); string orderid = Dr["orderid"].ToString(); string Totalprice = Convert.ToDouble(Dr["Totalprice"]).ToString("f2"); int zxnum = Convert.ToInt32(Dr["poid"].ToString()); int synum = Convert.ToInt32(Dr["pcount"].ToString()); string ggmc = Dr["ggmc"].ToString(); string time = Dr["O_Payed_Date"].ToString(); strdata += "{\"id\":\"" + O_Id + "\",\"orderid\":\"" + orderid + "\",\"price\":\"" + Totalprice + "\",\"name\":\"" + ggmc + "\",\"zxnum\":\"" + zxnum + "\",\"synum\":\"" + (zxnum - synum) + "\",\"time\":\"" + time + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } else { strdata = ""; } ds.Clear();*/ string strdata = ""; 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 = daoResults.GetDataSet(groupby, strOrder, "id,b0,b1,b2,addtime,seef,conent,ListNumber", "", "gtype=" + gtype + " and MemberId=" + model.Id + " and utype=7 And IFDelete=0", 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 id = Convert.ToInt32(Dr["id"]); string je = Convert.ToDouble(Dr["b0"]).ToString("f2"); int znum = Convert.ToInt32(Dr["b1"].ToString().Split('.')[0]); int synum = Convert.ToInt32(Dr["b2"].ToString().Split('.')[0]); string addtime = Dr["addtime"].ToString(); int seef = Convert.ToInt32(Dr["seef"].ToString()); string conent = Dr["conent"].ToString(); string orderid = Dr["ListNumber"].ToString(); strdata += "{\"id\":\"" + id + "\",\"orderid\":\"" + orderid + "\",\"price\":\"" + je + "\",\"name\":\"" + conent + "\",\"zxnum\":\"" + znum + "\",\"synum\":\"" + (znum - synum) + "\",\"time\":\"" + addtime + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } return data; } #endregion #region //获取短视频列表----------------------------------------------------------------------------------------- /// /// 获取短视频列表 /// protected string getggsplist(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; bool b = true; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { string strdata = ""; string province = "", city = "", county = "", sql = ""; bool dsj = false; if (!String.IsNullOrEmpty(context.Request["latitude"]) && !String.IsNullOrEmpty(context.Request["longitude"])) { string latitude = context.Request["latitude"].ToString(); string longitude = context.Request["longitude"].ToString(); sql = " or (KeyWords='-2' and dbo.GetDistance(" + latitude + "," + longitude + ",latitude,longitude)<=2000)"; string Address = Mtxfw.Utility.Common.GetAddress(longitude, latitude); if (Address != "") { string stra = Address.Substring(0, 2); string strzd = new DAL.province().Getzd("provinceid", "provincename like '%" + stra + "%'").ToString(); if (strzd != "") { province = strzd; } if (province != "") { if (Address.IndexOf("市") != -1) { strzd = new DAL.city().Getzd("cityid", "provinceid='" + province + "' and charindex(cityname,'" + Address + "')>0").ToString(); if (strzd != "") { city = strzd;// + (province!=""? " and provinceid = '"+ province + "'" : "") } if (city != "") { strzd = new DAL.county().Getzd("countyid", "cityid='" + city + "' and charindex(countyname,'" + Address + "')>0").ToString(); if (strzd != "") { county = strzd; } } else { DataSet ds = new DAL.county().GetList("charindex(countyname,'" + Address + "')>0"); if (ds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { string cityid = Dr["cityid"].ToString(); string countyid = Dr["countyid"].ToString(); if (new DAL.city().GetCount("provinceid='" + province + "' and cityid='" + cityid + "'") > 0) { county = countyid; city = cityid; } } } ds.Clear(); dsj = true; } //Mtxfw.Utility.Common.WriteHtml("/weixin/getindexdata0.txt", province + "|" + city + "|" + county + "|" + Address); } else { DataSet ds = new DAL.city().GetList("provinceid='" + province + "'"); if (ds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { string cityid = Dr["cityid"].ToString(); strzd = new DAL.county().Getzd("countyid", "cityid='" + cityid + "' and charindex(countyname,'" + Address + "')>0").ToString(); if (strzd != "") { county = strzd; city = cityid; } } } ds.Clear(); //Mtxfw.Utility.Common.WriteHtml("/weixin/getindexdata1.txt", province + "|" + city + "|" + county + "|" + Address); } } else { DataSet ds = new DAL.city().GetList("charindex(cityname,'" + Address + "')>0"); if (ds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { string cityid = Dr["cityid"].ToString(); string provinceid = Dr["provinceid"].ToString(); province = provinceid; city = cityid; } } ds.Clear(); strzd = new DAL.county().Getzd("countyid", "cityid='" + city + "' and charindex(countyname,'" + Address + "')>0").ToString(); if (strzd != "") { county = strzd; } } //Mtxfw.Utility.Common.WriteHtml("/weixin/getggsplist.txt", province + "|" + city + "|" + county + "|" + Address); sql += " or (KeyWords='" + province + "' and media_id='" + city + "' and thumb_media_id='" + county + "') or (KeyWords='" + province + "' and media_id='" + city + "' and thumb_media_id='') or (KeyWords='" + province + "' and media_id='' and thumb_media_id='')"; } } string strsql = "gtype=0 and parentid=10 And Seef=1 and csday>0 and (KeyWords='-1' " + sql + ")"; string groupby = ""; string strOrder = "NEWID()"; int Start = 0; int Limit = 100; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds0 = daoArt.GetDataSet(groupby, strOrder, "id,senderid,receiverid,wtype,wtype2,ltype,hasRead,title,Author,Paths,jlsecond,Content2,addtime", "", strsql + "", Start, Limit, out Recount); int dtcount = Recount; if (ds0.Tables[1].Rows.Count > 0) { int i = 0; foreach (System.Data.DataRow Dr in ds0.Tables[1].Rows) { int id = Convert.ToInt32(Dr["id"]); int uid = Convert.ToInt32(Dr["senderid"]); int plnum = Convert.ToInt32(Dr["receiverid"]); int fxnum = Convert.ToInt32(Dr["wtype"]); int dznum = Convert.ToInt32(Dr["wtype2"]); int ltype = Convert.ToInt32(Dr["ltype"]); int quanxian = Convert.ToInt32(Dr["hasRead"]); string title = Dr["title"].ToString(); string addtime = Dr["addtime"].ToString(); string pic = Dr["Author"].ToString(); string video = Dr["Paths"].ToString(); string msecond = Dr["jlsecond"].ToString(); string productids = Dr["Content2"].ToString(); if (pic != "") { if (pic.IndexOf("http") != -1) { pic = pic.Split('|')[0]; } else { pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "720x720", "cut"); } } if (video != "") { if (video.IndexOf("http") == -1) { video = config.webUrl + "/" + video; } else { video = Mtxfw.Utility.Common.cfileurl(video); } } bool isLike = false; bool isFollowed = false; bool isView = false; string strv = "," + id + ","; /*if (model.videoids != "") { if (model.videoids.Length >= strv.Length) { if (model.videoids.IndexOf(strv) != -1) { isView = true; } } }*/ if (!isView) { if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=1 and MemberId=" + model.Id + " and MemberId2=" + id) > 0) { isLike = true; } if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=0 and MemberId=" + model.Id + " and MemberId2=" + uid) > 0) { isFollowed = true; } string goods = ""; string linkurl = ""; int productid = 0; if (productids != "") { if (ltype == 1) { System.Data.DataSet Ds = new DAL.Link().GetList1("top 1 linkname,linkimg,linkurl", "id in(" + productids + ") order by id Desc"); if (Ds.Tables[0].Rows.Count > 0) { string linkname = Ds.Tables[0].Rows[0]["linkname"].ToString(); string linkimg = Ds.Tables[0].Rows[0]["linkimg"].ToString(); linkurl = Ds.Tables[0].Rows[0]["linkurl"].ToString(); if (linkname.Length > 10) { linkname = linkname.Substring(0, 10) + "..."; } if (linkimg.IndexOf("http") == -1) { linkimg = Mtxfw.Utility.Common.GetCoverPic(linkimg.Split('|')[0], "220x220", "cut"); } goods = ",\"goods\":{\"img\" :\"" + linkimg + "\",\"title\":\"" + linkname + "\"}"; } Ds.Clear(); } else { System.Data.DataSet Ds_Product = daoProduct.GetList1("top 1 P_ID,P_NAME,P_images", "gtype=" + gtype + " And P_State=N'已处理' And IFDelete=0 and P_ID in(" + productids + ") And (Select count(c.G_ID) From P_Guige c where c.G_PID=P_ID And c.G_KC>0)>0 order by P_HITED Desc"); if (Ds_Product.Tables[0].Rows.Count > 0) { int P_ID = Convert.ToInt32(Ds_Product.Tables[0].Rows[0]["P_ID"].ToString()); string P_NAME = Ds_Product.Tables[0].Rows[0]["P_NAME"].ToString(); string P_images = Ds_Product.Tables[0].Rows[0]["P_images"].ToString().Split('|')[0].Split(',')[0]; if (P_NAME.Length > 10) { P_NAME = P_NAME.Substring(0, 10) + "..."; } productid = P_ID; if (P_images.IndexOf("http") == -1) { P_images = Mtxfw.Utility.Common.GetCoverPic(P_images, "220x220", "cut"); } goods = ",\"goods\":{\"img\" :\"" + P_images + "\",\"title\":\"" + P_NAME + "\"}"; } Ds_Product.Clear(); } } strdata += "{\"vid\":\"" + id + "\",\"ltype\":" + ltype + ",\"productid\":\"" + productid + "\",\"linkurl\":\"" + linkurl + "\",\"msecond\":\"" + msecond + "\",\"isView\":" + isView + ",\"uid\":\"" + uid + "\",\"videoUrl\":\"" + video + "\",\"authorHeadUrl\":\"" + config.webUrl + "/image/logo.png\",\"isFollowed\":" + isFollowed + ",\"authorNameFormatStr\":\"@" + config.webName + "\",\"isLike\":" + isLike + ",\"likeCount\":\"" + (dznum >= 10000 ? (dznum / 10000).ToString().Split('.')[0] + "万" : dznum.ToString()) + "\",\"commonCount\":\"" + (plnum >= 10000 ? (plnum / 10000).ToString().Split('.')[0] + "万" : plnum.ToString()) + "\",\"shareCount\":\"" + (fxnum >= 10000 ? (fxnum / 10000).ToString().Split('.')[0] + "万" : fxnum.ToString()) + "\",\"musicImgUrl\":\"" + config.webUrl + "/image/logo.png\",\"videoTitle\":\"" + title + "\",\"arqueeText\":\"作者创作的原声\",\"reviewImg\":\"" + pic + "\",\"productids\":\"" + productids + "\",\"videoScaleType_i\": 0,\"videoScaleType_a\": 0"; strdata += goods; //strdata += ",\"footlist\":{\"img\" :\"\",\"title\":\"" + title + "\"}"; strdata += "},"; } i += 1; } if (strdata != "") { if (strdata.Substring(strdata.Length - 1, 1) == ",") { strdata = strdata.Substring(0, strdata.Length - 1); } } } ds0.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //获取视频商品列表----------------------------------------------------------------------------------------- /// /// 获取视频商品列表 /// protected string getvideoproductlist(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["productids"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string productids = HttpUtility.UrlDecode(context.Request["productids"].ToString()); Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { int Start = 0; int Limit = 10; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } int Recount = 0; string strdata = ""; string groupby = ""; string strOrder = "P_HITED Desc"; strdata += "\"productlist\":["; System.Data.DataSet Ds_Product = daoProduct.GetDataSet(groupby, strOrder, "P_ID,P_NAME,P_Market_P,P_VIP_P,P_images,utype", "", "gtype=" + gtype + " And P_State=N'已处理' And IFDelete=0 and P_ID in(" + productids + ") And (Select count(c.G_ID) From P_Guige c where c.G_PID=P_ID And c.G_KC>0)>0", Start, Limit, out Recount); if (Ds_Product.Tables[1].Rows.Count > 0) { int j = 0; foreach (System.Data.DataRow drv2 in Ds_Product.Tables[1].Rows) { string P_ID = drv2["P_ID"].ToString(); string utype = drv2["utype"].ToString(); string P_NAME = drv2["P_NAME"].ToString(); string P_Market_P = "0.00"; string P_VIP_P = "0.00"; string P_VIP_P0 = "0"; string P_VIP_P1 = "0"; string P_VIP_P3 = "0"; string P_VIP_P4 = "0"; DataSet ds0 = new DAL.P_Guige().GetList1(" top 1 G_JG,G_JG0,G_JG1,G_JG2,G_JG3,G_JG4", "G_PID=" + P_ID + " And G_KC>0 order by G_JG asc"); if (ds0.Tables[0].Rows.Count > 0) { P_VIP_P = Convert.ToDouble(ds0.Tables[0].Rows[0]["G_JG"]).ToString("f2"); P_VIP_P0 = Convert.ToDouble(ds0.Tables[0].Rows[0]["G_JG0"]).ToString(); P_VIP_P1 = Convert.ToDouble(ds0.Tables[0].Rows[0]["G_JG1"]).ToString(); P_Market_P = Convert.ToDouble(ds0.Tables[0].Rows[0]["G_JG2"]).ToString("f2"); P_VIP_P3 = Convert.ToDouble(ds0.Tables[0].Rows[0]["G_JG3"]).ToString(); P_VIP_P4 = Convert.ToDouble(ds0.Tables[0].Rows[0]["G_JG4"]).ToString(); } ds0.Clear(); string P_images = drv2["P_images"].ToString().Split('|')[0].Split(',')[0]; if (P_images.IndexOf("http") == -1) { P_images = Mtxfw.Utility.Common.GetCoverPic(P_images, "220x220", "cut"); } strdata += "{\"_id\":\"" + P_ID + "\",\"name\":\"" + P_NAME + "\",\"scje\":\"" + P_Market_P + "\",\"hyje\":\"" + P_VIP_P + "\",\"xfjf\":\"" + P_VIP_P3 + "\",\"gxjf\":\"" + P_VIP_P4 + "\",\"image\":\"" + P_images + "\"}"; if (j != Ds_Product.Tables[1].Rows.Count - 1) { strdata += ","; } j += 1; } } Ds_Product.Clear(); strdata += "]"; data = "{\"status\":1,\"Recount\":" + Recount + "," + strdata + "}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //点赞\取消点赞视频----------------------------------------------------------------------------------------- /// /// 点赞\取消点赞视频 /// protected string dzvideo(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"]) && !String.IsNullOrEmpty(context.Request["t"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); int t = Convert.ToInt32(context.Request["t"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { if (b) { if (t == 0) { if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=1 and MemberId=" + model.Id + " and MemberId2=" + amodel.id) > 0) { b = false; data = "{\"status\":0,\"msg\":\"您已点赞过!\"}"; } } else { if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=1 and MemberId=" + model.Id + " and MemberId2=" + amodel.id) == 0) { b = false; data = "{\"status\":0,\"msg\":\"您未点赞!\"}"; } } } if (b) { if (t == 0) { Model.user_guanzhu gmodel = new Model.user_guanzhu(); gmodel.MemberId = model.Id; gmodel.MemberId2 = amodel.id; gmodel.addtime = DateTime.Now; gmodel.utype = 1; gmodel.gtype = gtype; daoguanzhu.Add(gmodel); daoArt.UpdateuSel0("wtype2", 1, amodel.id); amodel.wtype2 += 1; } else { daoguanzhu.Delete("gtype=" + gtype + " and utype=1 and MemberId=" + model.Id + " and MemberId2=" + amodel.id); daoArt.UpdateuSel0("wtype2", -1, amodel.id); amodel.wtype2 -= 1; } data = "{\"status\":1,\"dznum\":\"" + (amodel.wtype2 >= 10000 ? (amodel.wtype2 / 10000).ToString().Split('.')[0] + "万" : amodel.wtype2.ToString()) + "\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //关注\取消关注作者----------------------------------------------------------------------------------------- /// /// 点赞\取消点赞作者 /// protected string guangzhu(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"]) && !String.IsNullOrEmpty(context.Request["t"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); int t = Convert.ToInt32(context.Request["t"].ToString()); Mtxfw.Model.user_info model = daoUser.GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; Mtxfw.Model.user_info umodel = daoUser.GetModel(id); if (umodel != null) { if (umodel.IFStores != 0) { b = false; data = "{\"status\":0,\"msg\":\"参数错误0!\"}"; } if (b) { if (t == 0) { if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=0 and MemberId=" + model.Id + " and MemberId2=" + umodel.Id) > 0) { b = false; data = "{\"status\":0,\"msg\":\"您已关注过!\"}"; } } else { if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=0 and MemberId=" + model.Id + " and MemberId2=" + umodel.Id) == 0) { b = false; data = "{\"status\":0,\"msg\":\"您未关注!\"}"; } } } if (b) { if (t == 0) { Model.user_guanzhu gmodel = new Model.user_guanzhu(); gmodel.MemberId = model.Id; gmodel.MemberId2 = umodel.Id; gmodel.addtime = DateTime.Now; gmodel.utype = 0; gmodel.gtype = gtype; daoguanzhu.Add(gmodel); } else { daoguanzhu.Delete("gtype=" + gtype + " and utype=0 and MemberId=" + model.Id + " and MemberId2=" + umodel.Id); } data = "{\"status\":1,\"msg\":\"" + (t == 0 ? "" : "取消") + "关注成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //分享视频----------------------------------------------------------------------------------------- /// /// 分享视频 /// protected string sharevideo(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { if (b) { daoArt.UpdateuSel0("wtype", 1, amodel.id); amodel.wtype += 1; data = "{\"status\":1,\"fxnum\":\"" + (amodel.wtype >= 10000 ? (amodel.wtype / 10000).ToString().Split('.')[0] + "万" : amodel.wtype.ToString()) + "\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //评论视频----------------------------------------------------------------------------------------- /// /// 评论视频 /// protected string plvideo(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["t"]) && !String.IsNullOrEmpty(context.Request["id"]) && !String.IsNullOrEmpty(context.Request["body"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); int t = Convert.ToInt32(context.Request["t"].ToString()); string body = HttpUtility.UrlDecode(context.Request["body"].ToString()); int aid = 0; if (!String.IsNullOrEmpty(context.Request["aid"])) { aid = Convert.ToInt32(context.Request["aid"].ToString()); } int aid0 = 0; if (!String.IsNullOrEmpty(context.Request["aid0"])) { aid0 = Convert.ToInt32(context.Request["aid0"].ToString()); } Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { bool b = true; Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { if (b) { DateTime dt = DateTime.Now; Mtxfw.Model.Article model = new Mtxfw.Model.Article(); model.senderid = umodel.Id; model.receiverid = amodel.senderid; model.Title = "视频评论"; model.ParentID = 11; model.CategoryId = amodel.id.ToString(); model.AddTime = dt; model.Author = ""; model.Content = body; model.Paths = ""; model.Content2 = ""; model.Paths2 = ""; model.KeyWords = ""; model.media_id = aid.ToString(); model.thumb_media_id = aid0.ToString(); model.wtype = t; model.wtype2 = 0; model.LinkID = 0; model.Seef = 0; model.gtype = gtype; daoArt.Add(model); daoArt.UpdateuSel0("receiverid", 1, amodel.id); amodel.receiverid += 1; data = "{\"status\":1,\"plnum\":\"" + (amodel.receiverid >= 10000 ? (amodel.receiverid / 10000).ToString().Split('.')[0] + "万" : amodel.receiverid.ToString()) + "\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //视频奖励----------------------------------------------------------------------------------------- /// /// 视频奖励 /// protected string videoreward(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { if (b) { string strv = "," + amodel.id + ","; if (model.videoids != "") { if (model.videoids.Length >= strv.Length) { if (model.videoids.IndexOf(strv) != -1) { b = false; data = "{\"status\":0,\"msg\":\"广告视频已观看过,不再获得奖励!\"}"; } } } } if (b) { Double xfjmoney = Convert.ToDouble(amodel.xfjmoney.ToString("f2")); //Double tgjmoney = Convert.ToDouble(amodel.tgjmoney.ToString("f2")); //Double jzjmoney = Convert.ToDouble(amodel.jzjmoney.ToString("f2")); DateTime dt = DateTime.Now; //if (Convert.ToDouble(model.umoney23.ToString("f2")) >= xfjmoney) //{ string videoids = model.videoids; if (videoids != "") { videoids += amodel.id + ","; } else { videoids = "," + amodel.id + ","; } daoUser.UpdatePassword("videoids", videoids, model.Id); if (amodel.csday > 0) { daoArt.UpdateuSel0("csday", -1, amodel.id);//减少播放次数 } Double umoney4 = Convert.ToDouble(xfjmoney.ToString("f2")); if (umoney4 > 0.00) { Model.user_Results_jl2 mjl2 = new Model.user_Results_jl2(); mjl2.MemberId = model.Id; mjl2.MemberId2 = 0; mjl2.Addmoney = umoney4; mjl2.Cutmoney = 0; mjl2.Totalmoney = (model.umoney36 + umoney4); mjl2.addtime = DateTime.Now; mjl2.BZContent = "看视频奖励"; mjl2.PayID = ""; mjl2.OrdersIDs = ""; mjl2.OrdersID = 0; mjl2.utype = 18; mjl2.utype2 = 0; mjl2.Seef = -1; mjl2.seeftime = DateTime.Now; mjl2.gtype = gtype; daojl2.Add(mjl2); daoUser.UpdateMoney("umoney36", umoney4, model.Id); } DataSet ds = daoResults.GetList1(" top 1 id", "gtype=" + gtype + " and IFDelete=0 And utype=7 and UserId=" + amodel.id + " and b1>b2 order by addtime asc"); if (ds.Tables[0].Rows.Count > 0) { foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { Int64 oid = Convert.ToInt64(Dr["id"].ToString()); daoResults.Updatemoney2("b2", 1, "id=" + oid + " and b1>b2"); } } ds.Clear(); data = "{\"status\":1,\"msg\":\"您获得了" + xfjmoney.ToString() + "个广告积分!\"," + returndata(model) + "}"; //} //else //{ //data = "{\"status\":0,\"msg\":\"广告额度不足!\"}"; //} } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //获取评论列表----------------------------------------------------------------------------------------- /// /// 获取评论列表 /// protected string getpllist(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int aid = Convert.ToInt32(context.Request["id"].ToString()); int pid = 0; if (!String.IsNullOrEmpty(context.Request["pid"])) { pid = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["pid"].ToString())); } Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { Mtxfw.Model.Article amodel = daoArt.GetModel(aid); if (amodel != null) { int Start = 0; int Limit = 10; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } string strdata = ""; DataSet ds; string strsql = "gtype=" + gtype + " and parentid=11 and categoryid='" + amodel.id + "'"; if (pid == 0) { strsql += " and media_id='0'"; } else { strsql += " and media_id='" + pid + "'"; } string groupby = ""; string strOrder = "addtime desc"; strdata += "\"data\":["; Int32 Recount = 0; ds = daoArt.GetDataSet(groupby, strOrder, "id,senderid,wtype,wtype2,addtime,Content,thumb_media_id", "", strsql + "", Start, Limit, out Recount); if (ds.Tables[1].Rows.Count > 0) { int i = 0; foreach (System.Data.DataRow Dr in ds.Tables[1].Rows) { int id = Convert.ToInt32(Dr["id"]); int senderid = Convert.ToInt32(Dr["senderid"]); int wtype = Convert.ToInt32(Dr["wtype"]); int dznum = Convert.ToInt32(Dr["wtype2"]); string addtime = Dr["addtime"].ToString(); string body = Dr["Content"].ToString(); string thumb_media_id = Dr["thumb_media_id"].ToString(); if (wtype == 0) { Mtxfw.Utility.emojiconsConfig econfig = new Mtxfw.Utility.emojiconsConfig(); string pattern2 = @"\[(.*?)\]"; Regex R2 = new Regex(pattern2); Match M2 = R2.Match(body); while (M2.Success) { string group = M2.Groups[1].ToString(); string gdata = econfig.getData("[" + group + "]"); if (group != "" && gdata != "") { body = body.Replace("[" + group + "]", ""); } M2 = M2.NextMatch(); } } string minpic = ""; if (wtype == 2) { body = "
"; } string pic = ""; string name = ""; bool ifzz = false; Mtxfw.Model.user_info umodel0 = new Mtxfw.DAL.user_info().GetModel(senderid); if (umodel0 != null) { pic = umodel0.UserPic; name = (umodel0.NCName != "" ? umodel0.NCName : umodel0.RealName); if (umodel0.Id == amodel.senderid) { ifzz = true; } } string name0 = ""; if (thumb_media_id != "" && thumb_media_id != "0") { umodel0 = new Mtxfw.DAL.user_info().GetModel(Convert.ToInt32(thumb_media_id)); if (umodel0 != null) { name0 = (umodel0.NCName != "" ? umodel0.NCName : umodel0.RealName); } } if (pic != "") { pic = config.webUrl + Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "40x40", "cut"); } bool isLike = false; if (daoguanzhu.GetCount("gtype=" + gtype + " and utype=1 and MemberId=" + umodel.Id + " and MemberId2=" + id) > 0) { isLike = true; } int replycount = 0; if (pid == 0) { replycount = daoArt.GetCount("gtype=" + gtype + " and parentid=11 and categoryid='" + amodel.id + "' and media_id='" + id + "'"); } strdata += "{\"id\":\"" + id + "\",\"pic\":\"" + pic + "\",\"uid\":\"" + senderid + "\",\"name\":\"" + name + "\",\"uid0\":\"" + thumb_media_id + "\",\"name0\":\"" + name0 + "\",\"ifzz\":" + ifzz + ",\"dznum\":\"" + dznum + "\",\"isLike\":" + isLike + ",\"time\":\"" + addtime + "\",\"body\":\"" + Mtxfw.Utility.Common.ReplaceString(body) + "\",\"replycount\":\"" + replycount + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); strdata += "]"; data = "{\"status\":1,\"Recount\":" + Recount + "," + strdata + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //咨询视频----------------------------------------------------------------------------------------- /// /// 咨询视频 /// protected string zixunvideo(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"]) && !String.IsNullOrEmpty(context.Request["name"]) && !String.IsNullOrEmpty(context.Request["phone"]) && !String.IsNullOrEmpty(context.Request["body"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int id = Convert.ToInt32(context.Request["id"].ToString()); string name = HttpUtility.UrlDecode(context.Request["name"].ToString()); string phone = HttpUtility.UrlDecode(context.Request["phone"].ToString()); string body = HttpUtility.UrlDecode(context.Request["body"].ToString()); Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { bool b = true; Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { if (b) { DateTime dt = DateTime.Now; Mtxfw.Model.Article model = new Mtxfw.Model.Article(); model.senderid = umodel.Id; model.receiverid = amodel.senderid; model.Title = "咨询视频"; model.ParentID = 12; model.CategoryId = amodel.id.ToString(); model.AddTime = dt; model.Author = name; model.Content = body; model.Paths = ""; model.Content2 = ""; model.Paths2 = ""; model.KeyWords = phone; 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); Mtxfw.Model.Article amodel0 = new Mtxfw.Model.Article(); amodel0.senderid = umodel.Id; amodel0.receiverid = amodel.senderid; amodel0.Title = "咨询信息"; amodel0.ParentID = 30; amodel0.CategoryId = ""; amodel0.AddTime = DateTime.Now; amodel0.Author = "../image/chat-ico.png"; amodel0.Content = name + "向您发来咨询信息"; amodel0.Paths = "zixun.html"; amodel0.Content2 = ""; amodel0.Paths2 = ""; amodel0.KeyWords = ""; amodel0.media_id = ""; amodel0.thumb_media_id = ""; amodel0.wtype = 5; amodel0.wtype2 = 0; amodel0.LinkID = 1; amodel0.Seef = 0; amodel0.gtype = gtype; string dataid = daoArt.Add(amodel).ToString(); string registrationId = ""; if (amodel.senderid > 0) { SqlDataReader Dr = daoUser.GetUserName(gtype, amodel.senderid); if (Dr.HasRows) { if (Dr.Read()) { registrationId = Dr["registrationId"].ToString(); } } Dr.Close(); } if (registrationId != "") { List RegistrationIDList = new List(); RegistrationIDList.Add(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); } data = "{\"status\":1,\"msg\":\"提交成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //获取咨询列表----------------------------------------------------------------------------------------- /// /// 获取咨询列表 /// protected string getzixunlist(HttpContext context) { string data = "{\"status\":0}"; int userId = 0; string LoginId = ""; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { userId = Convert.ToInt32(context.Request["userId"].ToString()); LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { int Start = 0; int Limit = 10; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } string strdata = ""; DataSet ds; string strsql = "gtype=" + gtype + " and parentid=12 and receiverid=" + umodel.Id; string groupby = ""; string strOrder = "addtime desc"; strdata += "\"data\":["; Int32 Recount = 0; ds = daoArt.GetDataSet(groupby, strOrder, "id,senderid,categoryid,Author,KeyWords,Content,addtime", "", strsql + "", Start, Limit, out Recount); if (ds.Tables[1].Rows.Count > 0) { int i = 0; foreach (System.Data.DataRow Dr in ds.Tables[1].Rows) { int id = Convert.ToInt32(Dr["id"]); int senderid = Convert.ToInt32(Dr["senderid"]); int aid = Convert.ToInt32(Dr["categoryid"]); string name = Dr["Author"].ToString(); string phone = Dr["KeyWords"].ToString(); string body = Dr["Content"].ToString(); string addtime = Dr["addtime"].ToString(); Mtxfw.Utility.emojiconsConfig econfig = new Mtxfw.Utility.emojiconsConfig(); string pattern2 = @"\[(.*?)\]"; Regex R2 = new Regex(pattern2); Match M2 = R2.Match(body); while (M2.Success) { string group = M2.Groups[1].ToString(); string gdata = econfig.getData("[" + group + "]"); if (group != "" && gdata != "") { body = body.Replace("[" + group + "]", ""); } M2 = M2.NextMatch(); } string videopic = ""; string videoname = ""; Mtxfw.Model.Article amodel = daoArt.GetModel(aid); if (amodel != null) { videopic = amodel.Author; if (videopic.IndexOf("http") == -1) { videopic = Mtxfw.Utility.Common.GetCoverPic(videopic, "220x220", "cut"); } videoname = amodel.Title; } strdata += "{\"id\":\"" + id + "\",\"videoname\":\"" + videoname + "\",\"videopic\":\"" + videopic + "\",\"videoid\":\"" + aid + "\",\"uid\":\"" + senderid + "\",\"name\":\"" + name + "\",\"phone\":\"" + phone + "\",\"body\":\"" + Mtxfw.Utility.Common.ReplaceString(body) + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); strdata += "]"; data = "{\"status\":1,\"Recount\":" + Recount + "," + strdata + "}"; } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } return data; } #endregion #region //更新银行信息----------------------------------------------------------------------------------------- /// /// 更新银行信息 /// protected string updatebankinfo(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["khname"]) && !String.IsNullOrEmpty(context.Request["bankname"]) && !String.IsNullOrEmpty(context.Request["bankcard"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string khname = HttpUtility.UrlDecode(context.Request["khname"].ToString()); string bankname = HttpUtility.UrlDecode(context.Request["bankname"].ToString()); string bankcard = HttpUtility.UrlDecode(context.Request["bankcard"].ToString()); string bankaddress = HttpUtility.UrlDecode(context.Request["bankaddress"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (String.IsNullOrEmpty(context.Request["code"]) && String.IsNullOrEmpty(context.Request["pwd"])) { b = false; data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } } if (b) { if (khname == "") { b = false; data = "{\"status\":0,\"msg\":\"开户姓名不能为空!\"}"; } else { if (!System.Text.RegularExpressions.Regex.IsMatch(khname, @"^[\u4e00-\u9fa5a-zA-Z]+$")) { b = false; data = "{\"status\":0,\"msg\":\"开户姓名填写不正确,只能输入中文和字母!\"}"; } } } if (b) { if (bankname == "") { b = false; data = "{\"status\":0,\"msg\":\"银行名称必须选择!\"}"; } else { if (!System.Text.RegularExpressions.Regex.IsMatch(bankname, @"^[\u4e00-\u9fa5a-zA-Z0-9]+$")) { b = false; data = "{\"status\":0,\"msg\":\"银行名称填写不正确,只能输入中文和字母或数字!\"}"; } } } if (b) { if (bankcard == "") { b = false; data = "{\"status\":0,\"msg\":\"银行卡号不能为空!\"}"; } else { if (!System.Text.RegularExpressions.Regex.IsMatch(bankcard, @"^-?\d+$")) { b = false; data = "{\"status\":0,\"msg\":\"银行卡号填写不正确,只能输入数字!\"}"; } } } if (b) { if (bankaddress == "") { b = false; data = "{\"status\":0,\"msg\":\"银行开户行地址不能为空!\"}"; }else { if (bankaddress.Length > 100) { b = false; data = "{\"status\":0,\"msg\":\"银行开户行地址太长!\"}"; } } } if (b) { if (daoResults.GetCount("utype=1 And MemberId=" + model.Id + " and IFDelete=0 And UserId=0 and seef=0 And DateDiff(hour,addtime,getdate())<48") > 0) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,提现后在48小时内不能修改银行资料!\"}"; } } if (!String.IsNullOrEmpty(context.Request["code"])) { string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); if (b) { if (model.PhoneNumber.ToLower() != code) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码不正确!\"}"; //Mtxfw.Utility.Common.WriteHtml("/weixin/apiajaxcode.txt", code); } } if (b) { if (model.PhoneTime != null) { DateTime dt1 = DateTime.Now; DateTime dt2 = model.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码已经失效!\"}"; } } } } if (b) { if (!String.IsNullOrEmpty(context.Request["pwd"])) { string pwd = HttpUtility.UrlDecode(context.Request["pwd"].ToString()); if (b) { if (model.Password != Mtxfw.Utility.Security.EncryptString(pwd)) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,安全密码不正确!\"}"; } } } } if (b) { model.ProductName = khname; model.RealName2 = bankname; model.Phone2 = bankcard; model.PostalCode = bankaddress; new Mtxfw.DAL.user_info().Update(model); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb==0?"app":"web") + "修改银行资料"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新支付宝信息----------------------------------------------------------------------------------------- /// /// 更新支付宝信息 /// protected string updatealipay(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string AliAccount = ""; string AliName = ""; string aliimage = ""; if (!String.IsNullOrEmpty(context.Request["AliAccount"]) && !String.IsNullOrEmpty(context.Request["AliName"])) { AliAccount = HttpUtility.UrlDecode(context.Request["AliAccount"].ToString()); AliName = HttpUtility.UrlDecode(context.Request["AliName"].ToString()); } if (!String.IsNullOrEmpty(context.Request["aliimage"])) { aliimage = HttpUtility.UrlDecode(context.Request["aliimage"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (String.IsNullOrEmpty(context.Request["code"]) && String.IsNullOrEmpty(context.Request["pwd"])) { b = false; data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } } if (b) { if ((AliAccount == "" || AliName == "") && aliimage == "") { b = false; data = "{\"status\":0,\"msg\":\"支付宝账号或支付宝收款码不能为空!\"}"; } } if (b) { if ((AliAccount != "" || AliName != "")) { if (!Regex.IsMatch(AliAccount, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$") && !System.Text.RegularExpressions.Regex.IsMatch(AliAccount, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { b = false; data = "{\"status\":0,\"msg\":\"支付宝账号必须是手机号或邮箱!\"}"; } } } if (b) { if (daoResults.GetCount("utype=1 And MemberId=" + model.Id + " and IFDelete=0 And UserId=1 and seef=0 And DateDiff(hour,addtime,getdate())<48") > 0) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,提现后在48小时内不能修改支付宝资料!\"}"; } } if (!String.IsNullOrEmpty(context.Request["code"])) { string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); if (b) { if (model.PhoneNumber.ToLower() != code) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码不正确!\"}"; } } if (b) { if (model.PhoneTime != null) { DateTime dt1 = DateTime.Now; DateTime dt2 = model.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码已经失效!\"}"; } } } } if (b) { if (!String.IsNullOrEmpty(context.Request["pwd"])) { string pwd = HttpUtility.UrlDecode(context.Request["pwd"].ToString()); if (b) { if (model.Password != Mtxfw.Utility.Security.EncryptString(pwd)) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,安全密码不正确!\"}"; } } } } if (b) { model.AliAccount = AliAccount; model.AliName = AliName; if (aliimage != "") { if (model.aliimage != "") { try { File.Delete(context.Server.MapPath(model.aliimage)); } catch (Exception err) { } } model.aliimage = aliimage; } new Mtxfw.DAL.user_info().Update(model); daoUser.UpdatePassword("uploadimage", "", model.Id); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = (model.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); logmodel.Body = (ifweb==0?"app":"web") + "修改支付宝资料"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新微信收款码信息----------------------------------------------------------------------------------------- /// /// 更新微信收款码信息 /// protected string updateweixinpay(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["weixinimage"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string weixinimage = HttpUtility.UrlDecode(context.Request["weixinimage"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (String.IsNullOrEmpty(context.Request["code"]) && String.IsNullOrEmpty(context.Request["pwd"])) { b = false; data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } } if (b) { if (weixinimage == "") { b = false; data = "{\"status\":0,\"msg\":\"微信收款码不能为空!\"}"; } } if (b) { if (daoResults.GetCount("utype=1 And MemberId=" + model.Id + " and IFDelete=0 And UserId=2 and seef=0 And DateDiff(hour,addtime,getdate())<48") > 0) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,提现后在48小时内不能修改微信收款码!\"}"; } } if (!String.IsNullOrEmpty(context.Request["code"])) { string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); if (b) { if (model.PhoneNumber.ToLower() != code) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码不正确!\"}"; } } if (b) { if (model.PhoneTime != null) { DateTime dt1 = DateTime.Now; DateTime dt2 = model.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码已经失效!\"}"; } } } } if (b) { if (!String.IsNullOrEmpty(context.Request["pwd"])) { string pwd = HttpUtility.UrlDecode(context.Request["pwd"].ToString()); if (b) { if (model.Password != Mtxfw.Utility.Security.EncryptString(pwd)) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,安全密码不正确!\"}"; } } } } if (b) { if (weixinimage != "") { if (model.weixinimage != "") { try { File.Delete(context.Server.MapPath(model.weixinimage)); } catch (Exception err) { } } model.weixinimage = weixinimage; } new Mtxfw.DAL.user_info().Update(model); daoUser.UpdatePassword("uploadimage", "", model.Id); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = (model.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); logmodel.Body = (ifweb==0?"app":"web") + "修改微信收款码信息"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"," + returndata(model) + "}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新钱包地址信息----------------------------------------------------------------------------------------- /// /// 更新钱包地址信息 /// protected string updateqbaddress(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["qbaddress"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string qbaddress = HttpUtility.UrlDecode(context.Request["qbaddress"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (String.IsNullOrEmpty(context.Request["code"]) && String.IsNullOrEmpty(context.Request["pwd"])) { b = false; data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } } if (b) { if (qbaddress == "") { b = false; data = "{\"status\":0,\"msg\":\"钱包地址不能为空!\"}"; } } if (b) { if (qbaddress.Substring(0, 2) != "0x" || qbaddress.Length != 42) { b = false; data = "{\"status\":0,\"msg\":\"钱包地址格式不正确!\"}"; } } if (!String.IsNullOrEmpty(context.Request["code"])) { string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); if (b) { if (model.PhoneNumber.ToLower() != code) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码不正确!\"}"; } } if (b) { if (model.PhoneTime != null) { DateTime dt1 = DateTime.Now; DateTime dt2 = model.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码已经失效!\"}"; } } } } if (b) { if (!String.IsNullOrEmpty(context.Request["pwd"])) { string pwd = HttpUtility.UrlDecode(context.Request["pwd"].ToString()); if (b) { if (model.Password != Mtxfw.Utility.Security.EncryptString(pwd)) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,安全密码不正确!\"}"; } } } } if (b) { if (model.qbaddress == "") { if (daoUser.GetCount("gtype=" + gtype + " and UserState='正常' And IFStores=0 and qbaddress='" + qbaddress + "'") > 0) { b = false; data = "{\"status\":0,\"msg\":\"同一钱包地址只能绑定一个账号!\"}"; } } else { if (daoUser.GetCount("IFStores=0 and id<>" + model.Id + " and qbaddress='" + qbaddress + "'") > 0) { b = false; data = "{\"status\":0,\"msg\":\"同一钱包地址只能绑定一个账号!\"}"; } } } if (b) { if (b) { model.qbaddress = qbaddress; model.QBTime = DateTime.Now.ToString(); daoUser.Update(model); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = (model.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); logmodel.Body = (ifweb == 0 ? "app" : "web") + "修改钱包地址" + qbaddress; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"," + returndata(model) + "}"; } } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //更新余额豆信息----------------------------------------------------------------------------------------- /// /// 更新余额豆信息 /// protected string updateyed(HttpContext context) { string data = "{\"status\":0}";// && !String.IsNullOrEmpty(context.Request["Province"]) if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string yedAccount = ""; string yedName = ""; string yedimage = ""; if (!String.IsNullOrEmpty(context.Request["yedAccount"]) && !String.IsNullOrEmpty(context.Request["yedName"])) { yedAccount = HttpUtility.UrlDecode(context.Request["yedAccount"].ToString()); yedName = HttpUtility.UrlDecode(context.Request["yedName"].ToString()); } if (!String.IsNullOrEmpty(context.Request["yedimage"])) { yedimage = HttpUtility.UrlDecode(context.Request["yedimage"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; if (b) { if (String.IsNullOrEmpty(context.Request["code"]) && String.IsNullOrEmpty(context.Request["pwd"])) { b = false; data = "{\"status\":0,\"msg\":\"参数为空!\"}"; } } if (b) { if ((yedAccount == "" || yedName == "") && yedimage == "") { b = false; data = "{\"status\":0,\"msg\":\"余额豆账号或余额豆收款码不能为空!\"}"; } } /*if (b) { if ((yedAccount != "" || yedName != "")) { if (!Regex.IsMatch(yedAccount, @"^[1]+[1,2,3,4,5,6,7,8,9]+\d{9}$") && !System.Text.RegularExpressions.Regex.IsMatch(yedAccount, @"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$")) { b = false; data = "{\"status\":0,\"msg\":\"余额豆账号必须是手机号或邮箱!\"}"; } } }*/ if (b) { if (daoResults.GetCount("utype=1 And MemberId=" + model.Id + " and IFDelete=0 And UserId=1 And DateDiff(hour,addtime,getdate())<48") > 0 || daojl2.GetCount("utype=8 and utype2=3 And MemberId=" + model.Id + " and IFDelete=0 And MemberId2=0 and seef=1 And DateDiff(hour,addtime,getdate())<48") > 0) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,提现后在48小时内不能修改支付宝资料!\"}"; } } if (!String.IsNullOrEmpty(context.Request["code"])) { string code = HttpUtility.UrlDecode(context.Request["code"].ToString()); if (b) { if (model.PhoneNumber.ToLower() != code) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码不正确!\"}"; } } if (b) { if (model.PhoneTime != null) { DateTime dt1 = DateTime.Now; DateTime dt2 = model.PhoneTime.AddMinutes(30); if (dt1 > dt2) { b = false; data = "{\"status\":0,\"msg\":\"手机验证码已经失效!\"}"; } } } } if (b) { if (!String.IsNullOrEmpty(context.Request["pwd"])) { string pwd = HttpUtility.UrlDecode(context.Request["pwd"].ToString()); if (b) { if (model.Password != Mtxfw.Utility.Security.EncryptString(pwd)) { b = false; data = "{\"status\":0,\"msg\":\"操作失败,安全密码不正确!\"}"; } } } } if (b) { model.yedAccount = yedAccount; model.yedName = yedName; if (yedimage != "") { if (model.yedimage != "") { try { File.Delete(context.Server.MapPath(model.yedimage)); } catch (Exception err) { } } model.yedimage = yedimage; } new Mtxfw.DAL.user_info().Update(model); daoUser.UpdatePassword("uploadimage", "", model.Id); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = (model.Id == 8714 ? "223.104.162.201" : Mtxfw.Utility.Common.GetIP); logmodel.Body = (ifweb == 0 ? "app" : "web") + "修改余额豆资料"; logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取申请服务中心----------------------------------------------------------------------------------------- /// /// 获取申请服务中心 /// protected string getappdeclaration(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { Mtxfw.Model.user_proxy pm = daoproxy.GetModel(gtype, 1, model.Id); if (pm != null) { data = "{\"status\":1,\"msg\":\"获取成功!\",\"username\":\"" + model.UserName + "\",\"Province\":\"" + pm.Agenprovince + "\",\"City\":\"" + pm.Agencity + "\",\"County\":\"" + pm.Agencounty + "\",\"AAddress\":\"" + pm.AAddress + "\",\"seef\":\"" + pm.seef + "\"}"; } else { data = "{\"status\":1,\"msg\":\"获取成功!\",\"username\":\"" + model.UserName + "\",\"Province\":\"" + model.Province + "\",\"City\":\"" + model.City + "\",\"County\":\"" + model.County + "\",\"AAddress\":\"" + model.MailingAddress + "\",\"seef\":\"-1\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //申请服务中心----------------------------------------------------------------------------------------- /// /// 申请服务中心 /// protected string appdeclaration(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["Province"]) && !String.IsNullOrEmpty(context.Request["City"]) && !String.IsNullOrEmpty(context.Request["County"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); string Province = HttpUtility.UrlDecode(context.Request["Province"].ToString()); string City = HttpUtility.UrlDecode(context.Request["City"].ToString()); string County = HttpUtility.UrlDecode(context.Request["County"].ToString()); string AAddress = ""; if (!String.IsNullOrEmpty(context.Request["AAddress"])) { AAddress = HttpUtility.UrlDecode(context.Request["AAddress"].ToString()); } Mtxfw.Model.user_info model = new Mtxfw.DAL.user_info().GetModel(userId); if (model != null) { if (model.LoginId == LoginId) { bool b = true; Mtxfw.Model.user_proxy pm = daoproxy.GetModel(gtype, 1, model.Id); if (pm == null) { Mtxfw.Model.user_proxy pmodel = new Model.user_proxy(); pmodel.MemberId = model.Id; pmodel.AName = ""; pmodel.AgenLevel = 0; pmodel.AgenCost = 0; pmodel.Agenprovince = Province; pmodel.Agencity = City; pmodel.Agencounty = County; pmodel.AAddress = AAddress; pmodel.IFJS = 0; pmodel.TType = 1; pmodel.gtype = gtype; pmodel.latitude = 0; pmodel.longitude = 0; pmodel.TType = 1; daoproxy.Add(pmodel); daoUser.UpdateuLevel("uLevel2", 1, model.Id); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = model.Id; logmodel.AddTime = DateTime.Now; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb==0?"app":"web") + "申请成为代理,区域:" + new DAL.province().GetProvince(Province) + new DAL.city().GetCity(City) + new DAL.county().GetCounty(County); logmodel.UType = 2; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"更新成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"您已申请过代理!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数不能为空!\"}"; } return data; } #endregion #region //获取系统公告列表----------------------------------------------------------------------------------------- /// /// 获取系统公告列表 /// protected string getsysmsglist(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["t"])) { int t = Convert.ToInt32(context.Request["t"].ToString()); string strdata = ""; string strsql = "gtype=0"; if (t == 2) { strsql += " and parentid=9"; } else { strsql += " and parentid=17"; if (t == 1) { strsql += " And CategoryId='1'"; } else { strsql += " And CategoryId='0'"; } } string groupby = ""; string strOrder = "addtime desc"; int Start = 0; int Limit = 30; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds = new Mtxfw.DAL.Article().GetDataSet(groupby, strOrder, "id,hasRead,title,Content2,Author,Paths,addtime", "", 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 id = Convert.ToInt32(Dr["id"]); int hasRead = Convert.ToInt32(Dr["hasRead"]); string title = Dr["title"].ToString(); string content = Dr["Content2"].ToString(); string addtime = Dr["addtime"].ToString(); string pic = Dr["Author"].ToString(); string video = Dr["Paths"].ToString(); if (pic.IndexOf("http") == -1) { pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "720x360", "cut"); } strdata += "{\"id\":\"" + id + "\",\"title\":\"" + title + "\",\"pic\":\"" + pic + "\",\"video\":\"" + video + "\",\"content\":\"" + Mtxfw.Utility.Common.CnCutString(Mtxfw.Utility.Common.CIntro(content), 60, "...") + "\",\"createTime\":\"" + addtime + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } return data; } #endregion #region //获取企业介绍列表----------------------------------------------------------------------------------------- /// /// 获取企业介绍列表 /// protected string getqyjslist(HttpContext context) { string data = "{\"status\":0}"; string strdata = ""; string strsql = "gtype=0"; strsql += " and parentid=7"; string groupby = ""; string strOrder = "addtime desc"; int Start = 0; int Limit = 30; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds = new Mtxfw.DAL.Article().GetDataSet(groupby, strOrder, "id,hasRead,title,Content2,Author,Paths,addtime", "", 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 id = Convert.ToInt32(Dr["id"]); int hasRead = Convert.ToInt32(Dr["hasRead"]); string title = Dr["title"].ToString(); string addtime = Dr["addtime"].ToString(); string pic = Dr["Author"].ToString(); if (pic.IndexOf("http") == -1) { pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "220x220", "cut"); } else { pic = pic + "?imageView2/2/w/220/h/220/q/100"; } strdata += "{\"id\":\"" + id + "\",\"title\":\"" + title + "\",\"pic\":\"" + pic + "\",\"createTime\":\"" + addtime + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; return data; } #endregion #region //获取发图素材列表----------------------------------------------------------------------------------------- /// /// 获取发图素材列表 /// protected string getftsclist(HttpContext context) { string data = "{\"status\":0}"; string strdata = ""; string strsql = "gtype=0"; strsql += " and parentid=9"; string groupby = ""; string strOrder = "addtime desc"; int Start = 0; int Limit = 30; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds = new Mtxfw.DAL.Article().GetDataSet(groupby, strOrder, "id,hasRead,title,Content2,Author,Paths,addtime", "", 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 id = Convert.ToInt32(Dr["id"]); int hasRead = Convert.ToInt32(Dr["hasRead"]); string title = Dr["title"].ToString(); string addtime = Dr["addtime"].ToString(); string pic = Dr["Author"].ToString(); if (pic.IndexOf("http") == -1) { pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "220x220", "cut"); } else { pic = pic + "?imageView2/2/w/220/h/220/q/100"; } strdata += "{\"id\":\"" + id + "\",\"title\":\"" + title + "\",\"pic\":\"" + pic + "\",\"createTime\":\"" + addtime + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; return data; } #endregion #region //获取健康知识列表----------------------------------------------------------------------------------------- /// /// 获取健康知识列表 /// protected string getjkzslist(HttpContext context) { string data = "{\"status\":0}"; string strdata = ""; string strsql = "gtype=0"; strsql += " and parentid=8"; string groupby = ""; string strOrder = "addtime desc"; int Start = 0; int Limit = 30; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds = new Mtxfw.DAL.Article().GetDataSet(groupby, strOrder, "id,hasRead,title,Content2,Author,Paths,addtime", "", 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 id = Convert.ToInt32(Dr["id"]); int hasRead = Convert.ToInt32(Dr["hasRead"]); string title = Dr["title"].ToString(); string addtime = Dr["addtime"].ToString(); string pic = Dr["Author"].ToString(); if (pic.IndexOf("http") == -1) { pic = Mtxfw.Utility.Common.GetCoverPic(pic.Split('|')[0], "220x220", "cut"); } else { pic = pic + "?imageView2/2/w/220/h/220/q/100"; } strdata += "{\"id\":\"" + id + "\",\"title\":\"" + title + "\",\"pic\":\"" + pic + "\",\"createTime\":\"" + addtime + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); data = "{\"status\":1,\"data\":[" + strdata + "]}"; return data; } #endregion #region //获取消息列表----------------------------------------------------------------------------------------- /// /// 获取消息列表 /// protected string getmessage(HttpContext context) { string data = "{\"status\":0}"; string strdata = ""; string strsql = "gtype=" + gtype + " and parentid=30"; string strsql2 = "gtype=" + gtype + " and parentid=30"; string groupby = " group by wtype,senderid"; string strOrder = " order by wtype desc"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); strsql += " And ((receiverid=" + userId + ") Or receiverid=0)"; strsql2 += " And ((receiverid=" + userId + ") Or receiverid=0)"; } else { strsql += " And receiverid=0"; strsql2 += " And receiverid=0"; } DataSet ds = daoArt.GetList1("max(id) as id,wtype,senderid,max(addtime) as addtime", strsql + groupby + strOrder); ds.Tables[0].DefaultView.Sort = "addtime Desc"; if (ds.Tables[0].Rows.Count > 0) { int i = 0; foreach (System.Data.DataRowView Dr in ds.Tables[0].DefaultView) { int id = Convert.ToInt32(Dr["id"]); int wtype = Convert.ToInt32(Dr["wtype"]); DateTime addtime = Convert.ToDateTime(Dr["addtime"]); DateTime dt = DateTime.Now; string strdt = addtime.ToString("HH:mm"); if(addtime.ToString("yyyy-MM-dd")!= dt.ToString("yyyy-MM-dd")) { strdt = addtime.ToString("yyyy-MM-dd"); } Mtxfw.Model.Article amodel = daoArt.GetModel(id); if (amodel != null) { string title = amodel.Title; string content = amodel.Content; string link = amodel.Paths; if (ifweb == 1) { if (link == "kf.html") { link = "mykf.html"; } if (link == "orders.html") { link = "myorders.html"; } } string gid = amodel.Paths2; string img = amodel.Author; int ACount = daoArt.GetCount(strsql2+ " and wtype=" + amodel.wtype + " and hasRead=0"); if (amodel.wtype == 7 || amodel.wtype == 10) { Mtxfw.Model.user_info umodel = daoUser.GetModel(amodel.senderid); if (umodel != null) { string aPhone = umodel.NCName; if (aPhone == "") { aPhone = umodel.Phone; if (aPhone.Length == 11) { aPhone = aPhone.Substring(0, 3) + "****" + aPhone.Substring(7, 4); } } title = aPhone; img = (umodel.UserPic == "" ? "../image/profile.png" : config.webUrl + Mtxfw.Utility.Common.GetCoverPic(umodel.UserPic, "100x100", "cut")); } } strdata += "{\"uId\":\"" + id + "\",\"img\":\"" + img + "\",\"title\":\"" + title + "\",\"time\":\"" + strdt + "\",\"subTitle\":\"" + content.Replace("\r", "\\r").Replace("\n", "\\n").Replace("\t", "\\t").Replace("\"", "\\\"") + "\",\"badge\":\"" + ACount + "\",\"link\":\"" + link + "\",\"hasRead\":\"" + amodel.hasRead + "\",\"icons\":[\"widget://image/dagou" + (amodel.hasRead==1?"0":"") + ".png\"],\"rightBtn\": ["; if (ifweb == 0) { strdata += "{bg: '#ff4d00',"; //按钮背景色,支持 rgb,rgba,#,默认#ee8262. strdata += "title: '删除',"; //按钮名字,字符串类型,默认‘按钮’ strdata += "titleSize: 13,"; //按钮标题大小,默认12 strdata += "titleColor: '#ffffff',"; // 按钮标题颜色,支持 rgb,rgba,#,默认#ffffff strdata += "selectedColor: '#ffffff',"; //按钮选中时候的颜色值,支持 rgb,rgba,# strdata += "icon: 'widget://image/Delete0.png'"; strdata += "}, {"; strdata += "bg: '#9E9C9C',"; //按钮背景色,支持 rgb,rgba,#,默认#ee8262. strdata += "title: '取消',"; //按钮名字,字符串类型,默认‘按钮’ strdata += "titleSize: 13,"; //按钮标题大小,默认12 strdata += "titleColor: '#ffffff',"; // 按钮标题颜色,支持 rgb,rgba,#,默认#ffffff strdata += "selectedColor: '#ffffff',"; //按钮选中时候的颜色值,支持 rgb,rgba,# strdata += "icon: 'widget://image/close.png'}"; } strdata += "]}"; strdata += ","; i += 1; } } } ds.Clear(); if (strdata != "") { strdata = strdata.Substring(0, strdata.Length - 1); } data = "{\"status\":1,\"data\":[" + strdata + "]}"; Mtxfw.Utility.Common.WriteHtml("/weixin/data.txt", data); return data; } #endregion #region //删除消息----------------------------------------------------------------------------------------- /// /// 删除消息 /// protected string delmessage(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int aid = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["id"].ToString())); Mtxfw.Model.user_info umodel = daoUser.GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { Mtxfw.Model.Article amodel = daoArt.GetModel(aid); if (amodel != null) { if (amodel.ParentID == 30) { daoArt.Delete("gtype=" + gtype + " and ParentID=30 and senderid=" + amodel.senderid + " and receiverid=" + amodel.receiverid + " And wtype=" + amodel.wtype); 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 = (ifweb==0?"app":"web") + "删除信息"; logmodel.UType = 1; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"删除成功!\"}"; } else { data = "{\"status\":0,\"msg\":\"参数错误4!\"}"; } } else { data = "{\"status\":0,\"msg\":\"信息已被删除!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误2!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } return data; } #endregion #region //消息设为已读----------------------------------------------------------------------------------------- /// /// 消息设为已读 /// protected string sethasRead(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"]) && !String.IsNullOrEmpty(context.Request["id"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); int aid = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["id"].ToString())); Mtxfw.Model.user_info umodel = daoUser.GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { Mtxfw.Model.Article amodel = daoArt.GetModel(aid); if (amodel != null) { if (amodel.ParentID == 30) { daoArt.UpdateuSel("hasRead", 1, "gtype=" + gtype + " and ParentID=30 and senderid=" + amodel.senderid + " and receiverid=" + amodel.receiverid + " And wtype=" + amodel.wtype); /*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 = (ifweb==0?"app":"web") + "消息设为已读"; logmodel.UType = 1; new DAL.User_CZ_log().Add(logmodel);*/ string strsql2 = "a.parentid=30 and a.hasRead=0"; strsql2 += " And ((a.receiverid=" + userId + ") Or a.receiverid=0)"; int msgCount = daoArt.GetCount(strsql2); data = "{\"status\":1,\"msg\":\"设置成功!\",\"msgCount\":" + msgCount + "}"; } else { data = "{\"status\":0,\"msg\":\"参数错误4!\"}"; } } else { data = "{\"status\":0,\"msg\":\"信息已被删除!\"}"; } } else { data = "{\"status\":0,\"msg\":\"您未登录\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误2!\"}"; } } else { data = "{\"status\":0,\"msg\":\"参数错误!\"}"; } return data; } #endregion #region //获取新手学堂数据----------------------------------------------------------------------------------------- /// /// 获取新手学堂数据 /// protected string getxsxtlist(HttpContext context) { string data = "{\"status\":0}"; string strdata = "\"xsxtlb\":["; DataSet ds = new Mtxfw.DAL.user_Goods_lb().GetList("gtype=" + gtype + " and utype=0 Order By LBLinkID"); if (ds.Tables[0].Rows.Count > 0) { int i = 0; foreach (System.Data.DataRow Dr in ds.Tables[0].Rows) { int LBid = Convert.ToInt32(Dr["id"]); string LBName = Dr["LBName"].ToString(); strdata += "{\"id\":\"" + LBid + "\",\"LBName\":\"" + LBName + "\""; string strsql = "gtype=" + gtype + " and parentid=19 And Seef=0"; strsql += " And CategoryId='" + LBid + "'"; strdata += ",\"data\":["; DataSet dss = new Mtxfw.DAL.Article().GetList1("top 6 id,hasRead,title,Content2,Author,Paths,addtime", "" + strsql + " order By LinkID desc"); if (dss.Tables[0].Rows.Count > 0) { int i2 = 0; foreach (System.Data.DataRow Drr in dss.Tables[0].Rows) { int id = Convert.ToInt32(Drr["id"]); int hasRead = Convert.ToInt32(Drr["hasRead"]); string title = Drr["title"].ToString(); string content = Drr["Content2"].ToString(); string addtime = Drr["addtime"].ToString(); string pic = Drr["Author"].ToString().Split('|')[0]; if (pic != "") { pic = Mtxfw.Utility.Common.cminimage0(pic); } strdata += "{\"id\":\"" + id + "\",\"title\":\"" + title + "\",\"pic\":\"" + pic + "\",\"content\":\"" + Mtxfw.Utility.Common.CnCutString(Mtxfw.Utility.Common.CIntro(content), 60, "...") + "\",\"createTime\":\"" + addtime + "\""; strdata += "}"; if (i2 != dss.Tables[0].Rows.Count - 1) { strdata += ","; } i2 += 1; } } dss.Clear(); strdata += "]"; strdata += "}"; if (i != ds.Tables[0].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); strdata += "]"; string strtp = ""; ds = new Mtxfw.DAL.user_Goods().GetList1("top 1 id,GoodsName,GoodsPic,addtime", "gtype=" + gtype + " and utype=5 Order By addtime Desc"); if (ds.Tables[0].Rows.Count > 0) { string GoodsPic = ds.Tables[0].Rows[0]["GoodsPic"].ToString(); if (GoodsPic != "") { strtp = (GoodsPic.IndexOf("http") != -1 ? GoodsPic : Mtxfw.Utility.Common.GetCoverPic(GoodsPic, "720x360", "cut")); } } ds.Clear(); data = "{\"status\":1,\"strtp\":\"" + strtp + "\"," + strdata + "}"; return data; } #endregion #region //获取新手学堂类别列表----------------------------------------------------------------------------------------- /// /// 获取新手学堂类别列表 /// protected string getxsxtLBlist(HttpContext context) { string data = "{\"status\":0}"; string strdata = ""; string strsql = "gtype=" + gtype + " and parentid=19 And Seef=0"; int t = 0; if (!String.IsNullOrEmpty(context.Request["t"])) { t = Convert.ToInt32(context.Request["t"].ToString()); strsql += " And CategoryId='" + t + "'"; } strdata += "\"data\":["; string groupby = ""; string strOrder = "LinkID desc"; int Start = 0; int Limit = 30; if (!String.IsNullOrEmpty(context.Request["Start"])) { Start = Convert.ToInt32(HttpUtility.UrlDecode(context.Request["Start"].ToString())); } Int32 Recount = 0; DataSet ds = new Mtxfw.DAL.Article().GetDataSet(groupby, strOrder, "id,hasRead,title,Content2,Author,Paths,addtime", "", 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 id = Convert.ToInt32(Dr["id"]); int hasRead = Convert.ToInt32(Dr["hasRead"]); string title = Dr["title"].ToString(); string content = Dr["Content2"].ToString(); string addtime = Dr["addtime"].ToString(); string pic = Dr["Author"].ToString(); string video = Dr["Paths"].ToString().Split('|')[0]; if (pic != "") { pic = Mtxfw.Utility.Common.cminimage0(pic); } if (video != "") { video = new Admin_Member_livefile().cvideo(video); } strdata += "{\"id\":\"" + id + "\",\"title\":\"" + title + "\",\"pic\":\"" + pic + "\",\"video\":\"" + video + "\",\"content\":\"" + Mtxfw.Utility.Common.CnCutString(Mtxfw.Utility.Common.CIntro(content), 60, "...") + "\",\"createTime\":\"" + addtime + "\""; strdata += "}"; if (i != ds.Tables[1].Rows.Count - 1) { strdata += ","; } i += 1; } } ds.Clear(); strdata += "]"; data = "{\"status\":1," + strdata + "}"; return data; } #endregion #region //留言----------------------------------------------------------------------------------------- /// /// 留言 /// protected string liuyan(HttpContext context) { string data = "{\"status\":0}"; bool b = true; if (!String.IsNullOrEmpty(context.Request["userId"]) && !String.IsNullOrEmpty(context.Request["LoginId"])) { int userId = Convert.ToInt32(context.Request["userId"].ToString()); string LoginId = HttpUtility.UrlDecode(context.Request["LoginId"].ToString()); Mtxfw.Model.user_info umodel = new Mtxfw.DAL.user_info().GetModel(userId); if (umodel != null) { if (umodel.LoginId == LoginId) { if (!String.IsNullOrEmpty(context.Request["id"]) && !String.IsNullOrEmpty(context.Request["body"])) { int id = Convert.ToInt32(context.Request["id"].ToString()); string body = HttpUtility.UrlDecode(context.Request["body"].ToString()); if (b) { if (umodel.NCName == "") { b = false; data = "{\"status\":0,\"msg\":\"您还没有设置昵称!\"}"; } } if (b) { Mtxfw.Model.Article amodel = new Mtxfw.DAL.Article().GetModel(id); if (amodel != null) { DateTime dt = DateTime.Now; Mtxfw.Model.Article model = new Mtxfw.Model.Article(); model.senderid = umodel.Id; model.receiverid = 0; model.Title = "留言"; model.ParentID = 15; model.CategoryId = amodel.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); Model.User_CZ_log logmodel = new Model.User_CZ_log(); logmodel.MemberId = umodel.Id; logmodel.AddTime = dt; logmodel.IP = Mtxfw.Utility.Common.GetIP; logmodel.Body = (ifweb==0?"app":"web") + "留言:" + amodel.Title; logmodel.UType = 3; logmodel.gtype = model.gtype; new DAL.User_CZ_log().Add(logmodel); data = "{\"status\":1,\"msg\":\"留言成功\"}"; } else { data = "{\"status\":0,\"msg\":\"参数错误\"}"; } } } else { data = "{\"status\":0,\"msg\":\"参数为空\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"您未登录!\"}"; } } else { b = false; data = "{\"status\":0,\"msg\":\"登录参数错误!\"}"; } } return data; } #endregion #region //获取资讯或视界详情----------------------------------------------------------------------------------------- /// /// 获取资讯或视界详情 /// protected string getsysmsgdetail(HttpContext context) { string data = "{\"status\":0}"; if (!String.IsNullOrEmpty(context.Request["id"])) { int id = Convert.ToInt32(context.Request["id"].ToString()); Mtxfw.Model.Article model = new Mtxfw.DAL.Article().GetModel(id); if (model != null) { string content = model.Content; model.wtype += 1; new Mtxfw.DAL.Article().UpdateuSel("wtype", model.wtype, model.id); /*string pattern = @""; Regex R = new Regex(pattern); Match M = R.Match(content); while (M.Success) { string vcontent = M.Groups[1].ToString(); //Mtxfw.Utility.Common.WriteHtml("/weixin/content1.txt", vcontent); //string pattern2 = @"]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>"; string pattern2 = @"poster=""[\s\t\r\n]*"""; Regex R2 = new Regex(pattern2); Match M2 = R2.Match(vcontent); if (M2.Success) { string vurl = M2.Groups[1].ToString(); content = content.Replace("poster=\"" + vurl + "\"", "poster=\"" + model.Author + "\""); } else { content = content.Replace("", "