Example #1
0
 /// <summary>
 /// 商品快照,存为mht,
 /// mht缺点 :在于非IE下只能下载,但360等双核浏览器可以自动切换
 /// html缺点:只是保存了页面不存图片和css,这样如果页面删除,则快照失效
 /// </summary>
 public static void SaveSnapShot(M_OrderList orderMod)
 {
     try
     {
         string    snapDir = "/UploadFiles/SnapDir/" + orderMod.Rename + orderMod.Userid + "/" + orderMod.OrderNo + "/";
         DataTable dt      = cartProBll.SelByOrderID(orderMod.id);
         foreach (DataRow dr in dt.Rows)
         {
             int    storeid = DataConverter.CLng(dr["StoreID"]);
             int    proid   = DataConverter.CLng(dr["Proid"]);
             string url     = SiteConfig.SiteInfo.SiteUrl + GetShopUrl(storeid, proid);
             new HtmlHelper().DownToMHT(url, snapDir + proid + ".mht");
         }
     }
     catch (Exception ex) { ZLLog.L(Model.ZLEnum.Log.exception, "订单:" + orderMod.OrderNo + "快照保存失败,原因:" + ex.Message); }
 }
Example #2
0
 protected void Application_Start()
 {
     //WebApiConfig.Register(GlobalConfiguration.Configuration);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     //RouteConfig.RegisterRoutes(RouteTable.Routes);
     //BundleConfig.RegisterBundles(BundleTable.Bundles);
     //-------------------------------------------------
     RegisterRoutes(RouteTable.Routes);
     log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("/Config/log.config")));
     //--------
     try
     {
         TaskCenter.Init();
         TaskCenter.Start();
     }
     catch (Exception ex) { ZLLog.L("TaskCenter" + ex.Message); }
 }
Example #3
0
        public DataTable ViewAuth_Conver(string purview)
        {
            DataTable dt = null;

            if (string.IsNullOrEmpty(purview))
            {
                return(dt);
            }
            try
            {
                dt = JsonConvert.DeserializeObject <DataTable>(purview);
                string viewGroup = DataConvert.CStr(dt.Rows[0]["ViewGroup"]);
                dt.Rows[0]["View"]      = DataConvert.CStr(dt.Rows[0]["View"]);
                dt.Rows[0]["ViewGroup"] = string.IsNullOrEmpty(viewGroup) ? "" : ("," + viewGroup + ",").Replace(",,", ",");
            }
            catch (Exception ex) { ZLLog.L("conver err:" + ex.Message); dt = null; }
            return(dt);
        }
Example #4
0
 //最终用于清除的方法,过期与主动都调用其
 public static void ClearByKeys(string keys)
 {
     keys = keys.TrimEnd(',');
     if (!string.IsNullOrEmpty(keys))
     {
         try
         {
             foreach (string key in keys.Split(','))
             {
                 //后期改为缓存事件分发
                 M_Cache model = UserSession[key];
                 B_User.UpdateField("LastActiveTime", (DateTime.Now.AddMinutes(-ActiveSpan)).ToString(), model.UserID, false);
                 UserSession.Remove(key);
             }
         }
         catch (Exception ex) { ZLLog.L(Model.ZLEnum.Log.labelex, "用户缓存出错:" + ex.Message); }
     }
 }
Example #5
0
    //----------------------------------------
    //----上传文件检测,首先多重判断,避免对普通页面的影响,然后再对安全进行检测,如带多个后缀名,则每个都检测
    public static void CheckUpladFiles()
    {
        HttpRequest  Request  = HttpContext.Current.Request;
        HttpResponse Response = HttpContext.Current.Response;

        if (HttpContext.Current.Request.ContentType.ToLower().IndexOf("multipart/form-data") > -1)
        {
            for (int i = 0; i < Request.Files.Count; i++)
            {
                HttpPostedFile file  = Request.Files[i];
                string         fname = Path.GetFileName(file.FileName).ToLower();
                if (file.ContentLength < 1 || string.IsNullOrEmpty(fname))
                {
                    continue;
                }
                if (fname.IndexOf(".") < 0)
                {
                    Response.Write("取消上传,原因:文件必须有后缀名,请勿上传可疑文件"); Response.End();
                }
                string[] filearr        = fname.Split('.');//多重后缀名检测,用于处理低版本IIS安全问题(IIS7以上可不需)
                string   UploadFileExts = SiteConfig.SiteOption.UploadFileExts.ToLower();
                for (int o = 1; o < filearr.Length; o++)
                {
                    ZLLog.L(ZLEnum.Log.fileup, "By:Global_CheckUpladFiles,文件名:" + file.FileName);
                    string fileext = filearr[o].ToString().ToLower();
                    if (!ExNameCheck(fileext))//;号检测
                    {
                        string exname = Path.GetExtension(fname).ToLower().Replace(".", "");
                        if (!StringHelper.FoundCharInArr(UploadFileExts, exname, "|"))
                        {
                            Response.Write("取消上传,原因:上传的文件不是符合扩展名" + UploadFileExts + "的文件");
                            Response.End();
                        }
                    }
                    else
                    {
                        Response.Write("取消上传,原因:请勿上传可疑文件!");
                        Response.End();
                    }
                }
            }//for end;
        }
    }
Example #6
0
 //支付成功时执行的操作
 private void PayOrder_Success(WxPayData result)
 {
     ZLLog.L(ZLEnum.Log.pay, PayPlat + " 支付单:" + result.GetValue("out_trade_no") + " 金额:" + result.GetValue("total_fee"));
     try
     {
         M_Order_PayLog paylogMod = new M_Order_PayLog();
         M_Payment      pinfo     = payBll.SelModelByPayNo(result.GetValue("out_trade_no").ToString());
         if (pinfo == null)
         {
             throw new Exception("支付单不存在");
         }                                                    //支付单检测合为一个方法
         if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
         {
             throw new Exception("支付单状态不为未支付");
         }
         pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
         pinfo.PlatformInfo = PayPlat;
         pinfo.SuccessTime  = DateTime.Now;
         pinfo.PayTime      = DateTime.Now;
         pinfo.CStatus      = true;
         //1=100,
         double tradeAmt = Convert.ToDouble(result.GetValue("total_fee")) / 100;
         pinfo.MoneyTrue = tradeAmt;
         payBll.Update(pinfo);
         DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
         foreach (DataRow dr in orderDT.Rows)
         {
             M_OrderList orderMod = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
             OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
             orderCom.SendMessage(orderMod, paylogMod, "payed");
             //orderCom.SaveSnapShot(orderMod);
         }
         ZLLog.L(ZLEnum.Log.pay, PayPlat + "支付成功,支付单:" + result.GetValue("out_trade_no").ToString());
     }
     catch (Exception ex)
     {
         ZLLog.L(ZLEnum.Log.pay, new M_Log()
         {
             Action  = "支付回调报错",
             Message = PayPlat + ",支付单:" + result.GetValue("out_trade_no").ToString() + ",原因:" + ex.Message
         });
     }
 }
Example #7
0
        /// <summary>
        /// 删除数据库记录与文件
        /// </summary>
        public void RealDel(string ids)
        {
            if (string.IsNullOrEmpty(ids))
            {
                return;
            }
            SafeSC.CheckIDSEx(ids);
            DataTable dt = DBCenter.Sel(TbName, "ID IN (" + ids + ")");

            foreach (DataRow dr in dt.Rows)
            {
                try
                {
                    SafeSC.DelFile(DataConvert.CStr(dr["VPath"]));
                }
                catch (Exception ex) { ZLLog.L("logo_icon_del:" + ex.Message); }
            }
            Del(ids);
        }
Example #8
0
        public static void SendEmailFunc(string email, string title, string html, string errInfo)
        {
            string errHead = "Email Send Error:[" + title + "][" + errInfo + "]";

            if (string.IsNullOrEmpty(email))
            {
                ZLLog.L(errHead + "未指定需要发送的Email"); return;
            }
            try
            {
                MailInfo mailMod = new MailInfo();
                mailMod.FromName  = SiteConfig.SiteInfo.WebmasterEmail;
                mailMod.Subject   = title;
                mailMod.ToAddress = new System.Net.Mail.MailAddress(email);
                mailMod.MailBody  = html;
                SendMail.Send(mailMod);
            }
            catch (Exception ex) { ZLLog.L(errHead + ex.Message); }
        }
