private bool DoAdd() { string strErr = ""; if (this.txtwxName.Text.Trim().Length == 0) { strErr += "公众帐号名称不能为空!"; } if (this.txtwxId.Text.Trim().Length == 0) { strErr += "公众号原始id不能为空!"; } if (this.txtweixinCode.Text.Trim().Length == 0) { strErr += "微信号不能为空!"; } if (this.txtwxToken.Text.Trim().Length == 0) { strErr += "TOKEN值不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return false; } Model.manager manager = GetAdminInfo(); int uId = manager.id; string wxName = this.txtwxName.Text; string wxId = this.txtwxId.Text; string weixinCode = this.txtweixinCode.Text; string wxPwd = ""; string headerpic = this.txtImgUrl.Text; string apiurl = ""; string wxToken = this.txtwxToken.Text; string wxProvince = ""; string wxCity = ""; string AppId = this.txtAppId.Text; string AppSecret = this.txtAppSecret.Text; DateTime createDate = DateTime.Now; DateTime endDate = DateTime.Now.AddYears(1); Model.wx_userweixin model = new Model.wx_userweixin(); model.uId = uId; model.wxName = wxName; model.wxId = wxId; model.yixinId = ""; model.weixinCode = weixinCode; model.wxPwd = wxPwd; model.headerpic = headerpic; model.apiurl = apiurl; model.wxToken = wxToken; model.wxProvince = wxProvince; model.wxCity = wxCity; model.AppId = AppId; model.AppSecret = AppSecret; model.Access_Token = ""; model.openIdStr = ""; model.createDate = createDate; model.endDate = endDate; model.wenziMaxNum = -1;//-1为无限制 model.tuwenMaxNum = -1; model.yuyinMaxNum = -1; model.wenziDefineNum = 0; model.tuwenDefineNum = 0; model.yuyinDefineNum = 0; model.requestTTNum = 0; model.requestUsedNum = 0; model.smsTTNum = 0; model.smsUsedNum = 0; model.isDelete = false; model.remark = ""; model.seq = 99; if (IsChaoGuoWxNum()) { return false; } int wId = bll.Add(model); this.id = wId; if (wId > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加微信号,主键为:" + model.id + ",微信号为:" + model.weixinCode); //记录日志 return true; } return false; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { string act = MyCommFun.QueryString("act"); string ruleName = ""; if (act == "subscribe") { ruleName = "关注时的触发内容"; } else if (act == "default") { ruleName = "默认回复内容"; } else if (act == "canel") { ruleName = "取消关注时的触发内容"; } try { if (this.txtTitle.Value.Trim().Length == 0) { JscriptMsg("标题不能为空", "back", "Error"); return; } Model.manager manager = GetAdminInfo(); Model.wx_userweixin weixin = GetWeiXinCode(); int rid = int.Parse(hidrId.Value); //规则id Model.wx_requestRule rule = new Model.wx_requestRule(); Model.wx_requestRuleContent rc = new Model.wx_requestRuleContent(); if (rid == 0) { //说明没有添加过微信关注的回复内容 int NewRId = AddRule(); //内容 EditRuleContent(NewRId, 0); } else { rule = rBll.GetModel(rid); if (rule.responseType != 2) { //如果此前非图文内容,则删除原来的数据 rBll.DeleteRule(rid); int NewRId = AddRule(); //内容 EditRuleContent(NewRId, 0); } else if (this.hidAction.Value.Trim().ToLower() == "add") { EditRuleContent(rid, 0); } else { int id = int.Parse(hidId.Value); EditRuleContent(rid, id); } } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "编辑" + ruleName); //记录日志 MessageBox.ResponseScript(this, " api.close(); "); } catch { JscriptMsg("编辑" + ruleName + "有问题!", "", "Error"); } }
/// <summary> /// 最新接口调用 /// 2014-11-24 /// </summary> /// <param name="ttFee">支付金额(单位元)</param> /// <param name="busiBody">订单内容</param> /// <param name="out_trade_no">订单号</param> /// <param name="code"></param> protected void WxPayDataV3(decimal ttFee, string busiBody, string out_trade_no, string code) { BLL.wx_payment_wxpay wxPayBll = new BLL.wx_payment_wxpay(); Model.wx_payment_wxpay paymentInfo = wxPayBll.GetModelByWid(wid); BLL.wx_userweixin uwBll = new BLL.wx_userweixin(); Model.wx_userweixin uwEntity = uwBll.GetModel(wid); // logBll.AddLog(wid,"【微支付】微信预定", "paypage.aspx WxPayDataV3", "211 wid:" + wid, 1); //先设置基本信息 string MchId = paymentInfo.mch_id; // "1218574001";// string partnerKey = paymentInfo.paykey; // 商户支付密钥Key。登录微信商户后台,进入栏目【账户设置】【密码安全】【API 安全】【API 密钥】 string notify_url = "http://" + HttpContext.Current.Request.Url.Authority + "/api/payment/wxpay/notify_url.aspx"; WXLogs.AddLog(wid, "【微支付】微信预定", "paypage.aspx WxPayDataV3", "uwEntity.AppId: " + uwEntity.AppId + "| uwEntity.AppSecret;" + uwEntity.AppSecret + "|code:" + code, 1); string timeStamp = ""; string nonceStr = ""; string paySign = ""; string sp_billno = out_trade_no; //当前时间 yyyyMMdd string date = DateTime.Now.ToString("yyyyMMdd"); if (null == sp_billno) { //生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一 sp_billno = DateTime.Now.ToString("HHmmss") + TenPayV3Util.BuildRandomStr(28); } //创建支付应答对象 OneGulp.WeChat.MP.TenPayLibV3.RequestHandler packageReqHandler = new OneGulp.WeChat.MP.TenPayLibV3.RequestHandler(null); //初始化 packageReqHandler.Init(); //packageReqHandler.SetKey(""/*TenPayV3Info.Key*/); timeStamp = TenPayV3Util.GetTimestamp(); nonceStr = TenPayV3Util.GetNoncestr(); //设置package订单参数 packageReqHandler.SetParameter("appid", uwEntity.AppId); //公众账号ID packageReqHandler.SetParameter("mch_id", MchId); //商户号 packageReqHandler.SetParameter("nonce_str", nonceStr); //随机字符串 packageReqHandler.SetParameter("body", busiBody); //商品描述 packageReqHandler.SetParameter("attach", wid + "|" + busiBody); packageReqHandler.SetParameter("out_trade_no", sp_billno); //商家订单号 packageReqHandler.SetParameter("total_fee", ((int)(ttFee * 100)).ToString()); //商品金额,以分为单位(money * 100).ToString() packageReqHandler.SetParameter("spbill_create_ip", Request.UserHostAddress); //用户的公网ip,不是商户服务器IP packageReqHandler.SetParameter("notify_url", notify_url); //接收财付通通知的URL packageReqHandler.SetParameter("trade_type", TenPayV3Type.JSAPI.ToString()); //交易类型 packageReqHandler.SetParameter("openid", openid); //用户的openId string sign = packageReqHandler.CreateMd5Sign("key", partnerKey); packageReqHandler.SetParameter("sign", sign); //签名 string data = packageReqHandler.ParseXML(); var result = TenPayV3Helper.Unifiedorder(data); var res = XDocument.Parse(result); prepayId = res.Element("xml").Element("prepay_id").Value; //设置支付参数 OneGulp.WeChat.MP.TenPayLibV3.RequestHandler paySignReqHandler = new OneGulp.WeChat.MP.TenPayLibV3.RequestHandler(null); paySignReqHandler.SetParameter("appId", uwEntity.AppId); paySignReqHandler.SetParameter("timeStamp", timeStamp); paySignReqHandler.SetParameter("nonceStr", nonceStr); paySignReqHandler.SetParameter("package", string.Format("prepay_id={0}", prepayId)); paySignReqHandler.SetParameter("signType", "MD5"); paySign = paySignReqHandler.CreateMd5Sign("key", partnerKey); packageValue = ""; packageValue += " \"appId\": \"" + uwEntity.AppId + "\", "; packageValue += " \"timeStamp\": \"" + timeStamp + "\", "; packageValue += " \"nonceStr\": \"" + nonceStr + "\", "; packageValue += " \"package\": \"" + string.Format("prepay_id={0}", prepayId) + "\", "; packageValue += " \"signType\": \"MD5\", "; packageValue += " \"paySign\": \"" + paySign + "\""; }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { Model.wx_userweixin weixin = GetWeiXinCode(); int id = MyCommFun.Str2Int(hidid.Value); #region //先判断 string strErr = ""; if (this.txttradeContent.Value.Trim().Length == 0) { strErr += "招商说明不能为空!"; } if (this.txttel.Text.Trim().Length == 0) { strErr += "电话不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return; } #endregion #region 赋值 Model.wx_ucard_sys storesys = new Model.wx_ucard_sys(); if (id > 0) { storesys = storesysBll.GetModel(id); } storesys.tradeContent = txttradeContent.Value.Trim(); storesys.tradeTel = txttel.Text.Trim(); #endregion if (id <= 0) { //新增 storesys.wid = weixin.id; storesys.createDate = DateTime.Now; //1新增主表 id = storesysBll.Add(storesys); AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "会员卡商城设置,主键为" + id); //记录日志 JscriptMsg("会员卡商城设置成功!", "business_list.aspx", "Success"); } else { //修改 //1修改主表 storesysBll.Update(storesys); AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改会员卡商家,主键为" + id); //记录日志 JscriptMsg("会员卡商城设置成功!", "business_list.aspx", "Success"); } }
private void ShowInfo(int _id) { Model.wx_userweixin weixin = GetWeiXinCode(); BLL.orders bll = new BLL.orders(); model = bll.GetModel(_id); //绑定商品列表 this.rptList.DataSource = model.order_goods; this.rptList.DataBind(); //获得会员信息 if (model.user_id > 0) { Model.users user_info = new BLL.users().GetModel(model.user_id); if (user_info != null) { Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id); if (group_info != null) { dlUserInfo.Visible = true; lbUserName.Text = user_info.user_name; lbUserGroup.Text = group_info.title; lbUserDiscount.Text = group_info.discount.ToString() + " %"; lbUserAmount.Text = user_info.amount.ToString(); lbUserPoint.Text = user_info.point.ToString(); } } } //根据订单状态,显示各类操作按钮 switch (model.status) { case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认 if (model.payment_status > 0) { //确认付款、取消订单、修改收货按钮显示 btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else { //确认订单、取消订单、修改收货按钮显示 btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改积分总计按钮显示 btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = true; break; case 2: //如果订单为已确认状态,则进入发货状态 if (model.express_status == 1) { //确认发货、取消订单、修改收货信息按钮显示 btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true; } else if (model.express_status == 2) { //完成订单、取消订单按钮可见 btnComplete.Visible = btnCancel.Visible = true; } //修改订单备注按钮可见 btnEditRemark.Visible = true; break; case 3: //作废订单、修改订单备注按钮可见 btnInvalid.Visible = btnEditRemark.Visible = true; break; } //根据订单状态和物流单号跟踪物流信息 if (model.express_status == 2 && model.express_no.Trim().Length > 0) { Model.express modelt = new BLL.express().GetModel(model.express_id); Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig(); if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "") { string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder; string detail = Utils.HttpGet(@apiurl); if (detail != null) { litExpressDetail.Text = Utils.ToHtml(detail); } } } }