Esempio n. 1
0
 def run(self):
     import logging, time
     version = '6.5'
     timenow = time.time()
     # 转换成localtime
     time_local = time.localtime(timenow)
     # 转换成新的时间格式(2016-05-09 18:59:20)
     myapplog = 'mylog'
     logging.basicConfig(
         level=logging.DEBUG,
         format=
         '%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
         datefmt='%a, %d %b %Y %H:%M:%S',
         filename='%s.l-og' % myapplog,
         filemode='w')
     root = logging.getLogger()
     print(root.name, type(root), root.parent, id(root))
     ## getwebpath()  # 初始化浏览器地址
     # 图片打开提速
     # yanzhengma_img = Image.open("yanzhengma.png")  # 打开图片的全局变量 ,提升第一次打开的速度
     # set_val('yanzhengma_img', yanzhengma_img)
     # 变量初始化
     from component.variable import Create_hash, init_val
     Create_hash()
     init_val()
     set_val('version', version)
     ###获取路径+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
     path = get_val('path')
     iconpath = path + 'logo.ico'  # 图标路径
     set_val('mainicon', iconpath)
     #获取默认浏览器位置
     getwebpath()
Esempio n. 2
0
    def __init__(self, name, code):  ##########版本号
        mainicon = 'logo.ico'
        wx.Frame.__init__(self, None, -1, name, size=(300, 240), style=wx.CAPTION | wx.CLOSE_BOX)
        id = self.GetId()
        set_val('loginframe', id)

        id = get_val('loginframe')
        print(id)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.icon = wx.Icon(mainicon, wx.BITMAP_TYPE_ICO)
        self.SetIcon(self.icon)

        # panel = wx.Panel(self)
        # self.notebook = wx.Notebook(panel)
        # self.code_tab = Identify_codePanel(self.notebook, user, psd)
        # self.notebook.AddPage(self.code_tab, "激活码登录")
        # self.account_tab = AccountPanel(self.notebook, user, psd)  # notebook作为父类
        # self.notebook.AddPage(self.account_tab, "账号登录")
        # sizer = wx.BoxSizer(wx.VERTICAL)
        # sizer.Add(self.notebook, 1, wx.ALL | wx.EXPAND, 5)
        # panel.SetSizer(sizer)
        self.panel = Identify_codePanel(self, code)
        self.Layout()
        # 初始化居中
        self.Center()

        pub.subscribe(self.connect_success, "connect")
Esempio n. 3
0
 def auto_yanzhengma(self):
     ###自动验证码打开
     a_time = get_val('a_time')
     Position_frame = get_val('Position_frame')
     auto_yanzhengma_time = get_val('auto_yanzhengma_time')
     auto_query_on = get_dick('auto_query_on')
     auto_yanzhengma_on = get_val('auto_yanzhengma_on')
     yanzhengma_view = get_val('yanzhengma_view')
     if not yanzhengma_view:
         if auto_query_on and not auto_yanzhengma_on and auto_yanzhengma_time < a_time < auto_yanzhengma_time + 0.5:
             moni_on = get_val('moni_on')
             if not moni_on:
                 setText(str(100000))  # 出一定超出的价格
                 selfdelete()
             else:
                 Paste_moni(100000)
             Click(Position_frame[1][0], Position_frame[1][1])
             set_val('auto_yanzhengma_on', True)
             timer1 = threading.Timer(8, self.close_yanzhengma)  ##8秒后关闭
             timer1.start()
             wx.CallAfter(pub.sendMessage,
                          'update info',
                          action='触发验证码自动预览')
         elif a_time < auto_yanzhengma_time:
             set_val('auto_yanzhengma_on', False)  ##设置成查看状态
