Пример #1
0
        /// <summary>
        /// 收银台调起支付入口
        /// </summary>
        /// <param name="json"></param>
        /// <returns></returns>
        public static string PayBankType(string json)
        {
            string StrJson = "{\"message\":\"失败\",\"result\":101}";

            try
            {
                OrderCode od = new OrderCode();
                od = JMP.TOOL.JsonHelper.Deserialize <OrderCode>(json);
                if (od != null)
                {
                    StrJson = Parameter(od, json);
                    if (StrJson == "ok")
                    {
                        StrJson = SelectCode(od, json);
                    }
                }
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString(); //报错信息
                StrJson = "{\"message\":\"参数异常\",\"result\":8990}";
                AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "收银台接口主入口错误信息", "报错信息:" + bcxx + ",支付接口请求数据" + json);                    //写入报错日志
                throw;
            }

            return(StrJson);
        }
Пример #2
0
        /// <summary>
        /// 根据监控器接口实现检测通道状态
        /// </summary>
        /// <param name="payChannelMonitor">通道监控器接口实现</param>
        /// <returns></returns>
        private bool CheckPayChannel(IPayChannelMonitor payChannelMonitor)
        {
            //检测2次
            var  maxRetries = 2;
            bool success;

            do
            {
                try
                {
                    if (payChannelMonitor.AllowAutoCheck == true && payChannelMonitor is ZhiFuBaoPayChannelMonitor)
                    {
                        success = payChannelMonitor.checkorder();
                    }
                    else
                    {
                        success = payChannelMonitor.Check();
                    }
                    if (success)
                    {
                        break;
                    }
                    maxRetries--;
                    Thread.Sleep(500);
                }
                catch (Exception ex)
                {
                    success = false;
                    AddLocLog.AddLog(1, 4, Request.UserHostAddress, "通道状态检测", ex.ToString());
                    break;
                }
            } while (maxRetries > 0);
            return(success);
        }
Пример #3
0
        /// <summary>
        /// 判断参数是否合法
        /// </summary>
        /// <param name="od"></param>
        /// <returns></returns>
        public static string Parameter(OrderCode od, string json)
        {
            string str = "ok";

            try
            {
                if (string.IsNullOrEmpty(od.sign))
                {
                    str = "{\"message\":\"参数sign有误\",\"result\":8999}";
                }
                //规则=JMP.TOOL.Encrypt.IndexEncrypt(mod.o_code+","+mod.o_price+","+tid);
                string   jmcode = JMP.TOOL.Encrypt.IndexDecrypt(od.sign);
                string[] jmstr  = jmcode.Split(',');
                bool     pdsj   = DateTime.ParseExact(jmstr[0].Substring(0, 14), "yyyyMMddHHmmss", CultureInfo.InvariantCulture) > DateTime.Parse(DateTime.Now.AddMinutes(-5).ToString("yyyy-MM-dd HH:mm:ss")) ? true : false;//判断是否在规定时间范围内

                if (!pdsj || jmstr[0] != od.code)
                {
                    return(str = "{\"message\":\"签名验证有误\",\"result\":8998}");
                }
                if (string.IsNullOrEmpty(od.code) || od.code.Length > 32)
                {
                    return(str = "{\"message\":\"参数code有误\",\"result\":8997}");
                }
                if (od.price <= 0 || decimal.Parse(jmstr[1]) != od.price)
                {
                    return(str = "{\"message\":\"参数price有误\",\"result\":8996}");
                }
                if (od.paymode > 7)
                {
                    return(str = "{\"message\":\"参数paymode有误\",\"result\":8995}");
                }
                if (string.IsNullOrEmpty(od.goodsname) || od.goodsname.Length > 32)
                {
                    return(str = "{\"message\":\"参数goodsname有误\",\"result\":8993}");
                }
                if (od.tid <= 0 || int.Parse(jmstr[2]) != od.tid)
                {
                    return(str = "{\"message\":\"参数tid有误\",\"result\":8992}");
                }
                if (od.paytype < 1 || od.paytype > 3)
                {
                    return(str = "{\"message\":\"参数paytype有误\",\"result\":8991}");
                }
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString(); //报错信息
                str = "{\"message\":\"参数异常\",\"result\":8990}";
                AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "收银台接口判断参数错误信息", "报错信息:" + bcxx + ",支付接口请求数据" + json);                   //写入报错日志
                throw;
            }
            return(str);
        }
