Example #1
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["CurrentPage"] == null || res["CurrentPage"].ToString().Trim().Length <= 0 ||
                res["PageNum"] == null || res["PageNum"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid         = res["UID"].ToString().Trim();
                pagenum     = int.Parse(res["PageNum"].ToString().Trim());
                currentpage = int.Parse(res["CurrentPage"].ToString().Trim());
                bool valid = false;
                if (res["Valid"] != null && res["Valid"].ToString().Trim().Length > 0)
                {
                    valid = res["Valid"].ToString().Trim() == "1" ? true : false;
                }
                UserCouponManager couponManager = new UserCouponManager();
                int       count = 0;
                DataTable dt    = couponManager.GetUserCoupons(uid, valid, currentpage, pagenum, ref count);
                if (dt == null || dt.Rows.Count <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "没有数据了"));
                }
                else
                {
                    return(JsonHelper.DataTableToJson("success", "获取数据成功", dt, "GetUserCoupons"));
                }
            }
        }
Example #2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["OrderID"] == null || res["OrderID"].ToString().Trim().Length <= 0 ||
                res["Platform"] == null || res["Platform"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "分享数据不完整"));
            }
            else
            {
                UserInfoManager   uim            = new UserInfoManager();
                OrdersManager     om             = new OrdersManager();
                SysSettingManager settingManager = new SysSettingManager();
                UserCouponManager couponManager  = new UserCouponManager();

                uid      = res["UID"].ToString().Trim();
                orderid  = res["OrderID"].ToString().Trim();
                platform = res["Platform"].ToString().Trim();

                Hashtable order_ht = om.GetOrderInfoByID(orderid);
                if (order_ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未找到订单数据,分享失败"));
                }
                string orderstate = SiteHelper.GetHashTableValueByKey(order_ht, "OrderState");
                if (orderstate != OrderState.Finished.GetHashCode().ToString())
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "订单未完成,分享失败"));
                }
                string sharestate = SiteHelper.GetHashTableValueByKey(order_ht, "ShareState");
                bool   result     = true;
                if (sharestate == "0")
                {
                    int couponNum = 0;
                    int.TryParse(settingManager.GetValueByKey("OrderShareNum"), out couponNum);
                    decimal couponMoney = 0.00m;
                    decimal.TryParse(settingManager.GetValueByKey("OrderShareMoney"), out couponMoney);
                    if (couponNum > 0 && couponMoney > 0)
                    {
                        result = couponManager.OrderShareGiveCoupons(uid, orderid, platform);
                    }
                }
                if (result)
                {
                    //响应数据到客户端
                    return(SiteHelper.GetJsonFromHashTable(null, "success", "订单分享成功", "UserInfo"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "订单分享失败"));
                }
            }
        }
Example #3
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void DataBindGrid(bool isQuery = false)
        {
            UserCouponManager couponManager = new UserCouponManager();
            int count     = 0;
            int pageIndex = isQuery ? 1 : PageControl1.PageIndex;

            KeyValuePair <StringBuilder, IList <SqlParam> > keyValue = InitCondition();
            DataTable dt = couponManager.GetPage(keyValue.Key, keyValue.Value, pageIndex, PageControl1.PageSize, ref count);

            ControlBindHelper.BindRepeaterList(dt, rp_Item);
            this.PageControl1.PageIndex   = pageIndex;
            this.PageControl1.RecordCount = Convert.ToInt32(count);
            this.PageControl1.PageChecking();
        }
