def add_home_provider_serials(self):
        # 批量添加房源信息,空间信息
        payload = hmpv.add_house_provider()
        home_provider_name = hmpv.add_house_provider()["providerName"]
        req_url = pu.house_manage_urls()["add_home_source_provider_url"]
        r = requests.post(req_url, json=payload)
        rsp = json.loads(r.text)
        # 添加房源信息
        if r.status_code == 200:
            provider_id = db.house_source_sql("get_provider_name_and_id",
                                              home_provider_name)
            payload = hmpv.add_house_source()
            payload["providerId"] = provider_id
            req_url = pu.house_manage_urls()["add_home_source_url"]
            r = requests.post(req_url, json=payload)
            home_source_name = payload["homeSourceName"]

            if r.status_code:
                # 添加空间信息
                payload = hmpv.add_space()
                payload["homeSourceId"] = db.house_source_sql(
                    "get_home_source_id", home_source_name)
                req_url = pu.house_manage_urls()["add_space_url"]
                r = requests.post(req_url, json=payload)
            else:
                pass
        else:
            pass
 def add_home_provider(self):
     payload = hmpv.add_house_provider()
     CustomerManage.home_provider_name = payload["providerName"]
     req_url = pu.house_manage_urls()["add_home_source_provider_url"]
     aa = self.ck
     r = requests.post(req_url, json=payload, cookies=self.ck)
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     # 检查provider name
     self.result_check(r,
                       operate_time,
                       payload,
                       payload["providerName"],
                       query_type="get_home_provider_info")
 def update_space(self):
     payload = hmpv.update_space()
     payload["homeSourceId"] = CustomerManage.home_source_id
     payload["id"] = db.house_source_sql("get_space_id",
                                         CustomerManage.home_no)
     req_url = pu.house_manage_urls()["update_space_url"]
     r = requests.post(req_url, json=payload, cookies=self.ck)
     CustomerManage.home_source_id = payload["homeSourceId"]
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     self.result_check(r,
                       operate_time,
                       payload,
                       CustomerManage.space_id,
                       query_type="get_space_info")
    def update_house_source(self):

        payload = hmpv.update_house_source()
        payload["id"] = db.house_source_sql("get_home_source_id",
                                            CustomerManage.home_source_name)
        payload["providerId"] = str(CustomerManage.provider_id)
        req_url = pu.house_manage_urls()["update_home_source_url"]
        r = requests.post(req_url, json=payload, cookies=self.ck)

        # 检查 homeSourceName, providerId,id,types,删除状态
        operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
        CustomerManage.home_source_name = payload["homeSourceName"]
        self.result_check(r,
                          operate_time,
                          payload,
                          payload["homeSourceName"],
                          query_type="get_home_source_info")
    def add_house_source(self):

        payload = hmpv.add_house_source()
        payload["providerId"] = db.house_source_sql(
            "get_provider_name_and_id", CustomerManage.home_provider_name)

        req_url = pu.house_manage_urls()["add_home_source_url"]
        r = requests.post(req_url, json=payload, cookies=self.ck)
        CustomerManage.home_source_name = payload["homeSourceName"]
        CustomerManage.addrCode = payload["addrCode"]
        CustomerManage.provider_id = payload["providerId"]
        operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
        self.result_check(r,
                          operate_time,
                          payload,
                          payload["homeSourceName"],
                          query_type="get_home_source_info")
 def add_space(self):
     payload = hmpv.add_space()
     payload["homeSourceId"] = db.house_source_sql(
         "get_home_source_id", CustomerManage.home_source_name)
     req_url = pu.house_manage_urls()["add_space_url"]
     r = requests.post(req_url, json=payload, cookies=self.ck)
     CustomerManage.home_source_id = payload["homeSourceId"]
     CustomerManage.home_no = payload["homeNo"]
     # homelist 检查id,homeSourceId,homeNo,floorNum,del
     # 通过homeSourceId,homeNo确定space 的id
     CustomerManage.space_id = db_wc.house_manage_web_check(
         "get_space_id", payload["homeSourceId"], payload["homeNo"])
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     self.result_check(r,
                       operate_time,
                       payload,
                       CustomerManage.space_id,
                       query_type="get_space_info")
    def delete_home_provider(self):
        home_provide_id = hmpv.delete_house_provider()
        req_url = pu.house_manage_urls()["delete_home_source_provider"] + str(
            home_provide_id) + "/deleteRecordById"
        r = requests.get(req_url, cookies=self.ck)
        operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
        query_result = db_wc.house_manage_web_check(
            "get_home_provider_info", CustomerManage.home_provider_name)
        # id,providerName,del,enterpriseAccountId
        payload = dict()

        payload["del_status"] = query_result[2]
        payload["id"] = query_result[0]
        self.result_check(r,
                          operate_time,
                          payload,
                          CustomerManage.home_source_name,
                          query_type="get_home_provider_info",
                          del_home_source=True)
 def delete_house_source(self):
     house_source_id = hmpv.delete_house_source()
     req_url = pu.house_manage_urls()["delete_home_source_url"] + str(
         house_source_id) + "/deleteRecordById"
     r = requests.get(req_url, cookies=self.ck)
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     # id,types,providerId,homeSourceName,del
     query_result = db_wc.house_manage_web_check(
         "get_home_source_info", CustomerManage.home_source_name)
     payload = dict()
     payload["homeSourceName"] = query_result[3]
     payload["providerId"] = query_result[2]
     payload["types"] = query_result[1]
     payload["del"] = query_result[4]
     self.result_check(r,
                       operate_time,
                       payload,
                       CustomerManage.home_source_name,
                       query_type="get_home_source_info",
                       del_home_source=True)
 def delete_space(self):
     space_id = hmpv.delete_space()
     req_url = pu.house_manage_urls()["delete_space_url"] + str(
         space_id) + "/deleteRecordById"
     r = requests.get(req_url, cookies=self.ck)
     operate_time = datetime.datetime.now().strftime("%H:%M:%S.%f")
     # 获取删除后的信息
     payload = dict()
     query_result = db_wc.house_manage_web_check("get_space_info", space_id)
     # id,homeSourceId,homeNo,isPublic,floorNum,homeType,del
     payload["floorNum"] = query_result[4]
     payload["homeNo"] = query_result[2]
     payload["homeSourceId"] = query_result[1]
     payload["del_status"] = query_result[6]
     self.result_check(r,
                       operate_time,
                       payload,
                       CustomerManage.space_id,
                       query_type="get_space_info",
                       del_space=True)