Esempio n. 4
0
def findconfirm():
    dick_target = get_val('dick_target')
    smartprice_chujia = get_val('smartprice_chujia')
    template = dick_target[1]
    imgpos_confirm = get_val('imgpos_confirm')
    sc = imgpos_confirm
    img = cv2.cvtColor(sc, cv2.COLOR_BGR2GRAY)  # 转灰度图
    w, h = template.shape[::-1]
    res = cv2.matchTemplate(img, template, cv2.TM_CCOEFF_NORMED)
    min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
    if max_val >= 0.7:
        # print(max_val, smartprice_chujia)
        if not smartprice_chujia:
            OnClick_confirm()  #点击确认
        else:
            print("找到确认")
            Smart_chujia()
        ##结果查找
        need_findresult = get_val('need_findresult')
        if need_findresult:
            print("查找结果")
            get_result()  ##确认结果
        #再判定是否需要点击确认

    else:
        set_val('need_findresult', True)
Esempio n. 5
0
 def close_yanzhengma(self):
     Position_frame = get_val('Position_frame')
     auto_yanzhengma_on = get_val('auto_yanzhengma_on')
     print(auto_yanzhengma_on)
     # if auto_yanzhengma_on:
     Click(Position_frame[7][0], Position_frame[7][1])
     print("fsdfsdsfs")
     self.tipframe.Show(False)
     set_val('auto_yanzhengma_on', False)  ##设置成查看状态
Esempio n. 6
0
 def Second_tijiaoyanchi_time_smart3(self, event):
     one_delay_smart3 = get_val('one_delay_smart3')
     tem = self.second_tijiaoyanchi_time_smart3.GetValue()
     yanchilist = get_val('yanchilist')
     if int(tem * 10) in yanchilist:
         set_val('one_delay_smart3', float(tem))
         self.update_strategy()
     else:
         self.second_tijiaoyanchi_time_smart3.SetValue(one_delay_smart3)
Esempio n. 7
0
def Hotkey_close():
    try:
        for id in HOTKEYS1.keys():
            user32.UnregisterHotKey(None, id)
        for id in HOTKEYS2.keys():
            user32.UnregisterHotKey(None, id)
        set_val('hotkey_on', False)
    except:
        set_val('hotkey_on', True)
    finally:
        pass
Esempio n. 8
0
def init_strategy():
    set_val('smartprice_chujia', False)
    strategy_type = get_dick('strategy_type')
    init_description()
    if strategy_type == '0':
        init_strategy0()
    elif strategy_type == '1':
        init_strategy1()
    elif strategy_type == '2':
        init_strategy2()
    elif strategy_type == '3':
        init_strategy3()
Esempio n. 9
0
 def draw_text(self, dc, text, pos):
     pageindex = get_val('pageindex')
     set_val('pageindex', pageindex + 1)
     vars = [0, 20, 0, pageindex + 1]
     print('vars', pageindex)
     self.SetScrollbars(*vars, noRefresh=True)
     range = self.GetScrollRange(0)
     self.SetScrollPos(0, range)
     # self.Scroll(0, pageindex*7)
     x1, y1 = pos
     dc.SetFont(self.infofont)
     dc.DrawText(text, x1, y1)
Esempio n. 10
0
 def init_info(self):
     action_infos = get_val('action_infos')
     len_info = len(action_infos)
     print("fdsfsfdsfds")
     if len_info > 5:
         self.infos = [action for action in action_infos[-6:]]
         self.update_info()
     else:
         new_actions = get_val('new_actions')
         self.infos = [self.create_info(action) for action in new_actions]
         self.update_info()
         set_val('action_infos', copy.deepcopy(self.infos))
