def get_product_sale_evaluate_price(self, productId): (skuList, checkList) = self.product_check_item(productId=productId) # skuList = ['13', '130', '17', '2236', '38', '1091', '2242'] # checkList = ['7420', '7422', '7425', '7428', '7432', '7439', '7443', '7447', '7450', '7452', '7460', '7463', '7465', '7467', '7471', '7475', '7482', '7489', '7491', '7493', '7500', '7507', '7514', '7517', '7522', '7528', '7533', '7537', '7541', '7548', '7555', '7556', '7559', '7562', '7571', '7574', '7578', '7581', '7587', '7589', '7606', '7614'] param = { "_head": { "_interface": "get_product_sale_evaluate_price", "_msgType": "request", "_remark": "hello", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "productId": productId, "skuList": skuList, "checkList": checkList } } url = "http://codserver.huishoubao.com/detect/get_product_sale_evaluate_price" md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def batch_get_skuid_info(skuidList): param = { "_head": { "_interface": "batch_get_skuid_info", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "skuidList": skuidList } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/product/batch_get_skuid_info" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def get_platform_type(): param = { "_head": { "_interface": "get_platform_type", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "SALESDETECT152533283241636", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "platformId": "", "platformName": "", "groupId": "", "pageSize": "10", "pageIndex": "0" } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def product_check_item_34(self, product_id="41567"): param = { "_head": { "_interface": "product_check_item_34", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "152533283241636", "_callerServiceId": self.service_id, "_groupNo": "1" }, "_param": { "productId": product_id } } url = "http://codserver.huishoubao.com/detect/product_check_item" md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.service_id } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 print(respone_dict) checkList = respone_dict['_data']['_data']['checkList'] skuList = respone_dict['_data']['_data']['skuList'] strCheckList = [] strCheckDesc = '' for info in checkList: answerList = info['answerList'] print("答案项列表{}".format(answerList)) '''第一种方式:在answerList下随机取1个''' # index = random.randint(0, len(answerList) - 1) index = 0 strCheckList.append(answerList[index]['answerId']) strCheckDesc += '"' + info['questionName'] + ":" + answerList[ index]['answerName'] + '",' '''第二种方式:在answerList下取answerWeight最大的那个''' # index = sorted(answerList, key=lambda x: int(x['answerWeight']), reverse=True)[0] # strCheckList.append(index['answerId']) # strCheckDesc += '"' + info['questionName'] + ":" + index['answerName'] + '",' strSkuList = [] strSkuDesc = '' for info in skuList: answerList = info['answerList'] # index = random.randint(0, len(answerList) - 1) index = 0 strSkuList.append(answerList[index]['answerId']) strSkuDesc += '"' + info['questionName'] + ":" + answerList[index][ 'answerName'] + '",' # print("====={}\n{}\n\n====={}\n{}".format(strSkuList, strSkuDesc, strCheckList, strCheckDesc)) return strSkuList, strSkuDesc, strCheckList, strCheckDesc
def sale_apply_price(self, planId, productId, evaType, ip="10.0.11.88", user_id="1895", freqLimitType="1"): # (strSkuList, strSkuDesc, strCheckList, strCheckDesc) = self.product_check_item_34(productId=productId) '''1. iPhone X''' strSkuList = ['8012', '130', '17', '2236', '36', '42', '2242'] strCheckList = [ '9015', '9019', '9027', '9028', '9035', '9039', '9047', '7481', '9057', '9059', '9062', '9067', '9071', '9074', '7559', '9077', '9079', '7570', '7574', '9082', '9084', '7589', '9090', '9094', '9098', '9102', '9106', '9111', '9117', '9120' ] param = { "_head": { "_interface": "sale_apply_price", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "lzm_adjustPrice", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "planId": planId, "productId": productId, "evaType": evaType, "skuItem": strSkuList, "optItem": strCheckList, "ip": ip, "userId": user_id, "freqLimitType": freqLimitType } } # print("==========>请求参数为:\n{}".format(json.dumps(param))) secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/adjustment_price/sale_apply_price" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_k8s_test()) # print('========>1.『{0}』 产品的『检测标准化选项-sku』(随机取)为:\n'.format(productId), strSkuList) # print('\n========>2. 以上『检测标准化选项-sku』为:\n', '{' + strSkuDesc[:-1] + '}') # print('\n========>3.『{0}』 产品的『检测标准化选项-机况-34』(随机取)为:\n'.format(productId), strCheckList) # print('\n========>4. 以上『检测标准化选项-机况-34』为:\n', '{' + strCheckDesc[:-1] + '}') # res_print(respone) print(respone.json()["_data"]["_errStr"])
def brand_ver_get(fkeys, fvalid, fpageindex, fpagesize): param = { "_head": { "_interface": "brand_ver_get", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1439261904", "_invokeId": "SALE15216018033998", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "fkeys": fkeys, "fvalid": fvalid, "fpageindex": fpageindex, "fpagesize": fpagesize, "fversions": "2" } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def v3_eva_option_get(channel_id, product_id, pid): param = { "_head": { "_interface": "eva_option_get", "_msgType": "request", "_remark": "eva_product_v3", "_version": "0.01", "_timestamps": "123", "_invokeId": "eva_product_v3", "_callerServiceId": "816006", "_groupNo": "1" }, "_param": { "channel_id": channel_id, "product_id": product_id, "pid": pid } } secret_key = "dk26kmdasnph0voz69fj0jpv7t3ixev8" callerserviceid = "212006" url = "http://prdserver.huishoubao.com/eva_product_v3/eva_option_get" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 hsb_response_print(respone=respone)
def product_id_info_get(fproduct_id, fchannel_id): param = { "_head": { "_interface": "product_id_info_get", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "110003", "_groupNo": "1" }, "_param": { "fproduct_id": fproduct_id, "fchannel_id": fchannel_id } } secret_key = "Qqn2QV8pcdCIzhpJeE6paatWZAtc2CTK" callerserviceid = "110003" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def v3_sale_evaluate(productId, checkType, evaType, optItem): param = { "_head": { "_interface": "sales_level_generation", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "152533283241636", "_callerServiceId": "216002", "_groupNo": "1" }, "_param": { "productId": productId, "checkType": checkType, "evaType": evaType, "optItem": optItem } } secret_key = "rAfnRwyWfh2N9vXVgWwdpJxaXgOCd8af" callerserviceid = "216002" url = "http://codserver.huishoubao.com/detect_v3/sales_level_generation" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 hsb_response_print(respone=respone)
def base_price_record_query(recodeId): param = { "_head": { "_interface": "record_query", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "test", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "recodeId": recodeId } } secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/adjustment_price/record_query" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_k8s_test()) respone.encoding = respone.apparent_encoding # 编码设置 hsb_response_print(respone=respone)
def product_id_info_get(evaFlag, fproduct_id, fchannel_id, ignoreMaxPrice): param = { "_head": { "_interface": "product_id_info_get", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123", "_invokeId": "eva_vpc_k8s_zhangjinfa", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "evaFlag": evaFlag, "fproduct_id": fproduct_id, "fchannel_id": fchannel_id, "ignoreMaxPrice": ignoreMaxPrice } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def get_eva_pid_channel(pid, channelId): param = { "_head": { "_interface": "get_eva_pid_channel", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "SALESDETECT152533283241636", "_callerServiceId": "212013", "_groupNo": "1" }, "_param": { "pid": pid, "channelId": channelId } } secret_key = "CtN4bZr7qYyxygRyP5T0VWMEvWhpH0uf" callerserviceid = "212013" # eva_query 估价查询服务 url = "http://evaserver.huishoubao.com/eva_query/get_eva_pid_channel" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def get_product_sale_evaluate_price(self, productId, channelId, isBottom): (skuList, checkList) = self.product_check_item_34(productId=productId) # skuList = ['12', '130', '17', '2236', '38', '1091', '1773'] # checkList = ['7418', '7423', '7426', '7428', '7434', '7438', '7442', '7445', '7450', '7453', '7461', '7462', '7464', '7469', '7472', '7474', '7483', '7487', '7490', '7496', '7499', '7508', '7515', '7518', '7523', '7615', '7534', '7536', '7544', '7547', '7554', '7557', '7561', '7563', '7570', '7575', '7578', '7580', '7586', '7590', '7610', '7613'] param = { "_head": { "_interface": "get_product_sale_evaluate_price", "_msgType": "request", "_remark": "hello", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "productId": productId, "skuList": skuList, "checkList": checkList, "channelId": channelId, "isBottom": isBottom } } url = "http://codserver.huishoubao.com/detect/get_product_sale_evaluate_price" md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def check_standard_info(classId, valid, checkKey): param = { "_head": { "_interface": "check_standard_info", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123456", "_invokeId": "123456", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "classId": classId, "valid": valid, "checkKey": checkKey } } secret_key = "gYt8YHmZVUtq9BxHzmNBQ0Eo7oGi8IKU" callerserviceid = "112006" url = "http://codserver.huishoubao.com/detect/check_standard_info" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def classhotget(pid, channel_id): param = { "_head": { "_interface": "classhotget", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1234567980", "_invokeId": "111", "_callerServiceId": "112002", "_groupNo": "123" }, "_param": { "pid": pid, "channel_id": channel_id } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def bm_get_product_sku(pid, productId): param = { "_head": { "_interface": "bm_get_product_sku", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "", "_invokeId": "", "_callerServiceId": "110001", "_groupNo": "1" }, "_param": { "pid": pid, "productId": productId } } secret_key = "c36691ced620bf82ad3fc4642f8a6427" callerserviceid = "110001" url = "http://bmserver.huishoubao.com/bangmai/bm_get_product_sku" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) hsb_response_print(respone=respone)
def get_eva_record(evaluateId): param = { "_head": { "_interface": "get_eva_record", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "eva_vpc_k8s_zhangjinfa", "_callerServiceId": "212011", "_groupNo": "1" }, "_param": { "evaluateId": evaluateId } } secret_key = "cfd7fabf8b7ca4602b3768ccd7440da4" callerserviceid = "212011" # eva_query 估价查询服务 url = "http://evaserver.huishoubao.com/eva_query/get_eva_record" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_k8s_test()) hsb_response_print(respone=respone)
def product_check_item_34(self, productId): param = { "_head": { "_interface": "product_check_item_34", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123456", "_invokeId": "test_zhangjinfa", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "productId": productId } } secret_key = "gYt8YHmZVUtq9BxHzmNBQ0Eo7oGi8IKU" callerserviceid = "112006" url = "http://codserver.huishoubao.com/detect/product_check_item" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 checkList = respone_dict['_data']['_data']['checkList'] skuList = respone_dict['_data']['_data']['skuList'] strCheckList = [] strCheckDesc = '' for info in checkList: answerList = info['answerList'] '''第一种方式:在answerList下随机取1个''' index = random.randint(0, len(answerList) - 1) strCheckList.append(answerList[index]['answerId']) strCheckDesc += '"' + info['questionName'] + ":" + answerList[ index]['answerName'] + '",' '''第二种方式:在answerList下取answerWeight最大的那个''' # index = sorted(answerList, key=lambda x: int(x['answerWeight']), reverse=True)[0] # strCheckList.append(index['answerId']) # strCheckDesc += '"' + info['questionName'] + ":" + index['answerName'] + '",' strSkuList = [] strSkuDesc = '' for info in skuList: answerList = info['answerList'] index = random.randint(0, len(answerList) - 1) strSkuList.append(answerList[index]['answerId']) strSkuDesc += '"' + info['questionName'] + ":" + answerList[index][ 'answerName'] + '",' return strSkuList, strSkuDesc, strCheckList, strCheckDesc
def base_price_evaluatee(self, channelId, pid, productId, ip, freqLimitType): (str_sku_answer_list, str_Option_answer_desc) = self.pdt_sku_query(productId=productId) # (str_options_list, str_options_list_desc) = self.product_6_eva_option_get(channel_id=channelId, product_id=productId, pid=pid) str_options_list = [ '82', '62', '66', '58', '236', '5530', '55', '78', '7642', '6931', '23', '5534', '224', '20', '1078', '2171', '3245' ] # "evaType":"2" 大质检; "priceType":"1" 销售定价 param = { "_head": { "_interface": "evaluate", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "mikingzhang_adjustPrice", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "channelId": channelId, "pid": pid, "productId": productId, "evaType": "2", "skuItem": str_sku_answer_list, "optItem": str_options_list, "ip": ip, "userId": "1002", "priceType": "1", "freqLimitType": freqLimitType } } secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/base_price/evaluate" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 print('========>1.『{0}』 产品的『标准sku,ID』(随机取)为:\n'.format(productId), str_sku_answer_list) print('\n========>2. 以上『标准sku,名称』为:\n', '{' + str_Option_answer_desc[:-1] + '}') # print('\n========>3.『{0}』 产品的『大质检机况17,ID』(随机取)为:\n'.format(productId), str_options_list) # print('\n========>4. 以上『大质检机况17,名称』为:\n', '{' + str_options_list_desc[:-1] + '}') hsb_response_print(respone=respone)
def sale_apply_price(self, planId, productId, evaType, ip, freqLimitType): # (strSkuList, strSkuDesc, strCheckList, strCheckDesc) = self.product_check_item_57(productId=productId) '''1. iPhone X''' # strSkuList = ["1083","42","36","2236","130","17","12"] # strCheckList = ["7418","7425","7422","7428","7432","7436","7442","7445","7449","7452","7460","7462","7464","7467","7470","7473","7481","7487","7490","7493","7499","7506","7510","7517","7522","7528","7532","7536","7541","7547","7553","7556","7559","7562","7570","7574","7578","7580","7586","7589","7599","7613"] strSkuList = ["12", "130", "2234", "35", "1282"] strCheckList = [ "7419", "7422", "7425", "7428", "7432", "9163", "7442", "7445", "7450", "7452", "7460", "7462", "7464", "7467", "7470", "7479", "7482", "7487", "7490", "7497", "7501", "7502", "7503", "7506", "7512", "7513", "7514", "7517", "7524", "7530", "7532", "7539", "7541", "7547", "7553", "7556", "7559", "7563", "7564", "7565", "7566", "7571", "7574", "7578", "7580", "7588", "7594", "7601", "7603", "7605", "7606", "7609", "7610", "7614", "9192" ] param = { "_head": { "_interface": "sale_apply_price", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "mikingzhang_adjustPrice", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "planId": planId, "productId": productId, "evaType": evaType, "skuItem": strSkuList, "optItem": strCheckList, "ip": ip, "userId": "1895", "freqLimitType": freqLimitType } } secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/adjustment_price/sale_apply_price" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_k8s_test()) # print('========>1.『{0}』 产品的『检测标准化选项-sku』(随机取)为:\n'.format(productId), strSkuList) # print('\n========>2. 以上『检测标准化选项-sku』为:\n', '{' + strSkuDesc[:-1] + '}') # print('\n========>3.『{0}』 产品的『检测标准化选项-机况-34』(随机取)为:\n'.format(productId), strCheckList) # print('\n========>4. 以上『检测标准化选项-机况-34』为:\n', '{' + strCheckDesc[:-1] + '}') hsb_response_print(respone=respone)
def base_price_evaluatee(self, channelId, pid, productId, ip, freqLimitType): (strSkuList, strSkuDesc, strCheckList, strCheckDesc) = self.product_check_item_57(productId=productId) # strSkuList = ["1083","42","36","2236","130","17","12"] # strCheckList = ["7418","7425","7422","7428","7432","7436","7442","7445","7449","7452","7460","7462","7464","7467","7470","7473","7481","7487","7490","7493","7499","7506","7510","7517","7522","7528","7532","7536","7541","7547","7553","7556","7559","7562","7570","7574","7578","7580","7586","7589","7599","7613"] # "evaType":"1" 标准质检; "priceType":"1" 销售定价 param = { "_head": { "_interface": "evaluate", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "mikingzhang_adjustPrice", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "channelId": channelId, "pid": pid, "productId": productId, "evaType": "1", "skuItem": strSkuList, "optItem": strCheckList, "ip": ip, "userId": "1002", "priceType": "1", "freqLimitType": freqLimitType } } secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/base_price/evaluate" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 print('========>1.『{0}』 产品的『标准sku,ID』(随机取)为:\n'.format(productId), strSkuList) print('\n========>2. 以上『标准sku,名称』为:\n', '{' + strSkuDesc[:-1] + '}') print( '\n========>3.『{0}』 产品的『检测标准化选项-机况-57,ID』(随机取)为:\n'.format( productId), strCheckList) print('\n========>4. 以上『检测标准化选项-机况-57,名称』为:\n', '{' + strCheckDesc[:-1] + '}') hsb_response_print(respone=respone)
def eva_option_get(channel_id, product_id, pid, business_id, need_default): param = { "_head": { "_interface": "eva_option_get", "_msgType": "request", "_remark": "hello", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "channel_id": channel_id, "product_id": product_id, "pid": pid, "business_id": business_id, "need_default": need_default } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) # response.encoding:从HTTP header中猜测的响应内容编码方式; # response.apparent_encoding:从内容分析出的响应内容的编码方式(备选编码方式) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 print(respone_dict) options_list = respone_dict['_body']['_data']['itemList'] str_options_list = '' str_options_desc = '' for info in options_list: answerList = info['question'] index = random.randint(0, len(answerList) - 1) str_options_list += '"' + answerList[index]['id'] + '",' str_options_desc += '"' + info['name'] + ":" + answerList[index][ 'name'] + '",' str_options_list = str_options_list[:-1] print('接口响应『json』格式数据为:\n', json.dumps(respone_dict, ensure_ascii=False) + '\n') print('大质检【用户】估价【sku】+【机况】答案项ID(随机取):\n', '{' + str_options_list + '}' + '\n') print('以上【sku】+以上【机况】选项名称+答案项名称:\n', '{' + str_options_desc[:-1] + '}' + '\n') print('接口响应时长:{0} 秒'.format(respone.elapsed.total_seconds()))
def base_price_evaluatee(self, channelId, pid, productId, ip, freqLimitType): (strSkuList, strSkuDesc, strCheckList, strCheckDesc) = self.product_check_item_34(productId=productId) # strSkuList = ['6116', '130', '17', '2236', '38', '42', '1083'] # strCheckList = ['9015', '9024', '9025', '9029', '9035', '9039', '9053', '7481', '9057', '9059', '9062', '9068', '9071', '9075', '7559', '9078', '9080', '9081', '7575', '9083', '9084', '9088', '9090', '9094', '9099', '9104', '9106', '9112', '9119'] # "evaType":"3" 34项标准质检 | "priceType":"1" 销售定价 param = { "_head": { "_interface": "evaluate", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "mikingzhang_adjustPrice2nd", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "channelId": channelId, "pid": pid, "productId": productId, "evaType": "3", "skuItem": strSkuList, "optItem": strCheckList, "ip": ip, "userId": "1002", "priceType": "1", "freqLimitType": freqLimitType } } secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/base_price/evaluate" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 print('========>1.『{0}』 产品的『检测标准化选项-sku』(随机取)为:\n'.format(productId), strSkuList) print('\n========>2. 以上『检测标准化选项-sku』为:\n', '{' + strSkuDesc[:-1] + '}') print( '\n========>3.『{0}』 产品的『检测标准化选项-机况-34』(随机取)为:\n'.format(productId), strCheckList) print('\n========>4. 以上『检测标准化选项-机况-34』为:\n', '{' + strCheckDesc[:-1] + '}') hsb_response_print(respone=respone)
def base_price_evaluatee(channelId, pid, productId, ip, freqLimitType): # "priceType":"2" 回收定价 | "evaType":"0" 价格3.0 param = { "_head": { "_interface": "evaluate", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "1525332832", "_invokeId": "mikingzhang_adjustPrice2nd", "_callerServiceId": "116006", "_groupNo": "1" }, "_param": { "channelId": channelId, "pid": pid, "productId": productId, "evaType": "0", "skuItem": ['12', '471', '18', '2236', '38', '1091', '2242'], "optItem": [ '8297', '8301', '8305', '8309', '8312', '8316', '8320', '8323', '8326', '8333', '8336', '8339', '8343', '8349', '8351', '8359', '8361', '8364', '8367', '8371', '8375', '8378', '8382', '8385', '8389', '8393', '8397', '8403', '8408', '8412', '8416', '8419', '8422', '8425', '8429', '8432', '8436', '8441', '8444', '8449' ], "ip": ip, "userId": "1002", "priceType": "2", "freqLimitType": freqLimitType } } secret_key = "R2gFCRbILiNhwv3YbtaGceYJlPS5Ku02" callerserviceid = "116006" url = "http://bpeserver.huishoubao.com/base_price/evaluate" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 hsb_response_print(respone=respone)
def product_check_item(self, productId): url = "http://codserver.huishoubao.com/detect/product_check_item" param = { "_head": { "_interface": "product_check_item_xyplus", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123456", "_invokeId": "123456", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "productId": productId } } md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 # print("======获取检测选项返回参数=========\n{}".format(json.dumps(respone_dict, indent=4, ensure_ascii=False))) checkList = respone_dict['_data']['_data']['checkList'] skuList = respone_dict['_data']['_data']['skuList'] for info in checkList: answerList = info['answerList'] # index = random.randint(0, len(answerList) - 1) index = 0 self.strCheckList.append(answerList[index]['answerId']) self.strCheckDesc += '"' + info['questionName'] + ":" + answerList[ index]['answerName'] + '",' self.strCheckList = self.strCheckList[:-1] for info in skuList: answerList = info['answerList'] # index = random.randint(0, len(answerList) - 1) index = 0 self.strSkuList.append(answerList[index]['answerId']) self.strSkuDesc += '"' + info['questionName'] + ":" + answerList[ index]['answerName'] + '",' # print('接口响应『json』格式数据为:\n', json.dumps(respone_dict, ensure_ascii=False),'\n') print('检测sku选项-答案项ID(随机取):{}\n'.format(self.strSkuList)) print('检测机况选项-答案项ID(随机取):{}\n'.format(self.strCheckList)) print('检测以上【sku】+以上【机况】选项名称+答案项名称:{}{}\n'.format( self.strSkuDesc, self.strCheckDesc[:-1])) print('接口响应时长:{0} 秒'.format(respone.elapsed.total_seconds()))
def eva_option_get(self, channel_id, product_id, pid, platform_type): ''' http://wiki.huishoubao.com/web/#/105?page_id=1595 ''' ''' platform_type:使用在不需要 pid 和 channle_id 的场景下,优先使用channel_id 或 pid,可不传''' param = { "_head": { "_interface": "eva_option_get", "_msgType": "request", "_remark": "hello", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "channel_id": channel_id, "product_id": product_id, "pid": pid, "platform_type": platform_type } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 options_list = respone_dict['_body']['_data']['itemList'] str_options_list = [] str_options_list_show = '' str_options_desc_show = '' for info in options_list: answerList = info['question'] index = random.randint(0, len(answerList) - 1) str_options_list.append(answerList[index]['id']) # 以下只为打印输出随机取的估价选项数据 str_options_list_show += '"' + answerList[index]['id'] + '",' str_options_desc_show += '"' + info['name'] + ":" + answerList[ index]['name'] + '",' str_options_list_show = str_options_list_show[:-1] print('估价答案项ID传参数据为(随机取):\n', '{' + str_options_list_show + '}' + '\n') print('以上估价答案项ID对应的选项+答案项名称:\n', '{' + str_options_desc_show[:-1] + '}' + '\n') return str_options_list
def pdt_sku_query(productId, combination): param = { "_head": { "_interface": "pdt_sku_query", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123", "_invokeId": "111", "_callerServiceId": "112002", "_groupNo": "1" }, "_param": { "subInterface": "sku_option_combination_get", "info": { "productId": productId, "combination": combination } } } secret_key = "HKmTk03iDUCLIrFrrQkfOxPiGyGPqxb9" callerserviceid = "112002" url = "http://prdserver.huishoubao.com/rpc/new_product_lib" md5value = json.dumps(param) + "_" + secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 optionsList = respone_dict['_body']['_data']['options'] str_sku_answer_list = '' str_Option_answer_desc = '' for info in optionsList: answerList = info['aInfo'] index = random.randint(0, len(answerList) - 1) str_sku_answer_list += '"' + answerList[index]['aId'] + '",' str_Option_answer_desc += '"' + info['qName'] + ":" + answerList[ index]['aName'] + '",' str_sku_answer_list = str_sku_answer_list[:-1] print('接口响应『json』格式数据为:\n', json.dumps(respone_dict, ensure_ascii=False) + '\n') print('【sku】选项-答案项ID(随机取):\n', '{' + str_sku_answer_list + '}' + '\n') print('以上【sku】选项名称+答案项名称:\n', '{' + str_Option_answer_desc[:-1] + '}' + '\n') print('接口响应时长:{0} 秒'.format(respone.elapsed.total_seconds()))
def get_product_lib_sku_option_item(self, productId, orderId): param = { "_head": { "_interface": "get_product_lib_sku_option_item", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123456", "_invokeId": "123456", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "productId": productId, "orderId": orderId } } url = "http://codserver.huishoubao.com/detect/get_product_lib_sku_option_item" md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 skuList = respone_dict['_data']['_data']['skuList'] optionList = respone_dict['_data']['_data']['optionList'] strSkuList = [] strSkuDesc = '' for info_sku in skuList: answerList_sku = info_sku['answerList'] index_sku = random.randint(0, len(answerList_sku) - 1) strSkuList.append(answerList_sku[index_sku]['answerId']) strSkuDesc += '"' + info_sku['questionName'] + ":" + answerList_sku[ index_sku]['answerName'] + '",' strOptionList = [] strOptionDesc = '' for info_option in optionList: answerList_option = info_option['answerList'] index_option = random.randint(0, len(answerList_option) - 1) strOptionList.append(answerList_option[index_option]['answerId']) strOptionDesc += '"' + info_option[ 'questionName'] + ":" + answerList_option[index_option][ 'answerName'] + '",' return strSkuList, strOptionList, strSkuDesc, strOptionDesc
def product_check_item(self, productId): # 【57项标准检测】 "_interface":"product_check_item" # 【闲鱼验机】【53项灰度检】 "_interface":"product_check_item_grayscale" # 【闲鱼无忧购验机1.0】 "_interface":"product_check_item_youpin" # 【闲鱼无忧购验机2.0】 "_interface":"product_check_item_youpin_v2" # 【34项标准检测】 "_interface":"product_check_item_34" param = { "_head": { "_interface": "product_check_item_youpin_v2", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "123456", "_invokeId": "123456", "_callerServiceId": "112006", "_groupNo": "1" }, "_param": { "productId": productId } } url = "http://codserver.huishoubao.com/detect/product_check_item" md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) respone.encoding = respone.apparent_encoding # 编码设置 respone_dict = json.loads(respone.text) # 转成字典 skuList = respone_dict['_data']['_data']['skuList'] checkList = respone_dict['_data']['_data']['checkList'] strSkuList = [] for info in skuList: answerList = info['answerList'] # index = random.randint(0, len(answerList) - 1) index = 0 strSkuList.append(answerList[index]['answerId']) strCheckList = [] for info in checkList: answerList = info['answerList'] # index = random.randint(0, len(answerList) - 1) index = 0 strCheckList.append(answerList[index]['answerId']) return strSkuList, strCheckList
def sales_level_generation_xyplus(self, productId, channelId, aIdList="", checkAIdList="", orderId="", isRecord=1): if not aIdList or not checkAIdList: self.convert_check_item_to_eva(productId, orderId) aIdList = self.aIdList checkAIdList = self.strCheckList param = { "_head": { "_interface": "sales_level_generation_xyplus", "_msgType": "request", "_remark": "", "_version": "0.01", "_timestamps": "", "_invokeId": "", "_callerServiceId": self.callerserviceid, "_groupNo": "1" }, "_param": { "productId": productId, "orderId": orderId, "channelId": channelId, "aIdList": aIdList, "checkAIdList": checkAIdList, "isRecord": isRecord } } print(param) url = "http://prdserver.huishoubao.com/product/sales_level_generation" md5value = json.dumps(param) + "_" + self.secret_key headers = { "Content-Type": "application/json;charset=UTF-8", "HSB-OPENAPI-SIGNATURE": Md5Enerypt(md5value), "HSB-OPENAPI-CALLERSERVICEID": self.callerserviceid } respone = requests.post(url, json=param, headers=headers, proxies=hsb_eva_ipProxy_test()) print( '==========4. 产品ID:『{0}』,『请求获取‘销售等级’的估价答案项』为:\n'.format(productId), checkAIdList) # print('==========5. 转换后的SKU+机况选项的描述:\n', aIdListOption) hsb_response_print(respone=respone)