Ejemplo n.º 1
0
        private bool UseBack2PriceRule(PagePrice pp, BiddingPriceRequest req)
        {
            var  sec            = pp.pageTime.Second;
            var  offeredPrice   = req.TargetPrice;
            var  PriceAt50      = biddingContext.GetPrice(50);
            int  PriceBack2     = biddingContext.GetPrice(sec - 2);
            bool price50Matched = sec > 50 && PriceAt50 > 0 && offeredPrice >= (PriceAt50 + DrawbackDeltaPrice + 100);

            if (!price50Matched)
            {
                return(false);
            }

            bool priceBack2Matched = sec >= 54 && PriceBack2 > 0 && (pp.basePrice - PriceBack2) >= 200;

            if (!priceBack2Matched)
            {
                return(false);
            }

            bool     matched   = false;
            int      delay     = -1;
            DateTime occurTime = DateTime.Now;

            if (offeredPrice == (pp.basePrice + 300 + 100)) // 提前 100
            {
                delay   = KK.RandomInt(Delay1Start, Delay1End);
                matched = true;
            }
            else if (offeredPrice == (pp.basePrice + 300 + 200))
            {
                delay   = KK.RandomInt(Delay2Start, Delay2End);
                matched = true;
            }
            else if (offeredPrice == (pp.basePrice + 300 + 300))
            {
                delay   = KK.RandomInt(Delay3Start, Delay3End);
                matched = true;
            }

            if (matched)
            {
                req.CanSubmit          = true;
                req.ComputedDelayMills = delay;
                req.SubmitMemo         = "Back2 Rule";
            }

            return(matched);
        }
Ejemplo n.º 2
0
        public void SafeCheck(object state)
        {
            try
            {
                int dice   = KK.RandomInt(54, 59);
                int minute = DateTime.Now.Minute;
                loggingChk = minute > dice;

                CheckState(state);
            }
            catch (Exception e)
            {
                logger.Error("Safe check error", e);
            }
        }
Ejemplo n.º 3
0
        private bool UseBack3PriceRule(PagePrice pp, BiddingPriceRequest req)
        {
            var  sec            = pp.pageTime.Second;
            var  offeredPrice   = req.TargetPrice;
            var  PriceAt50      = biddingContext.GetPrice(50);
            int  PriceBack2     = biddingContext.GetPrice(sec - 2);
            bool price50Matched = sec > 50 && PriceAt50 > 0 && offeredPrice >= (PriceAt50 + DrawbackDeltaPrice + 100);

            if (!price50Matched)
            {
                return(false);
            }

            bool priceBack3Matched = sec >= 56 && (pp.basePrice - biddingContext.GetPrice(sec - 3)) == 200;

            if (!priceBack3Matched)
            {
                return(false);
            }

            bool     matched   = false;
            int      delay     = -1;
            DateTime occurTime = DateTime.Now;

            if (offeredPrice == pp.basePrice + 300 + 100) // 提前100
            {
                delay   = KK.RandomInt(delayOneS, delayOneE);
                matched = true;
            }
            // 20190714 增加判断 连续变动价格(100)
            else if (offeredPrice == pp.basePrice + 300 + 200) // 提前 200
            {
                delay   = KK.RandomInt(delayTwoS, delayTwoE);
                matched = true;
            }

            if (matched)
            {
                req.CanSubmit          = true;
                req.ComputedDelayMills = delay;
                req.SubmitMemo         = "Back3 Rule";
            }

            return(matched);
        }