Example #4
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["PayWay"] == null || res["PayWay"].ToString().Trim().Length <= 0 ||
                res["OrderNum"] == null || res["OrderNum"].ToString().Trim().Length <= 0 ||
                res["OpenID"] == null || res["OpenID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid    = res["UID"].ToString().Trim();
                openID = res["OpenID"].ToString().Trim();
                ip     = HttpContext.Current.Request.UserHostAddress;
                int.TryParse(res["PayWay"].ToString().Trim(), out payway);
                string            ordernum      = res["OrderNum"].ToString().Trim();
                string            couponID      = "";
                OrdersManager     om            = new OrdersManager();
                UserCouponManager couponManager = new UserCouponManager();
                Hashtable         order_ht      = om.GetOrderInfoByNum(ordernum);
                if (order_ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未找到订单数据,支付失败"));
                }
                int     payState   = int.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "PayState"));
                int     orderState = int.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "OrderState"));
                decimal payMoney   = decimal.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "PayMoney"));
                decimal totalMoney = decimal.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "TotalMoney"));

                if (OrderState.UnPay.GetHashCode() != orderState)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "订单支付失败"));
                }
                if (payMoney <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未产生支付费用,无需进行支付操作"));
                }

                if (res["CouponID"] != null && res["CouponID"].ToString().Trim().Length > 0)
                {
                    couponID = res["CouponID"].ToString().Trim();
                    Hashtable coupon_ht = couponManager.GetDataByID(couponID);
                    if (coupon_ht == null || coupon_ht.Keys.Count == 0)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    string  orderid     = SiteHelper.GetHashTableValueByKey(coupon_ht, "OrderID");
                    string  begintime   = SiteHelper.GetHashTableValueByKey(coupon_ht, "BeginTime");
                    string  endtime     = SiteHelper.GetHashTableValueByKey(coupon_ht, "EndTime");
                    string  userid      = SiteHelper.GetHashTableValueByKey(coupon_ht, "UserID");
                    decimal couponMoney = 0.00m;
                    decimal.TryParse(SiteHelper.GetHashTableValueByKey(coupon_ht, "Money"), out couponMoney);
                    if (userid != uid)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (!string.IsNullOrEmpty(orderid))
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (DateTime.Parse(begintime) > DateTime.Now || DateTime.Parse(endtime) < DateTime.Now)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (couponMoney > totalMoney)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }

                    Hashtable update_order_ht = new Hashtable();
                    update_order_ht["CouponID"]    = couponID;
                    update_order_ht["CouponMoney"] = couponMoney;
                    update_order_ht["PayMoney"]    = totalMoney - couponMoney;
                    bool rrr = om.AddOrEditOrdersInfo(update_order_ht, SiteHelper.GetHashTableValueByKey(order_ht, "ID"));
                }

                webRoot         = SiteHelper.GetWebRoot();
                weixinNotifyUrl = string.Format("{0}{1}", webRoot, "/api/weapp/pay/wxpay/order_notify_url.aspx");
                alipayNotifyUrl = string.Format("{0}{1}", webRoot, "/api/weapp/pay/alipay/order_notify_url.aspx");

                string result = "";
                switch (payway)
                {
                case 1:
                    result = AliPay(uid, ordernum);
                    break;

                case 2:
                    result = WxPay(uid, ordernum);
                    break;

                case 3:
                    result = BalancePay(uid, ordernum);
                    break;

                default:
                    break;
                }
                return(result);
            }
        }