Example #9
0
    //用于处理微信初次验证
    private void Auth()
    {
        string echoString = HttpContext.Current.Request.QueryString["echoStr"];
        string signature  = HttpContext.Current.Request.QueryString["signature"];
        string timestamp  = HttpContext.Current.Request.QueryString["timestamp"];
        string nonce      = HttpContext.Current.Request.QueryString["nonce"];

        ZLLog.L(echoString + "|||" + signature + "|||" + timestamp + "|||" + nonce);
        Response.Clear();
        Response.Write(echoString); Response.Flush(); Response.End();
        //string token = "demo";
        //if (CheckSignature(token, signature, timestamp, nonce))
        //{
        //    if (!string.IsNullOrEmpty(echoString))
        //    {
        //        HttpContext.Current.Response.Write(echoString);
        //        HttpContext.Current.Response.End();
        //    }
        //}
    }
Example #10
0
        //根据用户信息与appid生成签名(可存表中,单独为其建立,免重生成),再根据签名登录IM服务器
        public string GetUserSign(string identity)
        {
            string       pri_key_path = C_QQIM_Contasnt.pri_key_path;
            FileStream   f            = new FileStream(pri_key_path, FileMode.Open, FileAccess.Read);
            BinaryReader reader       = new BinaryReader(f);

            byte[] b = new byte[f.Length];
            reader.Read(b, 0, b.Length);
            string pri_key = Encoding.Default.GetString(b);

            StringBuilder sig     = new StringBuilder(4096);
            StringBuilder err_msg = new StringBuilder(4096);
            int           ret     = sigcheck.tls_gen_sig_ex(C_QQIM_Contasnt.appid, identity, sig, 4096, pri_key, (UInt32)pri_key.Length, err_msg, 4096);

            if (0 != ret)
            {
                ZLLog.L("IM签名生成失败,原因:" + err_msg);
            }
            return(sig.ToString());
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            M_AdminInfo model = B_Admin.GetLogin();
            string      url   = Request.QueryString["ReturnUrl"];

            ZLLog.ToDB(ZLEnum.Log.alogin, new M_Log()
            {
                UName   = model.AdminName,
                Action  = "退出登录",
                Message = "退出登录"
            });
            B_Admin.ClearLogin();
            if (!string.IsNullOrEmpty(url))
            {
                Response.Write("<script>location.href='" + url + "'</script>");
            }
            else
            {
                HttpContext.Current.Response.Redirect("login.aspx");
            }
        }
Example #12
0
        public static Image AddWater(Image img)
        {
            if (!WaterModuleConfig.WaterConfig.IsUsed)
            {
                return(img);
            }
            if (IsPixelFormatIndexed(img.PixelFormat))
            {
                Bitmap bmp = new Bitmap(img.Width, img.Height, PixelFormat.Format32bppArgb);
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                    g.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                    g.DrawImage(img, 0, 0);
                }
                img = bmp;
            }
            //-----开始处理水印
            WaterImages water = new WaterImages();

            if (WaterModuleConfig.WaterConfig.WaterClass.Equals("1"))
            {
                string waterPath = function.VToP(WaterModuleConfig.WaterConfig.imgLogo);
                if (File.Exists(waterPath))
                {
                    img = water.DrawImage(img, waterPath);
                }
                else
                {
                    ZLLog.L("[" + WaterModuleConfig.WaterConfig.imgLogo + "]水印图片不存在");
                }
            }
            else
            {
                img = water.DrawFont(img);
            }
            return(img);
        }
Example #13
0
        public void Insert(M_Release model)
        {
            string           ppath = function.VToP(vpath);
            List <M_Release> list  = new List <M_Release>();

            if (File.Exists(ppath))
            {
                string json = SafeSC.ReadFileStr(vpath);
                if (!string.IsNullOrEmpty(json))
                {
                    try
                    {
                        list.AddRange(JsonConvert.DeserializeObject <List <M_Release> >(json));
                    }
                    catch (Exception ex) { ZLLog.L("生成时转换模型异常,原因" + ex.Message); }
                }
            }
            list.Add(model);
            string text = JsonConvert.SerializeObject(list);

            File.WriteAllText(ppath, text);
        }
Example #14
0
        //上传base64图片
        public IActionResult Base64()
        {
            string     base64str  = Request.Form["base64"];//上传的base64字符串
            string     action     = Request.Form["action"];
            string     uploadPath = "";
            string     saveName   = function.GetRandomString(6) + ".jpg";
            string     result     = "";
            M_UserInfo mu         = buser.GetLogin();

            try
            {
                if (!mu.IsNull)
                {
                    uploadPath = ZLHelper.GetUploadDir_User(mu, "dai");
                }
                else if (adminMod != null)
                {
                    uploadPath = ZLHelper.GetUploadDir_Admin(adminMod, "dai");
                }
                else //Not Login
                {
                    uploadPath = ZLHelper.GetUploadDir_Anony("dai");
                }
                ImgHelper imghelper = new ImgHelper();
                imghelper.Base64ToImg(uploadPath + saveName, base64str);
                result = uploadPath + saveName;
                return(Content(result));
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.fileup, new M_Log()
                {
                    Source  = Request.RawUrl(),
                    Message = "上传失败|文件名:" + uploadPath + saveName + "|" + "原因:" + ex.Message
                });
                return(Content(Failed.ToString()));
            }
        }
Example #15
0
 //检测版本号,如果不正确则修正
 public static void CheckVersion(Configuration config)
 {
     try
     {
         //没有Version则新建一个
         if (config.AppSettings.Settings["Version"] == null)
         {
             config.AppSettings.Settings.Add("Version", BLLCommon.Version);
         }
         else
         {
             //判断配置文件中版本号与BLL中是否一致
             string ver = config.AppSettings.Settings["Version"].Value;
             if (!BLLCommon.Version.Equals(ver))
             {
                 config.AppSettings.Settings["Version"].Value = BLLCommon.Version;
             }
         }
         config.Save(ConfigurationSaveMode.Modified);
         ConfigurationManager.RefreshSection("AppSettings");
     }
     catch (Exception ex) { ZLLog.L("CheckVersion" + ex.Message); }
 }
Example #16
0
        //设定间隔时间,也可自定义
        public void SetInterval()
        {
            switch (scheMod.ExecuteType)
            {
            case (int)M_Content_ScheTask.ExecuteTypeEnum.JustOnce:
                //每分钟检测一次,看是否到时间
                Interval = 60 * 1000;
                break;

            case (int)M_Content_ScheTask.ExecuteTypeEnum.EveryDay:
                //每分钟检测一次看是否到时间
                Interval = 60 * 1000;
                break;

            case (int)M_Content_ScheTask.ExecuteTypeEnum.Interval:
                int time = DataConvert.CLng(scheMod.Interval) * 60 * 1000;
                if (time <= 0)
                {
                    Interval = int.MaxValue;
                    ZLLog.L(scheMod.TaskName + ",时间设定不正确");
                }
                else
                {
                    Interval = time;
                }
                break;

            case (int)M_Content_ScheTask.ExecuteTypeEnum.Passive:
                Interval = int.MaxValue;
                break;

            case (int)M_Content_ScheTask.ExecuteTypeEnum.EveryMonth:
                //每分钟检测一次看是否到时间
                Interval = 60 * 1000;
                break;
            }
        }
Example #17
0
        //检测配置是否正确,开始执行SQL脚本
        protected void Step3_Next_Btn_Click(object sender, EventArgs e)
        {
            string dbname = TxtDataBase.Text.Trim();

            TxtPassword_Hid.Value = TxtPassword.Text.Trim();
            string connstr = GetConnstr(dbname);

            try
            {
                switch (SqlVersion_DP.SelectedValue.ToLower())
                {
                case "local":
                    //DBHelper.DB_Clear(connstr);
                    break;

                case "mssql":
                    //if (!DBHelper.DB_Exist(connstr, dbname)) { function.Script(this, "alert('数据库[" + dbname + "]不存在,请先创建好数据库,再执行该步!');"); return; }
                    break;

                case "oracle":
                    function.Script(this, "alert(\"" + Resources.L.该版本仅对商业用户开放 + "\");");
                    return;
                }
                WriteConnstr(connstr);
                if (!ignoreSql_chk.Checked)
                {
                    function.Script(this, "installDB();");
                }
                else
                {
                    Install_Wzd.MoveTo(WizardStep4);
                    CurStep_Hid.Value = "4";
                }
            }
            catch (Exception ex) { ZLLog.L("安装时出错,原因:" + ex.Message); function.Script(this, "showAlert(\"" + HttpUtility.UrlEncode(ex.Message.Replace(" ", "")) + "\");"); return; }
        }