Esempio n. 11
0
 def Yanzhengma_scale(self):
     ##------------------------------
     ###判定验证码放大框
     final_stage = get_val('final_stage')
     yanzhengma_view = get_val('yanzhengma_view')
     Yanzhengmasize = get_val('Yanzhengmasize')
     if final_stage:
         find_yan_confirm()
         yanzhengma_scale = get_dick('yanzhengma_scale')
         if yanzhengma_scale:
             yanzhengma_close = get_val("yanzhengma_close")
             if yanzhengma_close:
                 try:
                     if self.yanzhengmaframe.IsShown():
                         self.yanzhengmaframe.Show(False)
                         self.tipframe.Show(False)  ##关闭提交提示
                         set_val('auto_yanzhengma_on',
                                 False)  ##关闭自动关闭验证码的触发
                         self.currentstatusframe.Show(True)
                         set_val('yanzhengma_view', False)  #开关与动作在一起
                 except:
                     logger.exception('this is an exception message')
             #验证码放大是否需要刷新
             if yanzhengma_view:
                 auto_yanzhengma_on = get_val("auto_yanzhengma_on")
                 set_val('yanzhengma_close', False)
                 path = get_val('path')
                 yanpath = path + "\\yanzhengma.png"
                 cut_pic(Yanzhengmasize, yanpath)  # 直接调用得到 png 保存图片
                 try:
                     yanpath = get_val('yanpath')
                     yan = self.yanzhengmaframe
                     yan.Show()
                     yan.ShowImage(yanpath)
                     self.currentstatusframe.Show(False)
                     ##打开提示
                     if not auto_yanzhengma_on:
                         self.tipframe.Show(True)
                         self.tipframe.ShowImage('icons/tip1.png')
                     else:
                         self.tipframe.Show(True)
                         self.tipframe.ShowImage('icons/tip2.png')
                 except:  # 找不到的情况下也要重新创建
                     logger.exception('this is an exception message')
                 finally:
                     pass
     else:
         set_val('yanzhengma_view', False)
         set_val('yanzhengma_close', True)
         if self.yanzhengmaframe.IsShown():
             self.yanzhengmaframe.Show(False)
             self.currentstatusframe.Show(True)
Esempio n. 12
0
 def Second_tijiao_time_smart1(self, event):
     one_time2_smart1 = get_val('one_time2_smart1')
     one_time2_smart2 = get_val('one_time2_smart2')
     tem = self.second_tijiao_time_smart1.GetValue()
     timelist = get_val('timelist')
     strategy_type = get_dick('strategy_type')
     one_time1 = get_val('one_time1')
     second_time1 = get_val('second_time1')
     if strategy_type == '2':
         if int(
                 tem * 10
         ) in timelist and tem <= one_time2_smart2 - 1 and tem >= one_time1 + 1:
             print(one_time2_smart2, tem)
             one_time2_smart1 = tem
             set_val('one_time2_smart1', float(tem))
             set_val('one_realtime2_smart1',
                     gettime(one_time2_smart1))  # 计算得到的时间戳
             self.update_strategy()
         else:
             self.second_tijiao_time_smart1.SetValue(one_time2_smart1)
     elif strategy_type == '3':
         if int(
                 tem * 10
         ) in timelist and tem <= one_time2_smart2 - 1 and tem >= second_time1 + 1:
             one_time2_smart1 = tem
             set_val('one_time2_smart1', float(tem))
             set_val('one_realtime2_smart1',
                     gettime(one_time2_smart1))  # 计算得到的时间戳
             self.update_strategy()
         else:
             self.second_tijiao_time_smart1.SetValue(one_time2_smart1)
Esempio n. 13
0
def Smart_chujia():
    Position_frame = get_val('Position_frame')
    moni_on = get_val('moni_on')
    Click(Position_frame[4][0], Position_frame[4][1])  ##确认
    price = smart_price()  ##智能计算出价
    set_val('userprice', price)  ##保存用户出价
    if moni_on:
        wx.CallAfter(pub.sendMessage, 'moni smartchujia', price=price)
        # wx.CallAfter(self.call, 1, ‘abc’, name=”ccc”, help=”test”)
        # wx.FutureCall(5000, self.call, ‘call after 100ms’, name=”test”)
    else:
        print("国拍智能出价")
        guopai_chujia(price)
    userprice = get_val('userprice')
Esempio n. 14
0
 def Second_tijiao_time_smart(self, event):
     one_time2_smart = get_val('one_time2_smart')
     tem = self.second_tijiao_time_smart.GetValue()
     timelist = get_val('timelist')
     one_time2_smart3 = get_val('one_time2_smart3')
     if int(tem * 10) in timelist and tem >= one_time2_smart3:
         one_time2_smart = tem
         set_val('one_time2_smart', float(tem))
         set_val('one_realtime2_smart',
                 gettime(one_time2_smart))  # 计算得到的时间戳
         print(gettime(one_time2_smart))
         self.update_strategy()
     else:
         self.second_tijiao_time_smart3.SetValue(one_time2_smart)