Example #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.CacheControl = "no-cache";
            context.Response.AddHeader("Pragma", "no-cache");
            context.Response.ContentType = "text/plain";
            string Action = context.Request["action"];

            switch (Action)
            {
            case "GetDistrict":
                ServiceAreaManager areaManager = new ServiceAreaManager();
                DataTable          dtArea      = areaManager.GetAreaList(int.Parse(context.Request["levelType"]), int.Parse(context.Request["parentId"]));
                context.Response.Write(JsonHelper.DataTableToJson("success", "获取数据成功", dtArea, "ServiceArea"));
                context.Response.End();
                break;

            case "GetServiceAreaByID":
                ServiceAreaManager manager = new ServiceAreaManager();
                DataTable          dt      = manager.GetServiceAreaByID(context.Request["key"]);
                context.Response.Write(JsonHelper.DataTableToJson("success", "获取数据成功", dt, "ServiceArea"));
                context.Response.End();
                break;

            case "UpdateServiceAreaCoordinates":
                ServiceAreaManager sam = new ServiceAreaManager();
                string             key = context.Request["key"];
                Hashtable          ht  = sam.GetInfoByID(key);
                ht["COORDINATES"] = context.Request["Coordinates"];
                ht["LONGITUDE"]   = context.Request["Longitude"];
                ht["LATITUDE"]    = context.Request["Latitude"];
                string areaType   = ht["AREATYPE"].ToString();
                string status     = ht["STATUS"].ToString();
                string deleteMark = ht["DELETEMARK"].ToString();
                //AreaType 区域类型 1服务范围 2停车网点
                //Status 启动状态:0禁用,1启用
                //DeleteMark 0
                if ("1".Equals(areaType) && "1".Equals(status) && "True".Equals(deleteMark))
                {
                    ICache cache = null;
                    try
                    {
                        cache = CacheFactory.GetCache();
                        string   cacheKey = "Service_Area_" + ht["CITYID"].ToString();
                        DateTime timeSpan = DateTime.Now.AddDays(10);
                        cache.Set(cacheKey, context.Request["Coordinates"], timeSpan - DateTime.Now);
                        cache.Dispose();

                        /*List<LatLng> area_pts = new List<LatLng>();
                         * string coordinates = cache.Get<string>(cacheKey);
                         * if(coordinates!=null&& coordinates.Length>0)
                         * foreach (string str in coordinates.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries))
                         * {
                         *  string[] pt_arr = str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                         *  LatLng pt = new LatLng(double.Parse(pt_arr[1]), double.Parse(pt_arr[0]));
                         *  area_pts.Add(pt);
                         * }*/
                    }
                    catch (Exception e)
                    {
                        if (cache != null)
                        {
                            cache.Dispose();
                        }
                        Logger.Error("更新区域:" + ht["THISNAME"].ToString() + ",报错:" + e);
                    }
                    if (cache != null)
                    {
                        cache.Dispose();
                    }
                }
                if (sam.AddOrEditInfo(ht, key))
                {
                    context.Response.Write(JsonHelper.DataTableToJson("success", "更新成功", null, "UpdateServiceAreaCoordinates"));
                }
                else
                {
                    context.Response.Write(JsonHelper.DataTableToJson("faild", "更新失败", null, "UpdateServiceAreaCoordinates"));
                }
                context.Response.End();
                break;

            case "GetInviteCouponInfo":
                SysSettingManager settingManager = new SysSettingManager();
                int couponNum = 0;
                int.TryParse(settingManager.GetValueByKey("InviteCouponNum"), out couponNum);
                decimal couponMoney = 0.00m;
                decimal.TryParse(settingManager.GetValueByKey("InviteCouponMoney"), out couponMoney);
                double CouponPeriod = 0;
                double.TryParse(settingManager.GetValueByKey("CouponPeriod"), out CouponPeriod);
                Hashtable result_ht = new Hashtable();
                result_ht["CouponNum"]    = couponNum;
                result_ht["CouponMoney"]  = couponMoney;
                result_ht["CouponPeriod"] = DateTime.Now.Date.AddDays(CouponPeriod).ToString("yyyy-MM-dd");
                //响应数据到客户端
                context.Response.Write(SiteHelper.GetJsonFromHashTable2(result_ht, "success", "获取数据成功", "GetInviteCouponInfo"));
                break;

            case "SendVerificationCode":
                string mobie = context.Request["Mobile"].ToString().Trim();
                string code  = "";
                if (context.Request["Code"] != null)
                {
                    code = context.Request["Code"].ToString().Trim();
                }
                else
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "参数错误", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                string session_code = context.Session["dt_session_code"].ToString();
                if (code.ToLower() != session_code.ToLower())
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "图形验证码错误", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                SmsInfoManager  sim  = new SmsInfoManager();
                UserInfoManager uim  = new UserInfoManager();
                DataTable       user = uim.GetUserInfoByBindPhone(mobie);
                if (user != null && user.Rows.Count > 0)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "手机号已注册", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                bool sendResult = sim.SendVerificationCode(mobie);
                if (sendResult)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "success", "发送验证码成功", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }
                else
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "发送验证码失败", "SendVerificationCode"));
                    context.Response.End();
                    break;
                }

            case "NewUserRegister":
                sim = new SmsInfoManager();
                UserLoginLogManager ullm = new UserLoginLogManager();
                uim            = new UserInfoManager();
                settingManager = new SysSettingManager();
                string mobile           = context.Request["Mobile"].ToString().Trim();
                string verificationCode = context.Request["VerificationCode"].ToString().Trim();
                string invite_userid    = context.Request["InviteUserID"].ToString().Trim();

                string vcode = sim.GetVerCodeByMobile(mobile);
                if (verificationCode != vcode)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "手机验证码错误", "NewUserRegister"));
                    context.Response.End();
                    return;
                }

                user = uim.GetUserInfoByBindPhone(mobile);
                if (user != null && user.Rows.Count > 0)
                {
                    context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "用户已注册", "NewUserRegister"));
                    context.Response.End();
                    return;
                }
                else
                {
                    Hashtable newuser = new Hashtable();
                    newuser["BindPhone"]             = mobile;
                    newuser["RealNameCertification"] = (int)UserRealNameCertification.Unauthorized;
                    newuser["UserState"]             = (int)UserState.Enable;
                    newuser["Balance"]      = 0;
                    newuser["RaiseBalance"] = 0;
                    newuser["IsRaiseUser"]  = (int)UserIsRaise.NO;
                    newuser["InviteCode"]   = mobile;
                    newuser["InviteUserID"] = invite_userid;
                    int num = uim.AddUserInfo(newuser);
                    if (num > -1)
                    {
                        user = uim.GetUserInfoByBindPhone(mobile);

                        //新注册用户赠送优惠券
                        couponNum = 0;
                        int.TryParse(settingManager.GetValueByKey("RegCouponNum"), out couponNum);
                        couponMoney = 0.00m;
                        decimal.TryParse(settingManager.GetValueByKey("RegCouponMoney"), out couponMoney);
                        UserCouponManager couponManager = new UserCouponManager();
                        if (couponNum > 0 && couponMoney > 0)
                        {
                            couponManager.NewUserGiveCoupons(user.Rows[0]["ID"].ToString());
                        }

                        context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "success", "新用户注册成功", "NewUserRegister"));
                        context.Response.End();
                        return;
                    }
                    else
                    {
                        context.Response.Write(SiteHelper.GetJsonFromHashTable2(null, "faild", "手机号错误", "NewUserRegister"));
                        context.Response.End();
                        return;
                    }
                }
                break;

            default:
                break;
            }
        }