Example #18
0
        private string AjaxVaild(string user, string pwd)
        {
            user = user.Trim(); pwd = pwd.Trim();
            if (ValidateCount >= 3)
            {
                if (!ZoomlaSecurityCenter.VCodeCheck(RequestEx["VCode_hid"], RequestEx["vcode"]))
                {
                    return("验证码不正确");
                }
            }
            M_AdminInfo info = B_Admin.AuthenticateAdmin(user, pwd);

            ValidateCount++;
            if (info == null || info.IsNull)
            {
                if (ValidateCount == 3)
                {
                    return("True");
                }
                else
                {
                    return("用户名或密码错误!");
                }
            }
            else if (info.IsLock)
            {
                return("你的帐户被锁定,请与超级管理员联系");
            }
            else
            {
                ZLLog.L(ZLEnum.Log.alogin, "管理员[" + info.UserName + "]登录");
                ValidateCount = 0;
                B_Admin.SetLoginState(HttpContext, info);
            }
            return("True");
        }
Example #19
0
        //每半小时检测一次,如未发送过邮件且超过24小时,则发送
        public void SendEmailToUser()
        {
            string siteUrl  = SiteConfig.SiteInfo.SiteUrl + "/BU/Comment.aspx?p=";
            string mailHtml = EventDeal.Tlp_Read("订单成交24小时后_用户");

            //已支付,已满24小时,未发送过邮件的订单
            string where = "ParentID=0 AND (Payment!='' AND Payment IS NOT NULL) ";
            where       += " AND DATEDIFF(HOUR,AddTime,GETDATE())>=24";
            DataTable orderDT = DBCenter.Sel("ZL_OrderInfo", where);

            for (int i = 0; i < orderDT.Rows.Count; i++)
            {
                try
                {
                    DataRow     dr       = orderDT.Rows[i];
                    M_OrderList orderMod = new M_OrderList().GetModelFromReader(orderDT.Rows[i]);
                    string      url      = siteUrl + EncryptHelper.AESEncrypt(orderMod.id.ToString());
                    string      html     = mailHtml.Replace("{LinkUrl}", "<a href='" + siteUrl + "' target='_blank'>" + siteUrl + "</a>");
                    EventDeal.SendToEmail(orderMod.Email, "Order Comment", mailHtml, orderMod.id.ToString());
                    DBCenter.UpdateSQL(orderMod.TbName, "ParentID=1", "ID=" + orderMod.id);
                }
                catch (Exception ex) { ZLLog.L("邮件24小时通知 Error:[" + orderDT.Rows[i]["ID"] + "]" + ex.Message); }
            }
        }
Example #20
0
 public string shareLink = "";//sharelink
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         M_UserInfo mu = buser.GetLogin();
         pageMod = GetScenceMod();
         if (!B_Design_Helper.Se_CheckAccessPwd(pageMod, mu))
         {
             Server.Transfer("/design/h5/checkpwd.aspx?sid=" + Sid);
             return;
         }
         shareLink = Request.Url.Host + "/h5/" + pageMod.ID;
         if (DeviceHelper.GetBrower() == DeviceHelper.Brower.Micro)
         {
             try
             {
                 //Avoid sometimes WeChat API parsing error
                 WX_Share.Visible = true;
                 //--WXAPI
                 WxAPI api = WxAPI.Code_Get();
                 appid     = api.AppId.APPID;
                 timeStamp = WxAPI.HP_GetTimeStamp();
                 sign      = api.JSAPI_GetSign(api.JSAPITicket, noncestr, timeStamp, Request.Url.AbsoluteUri);
             }
             catch (Exception ex) { ZLLog.L("wxerror:" + ex.Message); }
         }
         Title_L.Text = pageMod.Title;
         Tit_L.Text   = pageMod.Title;
         if (string.IsNullOrEmpty(pageMod.PreviewImg))
         {
             string[] defwx = "/UploadFiles/demo/h4.jpg|/UploadFiles/demo/h5.jpg".Split('|');
             pageMod.PreviewImg = defwx[new Random().Next(0, defwx.Length)];
         }
         Wx_Img.ImageUrl = pageMod.PreviewImg;
     }
 }
        private void SendAuthedMail(string emailTlp, DataTable dt)
        {
            if (dt.Rows.Count < 1)
            {
                function.WriteErrMsg("授权申请不存在");
            }
            MailAddress adMod    = new MailAddress(dt.Rows[0]["Email"].ToString());
            MailInfo    mailInfo = new MailInfo()
            {
                ToAddress = adMod, IsBodyHtml = true
            };

            mailInfo.FromName = SiteConfig.SiteInfo.SiteName;
            mailInfo.Subject  = SiteConfig.SiteInfo.SiteName + "APP授权审核邮件";
            mailInfo.MailBody = new OrderCommon().TlpDeal(emailTlp, dt);
            if (SendMail.Send(mailInfo) == ZoomLa.Components.SendMail.MailState.Ok)//发送成功,生成用户,显示下一步提示
            {
                function.WriteErrMsg("发送成功!");
            }
            else
            {
                ZLLog.L(ZLEnum.Log.exception, adMod.Address + "的邮件发送失败,请检测邮箱地址是否正确!");
            }
        }
Example #22
0
        protected void EBtnSubmit_Click(object sender, EventArgs e)//添加文章
        {
            M_AdminInfo    adminMod = B_Admin.GetLogin();
            IList <string> content  = new List <string>();

            if (SiteConfig.SiteOption.FileRj == 1 && contentBll.SelHasTitle(txtTitle.Text.Trim()))
            {
                function.WriteErrMsg(Resources.L.该内容标题已存在 + "!", "javascript:history.go(-1);");
            }
            DataTable    dt         = fieldBll.SelByModelID(ModelID, false);
            Call         commonCall = new Call();
            DataTable    table      = commonCall.GetDTFromPage(dt, Page, ViewState, content);
            M_CommonData CData      = new M_CommonData();

            CData.NodeID     = NodeID;
            CData.ModelID    = ModelID;
            CData.TableName  = modelBll.GetModelById(ModelID).TableName;
            CData.Title      = txtTitle.Text.Trim();
            CData.Inputer    = string.IsNullOrEmpty(txtInputer.Text) ? adminMod.AdminName : txtInputer.Text;
            CData.EliteLevel = ChkAudit.Checked ? 1 : 0;
            CData.InfoID     = "";
            CData.Hits       = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text);
            CData.UpDateType = 2;
            CData.UpDateTime = DataConverter.CDate(txtdate.Text);
            CData.TagKey     = Request.Form["tabinput"];
            string status = ddlFlow.SelectedValue.Trim();

            if (!string.IsNullOrEmpty(status))
            {
                CData.Status = Convert.ToInt32(status);
            }
            // CData.Titlecolor = Titlecolor.Text;
            CData.Template   = TxtTemplate_hid.Value;
            CData.CreateTime = DataConverter.CDate(txtAddTime.Text);
            CData.SpecialID  = "," + string.Join(",", Spec_Hid.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + ",";
            string parentTree = "";

            CData.FirstNodeID = nodeBll.SelFirstNodeID(NodeID, ref parentTree);
            CData.ParentTree  = parentTree;
            CData.TitleStyle  = ThreadStyle.Value;
            CData.TopImg      = ThumImg_Hid.Value;//首页图片
            CData.PdfLink     = Makepdf.Checked ? "pdf_" + DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + ".pdf" : "";
            CData.Subtitle    = Subtitle.Text;
            CData.PYtitle     = PYtitle.Text;
            CData.RelatedIDS  = RelatedIDS_Hid.Value;
            CData.IsComm      = Convert.ToInt32(IsComm_Radio.SelectedValue);
            int newID = contentBll.AddContent(table, CData);//插入信息给两个表,主表和从表:CData-主表的模型,table-从表

            //推送
            if (!string.IsNullOrEmpty(pushcon_hid.Value))
            {
                string[] nodeArr = pushcon_hid.Value.Trim(',').Split(',');
                for (int i = 0; i < nodeArr.Length; i++)
                {
                    CData.NodeID = Convert.ToInt32(nodeArr[i]);
                    contentBll.AddContent(table, CData);
                }
            }
            #region 生成PDF
            //if (Makepdf.Checked)
            //{
            //    M_CommonData m_CommonData = contentBll.SelReturnModel(newID);
            //    string strSql = "select source from " + CData.TableName + " where id=" + m_CommonData.ItemID;
            //    string source = "";
            //    SqlDataReader dr = SqlHelper.ExecuteReader(System.Data.CommandType.Text, strSql);
            //    if (dr.Read())
            //    {
            //        source = dr["source"].ToString();
            //    }
            //    dr.Close();
            //}
            #endregion
            #region  关键词
            {
                keys = StrHelper.RemoveRepeat(CData.TagKey.Split(','), IgnoreKey_Hid.Value.Split(','));
                if (!string.IsNullOrEmpty(keys))
                {
                    keyBll.AddKeyWord(keys, 1);
                }
            }
            #endregion
            ZLLog.ToDB(ZLEnum.Log.content, new M_Log()
            {
                UName   = adminMod.AdminName,
                Source  = Request.RawUrl,
                Action  = "添加内容",
                Message = "标题:" + CData.Title + ",Gid:" + newID,
                Level   = "add"
            });
            //添加计划任务(审核时间),如果自动审核时间小于当前时间则忽略
            //if (!string.IsNullOrEmpty(CheckDate_T.Text) && Convert.ToDateTime(CheckDate_T.Text) > DateTime.Now)
            //{
            //    AddSched(newID, CheckDate_T.Text, M_Content_ScheTask.TaskTypeEnum.AuditArt);
            //    contentBll.UpdateStatus(newID, (int)ZLEnum.ConStatus.UnAudit);
            //}
            //if (!string.IsNullOrEmpty(TimeDate_T.Text))
            //{
            //    AddSched(newID, TimeDate_T.Text, M_Content_ScheTask.TaskTypeEnum.UnAuditArt);
            //}
            //积分
            if (SiteConfig.UserConfig.InfoRule > 0)
            {
                B_User     buser = new B_User();
                M_UserInfo muser = buser.GetUserByName(adminMod.AdminName);
                if (!muser.IsNull)
                {
                    buser.ChangeVirtualMoney(muser.UserID, new M_UserExpHis()
                    {
                        UserID    = muser.UserID,
                        detail    = "添加内容:" + txtTitle.Text + "增加积分",
                        score     = SiteConfig.UserConfig.InfoRule,
                        ScoreType = (int)M_UserExpHis.SType.Point
                    });
                }
            }
            M_Node        noinfo     = nodeBll.GetNodeXML(NodeID);
            CreateHtmlDel createHtml = CreateHtmlFunc;
            createHtml.BeginInvoke(HttpContext.Current.Request, quickmake.Checked, CData, table, null, null);
            Response.Redirect("ContentShow.aspx?gid=" + newID + "&type=add");
        }