Пример #4
0
        public void Write(List <string> lines)
        {
            var logs = lines.Where(x => x.Length > 0).Select(x => new JMP.MDL.jmp_userlog
            {
                l_info       = x,
                l_ip         = "订单通知程序",
                l_location   = "",
                l_logtype_id = 5,
                l_sms        = "订单通知程序",
                l_user_id    = 1,
                l_time       = DateTime.Now
            }).ToList();

            AddLocLog.AddUserLogBulk(logs);
        }
Пример #5
0
        private object DoLogin(string userName, string userPwd)
        {
            object result;
            var    bllLimit = new jmp_limit();
            var    bll      = new jmp_locuser();
            var    model    = bll.GetModel(userName);
            //加密用户登录密码
            var jmPwd = DESEncrypt.Encrypt(userPwd).ToLower();

            if (model != null)
            {
                if (model.u_loginname == userName && model.u_pwd.ToLower() == jmPwd)
                {
                    UserInfo.UserId      = model.u_id;
                    UserInfo.UserName    = model.u_realname;
                    UserInfo.UserNo      = model.u_loginname;
                    UserInfo.UserRoleId  = model.u_role_id;
                    UserInfo.UserDept    = model.u_department;
                    UserInfo.UserPostion = model.u_position;
                    var dtLimit = bllLimit.GetUserLimitSession(model.u_id, model.u_role_id);
                    if (dtLimit.Rows.Count > 0)
                    {
                        Session["dtSession"] = dtLimit;
                        model.u_count       += 1;
                        bll.Update(model);
                        var log = string.Format("用户({0})于{1}登录后台系统。", UserInfo.UserName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        AddLocLog.AddLog(UserInfo.UserId, 2, RequestHelper.GetClientIp(), "用户" + UserInfo.UserName + "登录。", log);
                        result = new { mag = "登录成功!", status = "1" };
                    }
                    else
                    {
                        result = new { mag = "权限不足!", status = "4" };
                    }
                }
                else
                {
                    result = new { mag = "用户名或密码错误!", status = "2" }
                };
            }
            else
            {
                result = new { mag = "用户名或密码错误!", status = "2" }
            };
            return(result);
        }
Пример #6
0
 public bool Add()
 {
     if (_appRequestAudit == null)
     {
         return(false);
     }
     try
     {
         var bll = new JMP.BLL.jmp_app_request_audit();
         bll.Add(_appRequestAudit);
         return(true);
     }
     catch (Exception ex)
     {
         AddLocLog.AddLog(0, 3, "", "添加应用异常请求监控器时出错", ex.ToString());
         return(false);
     }
 }
Пример #7
0
 public bool Add()
 {
     try
     {
         if (_orderAuditor == null)
         {
             return(false);
         }
         var bll = new JMP.BLL.jmp_order_audit();
         bll.Add(_orderAuditor);
         return(true);
     }
     catch (Exception ex)
     {
         AddLocLog.AddLog(1, 3, "", "添加应用异常请求监控器时出错", ex.ToString());
         return(false);
     }
 }
Пример #8
0
        /// <summary>
        /// 发送通知短信
        /// </summary>
        /// <param name="channel"></param>
        private void SendMessage(jmp_interface channel)
        {
            //TODO:发送短信提示
            var request = new ChuangLanRequest
            {
                Mobile  = ConfigReader.GetSettingValueByKey("CHUANGLAN.MOBILE.MONITOR"),
                Content = string.Format(ConfigReader.GetSettingValueByKey("CHUANGLAN.CONTENT.MONITOR"), channel.l_corporatename, channel.l_id)
            };

            try
            {
                IMessageSender messageSender = new ChuangLanMessageSender(request);
                messageSender.Send();
            }
            catch (Exception ex)
            {
                AddLocLog.AddLog(1, 4, Request.UserHostAddress, "通道状态检测", ex.ToString());
            }
        }
Пример #9
0
        public JsonResult InsertOrUpdate(JMP.MDL.jmp_appsdk mo)
        {
            object retJson = new { success = 0, msg = "操作失败" };

            if (mo.appid > 0)
            {
                JMP.BLL.jmp_appsdk bll = new JMP.BLL.jmp_appsdk();

                DataTable dt = bll.GetList(" appid='" + mo.appid + "' ").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    mo.id      = Int32.Parse(dt.Rows[0]["id"].ToString());
                    mo.uptimes = DateTime.Now;
                    if (bll.Update(mo))
                    {
                        retJson = new { success = 1, msg = "上传成功!" };
                        AddLocLog.AddUserLog(UserInfo.UserId, 3, Request.UserHostAddress, "修改上传应用asdk", "文件名:" + mo.appurl + ",应用id编号:" + mo.appid);
                    }
                    else
                    {
                        retJson = new { success = 0, msg = "上传失败!" };
                    }
                }
                else
                {
                    mo.uptimes = DateTime.Now;
                    int cg = bll.Add(mo);
                    if (cg > 0)
                    {
                        retJson = new { success = 1, msg = "上传成功!" };
                        AddLocLog.AddUserLog(UserInfo.UserId, 3, Request.UserHostAddress, "上传应用asdk", "文件名:" + mo.appurl + ",应用id编号:" + mo.appid);
                    }
                    else
                    {
                        retJson = new { success = 0, msg = "上传失败!" };
                    }
                }
            }
            return(Json(retJson));
        }
