Exemplo n.º 1
0
        /// <summary>
        /// 验证应用和签名是否合法
        /// </summary>
        /// <param name="mode">请求参数实体</param>
        /// <param name="json">请求参数json</param>
        /// <param name="CacheTime">有效查询时间</param>
        /// <returns></returns>
        private QueryRespon Selectparameter(QueryModels mode, string json, int CacheTime)
        {
            QueryRespon qu        = new QueryRespon();
            SelectAPP   selectAPP = new SelectAPP();
            jmp_app     app       = selectAPP.SelectAppId(mode.appid, CacheTime);

            if (app != null)
            {
                //验证签名的方式 参数AIIZ首字母顺序排列md532大写加密
                Dictionary <string, string> dic = JMP.TOOL.JsonHelper.Deserialize <Dictionary <string, string> >(json);
                dic = dic.Where(x => x.Key != "sign").ToDictionary(x => x.Key, x => x.Value);
                string signstr = JMP.TOOL.UrlStr.AzGetStr(dic) + "&key=" + app.a_key;
                string md5str  = JMP.TOOL.MD5.md5strGet(signstr, true).ToUpper();
                if (mode.sign != md5str)
                {
                    return(qu = qu.QueryResp(QueryErrorCode.Code9993));
                }
                else
                {
                    qu = qu.QueryResp(QueryErrorCode.Code100);
                }
            }
            else
            {
                qu = qu.QueryResp(QueryErrorCode.Code9994);
            }
            return(qu);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化接口主通道
        /// </summary>
        /// <param name="mode">参数实体</param>
        /// <param name="json">参数json字符串</param>
        /// <param name="CacheTime">缓存时间</param>
        /// <param name="ip">ip地址</param>
        /// <returns></returns>
        public InnerResponse InfoPass(JmPayParameter.Models.Initialization mode, string json, int CacheTime, string ip)
        {
            InnerResponse Inn = new InnerResponse();

            Inn = VerificationParameter(mode, json);
            if (Inn.Success == true)
            {
                if (mode.t_appid > 0)
                {
                    SelectAPP       selectAPP = new SelectAPP();
                    JMP.MDL.jmp_app app       = selectAPP.SelectAppId(mode.t_appid, CacheTime);
                    if (app != null)
                    {
                        jmp_terminal model = EntityEvaluation(mode, ip);
                        if (mode != null)
                        {
                            if (mode.t_isnew == 1)
                            {
                                Inn = Insertliveteral(model);
                            }
                            else
                            {
                                Inn = InsertNew(model);
                            }
                        }
                        else
                        {
                            Inn = Inn.InfoToResponse(InfoErrorCode.Code9998);
                        }
                    }
                    else
                    {
                        Inn = Inn.InfoToResponse(InfoErrorCode.Code9996);
                    }
                }
                else
                {
                    Inn = Inn.InfoToResponse(InfoErrorCode.Code9996);
                }
            }
            return(Inn);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 预下单接口通道
        /// </summary>
        /// <param name="json">json字符串</param>
        /// <param name="mode">参数实体类型</param>
        /// <param name="CacheTime">缓存时间</param>
        /// <param name="UserIp">ip地址</param>
        /// <returns></returns>
        public InnerResponse OrderInterface(string json, RequestParameter mode, int CacheTime, string UserIp)
        {
            InnerResponse Inn = new InnerResponse();

            if (!string.IsNullOrEmpty(json))
            {
                pr.ip = UserIp;
                //订单缓存时间
                int bizcodeTime = Int32.Parse(ConfigurationManager.AppSettings["bizcodeTime"]);
                Inn = ValidationParameter(mode, json, bizcodeTime);
                if (Inn.Success)
                {
                    SelectAPP selectAPP = new SelectAPP();
                    jmp_app   app       = selectAPP.SelectAppId(mode.appid, CacheTime);
                    if (app != null)
                    {
                        Apprate apprate = new Apprate();
                        if (mode.paytype > 0 && !apprate.SelectApprate(mode.appid, mode.paytype, CacheTime))
                        {
                            return(Inn = Inn.ToResponse(ErrorCode.Code8987));
                        }
                        pr.appkey = app.a_key;
                        Inn       = ValidationApp(mode, json, app);
                        if (Inn.Success == true)
                        {
                            Inn = DownOrder(mode, json);
                            if (Inn.Success == true)
                            {
                                //设置缓存
                                SetUpCache(mode.bizcode, mode.appid, bizcodeTime);
                                Inn = judge(mode.paytype, app.a_platform_id, app.a_rid, CacheTime, app.a_id);
                            }
                        }
                    }
                    else
                    {
                        Inn = Inn.ToResponse(ErrorCode.Code9998);
                    }
                }
            }
            return(Inn);
        }