public ActionResult down() { #region 获取用户实名认证状态信息 JMP.BLL.jmp_user sm_bll = new JMP.BLL.jmp_user(); JMP.MDL.jmp_user sm_model = new JMP.MDL.jmp_user(); int u_ids = UserInfo.Uid; //查询登录信息 sm_model = sm_bll.GetModel(u_ids); ViewBag.auditstate = sm_model.u_auditstate; ViewBag.linkEmail = sm_model.u_email; #endregion int appid = string.IsNullOrEmpty(Request["appid"]) ? 0 : Int32.Parse(Request["appid"]); JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app(); if (appid > 0) { modapp = bll.SelectAppId(appid); } string payfs = SelectPay(modapp.a_paymode_id); string[] pay = payfs.Split(','); ViewBag.pay = pay; ViewBag.modapp = modapp; return(View()); }
/// <summary> /// 根据应用id查询应用 /// </summary> /// <param name="appid">应用id</param> /// <param name="CacheTime">缓存时间从配置文件中读取的</param> /// <returns></returns> public jmp_app SelectAppId(int appid, int CacheTime) { jmp_app app = new jmp_app(); JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); string Cachekey = "Cachekey" + appid; if (JMP.TOOL.CacheHelper.IsCache(Cachekey)) //判读是否存在缓存 { app = JMP.TOOL.CacheHelper.GetCaChe <jmp_app>(Cachekey); //获取缓存 if (app == null) { app = bll.SelectAppIdStat(appid); if (app != null) { JMP.TOOL.CacheHelper.CacheObjectLocak <jmp_app>(app, Cachekey, CacheTime);//存入缓存 } } } else { app = bll.SelectAppIdStat(appid); if (app != null) { JMP.TOOL.CacheHelper.CacheObjectLocak <jmp_app>(app, Cachekey, CacheTime);//存入缓存 } } return(app); }
public JsonResult DeleteApp() { object retJson = new { success = 0, msg = "操作失败" }; JMP.MDL.jmp_app model = new JMP.MDL.jmp_app();//应用实体类 JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); int a_id = string.IsNullOrEmpty(Request["a_id"]) ? 0 : Int32.Parse(Request["a_id"].ToString()); if (a_id > 0) { model = bll.GetModel(a_id); model.a_state = -1; if (bll.Update(model)) { // AddLocLog.AddUserLog(Int32.Parse(UserInfo.UserId), 3, RequestHelper.GetClientIp(), "删除应用", "删除应用,应用id为:" + model.a_id); Logger.OperateLog("删除应用", "删除应用"); retJson = new { success = 1, msg = "操作成功" }; } else { retJson = new { success = 0, msg = "操作失败" }; } } return(Json(retJson)); }
/// <summary> /// 微信公众号第一次跳转 /// </summary> /// <param name="Oid">订单id</param> private void OnJump(int Oid) { try { string str = ""; JMP.MDL.jmp_app mo = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app blls = new JMP.BLL.jmp_app(); mo = JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_app>(blls.GetList(" a_id=(SELECT o_app_id FROM jmp_order WHERE o_id=" + Oid + ") ").Tables[0]); if (mo != null) { SelectInterface SeIn = new SelectInterface(); string cache = "wxgfgzh" + Oid; SeIn = SelectInfo(cache, mo.a_rid, mo.a_id, int.Parse(ConfigurationManager.AppSettings["CacheTime"].ToString())); if (SeIn == null || SeIn.PayId <= 0 || string.IsNullOrEmpty(SeIn.UserId) || string.IsNullOrEmpty(SeIn.UserKey)) { str = "{\"Message\":\"支付通道未配置\",\"ErrorCode\":106}"; Response.Write(str); } JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = bll.SelectOrderGoodsName(Oid, "jmp_order"); if (morder.o_price < SeIn.minmun) { str = "{\"Message\":\"订单金额不能小于单笔最小支付金额\",\"ErrorCode\":8990}"; Response.Write(str); } if (morder.o_price > SeIn.maximum) { str = "{\"Message\":\"订单金额不能大于单笔最大支付金额\",\"ErrorCode\":8989}"; Response.Write(str); } if (bll.UpdatePay(Oid, SeIn.PayId)) { string redirect_uri = ConfigurationManager.AppSettings["WxGzhRturnUrl"].ToString() + Oid + ".html"; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + "回调地址:" + redirect_uri, summary: "微信官方公众号第一次跳转支付接口错误信息", channelId: Oid); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + SeIn.wxappid + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_base#wechat_redirect"; Response.Redirect(url, false); } } else { str = "{\"Message\":\"支付接口异常\",\"ErrorCode\":102}"; Response.Write(str); } } catch (Exception ex) { PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + ex.Message, summary: "微信官方公众号第一次跳转支付接口错误信息", channelId: Oid); Response.Write("非法访问!"); } }
public ActionResult UserAppList() { int userId = UserInfo.UserId; int aid = string.IsNullOrEmpty(Request["aid"]) ? 0 : Int32.Parse(Request["aid"].ToString()); JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); DataTable dt = bll.GetList("a_user_id=" + userId).Tables[0]; List <JMP.MDL.jmp_app> list = new List <JMP.MDL.jmp_app>(); if (dt.Rows.Count > 0) { list = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_app>(dt); } ViewBag.aid = aid; ViewBag.list = list; return(PartialView()); }
public ActionResult Upload() { int appid = string.IsNullOrEmpty(Request["appid"]) ? 0 : Int32.Parse(Request["appid"]); ViewBag.appid = appid; JMP.BLL.jmp_appsdk bll = new JMP.BLL.jmp_appsdk(); JMP.MDL.jmp_appsdk model = new JMP.MDL.jmp_appsdk(); JMP.BLL.jmp_app bllapp = new JMP.BLL.jmp_app(); JMP.MDL.jmp_app mo = new JMP.MDL.jmp_app(); if (appid > 0) { model = bll.SelectModel(appid); mo = bllapp.GetModel(appid); } ViewBag.model = model == null ? new JMP.MDL.jmp_appsdk() : model; ViewBag.mo = mo == null ? new JMP.MDL.jmp_app() : mo; return(View()); }
/// <summary> /// 应用列表 /// </summary> /// <returns></returns> public ActionResult AppList() { #region 获取用户实名认证状态信息 JMP.BLL.jmp_user sm_bll = new JMP.BLL.jmp_user(); JMP.MDL.jmp_user sm_model = new JMP.MDL.jmp_user(); int u_ids = UserInfo.Uid; //查询登录信息 sm_model = sm_bll.GetModel(u_ids); ViewBag.auditstate = sm_model.u_auditstate; ViewBag.linkEmail = sm_model.u_email; #endregion int pageCount = 0; int pageIndexs = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]); //当前页 int PageSize = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]); //每页显示数量 string searchname = string.IsNullOrEmpty(Request["searchname"]) ? "" : Request["searchname"]; //应用名称 ViewBag.searchname = searchname; int terrace = string.IsNullOrEmpty(Request["terrace"]) ? 0 : int.Parse(Request["terrace"]); //运行平台 ViewBag.terrace = terrace; List <JMP.MDL.jmp_app> list = new List <JMP.MDL.jmp_app>(); JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); list = bll.SelectUserList(UserInfo.UserId.ToString(), searchname, terrace, pageIndexs, PageSize, out pageCount); ViewBag.pageIndexs = pageIndexs; ViewBag.PageSize = PageSize; ViewBag.pageCount = pageCount; ViewBag.list = list; #region =========获取应用平台在用信息========= JMP.BLL.jmp_platform paybll = new JMP.BLL.jmp_platform(); DataTable dt = paybll.GetList(" 1=1 and p_state='1' ").Tables[0];//获取应用平台在用信息 List <JMP.MDL.jmp_platform> yypt = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_platform>(dt); ViewBag.glptdt = yypt; #endregion return(View()); }
public ActionResult Appinfo() { int appid = string.IsNullOrEmpty(Request["appid"]) ? 0 : Int32.Parse(Request["appid"]); JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app(); if (appid > 0) { modapp = bll.SelectAppId(appid); } string payfs = SelectPay(modapp.a_paymode_id); string[] pay = payfs.Split(','); ViewBag.pay = pay; ViewBag.modapp = modapp; string helpUrl = System.Configuration.ConfigurationManager.AppSettings["helpUrl"].ToString(); ViewBag.helpUrl = helpUrl; return(View()); }
/// <summary> /// 根据应用id查询所属用户 /// </summary> /// <param name="APPID">应用id</param> /// <param name="tname">接口名称</param> /// <param name="noticestr">传入的字符串</param> /// <returns></returns> private int selectUserID(int APPID, string tname, string noticestr) { int aid = 0; try { JMP.MDL.jmp_app app = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app appbll = new JMP.BLL.jmp_app(); string notfrurl = "notfrurl" + APPID;//缓存名称 //判读是否存在缓存 if (JMP.TOOL.CacheHelper.IsCache(notfrurl)) { app = JMP.TOOL.CacheHelper.GetCaChe <JMP.MDL.jmp_app>(notfrurl);//获取缓存 if (app != null) { aid = app.u_id; } } else { app = appbll.SelectId(APPID); if (app != null) { aid = app.u_id; JMP.TOOL.CacheHelper.CacheObjectLocak <JMP.MDL.jmp_app>(app, notfrurl, 5);//存入缓存 } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, tname + "通知接口错误", "应用id:" + APPID + ",获取用户id失败!获取的参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("应用id:" + APPID + ",获取用户id失败!获取的参数:" + noticestr, summary: tname + "通知接口错误"); } } } catch (Exception ex) { // AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, tname + "通知接口错误", "查询用户id失败,报错信息:" + ex.ToString() + ",获取的参数:" + noticestr);//写入报错日志 PayNotifyGlobalErrorLogger.Log("查询用户id失败,报错信息:" + ex.ToString() + ",获取的参数:" + noticestr, summary: tname + "通知接口错误"); } return(aid); }
public JsonResult DeleteApp() { object retJson = new { success = 0, msg = "操作失败" }; JMP.MDL.jmp_app model = new JMP.MDL.jmp_app();//应用实体类 JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); int a_id = string.IsNullOrEmpty(Request["a_id"]) ? 0 : Int32.Parse(Request["a_id"].ToString()); if (a_id > 0) { model = bll.GetModel(a_id); model.a_state = -1; if (bll.Update(model)) { Logger.OperateLog("删除应用", "删除应用ID为'" + a_id + "'"); retJson = new { success = 1, msg = "操作成功" }; } else { retJson = new { success = 0, msg = "操作失败" }; } } return(Json(retJson)); }
/// <summary> /// 威富通微信公众号支付 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { int oid = !string.IsNullOrEmpty(Request["pid"]) ? Convert.ToInt32(Request["pid"].ToString()) : 0; if (oid > 0) { //获取缓存 try { string appid = ""; string appms = ""; string code = !string.IsNullOrEmpty(Request["code"]) ? Request["code"] : ""; if (!String.IsNullOrEmpty(code)) { //第二次 JMP.MDL.jmp_order morder = new JMP.BLL.jmp_order().SelectOrderGoodsName(oid, "jmp_order"); string ddjj = Get_paystr(morder.o_interface_id.ToString()); appid = ddjj.ToString().Split(',')[2]; appms = ddjj.ToString().Split(',')[3]; string openid = ""; string URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + appid + "&secret=" + appms + "&code=" + code + "&grant_type=authorization_code"; Encoding encoding = Encoding.UTF8; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL); request.Timeout = 3000; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); using (StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8)) { string jmpay = reader.ReadToEnd(); //解析json对象 JavaScriptSerializer serializer = new JavaScriptSerializer(); Dictionary <string, object> json = (Dictionary <string, object>)serializer.DeserializeObject(jmpay); object value = null; json.TryGetValue("openid", out value); openid = value.ToString(); } string str = ""; ClientResponseHandler resHandler = new ClientResponseHandler(); PayHttpClient pay = new PayHttpClient(); RequestHandler reqHandler = new RequestHandler(null); Dictionary <string, string> cfg = Utils.Load_CfgInterfaceId(morder.o_interface_id); reqHandler.setGateUrl(cfg["req_url"].ToString()); reqHandler.setKey(cfg["key"].ToString()); reqHandler.setParameter("out_trade_no", morder.o_code); //我们的订单号 reqHandler.setParameter("body", morder.o_goodsname); //商品描述 // reqHandler.setParameter("attach", string.IsNullOrEmpty(morder.o_privateinfo) ? "404" : morder.o_privateinfo);//附加信息 reqHandler.setParameter("total_fee", (Convert.ToInt32(morder.o_price * 100)).ToString()); //价格 reqHandler.setParameter("mch_create_ip", HttpContext.Current.Request.UserHostAddress); //终端IP reqHandler.setParameter("service", "pay.weixin.jspay"); reqHandler.setParameter("mch_id", cfg["mch_id"].ToString()); reqHandler.setParameter("version", cfg["version"].ToString()); reqHandler.setParameter("notify_url", ConfigurationManager.AppSettings["notifyurl"].ToString().Replace("{0}", morder.o_interface_id.ToString())); //回掉地址 reqHandler.setParameter("callback_url", ConfigurationManager.AppSettings["callbackurl"].ToString().Replace("{0}", oid.ToString())); //同步回掉地址 reqHandler.setParameter("sub_openid", openid); //获取openid reqHandler.setParameter("nonce_str", Utils.random()); //随机字符串 reqHandler.setParameter("charset", "UTF-8"); reqHandler.setParameter("sign_type", "MD5"); reqHandler.setParameter("is_raw", "1");//原生JS #region 判断是否需要禁用信用卡 //JMP.MDL.jmp_app moapp = new JMP.MDL.jmp_app(); //int tid = 0; //string hc = "gzhpdxykjy" + morder.o_app_id; //if (JMP.TOOL.CacheHelper.IsCache(hc))//判读是否存在缓存 //{ // moapp = JMP.TOOL.CacheHelper.GetCaChe<JMP.MDL.jmp_app>(hc);//获取缓存 // if (moapp != null) // { // tid = moapp.a_apptype_id > 0 ? moapp.a_apptype_id : 0; // if (tid == 0) // { // JMP.BLL.jmp_app blapp = new JMP.BLL.jmp_app(); // moapp = blapp.SelectId(morder.o_app_id); // JMP.TOOL.CacheHelper.CacheObjectLocak<JMP.MDL.jmp_app>(moapp, hc, 5);//存入缓存 // } // } // else // { // JMP.BLL.jmp_app blapp = new JMP.BLL.jmp_app(); // moapp = blapp.SelectId(morder.o_app_id); // tid = moapp.a_apptype_id > 0 ? moapp.a_apptype_id : 0; // JMP.TOOL.CacheHelper.CacheObjectLocak<JMP.MDL.jmp_app>(moapp, hc, 5);//存入缓存 // } //} //else //{ // JMP.BLL.jmp_app blapp = new JMP.BLL.jmp_app(); // moapp = blapp.SelectId(morder.o_app_id); // tid = moapp.a_apptype_id > 0 ? moapp.a_apptype_id : 0; // JMP.TOOL.CacheHelper.CacheObjectLocak<JMP.MDL.jmp_app>(moapp, hc, 5);//存入缓存 //} //if (tid == 71) //{ // reqHandler.setParameter("limit_credit_pay", "1");//是否限制信用卡(1:限制,0:不限制) //} #endregion reqHandler.createSign(); string datawft = Utils.toXml(reqHandler.getAllParameters()); Dictionary <string, string> reqContent = new Dictionary <string, string>(); reqContent.Add("url", reqHandler.getGateUrl()); reqContent.Add("data", datawft); pay.setReqContent(reqContent); if (pay.call()) { resHandler.setContent(pay.getResContent()); resHandler.setKey(cfg["key"].ToString()); Hashtable param = resHandler.getAllParameters(); Dictionary <string, string> dic = JMP.TOOL.UrlStr.hastable(param); string wftmsg = JMP.TOOL.JsonHelper.DictJsonstr(dic); if (resHandler.isTenpaySign()) { if (int.Parse(param["status"].ToString()) == 0 && int.Parse(param["result_code"].ToString()) == 0) { string pay_info = dic["pay_info"]; if (!string.IsNullOrEmpty(pay_info)) { Dictionary <string, object> List = new Dictionary <string, object>(); List = JMP.TOOL.JsonHelper.DataRowFromJSON(pay_info); try { string chengstr = "<script type=\"text/javascript\">function onBridgeReady(){WeixinJSBridge.invoke( 'getBrandWCPayRequest', {\"appId\": \"" + List["appId"] + "\", \"timeStamp\": \"" + List["timeStamp"] + "\", \"nonceStr\": \"" + List["nonceStr"] + "\",\"package\":\"" + List["package"] + "\",\"signType\": \"MD5\",\"paySign\": \"" + List["paySign"] + "\" },function(res) {if (res.err_msg ==\"get_brand_wcpay_request:ok\") { window.location.href=\"" + List["callback_url"] + "\" }else{ alert(res.err_msg) } });}if (typeof WeixinJSBridge == \"undefined\"){if (document.addEventListener){document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);}else if (document.attachEvent){document.attachEvent('WeixinJSBridgeReady', onBridgeReady); document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);} }else{onBridgeReady();}</script> "; Response.Write(chengstr); } catch { string wftzfsbxin = "威富通公众号支付失败信息,错误信息:" + wftmsg; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid + ":" + wftzfsbxin, summary: "威富通公众号接口错误信息2", channelId: oid); str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}"; } } else { string wftzfsbxin = "威富通公众号支付失败信息,错误信息:" + wftmsg; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid + ":" + wftzfsbxin, summary: "威富通公众号接口错误信息4", channelId: oid); str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}"; } } else { string wftzfsbxin = "威富通公众号支付失败信息,错误信息:" + wftmsg; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid + ":" + wftzfsbxin, summary: "威富公众号通接口错误信息3", channelId: oid); str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}"; } } else { str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}"; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid, summary: "威富公众号通接口错误信息4", channelId: oid); } } else { str = "{\"Message\":\"支付通道异常\",\"ErrorCode\":104}"; PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息openid:" + openid, summary: "威富公众号通接口错误信息5", channelId: oid); } Response.Write(str); } else { JMP.MDL.jmp_app mo = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app blls = new JMP.BLL.jmp_app(); mo = JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_app>(blls.GetList(" a_id=(SELECT o_app_id FROM jmp_order WHERE o_id=" + oid + ") ").Tables[0]); if (mo != null) { Dictionary <string, string> cfg = Utils.loadCfgWxgzh(mo.a_rid, mo.a_id); JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); if (bll.UpdatePay(oid, int.Parse(cfg["pay_id"].ToString()))) { string ddjj = Get_paystr(cfg["pay_id"].ToString()); appid = ddjj.ToString().Split(',')[2]; appms = ddjj.ToString().Split(',')[3]; string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + ConfigurationManager.AppSettings["redirecturi"].ToString() + oid + ".html&response_type=code&scope=snsapi_base#wechat_redirect"; Response.Redirect(url, false); } } else { string str = "{\"Message\":\"支付接口异常\",\"ErrorCode\":102}"; Response.Write(str); } } } catch (Exception ex) { PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + ex.ToString() + "订单表id:" + oid, summary: "威富公众号通接口错误信息", channelId: oid); Response.Write("非法访问!"); } } else { PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:第一步判断,订单表id:" + oid, summary: "威富公众号通接口错误信息", channelId: oid); Response.Write("非法访问!"); } }
/// <summary> /// 初始化接口 /// </summary> /// <param name="encryption"></param> /// <returns></returns> public string InfoInterface(ModelZd zd, string encryption, string ip) { object json = ""; // ModelZd zd = new ModelZd(); JMP.MDL.jmp_terminal model = new JMP.MDL.jmp_terminal(); //终端属性实体类型 JMP.MDL.jmp_liveteral mo = new JMP.MDL.jmp_liveteral(); //活跃实体类型 JMP.BLL.jmp_terminal zdbll = new JMP.BLL.jmp_terminal(); //终端属性业务逻辑层 JMP.BLL.jmp_liveteral hybll = new JMP.BLL.jmp_liveteral(); //活跃业务逻辑层 // zd = JMP.TOOL.JsonHelper.Deserializes<ModelZd>(encryption); #region 处理初始化数据 if (zd != null) { #region 判断参数 model.t_key = zd.t_key; JMP.BLL.jmp_app appbll = new JMP.BLL.jmp_app(); //应用业务逻辑层 DataTable dt = new DataTable(); if (JMP.TOOL.CacheHelper.IsCache(zd.t_appkey)) //判读是否存在缓存 { dt = JMP.TOOL.CacheHelper.GetCaChe <DataTable>(zd.t_appkey); //获取缓存 model.t_appid = string.IsNullOrEmpty(dt.Rows[0]["a_id"].ToString()) ? 0 : Int32.Parse(dt.Rows[0]["a_id"].ToString()); model.t_appkey = zd.t_appkey; } else { dt = appbll.GetListjK(zd.t_appkey).Tables[0]; if (dt.Rows.Count > 0) { model.t_appkey = zd.t_appkey; model.t_appid = string.IsNullOrEmpty(dt.Rows[0]["a_id"].ToString()) ? 0 : Int32.Parse(dt.Rows[0]["a_id"].ToString()); JMP.TOOL.CacheHelper.CacheObjectLocak <DataTable>(dt, zd.t_appkey, 5);//存入缓存 } else { return((json = "{\"message\":\"应用无效\",\"result\":9995}").ToString()); } } model.t_mark = zd.t_mark; model.t_network = zd.t_network; //model.t_ip = HttpContext.Current.Request.UserHostAddress; model.t_ip = string.IsNullOrEmpty(ip) ? "" : ip; //string IP = IPAddress.GetAddressByIp(model.t_ip.Split(':')[0].ToString()); string ipstr = ConfigurationManager.AppSettings["ipkstr"].ToString();//获取ip库文件地址 model.t_province = JMP.TOOL.IpProvince.IpAddress(model.t_ip, ipstr); //model.t_province = ""; model.t_imsi = zd.t_imsi; if (model.t_imsi == "404") { model.t_nettype = "其他"; } else { if (model.t_imsi.Length >= 5) { string wlxx = model.t_imsi.Substring(0, 5); if (wlxx == "46000" || wlxx == "46002" || wlxx == "46007" || wlxx == "46020") { model.t_nettype = "移动"; } else if (wlxx == "46003" || wlxx == "46005" || wlxx == "46011") { model.t_nettype = "电信"; } else if (wlxx == "46001" || wlxx == "46006" || wlxx == "46010") { model.t_nettype = "联通"; } else { model.t_nettype = "其他"; } } else { model.t_nettype = "其他"; } } model.t_brand = zd.t_brand; model.t_system = zd.t_system; model.t_hardware = zd.t_hardware; model.t_screen = zd.t_screen; model.t_sdkver = zd.t_sdkver; #endregion int cg = 0; if (zd.t_isnew == 1) { #region 活跃用户 mo.l_teral_key = model.t_key; mo.l_time = DateTime.Now; mo.l_appkey = model.t_appkey; mo.l_appid = model.t_appid; cg = hybll.Add(mo); #endregion } else { #region 新增用户 model.t_time = DateTime.Now; cg = zdbll.Add(model); #endregion } if (cg > 0) { json = "{\"message\":\"成功\",\"result\":100}"; } else { json = "{\"message\":\"失败\",\"error\":101}"; AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "接口错误信息", "报错信息:终端属性添加失败");//写入报错日志 } } else { json = "{\"message\":\"json解析出错\",\"error\":9999}"; AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "接口错误信息", "报错信息:终端属性参数为传入");//写入报错日志 } return(json.ToString()); #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int oid = !string.IsNullOrEmpty(Request["pid"]) ? Convert.ToInt32(Request["pid"].ToString()) : 0; //订单表ID if (oid > 0) { //获取缓存 try { string code = !string.IsNullOrEmpty(Request["code"]) ? Request["code"] : ""; if (!string.IsNullOrEmpty(code)) { string url = ""; System.Threading.Thread.Sleep(new Random().Next(100, 500)); if (JMP.TOOL.CacheHelper.IsCache(oid.ToString()) == false) { url = "/pfwxgzhorder" + oid + ".html?code=" + code; JMP.TOOL.CacheHelper.CacheObject(url, oid.ToString(), 1);//存入缓存 } else { url = JMP.TOOL.CacheHelper.GetCaChe <string>(oid.ToString()); } Response.Redirect(url, false); } else { string appid = ""; JMP.MDL.jmp_app mo = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app blls = new JMP.BLL.jmp_app(); mo = JMP.TOOL.MdlList.ToModel <JMP.MDL.jmp_app>(blls.GetList(" a_id=(SELECT o_app_id FROM jmp_order WHERE o_id=" + oid + ") ").Tables[0]); int pay_id = SelectUserInfo(mo.a_rid, mo.a_id); JMP.BLL.jmp_order bll = new JMP.BLL.jmp_order(); if (pay_id > 0) { if (bll.UpdatePay(oid, pay_id)) { string ddjj = Get_paystr(pay_id.ToString()); appid = ddjj.ToString().Split(',')[2]; string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + appid + "&redirect_uri=" + ConfigurationManager.AppSettings["redirecturipf"].ToString() + oid + ".html&response_type=code&scope=snsapi_base&state=1#wechat_redirect"; Response.Redirect(url, false); } } else { Response.Write("非法访问!"); } } } catch (Exception ex) { PayApiDetailErrorLogger.UpstreamPaymentErrorLog("报错信息:" + ex.Message, summary: "浦发银行公众号支付接口错误信息", channelId: oid); Response.Write("非法访问!"); } } else { Response.Write("非法访问!"); } } }
public ActionResult AppListTc() { int pageCount = 0; int pageIndexs = string.IsNullOrEmpty(Request["pageIndexs"]) ? 1 : Int32.Parse(Request["pageIndexs"]); //当前页 int PageSize = string.IsNullOrEmpty(Request["PageSize"]) ? 20 : Int32.Parse(Request["PageSize"]); //每页显示数量 int type = string.IsNullOrEmpty(Request["type"]) ? 0 : Int32.Parse(Request["type"]); //查询条件选择 string sea_name = string.IsNullOrEmpty(Request["sea_name"]) ? "" : Request["sea_name"]; //查询条件内容 int platformid = string.IsNullOrEmpty(Request["platformid"]) ? 0 : Int32.Parse(Request["platformid"]); //关联平台 string appstr = string.IsNullOrEmpty(Request["appstr"]) ? "" : Request["appstr"]; //已选择的应用id int cid = string.IsNullOrEmpty(Request["cid"]) ? 0 : Int32.Parse(Request["cid"]); //通道池ID ViewBag.appstr = appstr; ViewBag.cid = cid; List <JMP.MDL.jmp_app> list = new List <JMP.MDL.jmp_app>(); JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); List <JMP.MDL.jmp_app> listapp = new List <JMP.MDL.jmp_app>(); string xzsql = " select a.a_id,a.a_name,b.u_realname,b.u_id,a.a_user_id,a.a_auditstate,a.a_state,a.a_platform_id from jmp_app a left join jmp_user b on a.a_user_id=b.u_id where a.a_state=1 and a.a_auditstate=1 and b.u_auditstate=1 and a_id in(" + appstr + ") "; DataTable dt = !string.IsNullOrEmpty(appstr) ? bll.selectsql(xzsql) : new DataTable(); listapp = dt.Rows.Count > 0 ? JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_app>(dt) : new List <JMP.MDL.jmp_app>(); ViewBag.listapp = listapp; //string sql = " select a.a_id,a.a_name,b.u_realname,b.u_id,a.a_user_id,a.a_auditstate,a.a_state,a.a_platform_id from jmp_app a left join jmp_user b on a.a_user_id=b.u_id where a.a_state=1 and a.a_auditstate=1 and b.u_auditstate=1 "; string sql = "select * from (select a.a_id,a.a_name,b.u_realname,b.u_id,a.a_user_id,a.a_auditstate,a.a_state,a.a_platform_id from jmp_app a left join jmp_user b on a.a_user_id = b.u_id where a.a_state = 1 and a.a_auditstate = 1 and b.u_auditstate = 1 ) as a left join (select b.AppId from jmp_channel_pool a join jmp_channel_app_mapping b on a.Id = b.ChannelId and a.IsEnabled = 1 and a.Id!=" + cid + ") as b on a.a_id = b.AppId where b.AppId is null"; if (type > 0 && !string.IsNullOrEmpty(sea_name)) { switch (type) { case 1: sql += " and a.a_id=" + sea_name; //应用编号 break; case 2: sql += " and a.a_name like '%" + sea_name + "%' "; //应用名称 break; case 3: sql += " and b.u_realname like '%" + sea_name + "%' "; //用户名称 break; } } if (platformid > 0) { sql += " and a.a_platform_id=" + platformid; } if (!string.IsNullOrEmpty(appstr)) { sql += " and a_id not in(" + appstr + ") "; } string order = " order by a_state "; list = bll.SelectTClist(sql, order, pageIndexs, PageSize, out pageCount); ViewBag.type = type; ViewBag.sea_name = sea_name; ViewBag.pageIndexs = pageIndexs; ViewBag.PageSize = PageSize; ViewBag.pageCount = pageCount; ViewBag.list = list; ViewBag.platformid = platformid; return(View()); }
public ActionResult UpdateApp() { int appid = string.IsNullOrEmpty(Request["appid"]) ? 0 : Int32.Parse(Request["appid"]); JMP.BLL.jmp_app appbll = new JMP.BLL.jmp_app(); JMP.MDL.jmp_app model = new JMP.MDL.jmp_app(); string yy = ""; if (appid > 0) { model = appbll.SelectId(appid); #region =========获取应用平台在用信息========= JMP.BLL.jmp_platform bll = new JMP.BLL.jmp_platform(); DataTable dt = bll.GetList(" 1=1 and p_state='1' ").Tables[0];//获取应用平台在用信息 List <JMP.MDL.jmp_platform> yypt = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_platform>(dt); ViewBag.glptdt = yypt; #endregion #region ========获取应用类型在用信息====== JMP.BLL.jmp_apptype yybll = new JMP.BLL.jmp_apptype(); string where = " t_id in (select DISTINCT(t_topid) from jmp_apptype where t_topid in( select t_id from jmp_apptype where t_topid='0' )) and t_state='1' order by t_sort desc"; DataTable yydt = yybll.GetList(where).Tables[0];//获取应用类型在用信息 JMP.MDL.jmp_apptype models = new JMP.MDL.jmp_apptype(); int t_topid = 0; if (model.a_apptype_id > 0) { models = yybll.GetModel(model.a_apptype_id);//查询单条信息 t_topid = models.t_topid; } string yyid = ""; if (model.a_auditstate == 1) { yy += "<select id='xzyylx' disabled ='disabled' > "; } else { yy += "<select id='xzyylx' onclick='xzyylx()'> "; } for (int j = 0; j < yydt.Rows.Count; j++) { yyid = yydt.Rows[j]["t_id"].ToString(); if (t_topid > 0) { if (Int32.Parse(yydt.Rows[j]["t_id"].ToString()) == models.t_topid) { yy += "<option value='" + yyid + "' selected=selected >" + yydt.Rows[j]["t_name"] + "</option>"; } else { yy += "<option value='" + yyid + "' >" + yydt.Rows[j]["t_name"] + "</option>"; } } else { yy += "<option value='" + yyid + "' >" + yydt.Rows[j]["t_name"] + "</option>"; } } yy += "</select>"; #endregion } int userid = UserInfo.UserId; var userlist = _UserService.FindListBySql("relation_type='" + (int)Relationtype.Agent + "' and relation_person_id='" + userid + "' and u_state=1", ""); ViewBag.userlist = userlist; #region 获取所有支付方式 JMP.BLL.jmp_paymode zfbll = new JMP.BLL.jmp_paymode(); DataTable zfdt = new DataTable(); List <JMP.MDL.jmp_paymode> zflist = new List <JMP.MDL.jmp_paymode>(); zfdt = zfbll.GetList(" 1=1 and p_state='1' ").Tables[0];//获取支付类型在用信息 zflist = JMP.TOOL.MdlList.ToList <JMP.MDL.jmp_paymode>(zfdt); ViewBag.appid = appid; ViewBag.list = zflist; #endregion ViewBag.yy = yy; ViewBag.model = model; //支付方式 string[] zffs = model.a_paymode_id.Split(','); ViewBag.zffs = zffs; return(View()); }
public JsonResult InsertUpdateApp(JMP.MDL.jmp_app mod) { object retJson = new { success = 0, msg = "操作失败" }; JMP.BLL.jmp_app bll = new JMP.BLL.jmp_app(); if (mod.a_apptype_id == 0) { retJson = new { success = 0, msg = "请选择应用类型" }; } else { if (mod.a_id > 0) { #region 修改应用 string rzsm = ""; JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app(); modapp = bll.GetModel(mod.a_id); var modcolne = modapp.Clone(); modapp.a_name = mod.a_name; //应用名称 modapp.a_platform_id = mod.a_platform_id; //关联平台ID modapp.a_paymode_id = mod.a_paymode_id; //关联支付类型ID modapp.a_apptype_id = mod.a_apptype_id; //关联应用类型ID modapp.a_notifyurl = mod.a_notifyurl; //回掉地址 modapp.a_user_id = mod.a_user_id; //开发者ID modapp.a_showurl = mod.a_showurl; //同步地址 modapp.a_appurl = mod.a_appurl; //应用审核地址 modapp.a_appsynopsis = mod.a_appsynopsis; //应用简介 if (bll.Update(modapp)) { Logger.ModifyLog("修改应用", modcolne, mod); retJson = new { success = mod.a_id, msg = "修改成功" }; } else { retJson = new { success = 0, msg = "修改失败" }; } #endregion } else { #region 添加应用 mod.a_rid = 0; mod.a_auditor = ""; mod.a_state = 1; mod.a_auditstate = 0; mod.a_key = ""; mod.a_secretkey = ""; mod.a_time = DateTime.Now; int cg = _AppService.Insert(mod); // int cg = bll.Add(mod); if (cg > 0) { // Logger.CreateLog("新增应用",mod); mod.a_key = DESEncrypt.Encrypt(mod.a_user_id + ";" + cg + ";" + DateTime.Now.ToString("yyyyMMddssmmfff")); mod.a_secretkey = DESEncrypt.Encrypt(cg + ";" + mod.a_key + ";" + DateTime.Now.ToString("yyyyMMddssmmfff")); mod.a_id = cg; if (bll.Update(mod)) { Logger.CreateLog("新增应用", mod); retJson = new { success = 1, msg = "添加成功" }; } else { retJson = new { success = 0, msg = "添加失败" }; } } else { retJson = new { success = 0, msg = "添加失败" }; } #endregion } } return(Json(retJson)); }
public override void ProcessNotify(int tid) { WxPayData notifyData = GetNotifyData(tid); //检查支付结果中transaction_id是否存在 if (!notifyData.IsSet("transaction_id")) { //若transaction_id不存在,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中微信订单号不存在"); page.Response.Write(res.ToXml()); page.Response.End(); } string transaction_id = notifyData.GetValue("transaction_id").ToString(); //查询订单,判断订单真实性 string ordertime = notifyData.GetValue("time_end").ToString(); if (ordertime == "null") { //若订单查询失败,则立即返回结果给微信支付后台 WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "订单查询失败"); page.Response.Write(res.ToXml()); page.Response.End(); } //查询订单成功 else { //商户订单号 string out_trade_no = notifyData.GetValue("out_trade_no").ToString(); //交易号 string trade_no = notifyData.GetValue("transaction_id").ToString(); //交易状态 string trade_status = notifyData.GetValue("result_code").ToString(); //买家账号 string buyer_email = notifyData.GetValue("transaction_id").ToString(); //买家付款时间 string gmt_payment = ordertime; //交易金额(单位:分转换成元) decimal o_price = decimal.Parse((decimal.Parse(notifyData.GetValue("total_fee").ToString()) / 100).ToString("f2")); if (trade_status == "SUCCESS") { try { JMP.BLL.jmp_order order = new JMP.BLL.jmp_order(); JMP.MDL.jmp_order morder = new JMP.MDL.jmp_order(); string TableName = "jmp_order"; string orderTableName = JMP.TOOL.WeekDateTime.GetOrderTableName(DateTime.ParseExact(gmt_payment, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture).ToString("yyyy-MM-dd"));//获取订单表名 morder = order.GetModelbycode(out_trade_no, TableName); if (morder != null) { if (morder.o_price == o_price) { int payid = !string.IsNullOrEmpty(morder.o_paymode_id) ? Int32.Parse(morder.o_paymode_id) : 0; if (JMP.TOOL.OrderProportion.ddbl(morder.o_app_id, o_price, payid)) { WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } else { if (morder.o_state != 1) { morder.o_tradeno = trade_no; morder.o_ptime = DateTime.ParseExact(gmt_payment, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture); morder.o_payuser = buyer_email; morder.o_state = 1; morder.o_noticestate = 0; morder.o_price = o_price; order.Update(morder, TableName); JMP.MDL.jmp_app app = new JMP.MDL.jmp_app(); JMP.BLL.jmp_app appbll = new JMP.BLL.jmp_app(); app = appbll.SelectId(morder.o_app_id); if (app != null) { JMP.MDL.jmp_queuelist quli = new JMP.MDL.jmp_queuelist(); JMP.BLL.jmp_queuelist bllq = new JMP.BLL.jmp_queuelist(); quli.q_address = morder.o_address; quli.q_sign = new JMP.BLL.jmp_app().GetModel(morder.o_app_id).a_secretkey; quli.q_noticestate = 0; quli.q_times = 0; quli.q_noticetimes = DateTime.Now; quli.q_tablename = orderTableName; quli.q_o_id = morder.o_id; quli.trade_type = Int32.Parse(morder.o_paymode_id); quli.trade_time = morder.o_ptime; quli.trade_price = morder.o_price; quli.trade_paycode = morder.o_tradeno; quli.trade_code = morder.o_code; quli.trade_no = morder.o_bizcode; quli.q_privateinfo = morder.o_privateinfo; quli.q_uersid = app.u_id; int cg = bllq.Add(quli); if (cg > 0) { WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "微信官网通知错误", "订单号:" + morder.o_code + "添加到通知队列失败");//写入报错日志 PayApiGlobalErrorLogger.Log("订单号:" + morder.o_code + "添加到通知队列失败", summary: "微信官网通知错误"); WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "微信官网通知错误", "应用id:" + morder.o_app_id + ",获取用户id失败!");//写入报错日志 PayApiGlobalErrorLogger.Log("应用id:" + morder.o_app_id + ",获取用户id失败!", summary: "微信官网通知错误"); WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } else { //AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "微信官网通知接口错误", "订单号:" + out_trade_no + ",未查询到相关信息!");//写入报错日志 PayApiGlobalErrorLogger.Log("订单号:" + out_trade_no + ",未查询到相关信息!", summary: "微信官网通知接口错误"); WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } } } else { if (JMP.TOOL.UpdateOrder.OrderState.UpdateOrderState(morder.o_code, TableName)) { string ddsm = "订单号:" + morder.o_code + ",支付信息异常请核实!";//短信说明 JMP.TOOL.Auditor.IAuditor audit = new JMP.TOOL.Auditor.OrderAbnormalAuditor(morder.o_code, orderTableName, morder.o_app_id, ddsm, trade_no, DateTime.ParseExact(gmt_payment, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture), o_price, "成功", morder.o_price); audit.Add(); WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); page.Response.Write(res.ToXml()); page.Response.End(); } else { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } } else { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } catch { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "FAIL"); page.Response.Write(res.ToXml()); page.Response.End(); } } } }