Example #23
0
    private void SendMsg(Object info)
    {
        try
        {
            M_WxTextMsg reqMod = (M_WxTextMsg)info;
            System.Threading.Thread.Sleep(1000);//延迟1秒,避免先于欢迎消息
            M_WX_APPID appmod = new B_WX_APPID().GetAppByWxNo(reqMod.ToUserName);
            if (appmod == null)
            {
                throw new Exception("目标公众号[" + reqMod.ToUserName + "]不存在");
            }
            string     msgStr  = "";
            M_UserAPP  uappMod = new M_UserAPP();
            B_UserAPP  uappBll = new B_UserAPP();
            M_UserInfo mu      = new M_UserInfo();
            uappMod = uappBll.SelModelByOpenID(reqMod.FromUserName, "wechat");
            if (uappMod != null)
            {
                mu = buser.GetUserByUserID(uappMod.UserID);
                M_UserInfo pmu = buser.GetUserByUserID(DataConvert.CLng(reqMod.EventKey.Replace("qrscene_", "")));
                if (mu != null && mu.UserID > 0)
                {
                    if (DataConvert.CLng(mu.ParentUserID) > 0)
                    {
                        msgStr = "您已绑定了推荐人不能重复绑定!";
                    }
                    else
                    {
                        if (mu.UserID == DataConvert.CLng(reqMod.EventKey.Replace("qrscene_", "")))
                        {
                            msgStr = "您扫描的是您自己的二维码!";
                        }
                        else
                        {
                            if (pmu != null && pmu.UserID > 0)
                            {
                                string err = "";
                                if (CheckParentUser(pmu.UserID, mu.UserID, ref err))
                                {
                                    mu.ParentUserID = pmu.UserID.ToString();
                                    if (buser.UpdateByID(mu))
                                    {
                                        msgStr = "您成功绑定了推荐人:" + pmu.TrueName + "!";
                                    }

                                    else
                                    {
                                        msgStr = "绑定推荐人失败!";
                                    }
                                }
                                else
                                {
                                    msgStr = "绑定推荐失败,错误信息:" + err;
                                }
                            }
                            else
                            {
                                msgStr = "绑定推荐失败,推荐人不存在!";
                            }
                        }
                    }
                }
                WxAPI.Code_Get(appmod).SendMsg(reqMod.FromUserName, msgStr);
            }
        }
        catch (Exception ex) { ZLLog.L("微信多信息出错,原因:" + ex.Message); }
    }
Example #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string echoString = HttpContext.Current.Request.QueryString["echoStr"];
        string signature  = HttpContext.Current.Request.QueryString["signature"];
        string timestamp  = HttpContext.Current.Request.QueryString["timestamp"];
        string nonce      = HttpContext.Current.Request.QueryString["nonce"];

        if (Request.HttpMethod == "GET")
        {
            Auth(); return;
        }
        try
        {
            buser      = new B_User(HttpContext.Current);
            requesdata = GetXml();
            //requesdata = "<xml><ToUserName><![CDATA[gh_33273dafc0e4]]></ToUserName> <FromUserName><![CDATA[olwfpsvje_OHogJ8rOANahcqSijk]]></FromUserName> <CreateTime>1434081760</CreateTime> <MsgType><![CDATA[text]]></MsgType> <Content><![CDATA[pic]]></Content> <MsgId>6159334259197323209</MsgId> </xml>";
            if (string.IsNullOrEmpty(requesdata))
            {
                return;
            }
            M_WxTextMsg reqMod = new M_WxTextMsg(requesdata);
            //获取需要返回的公众号
            M_WX_APPID appmod = appBll.GetAppByWxNo(reqMod.ToUserName);
            if (appmod == null)
            {
                throw new Exception("目标公众号[" + reqMod.ToUserName + "]不存在");
            }
            api     = WxAPI.Code_Get(appmod);
            errmsg += "动作:" + reqMod.MsgType;
            switch (reqMod.MsgType)
            {
            case "event":    //事件--关注处理,后期扩展单击等
            {
                //M_WxImgMsg msgMod = JsonConvert.DeserializeObject<M_WxImgMsg>(appmod.WelStr);
                M_WxImgMsg msgMod = new M_WxImgMsg();
                msgMod.ToUserName   = reqMod.FromUserName;
                msgMod.FromUserName = reqMod.ToUserName;
                WxEventHandler(reqMod);        //系统事件处理
                //登录检测,可按需取消或修改位置
                M_UserInfo mu = UserBindCheck(reqMod);
                //if (mu.IsNull)
                //{
                //    msgMod.Articles.Add(new M_WXImgItem()
                //    {
                //        Title = "请先关联用户",
                //        Description = "你尚未关联用户,点击登录关联用户",
                //        Url = baseUrl + "/User/Login.aspx?WXOpenID=" + reqMod.FromUserName
                //    });
                //    RepToClient(msgMod.ToXML());
                //}
                WxMenuBtnHandler(reqMod, msgMod, mu);
            }
            break;

            case "text":    //接收文本消息
            {
                string xml = UserTextDeal(reqMod);
                RepToClient(xml);
            }
            break;
            }
        }
        catch (Exception ex) { ZLLog.L("微信报错," + errmsg + ",数据:" + requesdata + ",原因:" + ex.Message); }
    }