Example #6
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["Mobile"] == null ||
                res["VerificationCode"] == null ||
                res["Client"] == null ||
                res["Longitude"] == null ||
                res["Latitude"] == null ||
                res["EquipmentID"] == null ||
                res["Mobile"].ToString().Trim().Length <= 0 ||
                res["VerificationCode"].ToString().Trim().Length <= 0 ||
                res["Client"].ToString().Trim().Length <= 0 ||
                res["Longitude"].ToString().Trim().Length <= 0 ||
                res["Latitude"].ToString().Trim().Length <= 0 ||
                res["EquipmentID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录数据不完整"));
            }
            else
            {
                UserInfoManager     uim            = new UserInfoManager();
                SmsInfoManager      sim            = new SmsInfoManager();
                UserLoginLogManager ullm           = new UserLoginLogManager();
                SysSettingManager   settingManager = new SysSettingManager();
                bool isAllowLogin = false;
                //获取参数
                mobile           = res["Mobile"].ToString().Trim();
                verificationCode = res["VerificationCode"].ToString().Trim();
                client           = res["Client"].ToString().Trim();
                longitude        = res["Longitude"].ToString().Trim();
                latitude         = res["Latitude"].ToString().Trim();
                drviceid         = res["EquipmentID"].ToString().Trim();
                DataTable user = uim.GetUserInfoByBindPhone(mobile);
                if (user != null && user.Rows.Count > 0)
                {
                    string vcode = sim.GetVerCodeByMobile(mobile);
                    if (vcode != null && verificationCode.Trim() == vcode.Trim())
                    {
                        isAllowLogin = true;
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "验证码不正确"));
                    }
                }
                else
                {
                    Hashtable newuser = new Hashtable();
                    newuser["BindPhone"]             = mobile;
                    newuser["RealNameCertification"] = (int)UserRealNameCertification.Unauthorized;
                    newuser["UserState"]             = (int)UserState.Enable;
                    newuser["Balance"]      = 0;
                    newuser["RaiseBalance"] = 0;
                    newuser["IsRaiseUser"]  = (int)UserIsRaise.NO;
                    newuser["InviteCode"]   = mobile;
                    int num = uim.AddUserInfo(newuser);
                    if (num > -1)
                    {
                        user = uim.GetUserInfoByBindPhone(mobile);
                        string vcode = sim.GetVerCodeByMobile(mobile);
                        if (vcode != null && verificationCode.Trim() == vcode.Trim())
                        {
                            isAllowLogin = true;
                        }
                        else
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "验证码不正确"));
                        }
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "手机号错误"));
                    }

                    //新注册用户赠送优惠券
                    int couponNum = 0;
                    int.TryParse(settingManager.GetValueByKey("RegCouponNum"), out couponNum);
                    decimal couponMoney = 0.00m;
                    decimal.TryParse(settingManager.GetValueByKey("RegCouponMoney"), out couponMoney);
                    UserCouponManager couponManager = new UserCouponManager();
                    if (couponNum > 0 && couponMoney > 0)
                    {
                        couponManager.NewUserGiveCoupons(user.Rows[0]["ID"].ToString());
                    }
                }
                if (isAllowLogin)
                {
                    //记录登录日志
                    Hashtable loginlog = new Hashtable();
                    loginlog["UserID"]    = user.Rows[0]["ID"].ToString();
                    loginlog["Latitude"]  = latitude;
                    loginlog["Longitude"] = longitude;
                    loginlog["Client"]    = client;
                    ullm.AddUserLoginLog(loginlog);
                    //更新最后登录时间
                    Hashtable userh = new Hashtable();
                    userh["LastloginTime"] = SiteHelper.GetWebServerCurrentTime();
                    userh["DeviceID"]      = drviceid;
                    uim.AddOrEditUserInfo(userh, loginlog["UserID"].ToString());

                    decimal balance = 0.00m;
                    decimal.TryParse(user.Rows[0]["Balance"].ToString(), out balance);
                    decimal balance2 = 0.00m;
                    decimal.TryParse(user.Rows[0]["Balance2"].ToString(), out balance2);
                    user.Rows[0]["Balance"] = balance + balance2;
                    if (user.Rows[0]["UserType"].ToString() == UserType.OffDepositUser.GetHashCode().ToString())//免押金用户
                    {
                        string depositMoney = settingManager.GetValueByKey("GoldDepositAmount");
                        user.Rows[0]["Deposit"] = depositMoney;
                    }

                    //响应数据到客户端
                    return(SiteHelper.GetJsonFromHashTable(DataTableHelper.DataRowToHashTable(user.Rows[0]), "success", "登录成功", "UserInfo"));
                }
                else
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "登录操作失败"));
                }
            }
        }
