/// <summary> /// 输出最终的html /// </summary> /// <param name="templateFileName"></param> /// <param name="tPath"></param> /// <param name="wid"></param> public void OutPutHtml(string templateFileName) { ////注册一个自定义函数 //this.Document.RegisterGlobalFunction(this.GetNewsUrl); //对VT模板里的config变量赋值 Model.siteconfig config = new BLL.siteconfig().loadConfig(); string dd = Utils.ObjectToStr(config.webkeyword); this.Document.Variables.SetValue("config", config); this.Document.SetValue("ccright", ccRight); this.Document.SetValue("thisurl", MyCommFun.getTotalUrl()); this.Document.SetValue("yuming", MyCommFun.getWebSite()); string openid = MyCommFun.RequestOpenid(); this.Document.SetValue("openid", openid); this.Document.Variables.SetValue("this", this); if (tType == TemplateType.Class) { //如果为列表页面 ArticleClassPage(); } if (tType == TemplateType.News) { ArticleDetailPage(); } if (tType == TemplateType.Channel) { ArticleChannelPage(); } //输出最终呈现的数据 this.Document.Render(HttpContext.Current.Response.Output); }
static Config() { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/alipay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _seller_email = doc.SelectSingleNode(@"Root/seller_email"); XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = _partner.InnerText; //交易安全检验码,由数字和字母组成的32位字符串 key = _key.InnerText; //签约支付宝账号或卖家支付宝帐户 seller_email = _seller_email.InnerText; //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数 return_url = Utils.DelLastChar(model.weburl, "/") + _return_url.InnerText; //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数 notify_url = Utils.DelLastChar(model.weburl, "/") + _notify_url.InnerText; //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式 不需修改 sign_type = "MD5"; }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); Config xmlConfig = new Config(); //读取配置 v_oid = DTRequest.GetString("v_oid").ToUpper(); v_pstatus = DTRequest.GetString("v_pstatus"); v_pstring =DTRequest.GetString("v_pstring"); v_pmode = DTRequest.GetString("v_pmode"); v_md5str =DTRequest.GetString("v_md5str"); v_amount = DTRequest.GetString("v_amount"); v_moneytype = DTRequest.GetString("v_moneytype"); remark1 = DTRequest.GetString("remark1"); remark2 = DTRequest.GetString("remark2"); // 拼凑加密串 string signtext = v_oid + v_pstatus + v_amount + v_moneytype + xmlConfig.Key; signtext = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(signtext, "md5").ToUpper(); if (signtext == v_md5str) { if (v_pstatus.Equals("20")) { //成功状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + v_oid)); return; } } //失败状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error")); return; }
static Config() { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/alipay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _email = doc.SelectSingleNode(@"Root/email"); XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(); //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = _partner.InnerText; //交易安全检验码,由数字和字母组成的32位字符串 key = _key.InnerText; //签约支付宝账号或卖家支付宝帐户 email = _email.InnerText; //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数 return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText; //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数 notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText; //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式 不需修改 sign_type = "MD5"; }
/// <summary> /// 页面请求事件处理 /// </summary> /// <param name="sender">事件的源</param> /// <param name="e">包含事件数据的 EventArgs</param> private void ReUrl_BeginRequest(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; string requestPath = context.Request.Path; //获得当前页面,包含目录 string requestPage = requestPath.Substring(requestPath.LastIndexOf("/")); //获得当前页面,不包含目录 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); //获得站点配置信息 bool isRewritePath = IsUrlRewrite(siteConfig.webpath, requestPath); //排除不需要URL重写的目录 switch (siteConfig.staticstatus) { case 0: //关闭重写 if (isRewritePath && IsAspxFile(requestPath)) { context.RewritePath(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/" + requestPage); } break; case 1: //伪URL重写 if (isRewritePath) { RewriteUrl(context, siteConfig.webpath, requestPath, requestPage); } break; case 2: //全静态 if (requestPath.ToLower().Equals("/index.aspx")) { context.RewritePath(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/index." + siteConfig.staticextension); } break; } }
//启用模板 protected void lbtnStart_Click(object sender, EventArgs e) { ChkAdminLevel("sys_templet", ActionEnum.Add.ToString()); //检查权限 BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = siteConfig; for (int i = 0; i < rptList.Items.Count; i++) { string skinName = ((HiddenField)rptList.Items[i].FindControl("hideSkinName")).Value; CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { //判是否当前模板 if (skinName.ToLower() == siteConfig.templateskin) { JscriptMsg("该模板已是当前模板啦!", "back", "Warning"); return; } model.templateskin = skinName.ToLower(); //修改配置文件 bll.saveConifg(model, Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); //重新生成模板 MarkTemplates(skinName); JscriptMsg("模板启用并全部生成成功啦!", "templet_list.aspx", "Success"); return; } } }
private void UpLoadFile(HttpContext context) { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); string _delfile = DTRequest.GetString("DelFilePath"); HttpPostedFile _upfile = context.Request.Files["Filedata"]; bool _iswater = false; //默认不打水印 bool _isthumbnail = false; //默认不生成缩略图 if (DTRequest.GetQueryString("IsWater") == "1") _iswater = true; if (DTRequest.GetQueryString("IsThumbnail") == "1") _isthumbnail = true; if (_upfile == null) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}"); return; } UpLoad upFiles = new UpLoad(); string msg = upFiles.fileSaveAs(_upfile, _isthumbnail, _iswater); //删除已存在的旧文件,旧文件不为空且应是上传文件,防止跨目录删除 if (!string.IsNullOrEmpty(_delfile) && _delfile.IndexOf("../") == -1 && _delfile.ToLower().StartsWith(siteConfig.webpath.ToLower() + siteConfig.filepath.ToLower())) { Utils.DeleteUpFile(_delfile); } //返回成功信息 context.Response.Write(msg); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); SortedDictionary<string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, DTRequest.GetString("notify_id"), DTRequest.GetString("sign")); if (verifyResult)//验证成功 { //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 string trade_no = DTRequest.GetString("trade_no"); //支付宝交易号 string order_no = DTRequest.GetString("out_trade_no"); //获取订单号 string trade_status = DTRequest.GetString("trade_status"); //交易状态 if (trade_status == "WAIT_SELLER_SEND_GOODS" || trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS") { //成功状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + order_no)); return; } } } //失败状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error")); return; }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); string order_type = DTRequest.GetFormString("pay_order_type"); //订单类型 string order_no = DTRequest.GetFormString("pay_order_no"); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string subject = DTRequest.GetFormString("pay_subject"); if (order_no == "" || order_amount == 0 ) { Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")); return; } //检查是否已登录 Model.users userModel = new Web.UI.BasePage().GetUserInfo(); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "login")); //尚未登录 return; } if (userModel.amount < order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "recharge")); //账户的余额不足 return; } if (order_type.ToLower() == DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower()) //购买商品 { BLL.orders bll = new BLL.orders(); Model.orders model = bll.GetModel(order_no); if (model == null) { Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,商品订单号不存在!")); return; } //执行扣取账户金额 int result = new BLL.amount_log().Add(userModel.id, userModel.user_name, DTEnums.AmountTypeEnum.BuyGoods.ToString(), order_no, model.payment_id, -1 * order_amount, subject, 1); if (result > 0) { //更改订单状态 bool result1 = bll.UpdateField(order_no, "payment_status=2,payment_time='" + DateTime.Now + "'"); if (!result1) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error")); return; } //扣除积分 if (model.point < 0) { new BLL.point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no); } //支付成功 Response.Redirect(new Web.UI.BasePage().linkurl("payment1", "succeed", order_type, order_no)); return; } } Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,找不到需要支付的订单类型!")); return; }
private void comment_add(HttpContext context) { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); StringBuilder strTxt = new StringBuilder(); BLL.comment bll = new BLL.comment(); Model.comment model = new Model.comment(); string _code = DTRequest.GetFormString("txtCode"); int _channel_id = DTRequest.GetQueryInt("channel_id"); int _content_id = DTRequest.GetQueryInt("content_id"); string _title = DTRequest.GetFormString("txtTitle"); string _content = DTRequest.GetFormString("txtContent"); //校检验证码 if (string.IsNullOrEmpty(_code)) { context.Response.Write("{msg:0, msgbox:\"对不起,请输入验证码!\"}"); return; } if (context.Session[DTKeys.SESSION_CODE] == null) { context.Response.Write("{msg:0, msgbox:\"对不起,系统找不到生成的验证码!\"}"); return; } if (_code.ToLower() != (context.Session[DTKeys.SESSION_CODE].ToString()).ToLower()) { context.Response.Write("{msg:0, msgbox:\"您输入的验证码与系统的不一致!\"}"); return; } if (_channel_id == 0 || _content_id == 0) { context.Response.Write("{msg: 0, msgbox: \"对不起,参数传输有误!\"}"); return; } if (string.IsNullOrEmpty(_content)) { context.Response.Write("{msg: 0, msgbox: \"对不起,请输入评论的内容!\"}"); return; } model.channel_id = _channel_id; model.content_id = _content_id; model.title = _title; model.content = Utils.ToHtml(_content); model.user_name = "游客"; model.user_ip = DTRequest.GetIP(); model.is_lock = siteConfig.commentstatus; //审核开关 model.add_time = DateTime.Now; model.is_reply = 0; if (bll.Add(model) > 0) { context.Response.Write("{msg: 1, msgbox: \"恭喜您,留言提交成功啦!\"}"); return; } context.Response.Write("{msg: 0, msgbox: \"对不起,保存过程中发生错误!\"}"); return; }
private void ShowInfo() { BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); webname.Text = model.webname; webcompany.Text = model.webcompany; weburl.Text = model.weburl; webtel.Text = model.webtel; webfax.Text = model.webfax; webmail.Text = model.webmail; webcrod.Text = model.webcrod; webtitle.Text = model.webtitle; webkeyword.Text = model.webkeyword; webdescription.Text = model.webdescription; webcopyright.Text = model.webcopyright; webpath.Text = model.webpath; webmanagepath.Text = model.webmanagepath; webstatus.Text = model.webstatus.ToString(); webclosereason.Text = model.webclosereason; webcountcode.Text = model.webcountcode; staticstatus.SelectedValue = model.staticstatus.ToString(); staticextension.Text = model.staticextension; memberstatus.SelectedValue = model.memberstatus.ToString(); commentstatus.SelectedValue = model.commentstatus.ToString(); logstatus.SelectedValue = model.logstatus.ToString(); emailstmp.Text = model.emailstmp; emailport.Text = model.emailport.ToString(); emailfrom.Text = model.emailfrom; emailusername.Text = model.emailusername; if (!string.IsNullOrEmpty(model.emailpassword)) { emailpassword.Attributes["value"] = defaultpassword; } emailnickname.Text = model.emailnickname; attachpath.Text = model.attachpath; attachextension.Text = model.attachextension; attachsave.SelectedValue = model.attachsave.ToString(); attachfilesize.Text = model.attachfilesize.ToString(); attachimgsize.Text = model.attachimgsize.ToString(); attachimgmaxheight.Text = model.attachimgmaxheight.ToString(); attachimgmaxwidth.Text = model.attachimgmaxwidth.ToString(); thumbnailheight.Text = model.thumbnailheight.ToString(); thumbnailwidth.Text = model.thumbnailwidth.ToString(); watermarktype.SelectedValue = model.watermarktype.ToString(); watermarkposition.Text = model.watermarkposition.ToString(); watermarkimgquality.Text = model.watermarkimgquality.ToString(); watermarkpic.Text = model.watermarkpic; watermarktransparency.Text = model.watermarktransparency.ToString(); watermarktext.Text = model.watermarktext; watermarkfont.Text = model.watermarkfont; watermarkfontsize.Text = model.watermarkfontsize.ToString(); }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } // 保存当前的后台管理员 Session[MXKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, MXEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "MxWeiXinPF", model.user_name); Utils.WriteCookie("AdminPwd", "MxWeiXinPF", model.password); Response.Redirect("wxIndex.aspx"); return; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userPwd = TextBox1.Text.Trim(); BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); if (model.weburl == userPwd) { Utils.WriteCookie("UserCheckPwd", userPwd, 60); Response.Redirect(ReferUrl); } else { JscriptMsg("會員管理密碼錯誤!", "RePw.aspx", "Success"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "请输入用户名或密码"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判断登录错误次数 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "错误超过5次,关闭浏览器重新登录!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用户名或密码有误,请重试!"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, DTEnums.ActionEnum.Login.ToString(), "用户登录"); } //写入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "Agp2p", model.user_name, true); Utils.WriteCookie("AdminPwd", "Agp2p", model.password, true); Response.Redirect("index.aspx"); return; }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtPassword.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { msgtip.InnerHtml = "請輸入用戶名或密碼"; return; } if (Session["AdminLoginSun"] == null) { Session["AdminLoginSun"] = 1; } else { Session["AdminLoginSun"] = Convert.ToInt32(Session["AdminLoginSun"]) + 1; } //判斷登入錯誤次數 if (Session["AdminLoginSun"] != null && Convert.ToInt32(Session["AdminLoginSun"]) > 5) { msgtip.InnerHtml = "登入錯誤超過5次,關閉瀏覽器重新登入!"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, userPwd, true); if (model == null) { msgtip.InnerHtml = "用戶名或密碼有誤,請重再試!"; return; } Session[TWKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //寫入登錄日誌 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); if (siteConfig.logstatus > 0) { new BLL.manager_log().Add(model.id, model.user_name, TWEnums.ActionEnum.Login.ToString(), "用戶登入"); } //寫入Cookies Utils.WriteCookie("DTRememberName", model.user_name, 14400); Utils.WriteCookie("AdminName", "Tea", model.user_name); Utils.WriteCookie("AdminPwd", "Tea", model.password); Response.Redirect("index.aspx"); return; }
static TenpayUtil() { //��ȡXML������Ϣ string fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //��ȡվ��������Ϣ Model.siteconfig model = new BLL.siteconfig().loadConfig(); partner = _partner.InnerText; key = _key.InnerText; return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText; }
/// <summary> /// 获取OAuth配置信息 /// </summary> /// <param name="oauth_name"></param> public static oauth_config get_config(string oauth_name) { //读取接口配置信息 Model.user_oauth_app model = new BLL.user_oauth_app().GetModel(oauth_name); if (model != null) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //赋值 oauth_config config = new oauth_config(); config.oauth_name = model.api_path.Trim(); config.oauth_app_id = model.app_id.Trim(); config.oauth_app_key = model.app_key.Trim(); config.return_uri = HttpContext.Current.Request.Url.Authority.ToLower() + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx"; return(config); } return(null); }
/// <summary> /// 获取OAuth配置信息 /// </summary> /// <param name="oauth_name"></param> public static oauth_config get_config(string oauth_name) { //读取接口配置信息 Model.app_oauth model = new BLL.app_oauth().GetModel(oauth_name); if (model != null) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(HotoKeys.FILE_SITE_XML_CONFING); //赋值 oauth_config config = new oauth_config(); config.oauth_name = model.api_path.Trim(); config.oauth_app_id = model.app_id.Trim(); config.oauth_app_key = model.app_key.Trim(); config.return_uri = HotoUtils.DelLastChar(siteConfig.weburl, "/") + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx"; return(config); } return(null); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["name"])) { string UserName = HttpContext.Current.Request.QueryString["name"]; BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); if (model.weburl == DESEncrypt.Encrypt(UserName)) { context.Response.Write(1); } else { context.Response.Write("0"); } } }
public static string tenpay_return = ""; //��ʾ֧��֪ͨҳ��; #endregion Fields #region Constructors static TenpayUtil() { //��ȡXML������Ϣ string fullPath = HotoUtils.GetMapPath("~/xmlconfig/tenpay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _bargainor_id = doc.SelectSingleNode(@"Root/bargainor_id"); XmlNode _tenpay_key = doc.SelectSingleNode(@"Root/tenpay_key"); XmlNode _tenpay_return = doc.SelectSingleNode(@"Root/tenpay_return"); XmlNode _tenpay_notify = doc.SelectSingleNode(@"Root/tenpay_notify"); //��ȡվ��������Ϣ Model.siteconfig model = new BLL.siteconfig().loadConfig(HotoKeys.FILE_SITE_XML_CONFING); bargainor_id = _bargainor_id.InnerText; tenpay_key = _tenpay_key.InnerText; tenpay_return = HotoUtils.DelLastChar(model.weburl, "/") + _tenpay_return.InnerText; tenpay_notify = HotoUtils.DelLastChar(model.weburl, "/") + _tenpay_notify.InnerText; }
/// <summary> /// 获取OAuth配置信息 /// </summary> /// <param name="oauth_name"></param> public static oauth_config get_config(string oauth_name) { //读取接口配置信息 Model.user_oauth_app model = new BLL.user_oauth_app().GetModel(oauth_name); if (model != null) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //赋值 oauth_config config = new oauth_config(); config.oauth_name = model.api_path.Trim(); config.oauth_app_id = model.app_id.Trim(); config.oauth_app_key = model.app_key.Trim(); config.return_uri = HttpContext.Current.Request.Url.Authority.ToLower() + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx"; return config; } return null; }
/// <summary> /// 获取OAuth配置信息 /// </summary> /// <param name="oauth_name"></param> public static oauth_config get_config(string oauth_name) { //读取接口配置信息 Model.app_oauth model = new BLL.app_oauth().GetModel(oauth_name); if (model != null) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(HotoKeys.FILE_SITE_XML_CONFING); //赋值 oauth_config config = new oauth_config(); config.oauth_name = model.api_path.Trim(); config.oauth_app_id = model.app_id.Trim(); config.oauth_app_key = model.app_key.Trim(); config.return_uri = HotoUtils.DelLastChar(siteConfig.weburl, "/") + siteConfig.webpath + "api/oauth/" + model.api_path + "/return_url.aspx"; return config; } return null; }
protected void Page_Load(object sender, EventArgs e) { var webCode = Request.Params["code"]; var state = Request.Params["state"]; var webTokenResult = Senparc.Weixin.MP.AdvancedAPIs.OAuth.GetAccessToken(WxPayConfig.APPID, WxPayConfig.APPSECRET, webCode); string weburl = new BLL.siteconfig().loadConfig().weburl; if (state == "mp") { Response.Redirect(string.Format("{0}/weixin/index.html?openid={1}", weburl, webTokenResult.openid)); } else { //Response.Redirect(string.Format("", webTokenResult.openid, state)); } }
private void setEmail(int UserID) { //生成隨機碼 string strcode = Utils.GetCheckCode(20); //獲得郵件內容 Model.mail_template mailModel = new BLL.mail_template().GetModel("regverify"); BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); string titletxt = mailModel.maill_title; string bodytxt = mailModel.content; titletxt = titletxt.Replace("{webname}", model.webname); titletxt = titletxt.Replace("{username}", DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtusername")); bodytxt = bodytxt.Replace("{webname}", model.webname); bodytxt = bodytxt.Replace("{username}", DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtusername")); bodytxt = bodytxt.Replace("{linkurl}", "<a href=" + "http://" + Utils.GetHomeUrl() + "/RegPay.aspx?uId=" + UserID + ">請點擊連接激活帳戶" + "</a>"); //此處需要修改 DTMail.sendMail(model.emailstmp, model.emailport, model.emailfrom, model.emailpassword, model.emailusername, model.emailfrom, DTRequest.GetFormString("ctl00$ContentPlaceHolder1$txtemall"), "帝光房屋會員註冊成功通知", bodytxt); }
public HttpResponseMessage Get(string picid) { object o = dt_picture.GetPicture(picid); byte[] img = null; if (o != null) { if (o is string) { Model.siteconfig siteconfig = new BLL.siteconfig().loadConfig(); string url = Path.Combine(siteconfig.filepath + o.ToString()); if (!File.Exists(url)) { resObj = new BaseResponse(1, "图片不存在或已删除"); return(Json(resObj)); } Stream stream = new FileStream(url, FileMode.Open); img = new byte[stream.Length]; stream.Read(img, 0, img.Length); stream.Close(); } else if (o is byte[]) { img = (byte[])o; } var resp = new HttpResponseMessage(HttpStatusCode.OK) { Content = new ByteArrayContent(img) //或者 //Content = new StreamContent(ms) }; resp.Content.Headers.ContentType = new MediaTypeHeaderValue("image/jpg"); return(resp); } else { resObj = new BaseResponse(1, "图片不存在或已删除"); return(Json(resObj)); } }
private void UpLoadFile(HttpContext context) { try { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); string _delfile = RequestHelper.GetString("DelFilePath"); HttpPostedFile _upfile = context.Request.Files["Filedata"]; bool _iswater = false; //默认不打水印 bool _isthumbnail = false; //默认不生成缩略图 if (RequestHelper.GetQueryString("IsWater") == "1") { _iswater = true; } if (RequestHelper.GetQueryString("IsThumbnail") == "1") { _isthumbnail = true; } if (_upfile == null) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}"); return; } UpLoad upFiles = new UpLoad(); string folder = RequestHelper.GetQueryString("folder"); string msg = upFiles.fileSaveAs(_upfile, _isthumbnail, _iswater, folder); //删除已存在的旧文件,旧文件不为空且应是上传文件,防止跨目录删除 if (!string.IsNullOrEmpty(_delfile) && _delfile.IndexOf("../") == -1 && _delfile.ToLower().StartsWith(siteConfig.webpath.ToLower() + siteConfig.filepath.ToLower())) { Utils.DeleteUpFile(_delfile); } //NetLog.WriteTextLog("UpLoadFile", msg, System.DateTime.Now, "img"); //返回成功信息 context.Response.Write(msg); context.Response.End(); } catch (Exception e) { Utils.StringToTxt("UpLoadFile上传文件发生异常:" + e.TargetSite); } }
public Config() { //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/chinabankpc.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(); //赋值变量值 partner = _partner.InnerText; key = _key.InnerText; return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText; input_charset = "utf-8"; }
//生成首页静态 public static void CreateIndexHtml() { Model.siteconfig config = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); string urlPath = string.Format("{0}{1}/{2}", config.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, "index.aspx"); //文件相对路径 string htmlPath = string.Format("{0}{1}/{2}", config.webpath, DTKeys.DIRECTORY_REWRITE_HTML, "index." + config.staticextension); //保存相对路径 //检查文件是否存在 if (!File.Exists(Utils.GetMapPath(urlPath))) { } Stopwatch watch = new Stopwatch(); //测量时间 watch.Start(); StringWriter sw = new StringWriter(); HttpContext.Current.Server.Execute(urlPath, sw); File.WriteAllText(Utils.GetMapPath(htmlPath), sw.ToString(), Encoding.UTF8); watch.Stop(); //watch.Elapsed sw.Close(); sw.Dispose(); }
public static string tenpay_notify = ""; //支付完成后的回调处理页面; static TenpayUtil() { //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _bargainor_id = doc.SelectSingleNode(@"Root/bargainor_id"); XmlNode _tenpay_key = doc.SelectSingleNode(@"Root/tenpay_key"); XmlNode _tenpay_return = doc.SelectSingleNode(@"Root/tenpay_return"); XmlNode _tenpay_notify = doc.SelectSingleNode(@"Root/tenpay_notify"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); bargainor_id = _bargainor_id.InnerText; tenpay_key = _tenpay_key.InnerText; tenpay_return = Utils.DelLastChar(model.weburl, "/") + _tenpay_return.InnerText; tenpay_notify = Utils.DelLastChar(model.weburl, "/") + _tenpay_notify.InnerText; }
public static string notify_url = ""; //支付完成后的回调处理页面; static TenpayUtil() { //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/tenpay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(); partner = _partner.InnerText; key = _key.InnerText; return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText; }
public Config(int site_payment_id) { Model.site_payment model = new BLL.site_payment().GetModel(site_payment_id); //站点支付方式 if (model != null) { Model.payment payModel = new BLL.payment().GetModel(model.payment_id); //支付平台 Model.sites siteModel = new BLL.sites().GetModel(model.site_id); //站点配置 Model.siteconfig sysConfig = new BLL.siteconfig().loadConfig(); //系统配置 //收款支付宝账号 seller_email = model.key1; //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = model.key2; //如果签名方式设置为“MD5”时,请设置该参数 key = model.key3; //商户的私钥,如果签名方式设置为“0001”时,请设置该参数 private_key = @""; //支付宝的公钥,如果签名方式设置为“0001”时,请设置该参数 public_key = @""; //回调处理地址 if (!string.IsNullOrEmpty(siteModel.domain.Trim()) && siteModel.is_default == 0) //如果有自定义域名且不是默认站点 { return_url = "http://" + siteModel.domain + payModel.return_url; notify_url = "http://" + siteModel.domain + payModel.notify_url; } else if (siteModel.is_default == 0) //不是默认站点也没有绑定域名 { return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.return_url; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.notify_url; } else //否则使用当前域名 { return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.return_url; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.notify_url; } //字符编码格式 目前支持 utf-8 input_charset = "utf-8"; //签名方式,选择项:0001(RSA)、MD5 sign_type = "MD5";//无线的产品中,签名方式为rsa时,sign_type需赋值为0001而不是RSA } }
static Config() { //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/alipay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _email = doc.SelectSingleNode(@"Root/email"); XmlNode _type = doc.SelectSingleNode(@"Root/type"); XmlNode _return_url = doc.SelectSingleNode(@"Root/return_url"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(); //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = _partner.InnerText; //交易安全检验码,由数字和字母组成的32位字符串 key = _key.InnerText; //签约支付宝账号或卖家支付宝帐户 email = _email.InnerText; //接口类型1即时到帐2担保交易 type = _type.InnerText; //页面跳转同步返回页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数 return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _return_url.InnerText; //服务器通知的页面文件路径 要用 http://格式的完整路径,不允许加?id=123这类自定义参数 notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText; //↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式 不需修改 sign_type = "MD5"; }
public new static string AjaxQueryLoan(short type, short pageIndex, short pageSize, string startTime = "", string endTime = "") { var userInfo = GetUserInfo(); if (userInfo == null) { HttpContext.Current.Response.TrySkipIisCustomErrors = true; HttpContext.Current.Response.StatusCode = (int)HttpStatusCode.Unauthorized; return("请先登录"); } int count; var projects = QueryProjectsByLoaner(userInfo.id, (Agp2pEnums.MyLoanQueryTypeEnum)type, pageIndex, startTime, endTime, pageSize, out count); var now = DateTime.Now; var config = new BLL.siteconfig().loadConfig(); var result = projects.Select(proj => { var validTask = proj.li_repayment_tasks.Where(ta => ta.status != (int)Agp2pEnums.RepaymentStatusEnum.Invalid).ToList(); return(new { proj.id, url = linkurl(config, "project", proj.id), name = proj.title, profitRateYearly = proj.GetProfitRateYearly(), nextRepayTime = (validTask.FirstOrDefault(ta => ta.IsUnpaid()) ?? validTask.LastOrDefault())?.should_repay_time.ToString("yyyy-MM-dd"), financingAmount = proj.financing_amount, totalProfit = validTask.Any() ? validTask.Aggregate(0m, (sum, task) => sum + task.repay_interest) : Math.Round(proj.financing_amount * proj.GetFinalProfitRate(now), 2), status = proj.GetProjectStatusDesc(), isAutoRepay = proj.autoRepay, repayLimit = validTask.Where(ta => ta.IsUnpaid()) .Aggregate(0m, (sum, ta) => sum + ta.repay_interest + ta.repay_principal), }); }); return(JsonConvert.SerializeObject(new { totalCount = count, data = result })); }
private int GetIsLoginAndIsStaticstatus() { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //取得管理员登录信息 Model.dt_manager adminInfo = new Web.UI.ManagePage().GetAdminInfo(); if (adminInfo == null) { return(-1); } else if (!new BLL.manager_role().Exists(adminInfo.role_id, "app_builder_html", MXEnums.ActionEnum.Build.ToString())) { return(-2); } else if (siteConfig.staticstatus != 2) { return(-3); } else { return(1); } }
protected static DataTable get_project_list(int pageSize, int pageNum, out int total, int category_id, int profit_rate_index, int repayment_index, int status_index) { Model.siteconfig config = new BLL.siteconfig().loadConfig(); var queryToNewObj = QueryInvestables(pageSize, pageNum - 1, out total, category_id, profit_rate_index, repayment_index, status_index).Select(inv => { var p = inv.Project; return(new ProjectDetail { id = p.id, no = p.no, title = inv.Title, status = (int)inv.Status, sort_id = p.sort_id, repayment_type = p.GetProjectRepaymentTypeDesc(), repayment_term = inv.ProjectTermSpanName, repayment_number = inv.RepaymentTermSpanCount, profit_rate_year = Math.Round(inv.ProfitRateYearly * 100, 1), /*category_id = inv.CategoryId,*/ categoryTitle = inv.CategoryName, categoryCallIndex = inv.CategoryCallIndex, amount = inv.FinancingAmount, add_time = p.publish_time ?? p.add_time, publish_time = p.publish_time, tag = p.tag.GetValueOrDefault(), //category_img = get_category_icon_by_categoryid(categoryList, p.category_id),//类别图标路径 //project_repayment = p.GetProjectTermSpanEnumDesc(),//项目还款期限单位 project_amount_str = inv.FinancingAmountStr, //项目金额字符 project_investment_progress = inv.InvestmentProgress.ToString("p1").Split('%')[0], //项目进度 project_investment_balance = inv.InvestmentBalance.ToString("n0") + "元", //项目投资剩余金额 project_investment_count = inv.InvesterCount, //项目投资人数 linkurl = inv.Linkurl(config) }); }); var dt = queryToNewObj.ToDataTable(p => new object[] { queryToNewObj }); return(dt ?? new DataTable()); }
private void sys_channel_validate(HttpContext context) { string channelname = DTRequest.GetFormString("channelname"); string oldname = DTRequest.GetFormString("oldname"); if (string.IsNullOrEmpty(channelname)) { context.Response.Write("false"); return; } //检查是否与站点根目录下的目录同名 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath")); DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath)); foreach (DirectoryInfo dir in dirInfo.GetDirectories()) { if (channelname.ToLower() == dir.Name) { context.Response.Write("false"); return; } } //检查是否修改操作 if (channelname == oldname) { context.Response.Write("true"); return; } //检查Key是否与已存在 BLL.sys_channel bll = new BLL.sys_channel(); if (bll.Exists(channelname)) { context.Response.Write("false"); return; } context.Response.Write("true"); return; }
public Config(int site_payment_id) { Model.site_payment model = new BLL.site_payment().GetModel(site_payment_id); //站点支付方式 if (model != null) { Model.payment payModel = new BLL.payment().GetModel(model.payment_id); //支付平台 Model.sites siteModel = new BLL.sites().GetModel(model.site_id); //站点配置 Model.siteconfig sysConfig = new BLL.siteconfig().loadConfig(); //系统配置 //签约支付宝账号或卖家支付宝帐户 email = model.key1; //合作身份者ID,以2088开头由16位纯数字组成的字符串 partner = model.key2; //交易安全检验码,由数字和字母组成的32位字符串 key = model.key3; //回调处理地址 if (!string.IsNullOrEmpty(siteModel.domain.Trim()) && siteModel.is_default == 0) //如果有自定义域名且不是默认站点 { return_url = "http://" + siteModel.domain + payModel.return_url; notify_url = "http://" + siteModel.domain + payModel.notify_url; } else if (siteModel.is_default == 0) //不是默认站点也没有绑定域名 { return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.return_url; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.notify_url; } else //否则使用当前域名 { return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.return_url; notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.notify_url; } //字符编码格式 目前支持 gbk 或 utf-8 input_charset = "utf-8"; //签名方式 不需修改 sign_type = "MD5"; } }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); SortedDictionary<string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, DTRequest.GetString("notify_id"), DTRequest.GetString("sign")); if (verifyResult)//验证成功 { //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 string trade_no = DTRequest.GetString("trade_no"); //支付宝交易号 string order_no = DTRequest.GetString("out_trade_no"); //获取订单号 string total_fee = DTRequest.GetString("total_fee"); //获取总金额 string subject = DTRequest.GetString("subject"); //商品名称、订单名称 string body = DTRequest.GetString("body"); //商品描述、订单备注、描述 string buyer_email = DTRequest.GetString("buyer_email"); //买家支付宝账号 string trade_status = DTRequest.GetString("trade_status"); //交易状态 string order_type = DTRequest.GetString("extra_common_param"); //订单交易类别 if (DTRequest.GetString("trade_status") == "TRADE_FINISHED" || DTRequest.GetString("trade_status") == "TRADE_SUCCESS") { //成功状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment1", "succeed", order_type, order_no)); return; } } } //失败状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error")); return; }
public NativeConfig() { //读取XML配置信息 string fullPath = Utils.GetMapPath("~/xmlconfig/wxnatpay.config"); XmlDocument doc = new XmlDocument(); doc.Load(fullPath); XmlNode _partner = doc.SelectSingleNode(@"Root/partner"); XmlNode _key = doc.SelectSingleNode(@"Root/key"); XmlNode _appid = doc.SelectSingleNode(@"Root/appid"); XmlNode _notify_url = doc.SelectSingleNode(@"Root/notify_url"); //读取站点配置信息 Model.siteconfig model = new BLL.siteconfig().loadConfig(); //商户号(必须配置) partner = _partner.InnerText; //商户支付密钥,参考开户邮件设置(必须配置) key = _key.InnerText; //绑定支付的APPID(必须配置) appid = _appid.InnerText; //回调处理地址 notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + _notify_url.InnerText; }
public HttpResponseMessage Send([FromBody] Model.PushMessage msg) { Model.siteconfig sc = new BLL.siteconfig().loadConfig(); Common.JPush jpclient = new Common.JPush(sc.pushappkey, sc.pushappsecret); Dictionary <string, object> ed = new Dictionary <string, object>(); if (msg.extras != null) { msg.extras.ForEach(p => { if (!ed.Keys.Contains(p.Key)) { ed.Add(p.Key, p.Value); } }); } if (jpclient.SendPush(msg.message, msg.regids, ed)) { resObj = new Model.BaseResponse(0, "success"); } else { resObj = new Model.BaseResponse(1, "fail"); } return(Json(resObj)); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); SortedDictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判断是否有带返回参数 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, DTRequest.GetString("notify_id"), DTRequest.GetString("sign")); if (verifyResult)//验证成功 { //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表 string trade_no = DTRequest.GetString("trade_no"); //支付宝交易号 string order_no = DTRequest.GetString("out_trade_no"); //获取订单号 string total_fee = DTRequest.GetString("total_fee"); //获取总金额 string subject = DTRequest.GetString("subject"); //商品名称、订单名称 string body = DTRequest.GetString("body"); //商品描述、订单备注、描述 string buyer_email = DTRequest.GetString("buyer_email"); //买家支付宝账号 string trade_status = DTRequest.GetString("trade_status"); //交易状态 string order_type = DTRequest.GetString("extra_common_param"); //订单交易类别 if (DTRequest.GetString("trade_status") == "TRADE_FINISHED" || DTRequest.GetString("trade_status") == "TRADE_SUCCESS") { //成功状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment1", "succeed", order_type, order_no)); return; } } } //失败状态 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error")); return; }
protected void Page_Load(object sender, EventArgs e) { //讀取網站配置資訊 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); SortedDictionary <string, string> sPara = GetRequestGet(); if (sPara.Count > 0)//判斷是否有帶返回參數 { Notify aliNotify = new Notify(); bool verifyResult = aliNotify.Verify(sPara, DTRequest.GetString("notify_id"), DTRequest.GetString("sign")); if (verifyResult)//驗證成功 { //——請根據您的業務邏輯來編寫程式(以下代碼僅作參考)—— //獲取付款寶的通知返回參數,可參考技術文檔中頁面跳轉同步通知參數列表 string trade_no = DTRequest.GetString("trade_no"); //付款寶交易號 string order_no = DTRequest.GetString("out_trade_no"); //獲取訂單號 string total_fee = DTRequest.GetString("total_fee"); //獲取總金額 string subject = DTRequest.GetString("subject"); //商品名稱、訂單名稱 string body = DTRequest.GetString("body"); //商品描述、訂單備註、描述 string buyer_email = DTRequest.GetString("buyer_email"); //買家付款寶帳號 string trade_status = DTRequest.GetString("trade_status"); //交易狀態 string order_type = DTRequest.GetString("extra_common_param"); //訂單交易類別 if (DTRequest.GetString("trade_status") == "TRADE_FINISHED" || DTRequest.GetString("trade_status") == "TRADE_SUCCESS") { //成功狀態 Response.Redirect(new Web.UI.BasePage().linkurl("payment1", "succeed", order_type, order_no)); return; } } } //失敗狀態 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error")); return; }
string defaultpassword = "******"; //默认显示密码 #endregion Fields #region Methods /// <summary> /// 保存配置信息 /// </summary> protected void btnSubmit_Click(object sender, EventArgs e) { ChkAdminLevel("sys_config", DTEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); try { model.webname = webname.Text; model.webcompany = webcompany.Text; model.weburl = weburl.Text; model.webtel = webtel.Text; model.webfax = webfax.Text; model.webmail = webmail.Text; model.webcrod = webcrod.Text; model.webtitle = webtitle.Text; model.webkeyword = webkeyword.Text; model.webdescription = Utils.DropHTML(webdescription.Text); model.webcopyright = webcopyright.Text; model.webpath = webpath.Text; model.webmanagepath = webmanagepath.Text; model.webstatus = int.Parse(webstatus.Text.Trim()); model.webclosereason = webclosereason.Text; model.webcountcode = webcountcode.Text; model.staticstatus = int.Parse(staticstatus.SelectedValue); model.staticextension = staticextension.Text; model.memberstatus = int.Parse(memberstatus.SelectedValue); model.commentstatus = int.Parse(commentstatus.SelectedValue); model.logstatus = int.Parse(logstatus.SelectedValue); model.emailstmp = emailstmp.Text; model.emailport = int.Parse(emailport.Text.Trim()); model.emailfrom = emailfrom.Text; model.emailusername = emailusername.Text; //判断密码是否更改 if (emailpassword.Text.Trim() != defaultpassword) { model.emailpassword = DESEncrypt.Encrypt(emailpassword.Text, model.sysencryptstring); } model.emailnickname = emailnickname.Text; model.attachpath = attachpath.Text; model.attachextension = attachextension.Text; model.attachsave = int.Parse(attachsave.SelectedValue); model.attachfilesize = int.Parse(attachfilesize.Text.Trim()); model.attachimgsize = int.Parse(attachimgsize.Text.Trim()); model.attachimgmaxheight = int.Parse(attachimgmaxheight.Text.Trim()); model.attachimgmaxwidth = int.Parse(attachimgmaxwidth.Text.Trim()); model.thumbnailheight = int.Parse(thumbnailheight.Text.Trim()); model.thumbnailwidth = int.Parse(thumbnailwidth.Text.Trim()); model.watermarktype = int.Parse(watermarktype.SelectedValue); model.watermarkposition = int.Parse(watermarkposition.Text.Trim()); model.watermarkimgquality = int.Parse(watermarkimgquality.Text.Trim()); model.watermarkpic = watermarkpic.Text; model.watermarktransparency = int.Parse(watermarktransparency.Text.Trim()); model.watermarktext = watermarktext.Text; model.watermarkfont = watermarkfont.Text; model.watermarkfontsize = int.Parse(watermarkfontsize.Text.Trim()); bll.saveConifg(model, Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); JscriptMsg("修改系统信息成功啦!", "sys_config.aspx", "Success"); } catch { JscriptMsg("文件写入失败,请检查是否有权限!", "", "Error"); } }
private void ManagerFile(HttpContext context) { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //根目录路径,相对路径 String rootPath = siteConfig.webpath + siteConfig.filepath + "/"; //站点目录+上传目录 //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ String rootUrl = siteConfig.webpath + siteConfig.filepath + "/"; //图片扩展名 String fileTypes = "gif,jpg,jpeg,png,bmp"; String currentPath = ""; String currentUrl = ""; String currentDirPath = ""; String moveupDirPath = ""; String dirPath = Utils.GetMapPath(rootPath); String dirName = context.Request.QueryString["dir"]; //根据path参数,设置各路径和URL String path = context.Request.QueryString["path"]; path = String.IsNullOrEmpty(path) ? "" : path; if (path == "") { currentPath = dirPath; currentUrl = rootUrl; currentDirPath = ""; moveupDirPath = ""; } else { currentPath = dirPath + path; currentUrl = rootUrl + path; currentDirPath = path; moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1"); } //排序形式,name or size or type String order = context.Request.QueryString["order"]; order = String.IsNullOrEmpty(order) ? "" : order.ToLower(); //不允许使用..移动到上一级目录 if (Regex.IsMatch(path, @"\.\.")) { context.Response.Write("Access is not allowed."); context.Response.End(); } //最后一个字符不是/ if (path != "" && !path.EndsWith("/")) { context.Response.Write("Parameter is not valid."); context.Response.End(); } //目录不存在或不是目录 if (!Directory.Exists(currentPath)) { context.Response.Write("Directory does not exist."); context.Response.End(); } //遍历目录取得文件信息 string[] dirList = Directory.GetDirectories(currentPath); string[] fileList = Directory.GetFiles(currentPath); switch (order) { case "size": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new SizeSorter()); break; case "type": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new TypeSorter()); break; case "name": default: Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new NameSorter()); break; } Hashtable result = new Hashtable(); result["moveup_dir_path"] = moveupDirPath; result["current_dir_path"] = currentDirPath; result["current_url"] = currentUrl; result["total_count"] = dirList.Length + fileList.Length; List <Hashtable> dirFileList = new List <Hashtable>(); result["file_list"] = dirFileList; for (int i = 0; i < dirList.Length; i++) { DirectoryInfo dir = new DirectoryInfo(dirList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = true; hash["has_file"] = (dir.GetFileSystemInfos().Length > 0); hash["filesize"] = 0; hash["is_photo"] = false; hash["filetype"] = ""; hash["filename"] = dir.Name; hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } for (int i = 0; i < fileList.Length; i++) { FileInfo file = new FileInfo(fileList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = false; hash["has_file"] = false; hash["filesize"] = file.Length; hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0); hash["filetype"] = file.Extension.Substring(1); hash["filename"] = file.Name; hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); context.Response.Write(JsonHelper.ObjectToJSON(result)); context.Response.End(); }
private void setEmail(string UserEmail, string Content) { BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); DTMail.sendMail(model.emailstmp, model.emailport, model.emailfrom, model.emailpassword, model.emailusername, model.emailfrom, UserEmail, "帝光房屋留言回覆", Content); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string user_name = DTRequest.GetFormString("pay_user_name"); string subject = DTRequest.GetFormString("pay_subject"); //以下收货人信息 string receive_name = string.Empty; //收货人姓名 string receive_address = string.Empty; //收货人地址 string receive_zip = string.Empty; //收货人邮编 string receive_phone = string.Empty; //收货人电话 string receive_mobile = string.Empty; //收货人手机 //检查参数是否正确 if (string.IsNullOrEmpty(order_no) || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_recharge model = new BLL.user_recharge().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } //取得用户信息 Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!"))); return; } receive_name = userModel.nick_name; receive_address = userModel.address; receive_phone = userModel.telphone; receive_mobile = userModel.mobile; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } receive_name = model.accept_name; receive_address = model.address; receive_zip = model.post_code; receive_phone = model.telphone; receive_mobile = model.mobile; } if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //判断担保或是即时到帐接口 if (Config.Type == "1") //即时到帐 { //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额 sParaTemp.Add("paymethod", ""); //默认支付方式 sParaTemp.Add("defaultbank", ""); //默认网银代号 sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳 sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP()); ////获取客户端的IP地址 sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号 sParaTemp.Add("royalty_type", ""); sParaTemp.Add("royalty_parameters", ""); //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp); Response.Write(sHtmlText); } else //担保交易 { //把请求参数打包成数组 SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("price", order_amount.ToString()); //付款金额 sParaTemp.Add("quantity", "1"); //建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品 sParaTemp.Add("logistics_fee", "0.00"); //物流费用 sParaTemp.Add("logistics_type", "EXPRESS"); //物流类型,EXPRESS(快递)、POST(平邮)、EMS(EMS) sParaTemp.Add("logistics_payment", "SELLER_PAY"); //物流支付方式,SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费) sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("receive_name", receive_name); //收货人姓名 sParaTemp.Add("receive_address", receive_address); //收货人地址 sParaTemp.Add("receive_zip", receive_zip); //收货人邮编 sParaTemp.Add("receive_phone", receive_phone); //收货人电话号码 sParaTemp.Add("receive_mobile", receive_mobile); //收货人手机号码 //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_partner_trade_by_buyer(sParaTemp); Response.Write(sHtmlText); } }
/// <summary> /// 页面请求事件处理 /// </summary> /// <param name="sender">事件的源</param> /// <param name="e">包含事件数据的 EventArgs</param> private void ReUrl_BeginRequest(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //获得站点配置信息 string requestPath = context.Request.Path.ToLower(); //获得当前页面(含目录) //如果虚拟目录(不含安装目录)与站点根目录名相同则不需要重写 if (IsDirExist(DTKeys.CACHE_SITE_DIRECTORY, siteConfig.webpath, siteConfig.webpath, requestPath)) { return; } string requestDomain = context.Request.Url.Authority.ToLower(); //获得当前域名(含端口号) string sitePath = GetSitePath(siteConfig.webpath, requestPath, requestDomain); //获取当前站点目录 string requestPage = CutStringPath(siteConfig.webpath, sitePath, requestPath); //截取除安装、站点目录部分 //检查网站重写状态0表示不开启重写、1开启重写、2生成静态 if (siteConfig.staticstatus == 0) { #region 站点不开启重写处理方法=========================== //遍历URL字典,匹配URL页面部分 foreach (Model.url_rewrite model in SiteUrls.GetUrls().Urls) { //查找到与页面部分匹配的节点 if (model.page == requestPath.Substring(requestPath.LastIndexOf("/") + 1)) { //如果该页面属于插件页则映射到插件目录,否则映射到站点目录 if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN) { context.RewritePath(string.Format("{0}{1}/{2}{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, requestPage)); return; } else { context.RewritePath(string.Format("{0}{1}/{2}{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, sitePath, requestPage)); return; } } } #endregion } else { #region 站点开启重写或静态处理方法======================= //遍历URL字典 foreach (Model.url_rewrite model in SiteUrls.GetUrls().Urls) { //如果没有重写表达式则不需要重写 if (model.url_rewrite_items.Count == 0 && Utils.GetUrlExtension(model.page, siteConfig.staticextension) == requestPath.Substring(requestPath.LastIndexOf("/") + 1)) { //如果该页面属于插件页则映射到插件目录,否则映射到站点目录 if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN) { context.RewritePath(string.Format("{0}{1}/{2}/{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, model.page)); return; } else { context.RewritePath(string.Format("{0}{1}/{2}/{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, sitePath, model.page)); return; } } //遍历URL字典的子节点 foreach (Model.url_rewrite_item item in model.url_rewrite_items) { string newPattern = Utils.GetUrlExtension(item.pattern, siteConfig.staticextension); //替换扩展名 //如果与URL节点匹配则重写 if (Regex.IsMatch(requestPage, string.Format("^/{0}$", newPattern), RegexOptions.None | RegexOptions.IgnoreCase) || (model.page == "index.aspx" && Regex.IsMatch(requestPage, string.Format("^/{0}$", item.pattern), RegexOptions.None | RegexOptions.IgnoreCase))) { //如果开启生成静态、不是移动站点且是频道页或首页,则映射重写到HTML目录 if (siteConfig.staticstatus == 2 && !SiteDomains.GetSiteDomains().MobilePaths.Contains(sitePath) && (model.channel.Length > 0 || model.page.ToLower() == "index.aspx")) //频道页 { context.RewritePath(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/" + sitePath + Utils.GetUrlExtension(requestPage, siteConfig.staticextension, true)); return; } else if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN) //插件页 { string queryString = Regex.Replace(requestPage, string.Format("/{0}", newPattern), item.querystring, RegexOptions.None | RegexOptions.IgnoreCase); context.RewritePath(string.Format("{0}{1}/{2}/{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, model.page), string.Empty, queryString); return; } else //其它 { string queryString = Regex.Replace(requestPage, string.Format("/{0}", newPattern), item.querystring, RegexOptions.None | RegexOptions.IgnoreCase); context.RewritePath(string.Format("{0}{1}/{2}/{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, sitePath, model.page), string.Empty, queryString); return; } } } } #endregion } }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = MXRequest.GetFormString("pay_order_no").ToUpper(); //订单号 decimal order_amount = MXRequest.GetFormDecimal("pay_order_amount", 0); //订单金额 string user_name = MXRequest.GetFormString("pay_user_name"); //支付用户名 string subject = MXRequest.GetFormString("pay_subject"); //备注说明 string trans_type = string.Empty; //交易类型1实物2虚拟 if (order_no == "" || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_amount_log model = new BLL.user_amount_log().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.value != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } trans_type = "2"; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } trans_type = "1"; } //检查会员还是匿名 if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //创建RequestHandler实例 RequestHandler reqHandler = new RequestHandler(Context); //初始化 reqHandler.init(); //设置密钥 reqHandler.setKey(TenpayUtil.key); reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); //----------------------------- //设置支付参数 //----------------------------- reqHandler.setParameter("partner", TenpayUtil.partner); //商户号 reqHandler.setParameter("out_trade_no", order_no); //商家订单号 reqHandler.setParameter("total_fee", (Convert.ToDouble(order_amount) * 100).ToString()); //商品金额,以分为单位 reqHandler.setParameter("return_url", TenpayUtil.return_url); //交易完成后跳转的URL reqHandler.setParameter("notify_url", TenpayUtil.notify_url); //接收财付通通知的URL reqHandler.setParameter("body", user_name); //商品描述 reqHandler.setParameter("bank_type", "DEFAULT"); //银行类型(中介担保时此参数无效) reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP reqHandler.setParameter("fee_type", "1"); //币种,1人民币 reqHandler.setParameter("subject", siteConfig.webname + "-" + subject); //商品名称(中介交易时必填) //系统可选参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); //业务可选参数 reqHandler.setParameter("product_fee", "0"); //商品费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("transport_fee", "0"); //物流费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss reqHandler.setParameter("time_expire", ""); //订单失效时间,格式为yyyymmddhhmmss reqHandler.setParameter("buyer_id", ""); //买方财付通账号 reqHandler.setParameter("goods_tag", ""); //商品标记 reqHandler.setParameter("trade_mode", TenpayUtil.type); //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择) reqHandler.setParameter("transport_desc", ""); //物流说明 reqHandler.setParameter("trans_type", "1"); //交易类型,1实物交易,2虚拟交易 reqHandler.setParameter("agentid", ""); //平台ID reqHandler.setParameter("agent_type", ""); //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式 reqHandler.setParameter("seller_id", ""); //卖家商户号,为空则等同于partner //获取请求带参数的url string requestUrl = reqHandler.getRequestURL(); //实现自动跳转=============================== StringBuilder sbHtml = new StringBuilder(); sbHtml.Append("<form id='tenpaysubmit' name='tenpaysubmit' action='" + reqHandler.getGateUrl() + "' method='get'>"); Hashtable ht = reqHandler.getAllParameters(); foreach (DictionaryEntry de in ht) { sbHtml.Append("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n"); } //submit按钮控件请不要含有name属性 sbHtml.Append("<input type='submit' value='确认' style='display:none;'></form>"); sbHtml.Append("<script>document.forms['tenpaysubmit'].submit();</script>"); Response.Write(sbHtml.ToString()); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); string user_name = DTRequest.GetFormString("pay_user_name"); string subject = DTRequest.GetFormString("pay_subject"); //以下收货人信息 string receive_name = string.Empty; //收货人姓名 string receive_address = string.Empty; //收货人地址 string receive_zip = string.Empty; //收货人邮编 string receive_phone = string.Empty; //收货人电话 string receive_mobile = string.Empty; //收货人手机 //检查参数是否正确 if (string.IsNullOrEmpty(order_no) || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_recharge model = new BLL.user_recharge().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } //取得用户信息 Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!"))); return; } receive_name = userModel.nick_name; receive_address = userModel.address; receive_phone = userModel.telphone; receive_mobile = userModel.mobile; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } receive_name = model.accept_name; receive_address = model.address; receive_zip = model.post_code; receive_phone = model.telphone; receive_mobile = model.mobile; } if (user_name != "") { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //判断担保或是即时到帐接口 if (Config.Type == "1") //即时到帐 { //把请求参数打包成数组 SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额 sParaTemp.Add("paymethod", ""); //默认支付方式 sParaTemp.Add("defaultbank", ""); //默认网银代号 sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳 sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP()); ////获取客户端的IP地址 sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号 sParaTemp.Add("royalty_type", ""); sParaTemp.Add("royalty_parameters", ""); //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp); Response.Write(sHtmlText); } else //担保交易 { //把请求参数打包成数组 SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>(); sParaTemp.Add("payment_type", "1"); //收款类型1商品购买 sParaTemp.Add("out_trade_no", order_no); //网站订单号 sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称 sParaTemp.Add("price", order_amount.ToString()); //付款金额 sParaTemp.Add("quantity", "1"); //建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品 sParaTemp.Add("logistics_fee", "0.00"); //物流费用 sParaTemp.Add("logistics_type", "EXPRESS"); //物流类型,EXPRESS(快递)、POST(平邮)、EMS(EMS) sParaTemp.Add("logistics_payment", "SELLER_PAY"); //物流支付方式,SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费) sParaTemp.Add("body", user_name); //订单描述 sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址 sParaTemp.Add("receive_name", receive_name); //收货人姓名 sParaTemp.Add("receive_address", receive_address); //收货人地址 sParaTemp.Add("receive_zip", receive_zip); //收货人邮编 sParaTemp.Add("receive_phone", receive_phone); //收货人电话号码 sParaTemp.Add("receive_mobile", receive_mobile); //收货人手机号码 //构造即时到帐接口表单提交HTML数据,无需修改 Service ali = new Service(); string sHtmlText = ali.Create_partner_trade_by_buyer(sParaTemp); Response.Write(sHtmlText); } }
protected void btnSubmit_Click(object sender, EventArgs e) { string userName = txtUserName.Text.Trim(); string userPwd = txtUserPwd.Text.Trim(); string code = txtCode.Text.Trim(); if (userName.Equals("") || userPwd.Equals("")) { lblTip.Visible = true; lblTip.Text = "请输入用户名或密码"; return; } if (code.Equals("")) { lblTip.Visible = true; lblTip.Text = "请输入验证码"; return; } if (Session[DTKeys.SESSION_CODE] == null) { lblTip.Visible = true; lblTip.Text = "系统找不到验证码"; return; } if (code.ToLower() != Session[DTKeys.SESSION_CODE].ToString().ToLower()) { lblTip.Visible = true; lblTip.Text = "验证码输入不正确"; return; } BLL.manager bll = new BLL.manager(); Model.manager model = bll.GetModel(userName, DESEncrypt.Encrypt(userPwd)); if (model == null) { lblTip.Visible = true; lblTip.Text = "用户名或密码有误"; return; } Session[DTKeys.SESSION_ADMIN_INFO] = model; Session.Timeout = 45; //写入登录日志 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); if (siteConfig.logstatus > 0) { Model.manager_log modelLog = new Model.manager_log(); modelLog.user_id = model.id; modelLog.user_name = model.user_name; modelLog.action_type = "login"; modelLog.note = "用户登录"; modelLog.login_ip = DTRequest.GetIP(); modelLog.login_time = DateTime.Now; new BLL.manager_log().Add(modelLog); } //写入Cookies if (cbRememberId.Checked) { Utils.WriteCookie("DTRememberName", model.user_name, 14400); } else { Utils.WriteCookie("DTRememberName", model.user_name, -14400); } Utils.WriteCookie("AdminName", "DTcms", model.user_name); Utils.WriteCookie("AdminPwd", "DTcms", model.user_pwd); Response.Redirect("index.aspx"); return; }
private void ShowInfo() { BLL.siteconfig bll = new BLL.siteconfig(); Model.siteconfig model = bll.loadConfig(); webname.Text = model.webname; weburl.Text = model.weburl; webcompany.Text = model.webcompany; webaddress.Text = model.webaddress; webtel.Text = model.webtel; webfax.Text = model.webfax; webmail.Text = model.webmail; webcrod.Text = model.webcrod; webpath.Text = model.webpath; webmanagepath.Text = model.webmanagepath; staticstatus.SelectedValue = model.staticstatus.ToString(); staticextension.Text = model.staticextension; if (model.memberstatus == 1) { memberstatus.Checked = true; } else { memberstatus.Checked = false; } if (model.commentstatus == 1) { commentstatus.Checked = true; } else { commentstatus.Checked = false; } if (model.logstatus == 1) { logstatus.Checked = true; } else { logstatus.Checked = false; } if (model.webstatus == 1) { webstatus.Checked = true; } else { webstatus.Checked = false; } webclosereason.Text = model.webclosereason; webcountcode.Text = model.webcountcode; smsapiurl.Text = model.smsapiurl; smsusername.Text = model.smsusername; if (!string.IsNullOrEmpty(model.smspassword)) { smspassword.Attributes["value"] = defaultpassword; } labSmsCount.Text = GetSmsCount(); //取得短信数量 emailsmtp.Text = model.emailsmtp; if (model.emailssl == 1) { emailssl.Checked = true; } else { emailssl.Checked = false; } emailport.Text = model.emailport.ToString(); emailfrom.Text = model.emailfrom; emailusername.Text = model.emailusername; if (!string.IsNullOrEmpty(model.emailpassword)) { emailpassword.Attributes["value"] = defaultpassword; } emailnickname.Text = model.emailnickname; filepath.Text = model.filepath; filesave.SelectedValue = model.filesave.ToString(); fileremote.SelectedValue = model.fileremote.ToString(); fileextension.Text = model.fileextension; videoextension.Text = model.videoextension; attachsize.Text = model.attachsize.ToString(); videosize.Text = model.videosize.ToString(); imgsize.Text = model.imgsize.ToString(); imgmaxheight.Text = model.imgmaxheight.ToString(); imgmaxwidth.Text = model.imgmaxwidth.ToString(); thumbnailheight.Text = model.thumbnailheight.ToString(); thumbnailwidth.Text = model.thumbnailwidth.ToString(); thumbnailmode.Text = model.thumbnailmode; watermarktype.SelectedValue = model.watermarktype.ToString(); watermarkposition.Text = model.watermarkposition.ToString(); watermarkimgquality.Text = model.watermarkimgquality.ToString(); watermarkpic.Text = model.watermarkpic; watermarktransparency.Text = model.watermarktransparency.ToString(); watermarktext.Text = model.watermarktext; watermarkfont.SelectedValue = model.watermarkfont; watermarkfontsize.Text = model.watermarkfontsize.ToString(); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); BLL.orders objorders = new BLL.orders(); Model.orders modelorders = objorders.GetModel(order_no); if (modelorders == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,订单详情获取出错,请重试!"))); return; } decimal order_amount = modelorders.order_amount; string subject = DTRequest.GetFormString("pay_subject"); if (order_no == "" || order_amount == 0 ) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } //检查是否已登录 Model.users userModel = new Web.UI.BasePage().GetUserInfo(); if (userModel == null) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=login")); //尚未登录 return; } if (userModel.amount < order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=recharge")); //账户的余额不足 return; } if (order_no.StartsWith("B")) //B开头为商品订单 { BLL.orders bll = new BLL.orders(); Model.orders model = bll.GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,商品订单号不存在!"))); return; } if (model.payment_status == 1) { //执行扣取账户金额 int result = new BLL.user_amount_log().Add(userModel.id, userModel.user_name, -1 * order_amount, subject); if (result > 0) { //更改订单状态 bool result1 = bll.UpdateField(order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'"); if (!result1) { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error")); return; } //扣除积分 if (model.point < 0) { new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no, false); } } else { Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error")); return; } } //支付成功 Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + order_no)); return; } Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,找不到需要支付的订单类型!"))); return; }
private void ManagerFile(HttpContext context) { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath("Configpath")); //String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1); //根目录路径,相对路径 String rootPath = siteConfig.webpath + siteConfig.attachpath + "/"; //站点目录+上传目录 //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ String rootUrl = siteConfig.webpath + siteConfig.attachpath + "/"; //图片扩展名 String fileTypes = "gif,jpg,jpeg,png,bmp"; String currentPath = ""; String currentUrl = ""; String currentDirPath = ""; String moveupDirPath = ""; String dirPath = Utils.GetMapPath(rootPath); String dirName = context.Request.QueryString["dir"]; //if (!String.IsNullOrEmpty(dirName)) //{ // if (Array.IndexOf("image,flash,media,file".Split(','), dirName) == -1) // { // context.Response.Write("Invalid Directory name."); // context.Response.End(); // } // dirPath += dirName + "/"; // rootUrl += dirName + "/"; // if (!Directory.Exists(dirPath)) // { // Directory.CreateDirectory(dirPath); // } //} //根据path参数,设置各路径和URL String path = context.Request.QueryString["path"]; path = String.IsNullOrEmpty(path) ? "" : path; if (path == "") { currentPath = dirPath; currentUrl = rootUrl; currentDirPath = ""; moveupDirPath = ""; } else { currentPath = dirPath + path; currentUrl = rootUrl + path; currentDirPath = path; moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1"); } //排序形式,name or size or type String order = context.Request.QueryString["order"]; order = String.IsNullOrEmpty(order) ? "" : order.ToLower(); //不允许使用..移动到上一级目录 if (Regex.IsMatch(path, @"\.\.")) { context.Response.Write("Access is not allowed."); context.Response.End(); } //最后一个字符不是/ if (path != "" && !path.EndsWith("/")) { context.Response.Write("Parameter is not valid."); context.Response.End(); } //目录不存在或不是目录 if (!Directory.Exists(currentPath)) { context.Response.Write("Directory does not exist."); context.Response.End(); } //遍历目录取得文件信息 string[] dirList = Directory.GetDirectories(currentPath); string[] fileList = Directory.GetFiles(currentPath); switch (order) { case "size": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new SizeSorter()); break; case "type": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new TypeSorter()); break; case "name": default: Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new NameSorter()); break; } Hashtable result = new Hashtable(); result["moveup_dir_path"] = moveupDirPath; result["current_dir_path"] = currentDirPath; result["current_url"] = currentUrl; result["total_count"] = dirList.Length + fileList.Length; List<Hashtable> dirFileList = new List<Hashtable>(); result["file_list"] = dirFileList; for (int i = 0; i < dirList.Length; i++) { DirectoryInfo dir = new DirectoryInfo(dirList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = true; hash["has_file"] = (dir.GetFileSystemInfos().Length > 0); hash["filesize"] = 0; hash["is_photo"] = false; hash["filetype"] = ""; hash["filename"] = dir.Name; hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } for (int i = 0; i < fileList.Length; i++) { FileInfo file = new FileInfo(fileList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = false; hash["has_file"] = false; hash["filesize"] = file.Length; hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0); hash["filetype"] = file.Extension.Substring(1); hash["filename"] = file.Name; hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } context.Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); context.Response.Write(JsonMapper.ToJson(result)); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); TenpayUtil xmlConfig = new TenpayUtil(); //=============================获得订单信息================================ string order_no = DTRequest.GetFormString("pay_order_no").ToUpper(); //订单号 decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); //订单金额 string user_name = DTRequest.GetFormString("pay_user_name"); //支付用户名 string subject = DTRequest.GetFormString("pay_subject"); //备注说明 string trans_type = string.Empty; //交易类型1实物2虚拟 if (order_no == "" || order_amount == 0) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"))); return; } if (order_no.StartsWith("R")) //R开头为在线充值订单 { Model.user_recharge model = new BLL.user_recharge().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!"))); return; } if (model.amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!"))); return; } trans_type = "2"; } else //B开头为商品订单 { Model.orders model = new BLL.orders().GetModel(order_no); if (model == null) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!"))); return; } if (model.order_amount != order_amount) { Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!"))); return; } trans_type = "1"; } //检查会员还是匿名 if (!string.IsNullOrEmpty(user_name)) { user_name = "支付会员:" + user_name; } else { user_name = "匿名用户"; } //===============================请求参数================================== //创建RequestHandler实例 RequestHandler reqHandler = new RequestHandler(Context); //初始化 reqHandler.init(); //设置密钥 reqHandler.setKey(xmlConfig.key); reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); //----------------------------- //设置支付参数 //----------------------------- reqHandler.setParameter("partner", xmlConfig.partner); //商户号 reqHandler.setParameter("out_trade_no", order_no); //商家订单号 reqHandler.setParameter("total_fee", (Convert.ToDouble(order_amount) * 100).ToString()); //商品金额,以分为单位 reqHandler.setParameter("return_url", xmlConfig.return_url); //交易完成后跳转的URL reqHandler.setParameter("notify_url", xmlConfig.notify_url); //接收财付通通知的URL reqHandler.setParameter("body", user_name); //商品描述 reqHandler.setParameter("bank_type", "DEFAULT"); //银行类型(中介担保时此参数无效) reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP reqHandler.setParameter("fee_type", "1"); //币种,1人民币 reqHandler.setParameter("subject", siteConfig.webname + "-" + subject); //商品名称(中介交易时必填) //系统可选参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); //业务可选参数 reqHandler.setParameter("product_fee", "0"); //商品费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("transport_fee", "0"); //物流费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss reqHandler.setParameter("time_expire", ""); //订单失效时间,格式为yyyymmddhhmmss reqHandler.setParameter("buyer_id", ""); //买方财付通账号 reqHandler.setParameter("goods_tag", ""); //商品标记 reqHandler.setParameter("trade_mode", xmlConfig.type); //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择) reqHandler.setParameter("transport_desc", ""); //物流说明 reqHandler.setParameter("trans_type", "1"); //交易类型,1实物交易,2虚拟交易 reqHandler.setParameter("agentid", ""); //平台ID reqHandler.setParameter("agent_type", ""); //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式 reqHandler.setParameter("seller_id", ""); //卖家商户号,为空则等同于partner //获取请求带参数的url string requestUrl = reqHandler.getRequestURL(); //实现自动跳转=============================== StringBuilder sbHtml = new StringBuilder(); sbHtml.Append("<form id='tenpaysubmit' name='tenpaysubmit' action='" + reqHandler.getGateUrl() + "' method='get'>"); Hashtable ht = reqHandler.getAllParameters(); foreach (DictionaryEntry de in ht) { sbHtml.Append("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n"); } //submit按钮控件请不要含有name属性 sbHtml.Append("<input type='submit' value='确认' style='display:none;'></form>"); sbHtml.Append("<script>document.forms['tenpaysubmit'].submit();</script>"); Response.Write(sbHtml.ToString()); }
private int GetIsLoginAndIsStaticstatus() { Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //取得管理员登录信息 Model.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo(); if (adminInfo == null) return -1; else if (!new BLL.manager_role().Exists(adminInfo.role_id, "app_builder_html", MXEnums.ActionEnum.Build.ToString())) return -2; else if (siteConfig.staticstatus != 2) return -3; else return 1; }
private void edit_order_status(HttpContext context) { //取得管理员登录信息 Model.manager adminInfo = new Web.UI.ManagePage().GetAdminInfo(); if (adminInfo == null) { context.Response.Write("{\"status\": 0, \"msg\": \"未登录或已超时,请重新登录!\"}"); return; } //取得站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(); //取得订单配置信息 Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig(); string order_no = MXRequest.GetString("order_no"); string edit_type = MXRequest.GetString("edit_type"); if (order_no == "") { context.Response.Write("{\"status\": 0, \"msg\": \"传输参数有误,无法获取订单号!\"}"); return; } if (edit_type == "") { context.Response.Write("{\"status\": 0, \"msg\": \"无法获取修改订单类型!\"}"); return; } BLL.orders bll = new BLL.orders(); Model.orders model = bll.GetModel(order_no); if (model == null) { context.Response.Write("{\"status\": 0, \"msg\": \"订单号不存在或已被删除!\"}"); return; } switch (edit_type.ToLower()) { case "order_confirm": //确认订单 //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认订单的权限!\"}"); return; } if (model.status > 1) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能重复处理!\"}"); return; } model.status = 2; model.confirm_time = DateTime.Now; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"订单确认失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认订单号:" + model.order_no); //记录日志 #region 发送短信或邮件 if (orderConfig.confirmmsg > 0) { switch (orderConfig.confirmmsg) { case 1: //短信通知 if (string.IsNullOrEmpty(model.mobile)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}"); return; } Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.confirmcallindex); //取得短信内容 if (smsModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}"); return; } //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{username}", model.user_name); msgContent = msgContent.Replace("{orderno}", model.order_no); msgContent = msgContent.Replace("{amount}", model.order_amount.ToString()); //发送短信 string tipMsg = string.Empty; bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); if (!sendStatus) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}"); return; } break; case 2: //邮件通知 //取得用户的邮箱地址 if (model.user_id > 0) { Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null || string.IsNullOrEmpty(userModel.email)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}"); return; } //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.confirmcallindex); if (mailModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}"); return; } //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); mailContent = mailContent.Replace("{orderno}", model.order_no); mailContent = mailContent.Replace("{amount}", model.order_amount.ToString()); //发送邮件 MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, userModel.email, mailTitle, mailContent); } break; } } #endregion context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功!\"}"); break; case "order_payment": //确认付款 //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认付款的权限!\"}"); return; } if (model.status > 1 || model.payment_status == 2) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已确认,不能重复处理!\"}"); return; } model.payment_status = 2; model.payment_time = DateTime.Now; model.status = 2; model.confirm_time = DateTime.Now; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"订单确认付款失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认付款订单号:" + model.order_no); //记录日志 #region 发送短信或邮件 if (orderConfig.confirmmsg > 0) { switch (orderConfig.confirmmsg) { case 1: //短信通知 if (string.IsNullOrEmpty(model.mobile)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}"); return; } Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.confirmcallindex); //取得短信内容 if (smsModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}"); return; } //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{username}", model.user_name); msgContent = msgContent.Replace("{orderno}", model.order_no); msgContent = msgContent.Replace("{amount}", model.order_amount.ToString()); //发送短信 string tipMsg = string.Empty; bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); if (!sendStatus) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}"); return; } break; case 2: //邮件通知 //取得用户的邮箱地址 if (model.user_id > 0) { Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null || string.IsNullOrEmpty(userModel.email)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}"); return; } //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.confirmcallindex); if (mailModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}"); return; } //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); mailContent = mailContent.Replace("{orderno}", model.order_no); mailContent = mailContent.Replace("{amount}", model.order_amount.ToString()); //发送邮件 MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, userModel.email, mailTitle, mailContent); } break; } } #endregion context.Response.Write("{\"status\": 1, \"msg\": \"订单确认付款成功!\"}"); break; case "order_express": //确认发货 //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认发货的权限!\"}"); return; } if (model.status > 2 || model.express_status == 2) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已完成或已发货,不能重复处理!\"}"); return; } int express_id = MXRequest.GetFormInt("express_id"); string express_no = MXRequest.GetFormString("express_no"); if (express_id == 0) { context.Response.Write("{\"status\": 0, \"msg\": \"请选择配送方式!\"}"); return; } model.express_id = express_id; model.express_no = express_no; model.express_time = DateTime.Now; string ret = ""; if (model.payment_id == 3 && model.express_status != 2) { //通知微信支付,改变发货状态 FaHuoProc fahuo = new FaHuoProc(); BLL.wx_payment_wxpay payBll = new BLL.wx_payment_wxpay(); Model.wx_payment_wxpay paymentInfo = payBll.GetModelByWid(model.wid.Value); Dictionary<string, object> fahuoDict = fahuo.fahuomgr(paymentInfo, model); string errcode = fahuoDict["errcode"].ToString(); string errmsg = fahuoDict["errmsg"].ToString(); model.fahuoCode = errcode; model.fahuoMsg = errmsg; if (errcode == "0") { model.express_status = 2; } else { ret = "通知微信支付,改变发货状态失败:"+errmsg; } } model.express_status = 2; if (!bll.Update(model)) { ret += "订单发货失败!"; context.Response.Write("{\"status\": 0, \"msg\": \"" + ret + "\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认发货订单号:" + model.order_no); //记录日志 #region 发送短信或邮件 if (orderConfig.expressmsg > 0) { switch (orderConfig.expressmsg) { case 1: //短信通知 if (string.IsNullOrEmpty(model.mobile)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}"); return; } Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.expresscallindex); //取得短信内容 if (smsModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}"); return; } //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{username}", model.user_name); msgContent = msgContent.Replace("{orderno}", model.order_no); msgContent = msgContent.Replace("{amount}", model.order_amount.ToString()); //发送短信 string tipMsg = string.Empty; bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); if (!sendStatus) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}"); return; } break; case 2: //邮件通知 //取得用户的邮箱地址 if (model.user_id > 0) { Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null || string.IsNullOrEmpty(userModel.email)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}"); return; } //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.expresscallindex); if (mailModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}"); return; } //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); mailContent = mailContent.Replace("{orderno}", model.order_no); mailContent = mailContent.Replace("{amount}", model.order_amount.ToString()); //发送邮件 MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, userModel.email, mailTitle, mailContent); } break; } } #endregion context.Response.Write("{\"status\": 1, \"msg\": \"订单发货成功!\"}"); break; case "order_complete": //完成订单========================================= //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Confirm.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有确认完成订单的权限!\"}"); return; } if (model.status > 2) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经完成,不能重复处理!\"}"); return; } model.status = 3; model.complete_time = DateTime.Now; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"确认订单完成失败!\"}"); return; } //给会员增加积分检查升级 if (model.user_id > 0 && model.point > 0) { new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "购物获得积分,订单号:" + model.order_no, true); } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Confirm.ToString(), "确认交易完成订单号:" + model.order_no); //记录日志 #region 发送短信或邮件 if (orderConfig.completemsg > 0) { switch (orderConfig.completemsg) { case 1: //短信通知 if (string.IsNullOrEmpty(model.mobile)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >对方未填写手机号码!\"}"); return; } Model.sms_template smsModel = new BLL.sms_template().GetModel(orderConfig.completecallindex); //取得短信内容 if (smsModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >短信通知模板不存在!\"}"); return; } //替换标签 string msgContent = smsModel.content; msgContent = msgContent.Replace("{webname}", siteConfig.webname); msgContent = msgContent.Replace("{username}", model.user_name); msgContent = msgContent.Replace("{orderno}", model.order_no); msgContent = msgContent.Replace("{amount}", model.order_amount.ToString()); //发送短信 string tipMsg = string.Empty; bool sendStatus = new BLL.sms_message().Send(model.mobile, msgContent, 2, out tipMsg); if (!sendStatus) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送短信<br/ >" + tipMsg + "\"}"); return; } break; case 2: //邮件通知 //取得用户的邮箱地址 if (model.user_id > 0) { Model.users userModel = new BLL.users().GetModel(model.user_id); if (userModel == null || string.IsNullOrEmpty(userModel.email)) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >该用户不存在或没有填写邮箱地址。\"}"); return; } //取得邮件模板内容 Model.mail_template mailModel = new BLL.mail_template().GetModel(orderConfig.completecallindex); if (mailModel == null) { context.Response.Write("{\"status\": 1, \"msg\": \"订单确认成功,但无法发送邮件<br/ >邮件通知模板不存在。\"}"); return; } //替换标签 string mailTitle = mailModel.maill_title; mailTitle = mailTitle.Replace("{username}", model.user_name); string mailContent = mailModel.content; mailContent = mailContent.Replace("{webname}", siteConfig.webname); mailContent = mailContent.Replace("{weburl}", siteConfig.weburl); mailContent = mailContent.Replace("{webtel}", siteConfig.webtel); mailContent = mailContent.Replace("{username}", model.user_name); mailContent = mailContent.Replace("{orderno}", model.order_no); mailContent = mailContent.Replace("{amount}", model.order_amount.ToString()); //发送邮件 MXMail.sendMail(siteConfig.emailsmtp, siteConfig.emailusername, siteConfig.emailpassword, siteConfig.emailnickname, siteConfig.emailfrom, userModel.email, mailTitle, mailContent); } break; } } #endregion context.Response.Write("{\"status\": 1, \"msg\": \"确认订单完成成功!\"}"); break; case "order_cancel": //取消订单========================================== //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Cancel.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有取消订单的权限!\"}"); return; } if (model.status > 2) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经完成,不能取消订单!\"}"); return; } model.status = 4; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"取消订单失败!\"}"); return; } int check_revert1 = MXRequest.GetFormInt("check_revert"); if (check_revert1 == 1) { //如果存在积分换购则返还会员积分 if (model.user_id > 0 && model.point < 0) { new BLL.user_point_log().Add(model.user_id, model.user_name, (model.point * -1), "取消订单返还积分,订单号:" + model.order_no, false); } //如果已支付则退还金额到会员账户 if (model.user_id > 0 && model.payment_status == 2 && model.order_amount > 0) { new BLL.user_amount_log().Add(model.user_id, model.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_amount, "取消订单退还金额,订单号:" + model.order_no); } } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Cancel.ToString(), "取消订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"取消订单成功!\"}"); break; case "order_invalid": //作废订单========================================== //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Invalid.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有作废订单的权限!\"}"); return; } if (model.status != 3) { context.Response.Write("{\"status\": 0, \"msg\": \"订单尚未完成,不能作废订单!\"}"); return; } model.status = 5; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"作废订单失败!\"}"); return; } int check_revert2 = MXRequest.GetFormInt("check_revert"); if (check_revert2 == 1) { //扣除购物赠送的积分 if (model.user_id > 0 && model.point > 0) { new BLL.user_point_log().Add(model.user_id, model.user_name, (model.point * -1), "作废订单扣除积分,订单号:" + model.order_no, false); } //退还金额到会员账户 if (model.user_id > 0 && model.order_amount > 0) { new BLL.user_amount_log().Add(model.user_id, model.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_amount, "取消订单退还金额,订单号:" + model.order_no); } } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Invalid.ToString(), "作废订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"作废订单成功!\"}"); break; case "edit_accept_info": //修改收货信息==================================== //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改收货信息的权限!\"}"); return; } if (model.express_status == 2) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经发货,不能修改收货信息!\"}"); return; } string accept_name = MXRequest.GetFormString("accept_name"); string province = MXRequest.GetFormString("province"); string city = MXRequest.GetFormString("city"); string area = MXRequest.GetFormString("area"); string address = MXRequest.GetFormString("address"); string post_code = MXRequest.GetFormString("post_code"); string mobile = MXRequest.GetFormString("mobile"); string telphone = MXRequest.GetFormString("telphone"); if (accept_name == "") { context.Response.Write("{\"status\": 0, \"msg\": \"请填写收货人姓名!\"}"); return; } if (area == "") { context.Response.Write("{\"status\": 0, \"msg\": \"请选择所在地区!\"}"); return; } if (address == "") { context.Response.Write("{\"status\": 0, \"msg\": \"请填写详细的送货地址!\"}"); return; } if (mobile == "" && telphone == "") { context.Response.Write("{\"status\": 0, \"msg\": \"联系手机或电话至少填写一项!\"}"); return; } model.accept_name = accept_name; model.area = province + "," + city + "," + area; model.address = address; model.post_code = post_code; model.mobile = mobile; model.telphone = telphone; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"修改收货人信息失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改收货信息,订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"修改收货人信息成功!\"}"); break; case "edit_order_remark": //修改订单备注================================= string remark = MXRequest.GetFormString("remark"); if (remark == "") { context.Response.Write("{\"status\": 0, \"msg\": \"请填写订单备注内容!\"}"); return; } model.remark = remark; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"修改订单备注失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改订单备注,订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"修改订单备注成功!\"}"); break; case "edit_real_amount": //修改商品总金额================================ //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改商品金额的权限!\"}"); return; } if (model.status > 1) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}"); return; } decimal real_amount = MXRequest.GetFormDecimal("real_amount", 0); model.real_amount = real_amount; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"修改商品总金额失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改商品金额,订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"修改商品总金额成功!\"}"); break; case "edit_express_fee": //修改配送费用================================== //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有配送费用的权限!\"}"); return; } if (model.status > 1) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}"); return; } decimal express_fee = MXRequest.GetFormDecimal("express_fee", 0); model.express_fee = express_fee; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"修改配送费用失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改配送费用,订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"修改配送费用成功!\"}"); break; case "edit_payment_fee": //修改支付手续费================================= //检查权限 if (!new BLL.manager_role().Exists(adminInfo.role_id, "order_list", MXEnums.ActionEnum.Edit.ToString())) { context.Response.Write("{\"status\": 0, \"msg\": \"您没有修改支付手续费的权限!\"}"); return; } if (model.status > 1) { context.Response.Write("{\"status\": 0, \"msg\": \"订单已经确认,不能修改金额!\"}"); return; } decimal payment_fee = MXRequest.GetFormDecimal("payment_fee", 0); model.payment_fee = payment_fee; if (!bll.Update(model)) { context.Response.Write("{\"status\": 0, \"msg\": \"修改支付手续费失败!\"}"); return; } new BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, MXEnums.ActionEnum.Edit.ToString(), "修改支付手续费,订单号:" + model.order_no); //记录日志 context.Response.Write("{\"status\": 1, \"msg\": \"修改支付手续费成功!\"}"); break; } }
private void sys_channel_validate(HttpContext context) { string channelname = DTRequest.GetFormString("channelname"); string oldname = DTRequest.GetFormString("oldname"); if (string.IsNullOrEmpty(channelname)) { context.Response.Write("false"); return; } //检查是否与站点根目录下的目录同名 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(Utils.GetXmlMapPath(DTKeys.FILE_SITE_XML_CONFING)); DirectoryInfo dirInfo = new DirectoryInfo(Utils.GetMapPath(siteConfig.webpath)); foreach (DirectoryInfo dir in dirInfo.GetDirectories()) { if (channelname.ToLower() == dir.Name) { context.Response.Write("false"); return; } } //检查是否修改操作 if (channelname == oldname) { context.Response.Write("true"); return; } //检查Key是否与已存在 BLL.sys_channel bll = new BLL.sys_channel(); if (bll.Exists(channelname)) { context.Response.Write("false"); return; } context.Response.Write("true"); return; }
protected void Page_Load(object sender, EventArgs e) { //读取站点配置信息 Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING); //获得订单信息 string order_type = DTRequest.GetFormString("pay_order_type"); //订单类型 string order_no = DTRequest.GetFormString("pay_order_no"); //订单号 decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0); //订单金额 string user_name = DTRequest.GetFormString("pay_user_name"); //支付用户名 string subject = DTRequest.GetFormString("pay_subject"); //备注说明 if (order_type == "" || order_no == "" || order_amount == 0 || user_name == "") { Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")); return; } ////////////////////////////////////////////请求参数//////////////////////////////////////////// //创建RequestHandler实例 RequestHandler reqHandler = new RequestHandler(Context); //初始化 reqHandler.init(); //设置密钥 reqHandler.setKey(TenpayUtil.tenpay_key); reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm"); //----------------------------- //设置支付参数 //----------------------------- reqHandler.setParameter("partner", TenpayUtil.bargainor_id); //商户号 reqHandler.setParameter("out_trade_no", order_no); //商家订单号 reqHandler.setParameter("total_fee", (Convert.ToDouble(order_amount) * 100).ToString()); //商品金额,以分为单位 reqHandler.setParameter("return_url", TenpayUtil.tenpay_return); //交易完成后跳转的URL reqHandler.setParameter("notify_url", TenpayUtil.tenpay_notify); //接收财付通通知的URL reqHandler.setParameter("body", "支付会员:" + user_name); //商品描述 reqHandler.setParameter("bank_type", "DEFAULT"); //银行类型(中介担保时此参数无效) reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP reqHandler.setParameter("fee_type", "1"); //币种,1人民币 reqHandler.setParameter("subject", siteConfig.webname + "-" + subject); //商品名称(中介交易时必填) //系统可选参数 reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("service_version", "1.0"); reqHandler.setParameter("input_charset", "UTF-8"); reqHandler.setParameter("sign_key_index", "1"); //业务可选参数 reqHandler.setParameter("attach", order_type); //附加数据,原样返回 reqHandler.setParameter("product_fee", "0"); //商品费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("transport_fee", "0"); //物流费用,必须保证transport_fee + product_fee=total_fee reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss reqHandler.setParameter("time_expire", ""); //订单失效时间,格式为yyyymmddhhmmss reqHandler.setParameter("buyer_id", ""); //买方财付通账号 reqHandler.setParameter("goods_tag", ""); //商品标记 reqHandler.setParameter("trade_mode", "1"); //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择) reqHandler.setParameter("transport_desc", ""); //物流说明 reqHandler.setParameter("trans_type", "1"); //交易类型,1实物交易,2虚拟交易 reqHandler.setParameter("agentid", ""); //平台ID reqHandler.setParameter("agent_type", ""); //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式 reqHandler.setParameter("seller_id", ""); //卖家商户号,为空则等同于partner //获取请求带参数的url string requestUrl = reqHandler.getRequestURL(); /*Get的实现方式 string a_link = "<a target=\"_blank\" href=\"" + requestUrl + "\">" + "财付通支付" + "</a>"; Response.Write(a_link);*/ //实现自动跳转=============================== StringBuilder sbHtml = new StringBuilder(); sbHtml.Append("<form id='tenpaysubmit' name='tenpaysubmit' action='" + reqHandler.getGateUrl() + "' method='get'>"); Hashtable ht = reqHandler.getAllParameters(); foreach (DictionaryEntry de in ht) { sbHtml.Append("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n"); } //submit按钮控件请不要含有name属性 sbHtml.Append("<input type='submit' value='确认' style='display:none;'></form>"); sbHtml.Append("<script>document.forms['tenpaysubmit'].submit();</script>"); Response.Write(sbHtml.ToString()); }