Example #25
0
    /// <summary>
    /// 系统事件,如订阅等处理
    /// </summary>
    public void WxEventHandler(M_WxTextMsg reqMod)
    {
        M_WX_User userMod = null;

        errmsg += ",事件:" + reqMod.Event;
        switch (reqMod.Event.ToLower())
        {
        case "subscribe":
            userMod       = api.GetWxUserModel(reqMod.FromUserName);
            userMod.CDate = DateTime.Now;
            userMod.AppId = api.AppId.ID;
            wxuserBll.Insert(userMod);
            M_WxImgMsg msgmod = JsonConvert.DeserializeObject <M_WxImgMsg>(api.AppId.WelStr);
            msgmod.ToUserName   = reqMod.FromUserName;
            msgmod.FromUserName = reqMod.ToUserName;

            int       pid      = DataConvert.CLng(reqMod.EventKey.Replace("qrscene_", ""));
            M_UserAPP uappMod1 = new M_UserAPP();

            M_UserInfo mu1      = new M_UserInfo();
            M_WX_User  wuserMod = new M_WX_User();
            M_Uinfo    mubase   = new M_Uinfo();
            uappMod1 = uappBll.SelModelByOpenID(reqMod.FromUserName, "wechat");
            wuserMod = api.GetWxUserModel(reqMod.FromUserName);
            if (uappMod1 != null)
            {
                mu1 = buser.GetUserByUserID(uappMod1.UserID);
                if (mu1 != null && mu1.UserID > 0)
                {
                    mu1.TrueName = wuserMod.Name;
                    try
                    {
                        string vpath = SiteConfig.SiteOption.UploadDir + "User/" + mu1.UserName + mu1.UserID + "/wxheadimg.jpg";
                        HttpHelper.DownFile(wuserMod.HeadImgUrl, vpath);
                        mu1.UserFace = vpath;
                    }
                    catch (Exception ex)
                    {
                        ZLLog.L("微信更新头像错误,原因:" + ex.Message);
                    }

                    mu1.GroupID = 1;
                    buser.UpdateByID(mu1);
                }
                else
                {
                    mu1.UserName = "******" + DateTime.Now.ToString("yyyyMMddHHmmss") + function.GetRandomString(2).ToLower();
                    mu1.UserPwd  = StringHelper.MD5(function.GetRandomString(6));
                    mu1.Email    = function.GetRandomString(10) + "@wx.com";
                    mu1.Question = function.GetRandomString(5);
                    mu1.Answer   = function.GetRandomString(5);
                    mu1.TrueName = wuserMod.Name;
                    mu1.GroupID  = 1;
                    try
                    {
                        string vpath = SiteConfig.SiteOption.UploadDir + "User/" + mu1.UserName + mu1.UserID + "/wxheadimg.jpg";
                        HttpHelper.DownFile(wuserMod.HeadImgUrl, vpath);
                        mu1.UserFace = vpath;
                    }
                    catch (Exception ex)
                    {
                        ZLLog.L("微信更新头像错误,原因:" + ex.Message);
                    }

                    mu1.UserID = buser.Add(mu1);

                    uappMod1.UserID     = mu1.UserID;
                    uappMod1.SourcePlat = "wechat";
                    uappMod1.OpenID     = reqMod.FromUserName;
                    uappBll.UpdateByID(uappMod1);
                    mubase.UserId = mu1.UserID;
                    buser.AddBase(mubase);
                }
            }
            else
            {
                uappMod1     = new M_UserAPP();
                mu1.UserName = "******" + DateTime.Now.ToString("yyyyMMddHHmmss") + function.GetRandomString(2).ToLower();
                mu1.UserPwd  = StringHelper.MD5(function.GetRandomString(6));
                mu1.Email    = function.GetRandomString(10) + "@wx.com";
                mu1.Question = function.GetRandomString(5);
                mu1.Answer   = function.GetRandomString(5);
                mu1.TrueName = wuserMod.Name;
                mu1.GroupID  = 1;
                try
                {
                    string vpath = SiteConfig.SiteOption.UploadDir + "User/" + mu1.UserName + mu1.UserID + "/wxheadimg.jpg";
                    HttpHelper.DownFile(wuserMod.HeadImgUrl, vpath);
                    mu1.UserFace = vpath;
                }
                catch (Exception ex)
                {
                    ZLLog.L("微信更新头像错误,原因:" + ex.Message);
                }

                mu1.UserID = buser.Add(mu1);

                uappMod1.UserID     = mu1.UserID;
                uappMod1.SourcePlat = "wechat";
                uappMod1.OpenID     = reqMod.FromUserName;
                uappBll.Insert(uappMod1);
                mubase.UserId = mu1.UserID;
                buser.AddBase(mubase);
            }

            if (string.IsNullOrEmpty(msgmod.Articles[0].PicUrl))     //如未设置图片则以纯文本格式发送,纯文本支持内置超链接
            {
                M_WxTextMsg textMod = ImageToText(msgmod);
                RepToClient(textMod.ToXML());
            }
            else
            {
                RepToClient(msgmod.ToXML());
            }
            //关注时发送多条信息
            if (pid > 0)
            {
                System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(SendMsg), reqMod);
            }
            //关注时发送多条信息
            //System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(SendMsg), reqMod);
            break;

        case "unsubscribe":
            wxuserBll.DelByOpenid(api.AppId.ID, reqMod.FromUserName);
            break;

        case "location":    //用户进入公众号(包含定位信息)
            break;

        case "scan":
            M_UserAPP   uappMod   = new M_UserAPP();
            M_UserInfo  mu        = new M_UserInfo();
            M_WxTextMsg textMod2  = new M_WxTextMsg();
            M_WX_User   wuserMod1 = api.GetWxUserModel(reqMod.FromUserName);
            M_Uinfo     mubase1   = new M_Uinfo();

            textMod2.FromUserName = reqMod.ToUserName;
            textMod2.ToUserName   = reqMod.FromUserName;
            textMod2.MsgType      = "text";
            textMod2.Content      = "";
            uappMod = uappBll.SelModelByOpenID(reqMod.FromUserName, "wechat");
            if (uappMod != null)
            {
                mu = buser.GetUserByUserID(uappMod.UserID);
                M_UserInfo pmu = buser.GetUserByUserID(DataConvert.CLng(reqMod.EventKey));
                if (mu != null && mu.UserID > 0)
                {
                    if (DataConvert.CLng(mu.ParentUserID) > 0)
                    {
                        textMod2.Content = "您已绑定了推荐人不能重复绑定!";
                        RepToClient(textMod2.ToXML());
                    }
                    else
                    {
                        if (mu.UserID == DataConvert.CLng(reqMod.EventKey))
                        {
                            textMod2.Content = "您扫描的是您自己的二维码!";
                        }
                        else
                        {
                            mu.ParentUserID = DataConvert.CLng(reqMod.EventKey).ToString();
                            if (pmu != null && pmu.UserID > 0)
                            {
                                string err = "";
                                try
                                {
                                    if (CheckParentUser(pmu.UserID, mu.UserID, ref err))
                                    {
                                        mu.ParentUserID = pmu.UserID.ToString();
                                        if (buser.UpdateByID(mu))
                                        {
                                            textMod2.Content = "您成功绑定了推荐人:" + pmu.TrueName + "!";
                                        }

                                        else
                                        {
                                            textMod2.Content = "绑定推荐人失败!";
                                        }
                                    }
                                    else
                                    {
                                        textMod2.Content = "绑定推荐失败,错误信息:" + err;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    textMod2.Content = "绑定推荐失败,错误信息:" + pmu.TrueName + "的推荐关系有循环!";
                                }
                            }
                            else
                            {
                                textMod2.Content = "绑定推荐失败,推荐人不存在!";
                            }
                        }
                        RepToClient(textMod2.ToXML());
                    }
                }
            }
            else
            {
                uappMod1    = new M_UserAPP();
                mu.UserName = "******" + DateTime.Now.ToString("yyyyMMddHHmmss") + function.GetRandomString(2).ToLower();
                mu.UserPwd  = StringHelper.MD5(function.GetRandomString(6));
                mu.Email    = function.GetRandomString(10) + "@wx.com";
                mu.Question = function.GetRandomString(5);
                mu.Answer   = function.GetRandomString(5);
                mu.TrueName = wuserMod1.Name;
                mu.GroupID  = 1;
                try
                {
                    string vpath = SiteConfig.SiteOption.UploadDir + "User/" + mu.UserName + mu.UserID + "/wxheadimg.jpg";
                    HttpHelper.DownFile(wuserMod1.HeadImgUrl, vpath);
                    mu.UserFace = vpath;
                }
                catch (Exception ex)
                {
                    ZLLog.L("微信更新头像错误,原因:" + ex.Message);
                }

                M_UserInfo pmu = buser.GetUserByUserID(DataConvert.CLng(reqMod.EventKey));
                if (pmu != null && pmu.UserID > 0)
                {
                    mu.ParentUserID = reqMod.EventKey;
                }
                mu.UserID = buser.Add(mu);

                uappMod1.UserID     = mu.UserID;
                uappMod1.SourcePlat = "wechat";
                uappMod1.OpenID     = reqMod.FromUserName;
                uappBll.Insert(uappMod1);
                mubase1.UserId = mu.UserID;
                buser.AddBase(mubase1);

                if (pmu != null && pmu.UserID > 0)
                {
                    textMod2.Content = "您成功绑定了推荐人:" + pmu.TrueName + "!";
                    RepToClient(textMod2.ToXML());
                }
            }
            break;

        default:
            break;
        }
    }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string    MemberID       = Request.Params["MemberID"];          //商户号
            string    TerminalID     = Request.Params["TerminalID"];        //商户终端号
            string    TransID        = Request.Params["TransID"];           //商户流水号
            string    Result         = Request.Params["Result"];            //支付结果(1:成功,0:失败)
            string    ResultDesc     = Request.Params["ResultDesc"];        //支付结果描述
            string    FactMoney      = Request.Params["FactMoney"];         //实际成交金额
            string    AdditionalInfo = Request.Params["AdditionalInfo"];    //订单附加消息
            string    SuccTime       = Request.Params["SuccTime"];          //交易成功时间
            string    Md5Sign        = Request.Params["Md5Sign"].ToLower(); //md5签名
            M_Payment payMod         = payBll.SelModelByPayNo(TransID);
            M_PayPlat platMod        = new M_PayPlat();

            platMod = platBll.SelReturnModel(payMod.PayPlatID);
            if (platMod.PayClass != (int)M_PayPlat.Plat.BaoFo)
            {
                function.WriteErrMsg("回调页面错误");
            }
            String mark      = "~|~";//分隔符
            string _WaitSign = "MemberID=" + MemberID + mark + "TerminalID=" + TerminalID + mark + "TransID=" + TransID + mark + "Result=" + Result + mark + "ResultDesc=" + ResultDesc + mark
                               + "FactMoney=" + FactMoney + mark + "AdditionalInfo=" + AdditionalInfo + mark + "SuccTime=" + SuccTime
                               + mark + "Md5Sign=" + platMod.MD5Key;

            if (Md5Sign.ToLower() == StringHelper.MD5(_WaitSign).ToLower())
            {
                ZLLog.L(ZLEnum.Log.pay, "宝付:" + ResultDesc + " 支付结果:" + Result + " 支付单:" + TransID + " 金额:" + FactMoney);
                try
                {
                    M_Payment pinfo = payBll.SelModelByPayNo(TransID);
                    if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                    {
                        return;
                    }
                    pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                    pinfo.PlatformInfo = "宝付在线付款";                            //平台反馈信息
                    pinfo.SuccessTime  = DateTime.Now;                        //交易成功时间
                    pinfo.CStatus      = true;                                //处理状态
                    pinfo.MoneyTrue    = (Convert.ToDouble(FactMoney) / 100); //其以分为单位
                    payBll.Update(pinfo);
                    DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                    foreach (DataRow dr in orderDT.Rows)
                    {
                        M_Order_PayLog paylogMod = new M_Order_PayLog();
                        M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                        OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                        orderCom.SendMessage(orderMod, paylogMod, "payed");
                        //orderCom.SaveSnapShot(orderMod);
                    }
                    Response.Write("OK");
                    ZLLog.L(ZLEnum.Log.pay, "宝付平台支付成功!支付单:" + TransID);
                }
                catch (Exception ex)
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付回调报错",
                        Message = "平台:宝付,支付单:" + TransID + ",原因:" + ex.Message
                    });
                }
            }
            else
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付验证失败",
                    Message = "平台:宝付,支付单:" + TransID
                });
                Response.Write("Md5CheckFail");
            }
        }
