From 5b99402121ae5862365f83844ea0dfca1904ff3d Mon Sep 17 00:00:00 2001 From: zhanhuasheng Date: Tue, 25 Jun 2024 15:54:14 +0800 Subject: [PATCH] =?UTF-8?q?bugfix=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TestFile/inbox/channel_select.py | 25 ++++++++++++++++++------- YamlCase/setting/tag.yaml | 6 +++--- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/TestFile/inbox/channel_select.py b/TestFile/inbox/channel_select.py index 4f64c9b..eb57eef 100644 --- a/TestFile/inbox/channel_select.py +++ b/TestFile/inbox/channel_select.py @@ -4,7 +4,9 @@ from TestData.inbox.channel_test_data import channelData channel_select_sql = f'select * from `resource_item` where brand_id = {channelData.brandId} and resource_id in (7,2,3,4,6)' #2:livechat 3:facebook 4:email 6:ins 7:whatsapp channel_select_result = test_env_conn.select_many_value(sql=channel_select_sql) channel_id = channel_select_result[0]['id'] -channel_name = channel_select_result[0]['name'] +channel_name_select_sql = f'select * from `shop` where id = {channel_select_result[0]["rel_id"]}' +channel_name_select_result = test_env_conn.select_one_value(sql=channel_name_select_sql) +channel_name = channel_name_select_result['shop_name'] channel_rel_id = channel_select_result[0]['rel_id'] channel_resource_id = channel_select_result[0]['resource_id'] setattr(channelData, 'channel_id', channel_id) @@ -16,18 +18,27 @@ channel_open_room_select_result = test_env_conn.select_many_value(sql=channel_op setattr(channelData, 'channel_open_room_num', len(channel_open_room_select_result)) setattr(channelData, 'channel_open_room_num_add', len(channel_open_room_select_result) + 1) -customer_service_select_sql = f'select customer_service_id from `rel_customerservice_brand` where brand_id = {channelData.brandId} and is_activation = 1' +customer_service_select_sql = f'select * from `rel_customerservice_brand` where brand_id = {channelData.brandId} and is_delete = 0' customer_service_select_result = test_env_conn.select_many_value(sql=customer_service_select_sql) -customer_service_id_list = [i['customer_service_id'] for i in customer_service_select_result] +customer_service_id_list = set([i['customer_service_id'] for i in customer_service_select_result]) customer_service_list_select_sql = f'select * from `customer_service` where id in {tuple(customer_service_id_list)} and customer_type = 0' customer_service_list_select_result = test_env_conn.select_many_value(sql=customer_service_list_select_sql) -customer_service_id = customer_service_list_select_result[0]['id'] +end = 0 +for cs in customer_service_list_select_result: + for customer in customer_service_select_result: + if customer['customer_service_id'] == cs['id'] and customer['is_activation']: + customer_service_id = customer['customer_service_id'] + setattr(channelData, 'customer_service_name', cs['name']) + setattr(channelData, 'customer_service_image', cs['profile']) + setattr(channelData, 'customer_service_email', cs['email']) + end = 1 + break + if end: + break setattr(channelData, 'customer_service_num', len(customer_service_list_select_result)) setattr(channelData, 'customer_service_id', customer_service_id) -setattr(channelData, 'customer_service_name', customer_service_list_select_result[0]['name']) -setattr(channelData, 'customer_service_image', customer_service_list_select_result[0]['profile']) -setattr(channelData, 'customer_service_email', customer_service_list_select_result[0]['email']) + customer_channel_open_room_select_sql = f'select * from `im_room` where site_id = {channel_rel_id} and status = 1 and room_type != 2 and is_ignore = 0 and allocation_uid = {customer_service_id}' customer_channel_open_room_select_result = test_env_conn.select_many_value(sql=customer_channel_open_room_select_sql) diff --git a/YamlCase/setting/tag.yaml b/YamlCase/setting/tag.yaml index 8bb1f2e..a9f4239 100644 --- a/YamlCase/setting/tag.yaml +++ b/YamlCase/setting/tag.yaml @@ -92,7 +92,7 @@ api10: data: {"uid":"${userId}","uType":2,"platform":1,"siteIds":["${shopId}"],"status":1,"page":1,"pageSize":20,"sortName":"all","keyword":"${new_tag_name}","roomSearchExpArgs":{"searchDime":1,"searchId":""},"v":"${v}"} expected: - eq: {"$.code": 0} - - eq: {"$.data.list[0].roomId": "${room_id}"} + - in_list: {"data.list[*].roomId": "${room_id}"} - eq: {"$.data.list[0].searchMatchDimeType": 7} api11: @@ -102,7 +102,7 @@ api11: data: {"uid":"${userId}","uType":2,"platform":1,"siteIds":["${shopId}"],"status":1,"page":1,"pageSize":20,"sortName":"all","keyword":"${new_tag_name}","roomSearchExpArgs":{"searchDime":2,"searchId":""},"v":"${v}"} expected: - eq: {"$.code": 0} - - eq: {"$.data.list[0].roomId": "${room_id}"} + - in_list: {"data.list[*].roomId": "${room_id}"} - eq: {"$.data.list[0].searchMatchDimeType": 12} api12: @@ -112,7 +112,7 @@ api12: data: {"uid":"${userId}","uType":2,"platform":1,"siteIds":["${shopId}"],"status":1,"page":1,"pageSize":20,"sortName":"all","keyword":"${new_tag_name}","roomSearchExpArgs":{"searchDime":0,"searchId":""},"v":"${v}"} expected: - eq: {"$.code": 0} - - eq: {"$.data.list[0].roomId": "${room_id}"} + - in_list: {"$.data.list[*].roomId": "${room_id}"} - eq: {"$.data.list[0].searchMatchDimeType": 7} api13: -- GitLab