Esempio n. 15
0
def find_yan_confirm():
    try:
        dick_target = get_val('dick_target')
        template = dick_target[1]
        imgpos_yanzhengmaconfirm = get_val('imgpos_yanzhengmaconfirm')
        sc = imgpos_yanzhengmaconfirm
        img = cv2.cvtColor(sc, cv2.COLOR_BGR2GRAY)  # 转灰度图
        w, h = template.shape[::-1]
        res = cv2.matchTemplate(img, template, cv2.TM_CCOEFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        yanzhengma_control = get_val('yanzhengma_control')

        if max_val > 0.9 and yanzhengma_control:
            set_val('yanzhengma_view', True)
            # smartprice_chujia = get_val('smartprice_chujia')
            # if smartprice_chujia:
            #     set_val('smartprice_tijiao', True)  ##这代表出价成功
        elif max_val <= 0.9:
            set_val('yanzhengma_view', False)
            set_val('yanzhengma_close', True)
            set_val('yanzhengma_control', True)
            smartprice_tijiao = get_val('smartprice_tijiao')
            # if smartprice_tijiao:
            #     set_val('smartprice_tijiao', False)  ##这代表出价成功
            #     set_val('smartprice_chujia', False)
    except:
        logger.exception("error message")
Esempio n. 16
0
 def run(self):
     """Run Worker Thread."""
     # This is the code executing in the new thread.
     from component.remote_control import web_request
     try:
         remotetime_url = get_val('remotetime_url')
         result = web_request(remotetime_url)
         remotetime = result['currenttime']
         print("获取成功")
         set_val('true_time', remotetime + 0.06)  # 补网络延迟
         set_val('a_time', remotetime + 0.06)  # 补网络延迟
         setSystemTime(remotetime)  ##同步本地时间
     except:
         print("获取成功")
         logger.exception('this is an exception message')
Esempio n. 17
0
 def Modify(self):  # 更新
     dc = wx.BufferedDC(
         wx.ClientDC(self))  # ClientDC客户区  ,BufferedDC双缓冲绘图设备
     moni_on = get_val('moni_on')
     true_time = get_val('true_time')
     time_local = time.localtime(true_time)
     st = time.strftime("%H:%M:%S", time_local)  # + '.' + str(b_time)
     # st="%s:%s:%s"%(b_time[0],b_time[1],b_time[2])
     set_val('true_time_str', st)
     st = '国拍时间:%s' % st
     w, h = self.GetClientSize()
     dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
     dc.Clear()
     dc.SetFont(self.timefont)
     tw, th = dc.GetTextExtent(st)
     dc.DrawText(st, (w - tw) / 2, (h) / 2 - th / 2)
Esempio n. 18
0
def get_result():
    result_dick = get_val('result_dick')
    imgpos_result = get_val('imgpos_result')
    print(imgpos_result)
    imgpos_result = cv2.cvtColor(imgpos_result, cv2.COLOR_BGR2GRAY)
    for result, img in result_dick.items():
        print(result)
        res = cv2.matchTemplate(img, imgpos_result, cv2.TM_CCOEFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        print('max_val=', max_val)
        if max_val >= 0.7:
            set_val('need_findresult', False)  ##关闭
            wx.CallAfter(pub.sendMessage, 'update info', action=result)
            return result
    print('未知')
    return '未知结果'
Esempio n. 19
0
def getwebpath():
    # 查找注册表键值
    try:
        key = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT,
                             r"http\shell\open\command")
        name, value, type = winreg.EnumValue(key, 0)
        pattern = re.compile("\"*(.+\.exe)")
        result = re.findall(pattern, value)
        if result:
            needpath = result[0]
            set_val('needpath', needpath)
            # needpath='"'+result[0]+'"'
        if not os.path.exists(needpath):
            if os.path.exists('C:\Program Files (x86)'):
                pass
    except:
        logger.exception('this is an exception message')
Esempio n. 20
0
 def Second_tijiao_time_smart2(self, event):
     one_time2_smart1 = get_val('one_time2_smart1')
     one_time2_smart2 = get_val('one_time2_smart2')
     one_time2_smart3 = get_val('one_time2_smart3')
     tem = self.second_tijiao_time_smart2.GetValue()
     timelist = get_val('timelist')
     if int(
             tem * 10
     ) in timelist and tem <= one_time2_smart3 - 1 and tem >= one_time2_smart1 + 1:
         print(one_time2_smart1, one_time2_smart2, one_time2_smart3)
         one_time2_smart2 = tem
         set_val('one_time2_smart2', float(tem))
         set_val('one_realtime2_smart2',
                 gettime(one_time2_smart2))  # 计算得到的时间戳
         self.update_strategy()
     else:
         self.second_tijiao_time_smart2.SetValue(one_time2_smart2)
Esempio n. 21
0
def Cancel_chujia():
    tijiao_on = get_val('tijiao_on')
    yanzhengma_find = get_val('yanzhengma_find')
    tijiao_ok = get_val('tijiao_ok')
    if tijiao_on and not yanzhengma_find and not tijiao_ok:
        print("触发2")
        Position_frame = get_val('Position_frame')
        Click(Position_frame[7][0], Position_frame[7][1])  # 取消
        userprice = get_val('userprice')
        setText(str(userprice))
        selfdelete()
        Click(Position_frame[1][0], Position_frame[1][1])
        Click(Position_frame[6][0], Position_frame[6][1])
        # 验证码放大打开
        set_val('yanzhengma_close', True)  # 打开验证码放大器 查找确认
        ##提交关闭
        set_val('tijiao_OK', False)
Esempio n. 22
0
def selfChujia():
    Position_frame = get_val('Position_frame')
    Click(Position_frame[4][0], Position_frame[4][1])
    Click(Position_frame[0][0], Position_frame[0][1])
    Click(Position_frame[1][0], Position_frame[1][1])
    Click(Position_frame[6][0], Position_frame[6][1])
    set_val('price_view', True)
    set_val('price_count', 0)
    set_val('yanzhengma_count', 0)
    set_val('yanzhengma_view', True)
Esempio n. 23
0
def esc_chujia():
    Position_frame = get_val('Position_frame')
    moni_on = get_val('moni_on')
    Click(Position_frame[7][0], Position_frame[7][1])  # 取消
    Click(Position_frame[4][0], Position_frame[4][1])  ##确认
    price = smart_price()  ##智能计算出价
    set_val('userprice', price)  ##保存用户出价
    if moni_on:
        wx.CallAfter(pub.sendMessage, 'moni smartchujia', price=price)
        # wx.CallAfter(self.call, 1, ‘abc’, name=”ccc”, help=”test”)
        # wx.FutureCall(5000, self.call, ‘call after 100ms’, name=”test”)
    else:
        guopai_chujia(price)
    userprice = get_val('userprice')
    # set_val('smartprice_chujia', True)  #启动自动补枪 转化为智能出价模式
    # smartprice_chujia = get_val('smartprice_chujia')
    # print('smartprice_chujia', smartprice_chujia)
    wx.CallAfter(pub.sendMessage, 'update info', action=f'智能出价出价{userprice}')
Esempio n. 24
0
def timeset(imgpos_currenttime):
    try:
        currenttime = cv2.cvtColor(imgpos_currenttime, cv2.COLOR_BGR2GRAY)
        cv2.imwrite('time.png', currenttime)
        currenttime = readpic(currenttime)  # 识别出来的时间
        # print(currenttime)
        a_time = get_val('a_time')
        tem1 = time.time()
        a = time.strftime('%Y-%m-%d', time.localtime(tem1))
        b = a + ' ' + currenttime
        a_time_temp = time.mktime(time.strptime(
            b, '%Y-%m-%d %H:%M:%S')) + 0.6  # 转时间戳   补个平均时差

        if a_time_temp - 0.9 <= a_time <= a_time_temp + 0.9:
            pass
        else:
            set_val('a_time', a_time_temp)
    except:
        logger.exception('this is an exception message')
Esempio n. 25
0
 def OnClose(self, event):
     set_val('web_on', False)
     set_val('view_time', False)
     set_val('moni_on', False)
     set_val('guopai_on', False)
     self.yanzhengmaframe.Show(False)
     self.tipframe.Show(False)
     self.currentstatusframe.Show(False)
     event.Skip()
     id = get_val('topframe')
     topframe = wx.FindWindowById(id)
     topframe.Show(True)
Esempio n. 26
0
def findfirstprice():
    try:
        print('findfirstprice')
        dick_target = get_val('dick_target')
        template = dick_target[4]
        template2 = dick_target[5]
        sc = grab_screen()
        img = np.asarray(sc)
        w, h = template.shape[::-1]
        res = cv2.matchTemplate(img, template, cv2.TM_CCOEFF_NORMED)
        min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res)
        res2 = cv2.matchTemplate(img, template2, cv2.TM_CCOEFF_NORMED)
        min_val, max_val2, min_loc, max_loc = cv2.minMaxLoc(res2)
        if max_val >= 0.9 or max_val2 >= 0.9:
            set_val('firstprice_done', True)
        else:
            set_val('firstprice_done', False)
    except:
        pass