Example #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ZLLog.L(ZLEnum.Log.pay, "进入双乾支付页");
        string MerNo     = Request.Params["MerNo"].ToString();
        string BillNo    = Request.Params["BillNo"].ToString();
        string Amount    = Request.Params["Amount"].ToString();
        string Succeed   = Request.Params["Succeed"].ToString();
        string Result    = Request.Params["Result"].ToString();
        string MD5info   = Request.Params["MD5info"].ToString();
        string MerRemark = Request.Params["MerRemark"].ToString();

        M_Payment payMod  = payBll.SelModelByPayNo(BillNo);
        M_PayPlat platMod = new M_PayPlat();

        platMod = platBll.SelReturnModel(payMod.PayPlatID);
        if (platMod.PayClass != (int)M_PayPlat.Plat.EPay95)
        {
            ZLLog.L(ZLEnum.Log.safe, "回调页面错误" + Request.RawUrl);
        }
        string MD5key = platMod.MD5Key;//Md5加密私钥[注册时产生]
        string md5md5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(MD5key, "MD5").ToUpper();
        string md5src = "Amount=" + Amount + "&BillNo=" + BillNo + "&MerNo=" + MerNo + "&Succeed=" + Succeed + "&" + md5md5;
        string md5str = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(md5src, "MD5").ToUpper();

        try { ZLLog.L(ZLEnum.Log.labelex, "双乾详情:" + md5src); }
        catch (Exception ex) { ZLLog.L(ZLEnum.Log.labelex, "双乾未完成记录" + ex.Message); }
        if (MD5info.Equals(md5str))
        {
            if (!Succeed.Equals("88"))
            {
                ZLLog.L(ZLEnum.Log.pay, "支付单:" + BillNo + ", 支付状态非成功,取消处理!" + md5src); return;
            }
            try
            {
                M_Payment pinfo = payBll.SelModelByPayNo(BillNo);
                if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                {
                    return;
                }
                pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                pinfo.PlatformInfo = "双乾坤支付";      //平台反馈信息
                pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                pinfo.CStatus      = true;         //处理状态
                pinfo.MoneyTrue    = Convert.ToDecimal(Amount);
                payBll.Update(pinfo);

                //-------支付成功处理,发送邮件
                M_OrderList orderMod1 = orderBll.SelModelByOrderNo(pinfo.PaymentNum);
                B_User      userBll   = new B_User();
                M_UserInfo  info      = userBll.GetSelect(pinfo.UserID);
                MailInfo    mailInfo  = new MailInfo();
                mailInfo.IsBodyHtml = true;
                mailInfo.FromName   = SiteConfig.SiteInfo.SiteName;
                MailAddress address = new MailAddress(info.Email);
                mailInfo.ToAddress = address;
                mailInfo.MailBody  = "尊敬的" + info.UserName + ",您的入金订单" + orderMod1.OrderNo + "购买生效<br/>金额:" + String.Format("{0:N2}", orderMod1.Ordersamount) + "<br/>您可进入<a href='" + SiteConfig.SiteInfo.SiteUrl + "/User/Info/ConsumeDetail.aspx?SType=1'>会员中心</a>查看充值记录<br/>如有任何问题请访问我们网站<a href='" + SiteConfig.SiteInfo.SiteUrl + "'>" + SiteConfig.SiteInfo.SiteUrl + "</a>,联系我们!";
                mailInfo.Subject   = SiteConfig.SiteInfo.SiteName + "网站会员入金提醒";
                SendMail.Send(mailInfo);

                DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                foreach (DataRow dr in orderDT.Rows)
                {
                    M_Order_PayLog paylogMod = new M_Order_PayLog();
                    M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                    FinalStep(pinfo, orderMod, paylogMod);
                    //orderCom.SendMessage(orderMod, paylogMod, "payed");
                    //orderCom.SaveSnapShot(orderMod);
                }
                //Response.Write("OK");
                ZLLog.L(ZLEnum.Log.pay, "完成支付" + BillNo);
            }
            catch (Exception ex)
            {
                ZLLog.L(ZLEnum.Log.pay, new M_Log()
                {
                    Action  = "支付回调报错",
                    Message = "平台:双乾,支付单:" + BillNo + ",原因:" + ex.Message
                });
            }
        }
        else
        {
            ZLLog.L(ZLEnum.Log.pay, "双乾验证失败!支付单:" + BillNo);
        }
    }
