Пример #1
0
        /// <summary>
        /// 加载分省扣量数据
        /// </summary>
        /// <param name="defCfg"></param>
        /// <param name="prvCfg">为空时,直接反回默认扣量</param>
        /// <param name="ProvinceId">当前传入省份信息</param>
        /// <returns></returns>
        public static IHold_DataItem LoadProvinceData(tbl_trone_orderItem defCfg, tbl_cp_trone_rateItem prvCfg, int ProvinceId)
        {
            if (prvCfg == null || string.IsNullOrEmpty(prvCfg.province_hold_rate))
            {
                return(defCfg);
            }
            //23,4,28,22,13,11,27=0.36;7,19,24,29,3,15,17,25=0.25;5,2,16=0.36;30,8,26,9,20=0.35
            var cfg = prvCfg.province_hold_rate.Replace(" ", "");

            var mc = Regex.Match(cfg, "((?in)(^|;)([\\d,]+?,|)" + ProvinceId.ToString() + "(,.+?|))=([\\d\\.]+)");

            if (!mc.Success)
            {
                return(defCfg);
            }

            float rate;

            if (!float.TryParse(mc.Groups[2].Value, out rate))
            {
                return(defCfg);
            }
            int bitsKey = prvCfg.sp_trone_id;

            bitsKey <<= 13;
            bitsKey  |= defCfg.cp_id & 0x1fff;
            bitsKey <<= 13;
            bitsKey  |= ProvinceId;

            //sp_trone id 13bit  + cp id 13bit + provinceId 6bit
            // 13bit max int 8191
            return(new ProvinceHoldConfg(defCfg, rate, bitsKey));
        }
Пример #2
0
 void ICPPushModel.SetHidden(Shotgun.Database.IBaseDataClass2 dBase, tbl_trone_orderItem tCfg)
 {
     this.syn_flag       = 0;
     this.trone_order_id = tCfg.id;
     this.cp_id          = tCfg.cp_id;
     dBase.SaveData(this);
 }
Пример #3
0
 tbl_cp_mrItem ICPPushModel.SetPushed(Shotgun.Database.IBaseDataClass2 dBase, tbl_trone_orderItem tCfg)
 {
     this.syn_flag       = 1;
     this.trone_order_id = tCfg.id;
     this.cp_id          = tCfg.cp_id;
     dBase.SaveData(this);
     return(this.CopyToCP());
 }
Пример #4
0
        private bool IsMatch(LightDataModel.tbl_trone_orderItem m, string msg)
        {
            Regex rx;

            if (msg == null)
            {
                msg = string.Empty;
            }
            if (m.is_dynamic)
            {//CP可模糊的指令
                rx = Library.GetRegex(m.order_num);
                return(rx.IsMatch(msg));
            }
            //CP精确指令
            return(msg.Equals(m.order_num, StringComparison.OrdinalIgnoreCase));
        }
Пример #5
0
        /// <summary>
        /// 校验指令是否匹配
        /// </summary>
        /// <param name="cfg">配置通道</param>
        /// <param name="realMsg">传的真实指令</param>
        /// <returns></returns>
        public static bool IsMatch(LightDataModel.tbl_trone_orderItem cfg, string realMsg)
        {
            if (cfg.is_unknow)
            {
                return(false);
            }

            Regex rx;

            if (realMsg == null)
            {
                realMsg = string.Empty;
            }
            if (cfg.is_dynamic)
            {//CP可模糊的指令
                rx = Library.GetRegex(cfg.order_num);
                return(rx.IsMatch(realMsg));
            }
            //CP精确指令
            return(realMsg.Equals(cfg.order_num, StringComparison.OrdinalIgnoreCase));
        }