Пример #10
0
        /// <summary>
        /// 根据订单编号查询订单信息并调取支付当时
        /// </summary>
        /// <param name="od">参数实体</param>
        /// <returns></returns>
        public static string SelectCode(OrderCode od, string json)
        {
            string StrJson = "{\"message\":\"参数code有误\",\"result\":8997}";

            try
            {
                JMP.MDL.jmp_order mode = new JMP.MDL.jmp_order();
                JMP.BLL.jmp_order bll  = new JMP.BLL.jmp_order();
                mode = bll.GetModelbycode(od.code, "jmp_order");
                if (mode != null && mode.o_state == 0)
                {
                    if (mode.o_price == od.price)
                    {
                        if (bll.UpdatePayMode(mode.o_id, od.paymode))
                        {
                            StrJson = PayType.PaySelect(od.paymode.ToString(), mode.o_app_id, od.tid, od.paytype, mode.o_code, od.goodsname, mode.o_price, mode.o_id, mode.o_privateinfo);//直接调取支付方式
                        }
                    }
                    else
                    {
                        StrJson = "{\"message\":\"请求金额不一致\",\"result\":8994}";
                    }
                }
                else
                {
                    StrJson = "{\"message\":\"参数code有误\",\"result\":8997}";
                }
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString() + "报错位置:" + e.StackTrace.ToString(); //报错信息
                StrJson = "{\"message\":\"参数异常\",\"result\":8990}";
                AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "收银台调取支付接口错误信息", "报错信息:" + bcxx + ",支付接口请求数据" + json);                   //写入报错日志
                throw;
            }

            return(StrJson);
        }
Пример #11
0
 public void Write(string summary, string content)
 {
     AddLocLog.AddLog(1, 5, "", summary, content);
 }
Пример #12
0
 public void Write(string content)
 {
     AddLocLog.AddLog(1, 5, "", "订单通知程序", content);
 }
Пример #13
0
        /// <summary>
        /// 根据订单查询判断是否符合查询条件
        /// </summary>
        /// <param name="jmcode">订单好</param>
        /// <returns></returns>
        public static string QuerySelect(string jmcode)
        {
            string str = "";

            try
            {
                JMP.BLL.jmp_query bll  = new JMP.BLL.jmp_query();
                JMP.MDL.jmp_query mo   = new JMP.MDL.jmp_query();
                JMP.MDL.jmp_query mode = new JMP.MDL.jmp_query();
                if (JMP.TOOL.CacheHelper.IsCache(jmcode))                           //判读是否存在缓存
                {
                    mo = JMP.TOOL.CacheHelper.GetCaChe <JMP.MDL.jmp_query>(jmcode); //获取缓存
                }
                else
                {
                    mo = bll.SelectCode(jmcode);
                }
                if (mo != null && mo.q_id > 0)
                {
                    mode.q_time = mo.q_time + 1;
                    mode.q_code = mo.q_code;
                    mode.q_id   = mo.q_id;
                    if (mode.q_time > 5)
                    {
                        str = "{\"message\":\"fail\"}";
                    }
                    else
                    {
                        if (bll.Update(mode))
                        {
                            str = jxjson(SelectOrder(jmcode));
                            JMP.TOOL.CacheHelper.CacheObjectLocak <JMP.MDL.jmp_query>(mode, jmcode, 60);//存入缓存
                        }
                        else
                        {
                            str = "{\"message\":\"fail\"}";
                        }
                    }
                }
                else
                {
                    mode.q_code = jmcode;
                    mode.q_time = 1;
                    int cg = bll.Add(mode);
                    if (cg > 0)
                    {
                        str = jxjson(SelectOrder(jmcode));
                        JMP.TOOL.CacheHelper.CacheObjectLocak <JMP.MDL.jmp_query>(mode, jmcode, 60);//存入缓存
                    }
                    else
                    {
                        str = "{\"message\":\"fail\"}";
                    }
                }
            }
            catch (Exception ex)
            {
                AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "查询接口判断订单出错", "报错信息:" + ex.ToString() + ",查询参数:" + jmcode);//写入报错日志
                return(str = "{\"message\":\"fail\"}");
            }
            return(str);
        }