Example #28
0
    /// <summary>
    /// 异步回调后-->验证支付单状态-->如果正常,更新订单状态
    /// </summary>
    /// <param name="mod">订单模型</param>
    /// <param name="paylogMod">订单支付日志模型</param>
    public static void FinalStep(M_Payment pinfo, M_OrderList mod, M_Order_PayLog paylogMod)
    {
        B_OrderList    orderBll  = new B_OrderList();
        B_CartPro      cartBll   = new B_CartPro();
        B_Order_PayLog paylogBll = new B_Order_PayLog();
        B_User         buser     = new B_User();

        //订单已处理,避免重复(如已处理过,则继续处理下一张订单)
        if (mod.OrderStatus >= 99)
        {
            ZLLog.L(ZoomLa.Model.ZLEnum.Log.safe, new M_Log()
            {
                Action  = "支付回调异常,订单状态已为99",
                Message = "订单号:" + mod.OrderNo + ",支付单:" + pinfo.PayNo
            });
            return;
        }
        //已经收到钱了,所以先执行
        orderBll.UpOrderinfo("Paymentstatus=1,Receivablesamount=" + pinfo.MoneyTrue, mod.id);
        if (mod.Ordertype == (int)M_OrderList.OrderEnum.Domain)//域名订单
        {
            orderBll.UpOrderinfo("OrderStatus=1", mod.id);
            //Response.Redirect("~/Plugins/Domain/DomReg2.aspx?OrderNo=" + mod.OrderNo);
        }
        else if (mod.Ordertype == (int)M_OrderList.OrderEnum.IDC)//IDC服务
        {
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);
            cartBll.IDC_UpdateEndTimeByOid(mod.id);
        }
        else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Purse)//余额充值,不支持银币
        {
            buser.ChangeVirtualMoney(mod.Userid, new M_UserExpHis()
            {
                score     = (int)mod.Ordersamount,
                ScoreType = (int)M_UserExpHis.SType.Purse,
                detail    = "余额充值,订单号:" + mod.OrderNo
            });
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);            //成功的订单
        }
        else if ((mod.Ordertype == (int)M_OrderList.OrderEnum.IDCRen)) //IDC服务续费
        {
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);
            B_Product proBll = new B_Product();
            //更新旧订单的期限
            if (string.IsNullOrEmpty(mod.Ordermessage))//购物车ID
            {
                //function.WriteErrMsg("出错,无需续费订单信息,请联系管理员!!!");
                throw new Exception("出错,无续费订单信息,请联系管理员");
            }
            M_CartPro newCartMod = cartBll.SelModByOrderID(mod.id);//新购物车只是取其商品ID与数量等
            M_Product proMod     = proBll.GetproductByid(newCartMod.ProID);
            //更新延长旧服务的到期时间,旧服务是存在CartPro的EndTime当中
            M_CartPro oldCartMod = cartBll.SelReturnModel(Convert.ToInt32(mod.Ordermessage));
            if (oldCartMod.EndTime < DateTime.Now)
            {
                oldCartMod.EndTime = DateTime.Now;                                   //如已过期,则将时间更新至今日
            }
            oldCartMod.EndTime = proBll.GetEndTime(proMod, newCartMod.Pronum, oldCartMod.EndTime);
            cartBll.UpdateByID(oldCartMod);
            //paylogMod.Remind = "为" + mod.Ordermessage + "订单续费(购物车)";
        }
        else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Cloud)//云购订单
        {
            //根据份数生成幸运码,写入表中,并减去库存 ZL_Order_LuckCode
        }
        else//其他旅游订单等,只更新状态
        {
            orderBll.UpOrderinfo("OrderStatus=99", mod.id);//成功的订单
        }
        //-------支付成功处理,并写入日志
        paylogMod.Remind   += "订单" + mod.OrderNo + "购买生效";
        paylogMod.OrderID   = mod.id;
        paylogMod.PayMoney  = mod.Ordersamount;
        paylogMod.PayMethod = (int)M_Order_PayLog.PayMethodEnum.Other;//外部指定
        paylogMod.PayPlatID = pinfo.PayPlatID;
        paylogBll.insert(paylogMod);
    }
Example #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //DataTable pay = payPlatBll.GetPayPlatByClassid(12);
            M_PayPlat platMod = payPlatBll.SelModelByClass(M_PayPlat.Plat.Alipay_Instant);
            SortedDictionary <string, string> sArrary = GetRequestPost();

            ///////////////////////以下参数是需要设置的相关配置参数,设置后不会更改的//////////////////////
            ZoomLa.Model.M_Alipay_config con = new ZoomLa.Model.M_Alipay_config();
            string partner       = platMod.AccountID;
            string key           = platMod.MD5Key;
            string input_charset = con.Input_charset;
            string sign_type     = con.Sign_type;
            string transport     = con.Transport;

            //////////////////////////////////////////////////////////////////////////////////////////////
            if (sArrary.Count > 0)//判断是否有带返回参数
            {
                ZoomLa.BLL.B_Alipay_notify aliNotify = new ZoomLa.BLL.B_Alipay_notify(sArrary, Request.Form["notify_id"], partner, key, input_charset, sign_type, transport);
                string responseTxt = aliNotify.ResponseTxt;     //获取远程服务器ATN结果,验证是否是支付宝服务器发来的请求
                string sign        = Request.Form["sign"];
                string mysign      = aliNotify.Mysign;          //获取通知返回后计算后(验证)的签名结果
                                                                //判断responsetTxt是否为ture,生成的签名结果mysign与获得的签名结果sign是否一致
                                                                //responsetTxt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
                                                                //mysign与sign不等,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
                string order_no = Request.Form["out_trade_no"]; //获取订单号
                ZLLog.L(ZLEnum.Log.pay, PayPlat + aliNotify.ResponseTxt + ":" + order_no + ":" + Request.Form["buyer_email"] + ":" + Request.Form["trade_status"] + ":" + Request.Form["price"] + ":" + Request.Form["subject"]);
                if (responseTxt == "true" && sign == mysign)    //验证成功
                {
                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取通知返回参数,可参考技术文档中服务器异步通知参数列表
                    string trade_no     = Request.Form["trade_no"];       //交易号
                    string total_fee    = Request.Form["price"];          //获取总金额
                    string subject      = Request.Form["subject"];        //商品名称、
                    string body         = Request.Form["body"];           //商品描述、订单备注、描述
                    string buyer_email  = Request.Form["buyer_email"];    //买家账号
                    string trade_status = Request.Form["trade_status"];   //交易状态
                    if (Request.Form["trade_status"] == "WAIT_BUYER_PAY") //没有付款
                    {
                    }
                    else if (trade_status.Equals("WAIT_SELLER_SEND_GOODS"))//付款成功,但是卖家没有发货
                    {
                    }
                    else if (trade_status.Equals("TRADE_SUCCESS"))//付款成功
                    {
                        try
                        {
                            M_Payment pinfo = payBll.SelModelByPayNo(order_no);
                            if (pinfo.Status != (int)M_Payment.PayStatus.NoPay)
                            {
                                return;
                            }
                            pinfo.Status       = (int)M_Payment.PayStatus.HasPayed;
                            pinfo.PlatformInfo = PayPlat;      //平台反馈信息
                            pinfo.SuccessTime  = DateTime.Now; //交易成功时间
                            pinfo.CStatus      = true;         //处理状态
                            pinfo.AlipayNO     = trade_no;     //保存支付宝交易号
                            pinfo.MoneyTrue    = Convert.ToDouble(total_fee);
                            payBll.Update(pinfo);
                            DataTable orderDT = orderBll.GetOrderbyOrderNo(pinfo.PaymentNum);
                            foreach (DataRow dr in orderDT.Rows)
                            {
                                M_Order_PayLog paylogMod = new M_Order_PayLog();
                                M_OrderList    orderMod  = orderBll.SelModelByOrderNo(dr["OrderNo"].ToString());
                                OrderHelper.FinalStep(pinfo, orderMod, paylogMod);
                                orderCOM.SendMessage(orderMod, paylogMod, "payed");
                            }
                            Response.Write("success");
                            ZLLog.L(ZLEnum.Log.pay, PayPlat + "成功!支付单:" + order_no);
                        }
                        catch (Exception ex)
                        {
                            ZLLog.L(ZLEnum.Log.pay, new M_Log()
                            {
                                Action  = "支付回调报错",
                                Message = PayPlat + ",支付单:" + order_no + ",原因:" + ex.Message
                            });
                        }
                    }
                    else if (Request.Form["trade_status"] == "WAIT_BUYER_CONFIRM_GOODS")//卖家已经发货,等待买家确认
                    {
                    }
                    else if (Request.Form["trade_status"] == "TRADE_FINISHED")
                    {
                    }
                    else//其他状态判断。普通即时到帐中,其他状态不用判断,直接打印success。
                    {
                        ZLLog.L(PayPlat + "付款未成功截获,单号:[" + trade_status + "]");
                    }
                }
                else//验证失败
                {
                    ZLLog.L(ZLEnum.Log.pay, new M_Log()
                    {
                        Action  = "支付验证失败",
                        Message = PayPlat + ",支付单:" + order_no
                    });
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("success");
            }
        }