Esempio n. 27
0
 def Second_tijiao_pricediff_smart3(self, event):
     select = self.second_tijiao_pricediff_smart3.GetString(
         self.second_tijiao_pricediff_smart3.GetSelection())
     if select == u"提前100":
         set_val('one_advance_smart3', 100)
     elif select == u"提前200":
         set_val('one_advance_smart3', 200)
     elif select == u"提前300":
         set_val('one_advance_smart3', 300)
     else:
         set_val('one_advance_smart3', 0)
     self.update_strategy()
Esempio n. 28
0
 def run(self):
     for i in range(10000000):
         time.sleep(0.035)
         lowest_price = get_val('lowest_price')
         pricelist = get_val('pricelist')
         a_time = get_val('a_time')
         try:
             price = int(Price_read())  # 获取当前最低价
             if price in pricelist:  # 字典查找
                 set_val('findpos_on', False)
                 if lowest_price == price:
                     trans_time()  # 保存价格
                 else:
                     set_val('lowest_price', price)
                     trans_time()  # 保存价格
                     set_val('changetime', a_time)
             else:
                 set_val('findpos_on', True)
         except:
             set_val('findpos_on', True)
Esempio n. 29
0
 def childmove(self, event):
     #位置重新计算
     Px, Py = self.Position
     init_pos(Px, Py)
     set_val('Px', Px)
     set_val('Py', Py)
     x, y = self.Position
     x0, y0 = get_val('CurrentStatusFramePos')
     self.currentstatusframe.Move(x + x0, y + y0)
     x1, y1 = get_val('YanzhengmaFramePos')
     try:
         self.yanzhengmaframe.Move(x + x1, y + y1)  # 移动到新位置
     except:
         logger.exception('this is an exception message')
     x2, y2 = get_val('TipFramePos')
     try:
         self.tipframe.Move(x + x2, y + y2)  # 移动到新位置
     except:
         logger.exception('this is an exception message')
     wx.CallAfter(pub.sendMessage, 'dialog close')
Esempio n. 30
0
    def urlchange(self, event):
        guopai_dianxin = get_val('guopai_dianxin')
        urlchange_dianxin_label = get_val('urlchange_dianxin_label')
        urlchange_nodianxin_label = get_val('urlchange_nodianxin_label')
        if guopai_dianxin:
            self.urlchange_button.SetLabel(urlchange_dianxin_label)
            set_val('guopai_dianxin', False)
            url_nodianxin = get_val('url_nodianxin')
            print(url_nodianxin, 'url_nodianxin')
            self.parent.htmlpanel.webview.LoadURL(url_nodianxin)
            nodianxin_webstatus_label = get_val('nodianxin_webstatus_label')
            self.webstatus.SetLabel(nodianxin_webstatus_label)

        else:
            self.urlchange_button.SetLabel(urlchange_nodianxin_label)
            set_val('guopai_dianxin', True)
            url_dianxin = get_val('url_dianxin')
            print(url_dianxin)
            self.parent.htmlpanel.webview.LoadURL(url_dianxin)
            dianxin_webstatus_label = get_val('dianxin_webstatus_label')
            self.webstatus.SetLabel(dianxin_webstatus_label)