Example #7
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0 ||
                res["PayWay"] == null || res["PayWay"].ToString().Trim().Length <= 0 ||
                res["OrderNum"] == null || res["OrderNum"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();
                int.TryParse(res["PayWay"].ToString().Trim(), out payway);
                cacheKey += uid;
                string ordernum                    = res["OrderNum"].ToString().Trim();
                string couponID                    = "";
                UserFinancialManager ufm           = new UserFinancialManager();
                UserInfoManager      uim           = new UserInfoManager();
                OrdersManager        om            = new OrdersManager();
                UserCouponManager    couponManager = new UserCouponManager();
                Hashtable            order_ht      = om.GetOrderInfoByNum(ordernum);
                if (order_ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未找到订单数据,支付失败"));
                }
                int     payState   = int.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "PayState"));
                int     orderState = int.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "OrderState"));
                decimal payMoney   = decimal.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "PayMoney"));
                decimal totalMoney = decimal.Parse(SiteHelper.GetHashTableValueByKey(order_ht, "TotalMoney"));

                if (OrderState.UnPay.GetHashCode() != orderState)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "订单支付失败"));
                }
                if (totalMoney <= 0)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "未产生支付费用,无需进行支付操作"));
                }

                #region 检测前一笔未确认支付交易是否成功,成功则禁止重复支付

                Hashtable financial_ht = ufm.GetLatestUserFinancialInfo(uid, UserFinancialState.NewSubmit, UserFinancialChangesType.Consumption);
                if (financial_ht != null && financial_ht.Keys.Count > 0)
                {
                    string order_num    = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderNum");
                    string order_payid  = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderPayID");
                    string operator_way = SiteHelper.GetHashTableValueByKey(financial_ht, "OperatorWay");
                    if (operator_way == UserFinancialOperatorWay.WeixinPay.GetHashCode().ToString())
                    {
                        WxOrderQuery     orderQuery  = new WxOrderQuery();
                        OrderQueryResult queryResult = orderQuery.Query(order_payid);
                        if (queryResult.trade_state == TradeStateEnum.SUCCESS)
                        {
                            Hashtable hashuf = new Hashtable();
                            hashuf["ID"]       = SiteHelper.GetHashTableValueByKey(financial_ht, "ID");
                            hashuf["OrderNum"] = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderNum");
                            hashuf["UserID"]   = SiteHelper.GetHashTableValueByKey(financial_ht, "UserID");
                            hashuf["State"]    = UserFinancialState.Effect.GetHashCode();
                            hashuf["TradeNo"]  = queryResult.transaction_id;
                            hashuf["TotalFee"] = queryResult.total_fee;
                            hashuf["PayWay"]   = UserFinancialOperatorWay.WeixinPay;
                            decimal changesAmount = 0.00m;
                            decimal.TryParse(SiteHelper.GetHashTableValueByKey(financial_ht, "ChangesAmount"), out changesAmount);
                            bool isSuccess = false;
                            if (Math.Abs(changesAmount) == queryResult.total_fee)
                            {
                                isSuccess = uim.OrderPayCallback(hashuf);
                            }
                            if (isSuccess && ordernum == order_num)
                            {
                                return(SiteHelper.GetJsonFromHashTable(null, "faild", "您当前订单已成功支付"));
                            }
                        }
                    }
                    else if (operator_way == UserFinancialOperatorWay.Alipay.GetHashCode().ToString())
                    {
                        AlipayOrderQuery orderQuery  = new AlipayOrderQuery();
                        OrderQueryResult queryResult = orderQuery.Query(order_payid);
                        if (queryResult.trade_state == TradeStateEnum.SUCCESS)
                        {
                            Hashtable hashuf = new Hashtable();
                            hashuf["ID"]       = SiteHelper.GetHashTableValueByKey(financial_ht, "ID");
                            hashuf["OrderNum"] = SiteHelper.GetHashTableValueByKey(financial_ht, "OrderNum");
                            hashuf["UserID"]   = SiteHelper.GetHashTableValueByKey(financial_ht, "UserID");
                            hashuf["State"]    = UserFinancialState.Effect.GetHashCode();
                            hashuf["TradeNo"]  = queryResult.transaction_id;
                            hashuf["TotalFee"] = queryResult.total_fee;
                            hashuf["PayWay"]   = UserFinancialOperatorWay.Alipay;
                            decimal changesAmount = 0.00m;
                            decimal.TryParse(SiteHelper.GetHashTableValueByKey(financial_ht, "ChangesAmount"), out changesAmount);
                            bool isSuccess = false;
                            if (Math.Abs(changesAmount) == queryResult.total_fee)
                            {
                                isSuccess = uim.OrderPayCallback(hashuf);
                            }
                            if (isSuccess && ordernum == order_num)
                            {
                                return(SiteHelper.GetJsonFromHashTable(null, "faild", "您当前订单已成功支付"));
                            }
                        }
                    }
                }

                #endregion

                if (res["CouponID"] != null && res["CouponID"].ToString().Trim().Length > 0)
                {
                    couponID = res["CouponID"].ToString().Trim();
                    Hashtable coupon_ht = couponManager.GetDataByID(couponID);
                    if (coupon_ht == null || coupon_ht.Keys.Count == 0)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    string  orderid     = SiteHelper.GetHashTableValueByKey(coupon_ht, "OrderID");
                    string  begintime   = SiteHelper.GetHashTableValueByKey(coupon_ht, "BeginTime");
                    string  endtime     = SiteHelper.GetHashTableValueByKey(coupon_ht, "EndTime");
                    string  userid      = SiteHelper.GetHashTableValueByKey(coupon_ht, "UserID");
                    decimal couponMoney = 0.00m;
                    decimal.TryParse(SiteHelper.GetHashTableValueByKey(coupon_ht, "Money"), out couponMoney);
                    if (userid != uid)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (!string.IsNullOrEmpty(orderid))
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (DateTime.Parse(begintime) > DateTime.Now || DateTime.Parse(endtime) < DateTime.Now)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }
                    if (couponMoney > totalMoney)
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "使用骑行券失败,支付失败"));
                    }

                    Hashtable update_order_ht = new Hashtable();
                    update_order_ht["CouponID"]    = couponID;
                    update_order_ht["CouponMoney"] = couponMoney;
                    update_order_ht["PayMoney"]    = totalMoney - couponMoney;
                    bool rrr = om.AddOrEditOrdersInfo(update_order_ht, SiteHelper.GetHashTableValueByKey(order_ht, "ID"));
                }

                webRoot         = SiteHelper.GetWebRoot();
                weixinNotifyUrl = string.Format("{0}{1}", webRoot, "/api/app/pay/wxpay/order_notify_url.aspx");
                alipayNotifyUrl = string.Format("{0}{1}", webRoot, "/api/app/pay/alipay/order_notify_url.aspx");

                string result = "";
                ICache cache  = null;
                switch (payway)
                {
                case 1:
                    cache = CacheFactory.GetCache();
                    if (!string.IsNullOrEmpty(cache.Get <string>(cacheKey)))
                    {
                        cache.Dispose();
                        Logger.Error("订单支付宝支付5秒内," + uid);
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "5秒内请勿重复点击"));
                    }
                    cache.Dispose();
                    result = AliPay(uid, ordernum);
                    break;

                case 2:
                    cache = CacheFactory.GetCache();
                    if (!string.IsNullOrEmpty(cache.Get <string>(cacheKey)))
                    {
                        cache.Dispose();
                        Logger.Error("订单微信支付5秒内," + uid);
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "5秒内请勿重复点击"));
                    }
                    cache.Dispose();
                    result = WxPay(uid, ordernum);
                    break;

                case 3:
                    result = BalancePay(uid, ordernum);
                    break;

                default:
                    break;
                }
                return(result);
            }
        }