# -*- coding:utf-8 -*- """ 国家信息管理业务关键字层 """ import allure from dulizhan.library.Dlizhan_interface import DlzhanInterface from base_framework.public_tools import log obj_log = log.get_logger() class AddressCountryManage(DlzhanInterface): """国家信息管理业务关键字类""" def __init__(self): super().__init__() @allure.step("创建国家信息") def kw_joyhub_address_country_create_post(self, country_code, country_name, country_name_en, phone_code, lingxing_country_code=None, paypal_country_code=None, status=1, id=0): """ 创建国家信息业务关键字 :param id: 主键,新增为0 :param country_code: 国家代码(如 CN/US) :param country_name: 国家名称 :param country_name_en: 国家英文名称 :param phone_code: 电话区号 :param lingxing_country_code: 领星国家代码(可选) :param paypal_country_code: paypal国家代码(可选) :param status: 状态 (1正常 2停用) :return: 响应结果 """ obj_log.info(f"创建国家信息 - country_code: {country_code}, country_name: {country_name}, status: {status}") params = { "id": id, "countryCode": country_code, "countryName": country_name, "countryNameEn": country_name_en, "phoneCode": phone_code, "status": status } if lingxing_country_code: params["lingxingCountryCode"] = lingxing_country_code if paypal_country_code: params["paypalCountryCode"] = paypal_country_code resp = self.kw_in_joyhub_address_country_create_post(**params) obj_log.info(f"创建国家信息响应: {resp}") return resp @allure.step("删除国家信息") def kw_joyhub_address_country_delete_delete(self, country_id): """ 删除国家信息业务关键字 :param country_id: 国家信息ID :return: 响应结果 """ obj_log.info(f"删除国家信息 - country_id: {country_id}") resp = self.kw_in_joyhub_address_country_delete_delete(country_id) obj_log.info(f"删除国家信息响应: {resp}") return resp @allure.step("批量删除国家信息") def kw_joyhub_address_country_delete_list_delete(self, country_ids): """ 批量删除国家信息业务关键字 :param country_ids: 国家信息ID列表 :return: 响应结果 """ obj_log.info(f"批量删除国家信息 - country_ids: {country_ids}") resp = self.kw_in_joyhub_address_country_delete_list_delete(country_ids) obj_log.info(f"批量删除国家信息响应: {resp}") return resp @allure.step("获得国家信息详情") def kw_joyhub_address_country_get_get(self, country_id): """ 获得国家信息详情业务关键字 :param country_id: 国家信息ID :return: 响应结果 """ obj_log.info(f"获得国家信息详情 - country_id: {country_id}") resp = self.kw_in_joyhub_address_country_get_get(country_id) obj_log.info(f"获得国家信息详情响应: {resp}") return resp @allure.step("获得国家信息分页") def kw_joyhub_address_country_page_get(self, page_num=1, page_size=10, **kwargs): """ 获得国家信息分页业务关键字 :param page_num: 页码 :param page_size: 每页大小 :param kwargs: 其他查询条件 :return: 响应结果 """ obj_log.info(f"获得国家信息分页 - page_num: {page_num}, page_size: {page_size}") params = { "page": page_num, "size": page_size } params.update(kwargs) resp = self.kw_in_joyhub_address_country_page_get(**params) obj_log.info(f"获得国家信息分页响应: {resp}") return resp @allure.step("更新国家信息") def kw_joyhub_address_country_update_put(self, country_id, country_code, country_name, country_name_en, phone_code, lingxing_country_code=None, paypal_country_code=None, status=1): """ 更新国家信息业务关键字 :param country_id: 国家信息ID :param country_code: 国家代码 :param country_name: 国家名称 :param country_name_en: 国家英文名称 :param phone_code: 电话区号 :param lingxing_country_code: 领星国家代码(可选) :param paypal_country_code: paypal国家代码(可选) :param status: 状态 (1正常 2停用) :return: 响应结果 """ obj_log.info(f"更新国家信息 - country_id: {country_id}, country_code: {country_code}, country_name: {country_name}") params = { "id": country_id, "countryCode": country_code, "countryName": country_name, "countryNameEn": country_name_en, "phoneCode": phone_code, "status": status } if lingxing_country_code: params["lingxingCountryCode"] = lingxing_country_code if paypal_country_code: params["paypalCountryCode"] = paypal_country_code resp = self.kw_in_joyhub_address_country_update_put(**params) obj_log.info(f"更新国家信息响应: {resp}") return resp @allure.step("批量更新国家信息状态") def kw_joyhub_address_country_update_status_list_put(self, country_ids, status): """ 批量更新国家信息状态业务关键字 :param country_ids: 国家信息ID列表 :param status: 状态 (1正常 2停用) :return: 响应结果 """ obj_log.info(f"批量更新国家信息状态 - country_ids: {country_ids}, status: {status}") # 接口参数通过query传递,ids需要用逗号分隔 ids_str = ','.join(map(str, country_ids)) resp = self.kw_in_joyhub_address_country_update_status_list_put(ids=ids_str, status=status) obj_log.info(f"批量更新国家信息状态响应: {resp}") return resp