Example #30
0
    protected void EBtnSubmit_Click(object sender, EventArgs e)//添加文章
    {
        IList <string> content   = new List <string>();
        string         adminname = HttpContext.Current.Request.Cookies["ManageState"]["LoginName"]; adminname = StringHelper.Base64StringDecode(adminname);

        if (SiteConfig.SiteOption.FileRj == 1 && contentBll.SelHasTitle(txtTitle.Text.Trim()))
        {
            function.WriteErrMsg("该内容标题已存在!", "javascript:history.go(-1);");
        }
        DataTable    dt         = mfieldBll.GetModelFieldAllListT(ModelID).Tables[0];
        Call         commonCall = new Call();
        DataTable    table      = commonCall.GetDTFromPage(dt, Page, ViewState, content);
        M_CommonData CData      = new M_CommonData();

        CData.NodeID     = NodeID;
        CData.ModelID    = ModelID;
        CData.TableName  = modelBll.GetModelById(ModelID).TableName;
        CData.Title      = txtTitle.Text.Trim();
        CData.Inputer    = string.IsNullOrEmpty(txtInputer.Text) ? adminname : txtInputer.Text;
        CData.EliteLevel = ChkAudit.Checked ? 1 : 0;
        CData.InfoID     = "";
        CData.Hits       = string.IsNullOrEmpty(txtNum.Text) ? 0 : DataConverter.CLng(txtNum.Text);
        CData.UpDateType = 2;
        CData.UpDateTime = DataConverter.CDate(txtdate.Text);
        CData.TagKey     = Request.Form["tabinput"];
        string status = ddlFlow.SelectedValue.Trim();

        if (!string.IsNullOrEmpty(status))
        {
            CData.Status = Convert.ToInt32(status);
        }
        // CData.Titlecolor = Titlecolor.Text;
        CData.Template     = TxtTemplate_hid.Value;
        CData.CreateTime   = DataConverter.CDate(txtAddTime.Text);
        CData.ProWeek      = DataConverter.CLng(proweek.Text);
        CData.SpecialID    = "," + string.Join(",", Spec_Hid.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + ",";
        CData.Pronum       = DataConverter.CLng(pronum.Text);
        CData.BidType      = DataConverter.CLng(BidType.SelectedValue);
        CData.IsBid        = (CData.BidType > 0) ? 1 : 0;
        CData.BidMoney     = DataConverter.CDouble(bidmoney.Text);
        CData.DefaultSkins = 0;
        CData.FirstNodeID  = GetFriestNode(NodeID);
        CData.TitleStyle   = ThreadStyle.Value;
        CData.ParentTree   = GetParentTree(NodeID);     //父级别树
        CData.TopImg       = Request.Form["selectpic"]; //首页图片
        CData.PdfLink      = Makepdf.Checked ? "pdf_" + DateTime.Now.ToString("yyyyMMddHHmmssfffffff") + ".pdf" : "";
        CData.Subtitle     = Subtitle.Text;
        CData.PYtitle      = PYtitle.Text;
        CData.RelatedIDS   = RelatedIDS_Hid.Value;
        CData.IsComm       = Convert.ToInt32(IsComm_Radio.SelectedValue);
        int newID = contentBll.AddContent(table, CData);//插入信息给两个表,主表和从表:CData-主表的模型,table-从表

        //推送
        if (!string.IsNullOrEmpty(pushcon_hid.Value))
        {
            string[] nodeArr = pushcon_hid.Value.Trim(',').Split(',');
            for (int i = 0; i < nodeArr.Length; i++)
            {
                CData.NodeID = Convert.ToInt32(nodeArr[i]);
                contentBll.AddContent(table, CData);
            }
        }
        #region 生成PDF
        //if (Makepdf.Checked)
        //{
        //    M_CommonData m_CommonData = contentBll.SelReturnModel(newID);
        //    string strSql = "select source from " + CData.TableName + " where id=" + m_CommonData.ItemID;
        //    string source = "";
        //    SqlDataReader dr = SqlHelper.ExecuteReader(System.Data.CommandType.Text, strSql);
        //    if (dr.Read())
        //    {
        //        source = dr["source"].ToString();
        //    }
        //    dr.Close();
        //}
        #endregion
        #region  关键词
        B_KeyWord kll = new B_KeyWord();
        if (!string.IsNullOrEmpty(CData.TagKey))
        {
            string[] arrKey = CData.TagKey.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            for (int tt = 0; tt < arrKey.Length; tt++)
            {
                if (kll.IsExist(arrKey[tt]))
                {
                    M_KeyWord kinfo = kll.GetKeyByName(arrKey[tt]);
                    kinfo.QuoteTimes++;
                    kinfo.LastUseTime = DateTime.Now;
                    if (string.IsNullOrEmpty(kinfo.ArrGeneralID))
                    {
                        kinfo.ArrGeneralID = newID.ToString() + ",";
                    }
                    else
                    {
                        kinfo.ArrGeneralID = kinfo.ArrGeneralID + newID.ToString() + ",";
                    }
                    kll.Update(kinfo);
                }
                else
                {
                    M_KeyWord kinfo1 = new M_KeyWord();
                    kinfo1.KeyWordID    = 0;
                    kinfo1.KeywordText  = arrKey[tt];
                    kinfo1.KeywordType  = 1;
                    kinfo1.LastUseTime  = DateTime.Now;
                    kinfo1.Hits         = 0;
                    kinfo1.Priority     = 10;
                    kinfo1.QuoteTimes   = 1;
                    kinfo1.ArrGeneralID = "," + newID.ToString() + ",";
                    kll.Add(kinfo1);
                }
            }
        }
        #endregion
        ZLLog.ToDB(ZLEnum.Log.content, new M_Log()
        {
            UName   = adminname,
            Source  = Request.RawUrl,
            Action  = "添加内容",
            Message = "标题:" + CData.Title + ",Gid:" + newID,
            Level   = "add"
        });
        //添加计划任务(审核时间),如果自动审核时间小于当前时间则忽略
        if (!string.IsNullOrEmpty(CheckDate_T.Text) && Convert.ToDateTime(CheckDate_T.Text) > DateTime.Now)
        {
            AddSched(newID, CheckDate_T.Text, M_Content_ScheTask.TaskTypeEnum.AuditArt);
            contentBll.UpdateStatus(newID, (int)ZLEnum.ConStatus.UnAudit);
        }
        if (!string.IsNullOrEmpty(TimeDate_T.Text))
        {
            AddSched(newID, TimeDate_T.Text, M_Content_ScheTask.TaskTypeEnum.UnAuditArt);
        }
        //积分
        if (SiteConfig.UserConfig.InfoRule > 0)
        {
            B_User     buser = new B_User();
            M_UserInfo muser = buser.GetUserByName(adminname);
            if (!muser.IsNull)
            {
                buser.ChangeVirtualMoney(muser.UserID, new M_UserExpHis()
                {
                    UserID    = muser.UserID,
                    detail    = "添加内容:" + txtTitle.Text + "增加积分",
                    score     = SiteConfig.UserConfig.InfoRule,
                    ScoreType = (int)M_UserExpHis.SType.Point
                });
            }
        }
        M_Node        noinfo     = nodeBll.GetNodeXML(NodeID);
        CreateHtmlDel createHtml = CreateHtmlFunc;
        createHtml.BeginInvoke(HttpContext.Current.Request, quickmake.Checked, CData, table, null, null);
        Response.Redirect("ContentShow.aspx?gid=" + newID + "&nodename=" + Server.UrlEncode(nodename.Value) + "&type=add");
    }