Ejemplo n.º 4
0
        private bool UseFinalRule(PagePrice pp, BiddingPriceRequest req)
        {
            if (pp.pageTime.Hour >= FinalTime.Hour &&
                pp.pageTime.Minute >= FinalTime.Minute &&
                pp.pageTime.Second >= FinalTime.Second
                )
            {
                var priceAt53 = biddingContext.GetPrice(53);
                var priceAt54 = biddingContext.GetPrice(54);
                var priceAt55 = biddingContext.GetPrice(55);
                var priceAt56 = biddingContext.GetPrice(56);

                int    delay;
                string memo;

                // 并且53秒到56秒之间价格未变动,则随机延迟700到1500毫秒之后提交,否则随机延迟200到1200毫秒之后提交。
                if (priceAt53 == priceAt54 && priceAt54 == priceAt55 && priceAt55 == priceAt56)
                {
                    delay = KK.RandomInt(ForceStart1, ForceEnd1);
                    memo  = "Final Rule NoChange";
                }
                else
                {
                    delay = KK.RandomInt(ForceStart, ForceEnd);
                    memo  = "Final Rule";
                }

                DateTime occurTime = DateTime.Now;
                req.CanSubmit          = true;
                req.ComputedDelayMills = delay;
                req.SubmitMemo         = memo;

                return(true);
            }

            return(false);
        }
        protected override JsonCommand DoExecute(BidAccountLoginRequest req)
        {
            logger.InfoFormat("Execute BidAccountLogin: MachineCode is {0}, coords is {1}, ScreenModeVal is {2}", req.MachineCode, req.LoginCoords, req.ScreenModeVal);

            // string bidNo, string password, string idCardNo, bool clickLoginButton
            var coords = req.LoginCoords;
            var arr    = coords.Split(';');
            var p1     = CoordPoint.FromAndAdjustRemote(arr[0]);
            var p2     = CoordPoint.FromAndAdjustRemote(arr[1]);
            var p3     = CoordPoint.FromAndAdjustRemote(arr[2]);

            bool isAbsolute = false;

            if (req.ScreenModeVal == 10)
            {
                isAbsolute = true;
            }


            Task ta = loginActManager.LoginBidAccount(req.BidAccountNo, req.BidAccountPswd, req.BidAccountIdCard, false);

            ta.ContinueWith((task) =>
            {
                bidActionManager.ClickBtnOnceAtPoint(p1, "验证码坐标 点1", isAbsolute, KK.RandomInt(100, 500));
                bidActionManager.ClickBtnOnceAtPoint(p2, "验证码坐标 点2", isAbsolute, KK.RandomInt(100, 500));
                bidActionManager.ClickBtnOnceAtPoint(p3, "验证码坐标 点3", isAbsolute, KK.RandomInt(100, 500));

                loginActManager.ClickLoginButton();
            });

            // ta.Wait();

            // ThreadUtils.StartNewTaskSafe();


            return(null);
        }
Ejemplo n.º 6
0
        private void _LoginBidAccount(string bidNo, string password, string idCardNo, bool clickLoginButton)
        {
            // 登录页
            var p21 = actionManager.DeltaPoint(610, 168);
            var p22 = actionManager.DeltaPoint(610, 218);
            var p23 = actionManager.DeltaPoint(610, 264);

            actionManager.InputTextAtPoint(p21, bidNo, true, "投标号");
            KK.Sleep(KK.RandomInt(100, 500));

            actionManager.InputTextAtPoint(p22, password, true, "密码");
            KK.Sleep(KK.RandomInt(100, 500));

            // 可能需要输入身份证 - 身份证
            isIdCardShow = IsIdCardNeeded();
            if (isIdCardShow)
            {
                actionManager.InputTextAtPoint(p23, idCardNo, true, "身份证");
            }
            else
            {
                var p231 = actionManager.DeltaPoint(610, 256);
                actionManager.InputTextAtPoint(p231, idCardNo, true, "身份证");
            }

            KK.Sleep(KK.RandomInt(100, 500));

            //this.inputCaptchaAtLogin(p23, "301726");
            //this.clickLoginAtLogin(p24);
            if (clickLoginButton)
            {
                ClickLoginButton();
            }

            logger.InfoFormat("login account#{0} ", bidNo);
        }