def run(self):
        while True:
            print(f"\n{'#':=<9}#\n# 预约前 #\n{'#':=<9}#")
            self.usPipe = UsPipeline()

            # print('数据库连接完毕...')
            data = self.usPipe.selAppointment()
            if not data:
                if hasattr(self, "usPay"):
                    del self.usPay
                print('没有数据, 等待中...', strftime('%m/%d %H:%M:%S'))
                sleep(5)
                os.system("cls")
                continue

            # =======
            # 数据处理
            # =======

            # 判断是否需要申请
            print('有数据进行提交\n')

            # 获取需要申请的人员信息
            self.usPay = AutoPay(
                data=self.usPipe.order_data, 
                usPipe=self.usPipe,  # noWin=True
            )
            email_info = self.usPipe.get_group_email(
                self.usPipe.order_data[0]["mpid"])
            if not email_info and email_info["status"] != 1:
                if not self.usPay.res["register_is"]:
                    self.register()
                self.usPay.payInfo()
            else:
                self.usPay.groupAppointment()
Exemple #2
0
def appointment(name):
    global app_datas, ids
    while 1:
        usPipe = UsPipeline()
        if app_datas.qsize():
            oid = app_datas.get(timeout=1)
            sql = "SELECT * FROM dc_business_america_order WHERE id=%s AND interview_status=7"
            order = usPipe.getOne(sql, oid)
            if not order:
                continue
            print(name, "有数据提交 order表 id:", oid)
            sql = "SELECT * FROM dc_business_america_public_eng WHERE order_id=%s"
            publics = usPipe.getAll(sql, order["id"])
            if not publics:
                continue
            infos = []
            works = []
            for i in publics:
                sql = "SELECT * FROM dc_business_america_info_eng WHERE aid=%s"
                infos.append(usPipe.getOne(sql, i["aid"]))
                sql = "SELECT * FROM dc_business_america_work_eng WHERE aid=%s"
                works.append(usPipe.getOne(sql, i["aid"]))

            autoPay = AutoPay(data=[order, publics, infos, works],
                              usPipe=usPipe,
                              noWin=True)
            if autoPay.group_pay_over(1):
                sleep(1)
                print(f"{name} - remove {oid}")
                ids.remove(oid)
        else:
            print(f"\n{name} No Datas ...", strftime("%m-%d %H:%M:%S"))
            sleep(30)
Exemple #3
0
    def run(self):
        # ========
        # 开始执行
        # ========
        while True:
            print(f"\n{'#':=<8}#\n# DS160 #\n{'#':=<8}#")
            print(strftime("%Y-%m-%d %H-%M-%S"))
            self.auto = UsPipeline()
            # print('数据库连接完毕...')

            # 获取数据库信息
            data = self.auto.selDBInfo
            # 判断是否需要申请
            if data:
                # =======
                # 数据处理
                # =======
                print('有数据进行提交\n')
                self.au = AllPage(data=self.auto.data,
                                  noWin=False,
                                  usPipe=self.auto)
                try:
                    self.control[self.au.resPublic["visa_status"]]()
                except Exception as e:
                    print(e)
                    if hasattr(self.au, 'driver'):
                        self.au.driver.quit()
                        self.au.getDriver()
            else:
                self.auto = None

                self.au = None

                print('没有数据, 等待中...', strftime('%m/%d %H:%M:%S'))
                sleep(5)
                # os.system("cls")
            try:
                self.au.driver.quit()
            except Exception:
                pass
Exemple #4
0
def main():
    while True:
        # r.run
        try:
            r = UsRun()
            r.run
            print(strftime("%Y-%m-%d %H-%M-%S"))
        except UsError as ue:
            print("in ue error")
            print(ue)
        except Exception as e:
            print("in e error")
            print(f"other:\n{e}")
            print("sleep 30s")
        finally:
            del r
        sleep(5)
Exemple #5
0
    def run(self):
        while True:
            if hasattr(self, "usPay"):
                del self.usPay
            print(f"\n{'#':=<7}#\n# 预约 #\n{'#':=<7}#")
            try:
                self.usPipe = UsPipeline()
            except:
                print('数据库连接超时...重连...')
                continue
            # print('数据库连接完毕...')
            data = self.usPipe.selDBOrder()
            if not data:
                print('没有数据, 等待中...', strftime('%m/%d %H:%M:%S'))
                sleep(5)
                os.system("cls")
                continue

            # =======
            # 数据处理
            # =======

            # 判断是否需要申请
            print('有数据进行提交\n')

            # 获取需要申请的人员信息
            self.usPay = AutoPay(data=self.usPipe.order_data,
                                 usPipe=self.usPipe,
                                 noWin=False)
            email_info = self.usPipe.get_group_email(
                self.usPipe.order_data[0]["mpid"])
            if email_info["status"] != 1:
                if self.id != self.usPay.res["id"]:
                    self.id = self.usPay.res["id"]
                    self.usPay.login()
                if self.usPay.res["python_status"] == 1 or self.usPay.res[
                        "interview_status"] == 4:
                    self.usPay.getDate()
                if self.usPay.res["interview_status"] == 4:
                    self.usPay.appointment()
                elif self.usPay.res["interview_status"] == 9:
                    self.usPay.cancel()
            else:
                self.usPay.group_pay_over()
Exemple #6
0
            self.au = None

            print('没有数据, 等待中...', strftime('%m/%d %H:%M:%S'))
            sleep(5)
            os.system("cls")


def main():
    while True:
        # r.run
        try:
            r = UsRun()
            r.run
        except UsError as ue:
            print("in ue error")
            print(ue)
        except Exception as e:
            print("in e error")
            print(f"other:\n{e}")
            print("sleep 30s")
        finally:
            del r
        sleep(5)


if __name__ == '__main__':
    # sleep(60)
    print(strftime("%Y-%m-%d %H-%M-%S"))
    main()