Пример #14
0
        /// <summary>
        /// 根据订单号查询订单信息
        /// </summary>
        /// <param name="code">订单编号</param>
        /// <returns></returns>
        public static string SelectOrder(string code)
        {
            string str = "";

            try
            {
                JMP.MDL.jmp_order mode = new JMP.MDL.jmp_order();
                JMP.BLL.jmp_order bll  = new JMP.BLL.jmp_order();
                mode = bll.GetModelbycode(code, "jmp_order");
                if (mode != null)
                {
                    #region 查询时时表信息
                    if (mode.o_state == 1)
                    {
                        str = "{\"message\":\"success\",\"price\":\"" + mode.o_price.ToString("f2") + "\"}";
                    }
                    else
                    {
                        str = "{\"message\":\"fail\"}";
                    }
                    #endregion
                }
                else
                {
                    #region 根据指定时间查询归档表
                    string orderTableName = JMP.TOOL.WeekDateTime.GetOrderTableName(DateTime.Now.ToString("yyyy-MM-dd")); //获取订单表名
                    mode = bll.GetModelbycode(code, orderTableName);                                                      //查询本周归档表
                    if (mode != null)
                    {
                        if (mode.o_state == 1)
                        {
                            str = "{\"message\":\"success\",\"price\":\"" + mode.o_price.ToString("f2") + "\"}";
                        }
                        else
                        {
                            str = "{\"message\":\"fail\"}";
                        }
                    }
                    else
                    {
                        string TableName = JMP.TOOL.WeekDateTime.GetOrderTableName(DateTime.Now.AddDays(-7).ToString("yyyy-MM-dd")); //获取订单表名
                        mode = bll.GetModelbycode(code, TableName);                                                                  //查询上周归档表
                        if (mode != null)
                        {
                            if (mode.o_state == 1)
                            {
                                str = "{\"message\":\"success\",\"price\":\"" + mode.o_price.ToString("f2") + "\"}";
                            }
                            else
                            {
                                str = "{\"message\":\"fail\"}";
                            }
                        }
                        else
                        {
                            str = "{\"message\":\"fail\"}";
                        }
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                AddLocLog.AddLog(1, 4, HttpContext.Current.Request.UserHostAddress, "查询接口查询订单出错", "报错信息:" + ex.ToString() + ",查询参数:" + code);//写入报错日志
                return(str = "{\"message\":\"fail\"}");
            }
            return(str);
        }
Пример #15
0
        public ActionResult UserLoginbygw(string qs)
        {
            object result  = "";
            string ms      = JMP.TOOL.DESEncrypt.Decrypt(qs);
            string u_name  = ms.Split(';')[0].ToString();
            string u_pwd   = ms.Split(';')[1].ToString();
            string admname = ms.Split(';')[2].ToString();
            string admtime = ms.Split(';')[3].ToString();

            if (Convert.ToDateTime(admtime).AddMinutes(5) < System.DateTime.Now)
            {
                result = new { msg = "登录超时,后台密码失效,请从新刷新后台用户列表!", success = "2" };
            }
            else
            {
                JMP.BLL.jmp_limit bll_limit = new JMP.BLL.jmp_limit();
                JMP.BLL.jmp_user  bll       = new JMP.BLL.jmp_user();
                JMP.MDL.jmp_user  model     = bll.GetModel(u_name);
                //加密用户登录密码
                string jm_pwd = u_pwd;
                if (model != null && model.u_state == 1)
                {
                    if ((model.u_email == u_name || model.u_phone == u_name) && model.u_password == jm_pwd)
                    {
                        UserInfo.UserId     = model.u_id;
                        UserInfo.UserName   = model.u_realname;
                        UserInfo.UserNo     = model.u_email;
                        UserInfo.UserRoleId = model.u_role_id;
                        DataTable dtLimit = bll_limit.GetAppUserLimitSession(model.u_id, model.u_role_id);
                        if (dtLimit.Rows.Count > 0)
                        {
                            Session["dtSession"] = dtLimit;
                            if (admname != "0")
                            {
                                string log = string.Format(admname + "从官网登录。", UserInfo.UserNo, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                                AddLocLog.AddUserLog(UserInfo.UserId, 2, RequestHelper.GetClientIp(), admname + "从官网登录。", log);
                            }
                            result = new { msg = "登录成功!", success = "1" };
                        }
                        else
                        {
                            result = new { msg = "权限不足!", success = "2" };
                        }
                    }
                    else
                    {
                        result = new { msg = "用户名或密码错误!", success = "2" };
                    }
                }
                else
                {
                    if (model == null)
                    {
                        result = new { msg = "用户名或密码错误!", success = "2" };
                    }
                    else if (model.u_state != 1)
                    {
                        result = new { msg = "该账号已冻结!", success = "2" };
                    }
                }
            }
            ViewBag.message = result;
            return(View());
        }
Пример #16
0
        public JsonResult Orderrewire()
        {
            object retJson   = new { success = 0, msg = "操作失败" };
            string ordercode = string.IsNullOrEmpty(Request["code"]) ? "" : Request["code"];
            string ptime     = string.IsNullOrEmpty(Request["ptime"]) ? "" : Request["ptime"];
            bool   sess      = Convert.ToDateTime(Session["sendtime_" + ordercode]) > System.DateTime.Now.AddMinutes(-1) ? true : false;

            if (!string.IsNullOrEmpty(ordercode) && !string.IsNullOrEmpty(ptime))
            {
                if (DateTime.Parse(DateTime.Parse(ptime).ToString("yyyy-MM-dd")) > DateTime.Parse(DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd")))
                {
                    if (sess)
                    {
                        retJson = new { success = 0, msg = "请间隔一分钟,再次发送!" };
                        return(Json(retJson));
                    }
                    else
                    {
                        JMP.BLL.jmp_order bll        = new JMP.BLL.jmp_order();
                        JMP.MDL.jmp_order morder     = new JMP.MDL.jmp_order();
                        string            tabalename = "dbo.jmp_order_" + JMP.TOOL.WeekDateTime.GetWeekFirstDayMon(DateTime.Parse(ptime)).ToString("yyyyMMdd");
                        morder = bll.SelectOrder(ordercode, tabalename);
                        if (morder != null)
                        {
                            if (morder.o_times > 8 && morder.o_times < 12)
                            {
                                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       = morder.o_times;
                                quli.q_noticetimes = DateTime.Now;
                                quli.q_tablename   = tabalename;
                                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      = UserInfo.UserId;
                                int cg = bllq.Add(quli);
                                if (cg > 0)
                                {
                                    Session["sendtime_" + morder.o_code] = System.DateTime.Now;
                                    retJson = new { success = 1, msg = "已重发通知!手动通知次数剩余:" + (11 - morder.o_times) + "次" };
                                }
                                else
                                {
                                    AddLocLog.AddLog(1, 4, Request.UserHostAddress, "管理平台手动重发通知失败", "订单号:" + morder.o_code + ",表名:" + tabalename);//写入报错日
                                    retJson = new { success = 0, msg = "操作失败!" };
                                }
                            }
                            else
                            {
                                retJson = new { success = 0, msg = "手动通知无效!" };
                            }
                        }
                    }
                }
                else
                {
                    retJson = new { success = 0, msg = "只能重发三天以内的数据!" };
                }
            }
            else
            {
                retJson = new { success = 0, msg = "数据异常!" };
            }
            return(Json(retJson));
        }
Пример #17
0
        public JsonResult UserLogin(string u_name, string u_pwd, string code)
        {
            object result = new { msg = "操作失败!", status = "0" };

            JMP.BLL.jmp_limit bll_limit = new JMP.BLL.jmp_limit();
            JMP.BLL.jmp_user  bll       = new JMP.BLL.jmp_user();
            JMP.MDL.jmp_user  model     = new JMP.MDL.jmp_user();

            var isDebug = ConfigurationManager.AppSettings["IsDebug"];

            if (!string.IsNullOrEmpty(isDebug) && isDebug == "true")
            {
                string yzcode = Session["ValidateCode"].ToString();
                if (yzcode != code)
                {
                    result = new { msg = "验证码错误!", success = "2" };
                    return(Json(result));
                }
            }

            model = bll.GetModel(u_name);

            //加密用户登录密码
            string jm_pwd = DESEncrypt.Encrypt(u_pwd);

            if (model != null && model.u_state == 1)
            {
                if ((model.u_email == u_name || model.u_phone == u_name) && model.u_password == jm_pwd)
                {
                    UserInfo.UserId     = model.u_id;
                    UserInfo.UserName   = model.u_realname;
                    UserInfo.UserNo     = model.u_email;
                    UserInfo.UserRoleId = model.u_role_id;
                    UserInfo.auditstate = model.u_auditstate.ToString();
                    DataTable dtLimit = bll_limit.GetAppUserLimitSession(model.u_id, model.u_role_id);
                    if (dtLimit.Rows.Count > 0)
                    {
                        Session["dtSession"] = dtLimit;
                        model.u_count       += 1;

                        string log = string.Format("开发者{0}于{1}登录聚米支付平台。", UserInfo.UserNo, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        AddLocLog.AddUserLog(UserInfo.UserId, 2, RequestHelper.GetClientIp(), "用户" + UserInfo.UserName + "登录。", log);
                        result = new { msg = "登录成功!", success = "1" };
                        return(Json(result));
                    }
                    else
                    {
                        result = new { msg = "权限不足!", success = "2" };
                    }
                }
                else
                {
                    result = new { msg = "用户名或密码错误!", success = "2" };
                }
            }
            else
            {
                if (model == null)
                {
                    result = new { msg = "用户名或密码错误!", success = "2" };
                }
                else if (model.u_state != 1)
                {
                    result = new { msg = "该账号已冻结!", success = "2" };
                }
            }
            return(Json(result));
        }
Пример #18
0
        /// <summary>
        /// 加载配置文件
        /// </summary>
        /// <returns></returns>
        public static Dictionary <String, String> loadCfg(int tid, int appid)
        {
            Dictionary <String, String> cfg = new Dictionary <string, string>();
            string  dpkey     = ""; //智付私钥
            string  dppartner = ""; //智付账号
            int     dppay_id  = 0;  //支付渠道id
            decimal minmun    = 0;
            decimal maximum   = 0;

            try
            {
                DataTable             dt   = new DataTable();
                JMP.BLL.jmp_interface blli = new JMP.BLL.jmp_interface();
                string DPzfjkhc            = "DPzfjkhc" + appid;//组装缓存key值
                if (JMP.TOOL.CacheHelper.IsCache(DPzfjkhc))
                {
                    dt = JMP.TOOL.CacheHelper.GetCaChe <DataTable>(DPzfjkhc);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        int      row   = new Random().Next(0, dt.Rows.Count);
                        string[] payzf = dt.Rows[row]["l_str"].ToString().Split(',');
                        dpkey     = payzf[1].Replace("\r", "").Replace("\n", "").Trim(); //获取缓存数据中的智付私钥
                        dppartner = payzf[0].Replace("\r", "").Replace("\n", "").Trim(); //获取缓存数据中的智付账号
                        dppay_id  = Int32.Parse(dt.Rows[row]["l_id"].ToString());        //支付渠道id
                        minmun    = decimal.Parse(dt.Rows[row]["l_minimum"].ToString()); //单笔最小支付金额
                        maximum   = decimal.Parse(dt.Rows[row]["l_maximum"].ToString()); //单笔最大支付金额
                    }
                    else
                    {
                        dt = blli.SelectPay("ZF", tid, appid);
                        if (dt != null && dt.Rows.Count > 0)
                        {
                            int      row   = new Random().Next(0, dt.Rows.Count);
                            string[] payzf = dt.Rows[row]["l_str"].ToString().Split(',');
                            dppartner = payzf[0].Replace("\r", "").Replace("\n", "").Trim();    //获取智付账号
                            dpkey     = payzf[1].Replace("\r", "").Replace("\n", "").Trim();    //获取智付私钥
                            dppay_id  = Int32.Parse(dt.Rows[row]["l_id"].ToString());           //支付渠道id
                            minmun    = decimal.Parse(dt.Rows[row]["l_minimum"].ToString());    //单笔最小支付金额
                            maximum   = decimal.Parse(dt.Rows[row]["l_maximum"].ToString());    //单笔最大支付金额
                            JMP.TOOL.CacheHelper.CacheObjectLocak <DataTable>(dt, DPzfjkhc, 1); //存入缓存
                        }
                        else
                        {
                            PayApiGlobalErrorLogger.Log("应用id为:" + appid + "的支付通道为空!风控id为:" + tid + ",获取缓存失败后从数据库未查询到相关信息!", summary: "智付支付接口错误");
                        }
                    }
                }
                else
                {
                    dt = blli.SelectPay("ZF", tid, appid);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        int      row   = new Random().Next(0, dt.Rows.Count);
                        string[] payzf = dt.Rows[row]["l_str"].ToString().Split(',');
                        dppartner = payzf[0].Replace("\r", "").Replace("\n", "").Trim();    //获取智付账号
                        dpkey     = payzf[1].Replace("\r", "").Replace("\n", "").Trim();    //获取智付私钥
                        dppay_id  = Int32.Parse(dt.Rows[row]["l_id"].ToString());           //支付渠道id
                        minmun    = decimal.Parse(dt.Rows[row]["l_minimum"].ToString());    //单笔最小支付金额
                        maximum   = decimal.Parse(dt.Rows[row]["l_maximum"].ToString());    //单笔最大支付金额
                        JMP.TOOL.CacheHelper.CacheObjectLocak <DataTable>(dt, DPzfjkhc, 1); //存入缓存
                    }
                    else
                    {
                        PayApiGlobalErrorLogger.Log("应用id为:" + appid + "的支付通道为空!风控id为:" + tid + ",从数据库未查询到相关信息!", summary: "智付支付接口错误");
                    }
                }
            }
            catch (Exception e)
            {
                string bcxx = "报错提示" + e.Message + "报错对象:" + e.Source + "报错方法:" + e.TargetSite + "报错信息:" + e.ToString(); //报错信息
                AddLocLog.AddLog(1, 4, "", "智付支付接口错误", bcxx);                                                            //写入报错日志
                throw;
            }
            //从数据库读取配置文件
            cfg.Add("partner", dppartner);
            cfg.Add("dpkey", dpkey);
            cfg.Add("pay_id", dppay_id.ToString());
            cfg.Add("minmun", minmun.ToString());
            cfg.Add("maximum", maximum.ToString());
            return(cfg);
        }
Пример #19
0
        /// <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
        }
Пример #20
0
        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 修改应用

                    JMP.MDL.jmp_app modapp = new JMP.MDL.jmp_app();

                    modapp = bll.GetModel(mod.a_id);
                    var modclone = 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_showurl     = mod.a_showurl;     //同步地址
                    modapp.a_appurl      = mod.a_appurl;      //应用审核地址
                    modapp.a_appsynopsis = mod.a_appsynopsis; //应用简介
                    //mod.a_auditstate = modapp.a_auditstate;//应用审核状态
                    //mod.a_key = modapp.a_key;
                    //mod.a_state = modapp.a_state;
                    //mod.a_secretkey = modapp.a_secretkey;
                    //mod.a_time = modapp.a_time;
                    //mod.a_user_id = modapp.a_user_id;
                    //mod.a_rid = modapp.a_rid;
                    if (bll.Update(modapp))
                    {
                        Logger.ModifyLog("修改应用", modclone, 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;
                    mod.a_user_id    = UserInfo.UserId;
                    int cg = bll.Add(mod);
                    if (cg > 0)
                    {
                        AddLocLog.AddUserLog(UserInfo.UserId, 3, RequestHelper.GetClientIp(), "添加应用", "添加应用");

                        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));
        }