Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
willdesk_apiauto
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
29
Issues
29
List
Boards
Labels
Service Desk
Milestones
Merge Requests
29
Merge Requests
29
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
桦生 詹
willdesk_apiauto
Commits
b7948fc3
Commit
b7948fc3
authored
Jul 17, 2024
by
zhanhuasheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交sql文件
parent
e4adb356
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
TestFile/setting/shopifyIntegration/shopifyIntegration_integration_num_select.py
...yIntegration/shopifyIntegration_integration_num_select.py
+61
-0
No files found.
TestFile/setting/shopifyIntegration/shopifyIntegration_integration_num_select.py
0 → 100644
View file @
b7948fc3
from
Utils.sql_handler
import
test_env_conn
from
TestData.setting.shopify_integration_test_data
import
shopifyIntegrationData
shop_id_select_sql
=
f
'select rel_id,resource_id from `resource_item` where brand_id =
{
shopifyIntegrationData
.
brandId
}
'
shop_id_select_result
=
test_env_conn
.
select_many_value
(
sql
=
shop_id_select_sql
)
shop_id_list
=
tuple
([
shop
[
'rel_id'
]
for
shop
in
shop_id_select_result
])
shopify_shop_num
=
0
js_shop_num
=
0
email_shop_num
=
0
whatsapp_shop_num
=
0
facebook_shop_num
=
0
ins_shop_num
=
0
macro_num
=
0
whatsapp_id_list
=
()
email_id_list
=
()
if
shop_id_list
:
shop_select_sql
=
f
'select * from `shop` where id in
{
shop_id_list
}
and brand_id =
{
shopifyIntegrationData
.
brandId
}
and is_delete = 0'
shop_select_result
=
test_env_conn
.
select_many_value
(
sql
=
shop_select_sql
)
for
shop
in
shop_select_result
:
if
shop
[
'source'
]
==
1
and
shop
[
'connect_status'
]
==
2
:
js_shop_num
+=
1
elif
shop
[
'source'
]
==
2
and
shop
[
'connect_status'
]
==
2
:
shopify_shop_num
+=
1
elif
shop
[
'source'
]
==
3
:
facebook_shop_num
+=
1
elif
shop
[
'source'
]
==
4
:
email_id_list
+=
(
shop
[
'third_id'
],)
elif
shop
[
'source'
]
==
5
:
ins_shop_num
+=
1
elif
shop
[
'source'
]
==
6
:
whatsapp_id_list
+=
(
shop
[
'third_id'
],)
if
email_id_list
:
email_select_sql
=
f
'select * from `email_config` where id in
{
email_id_list
}
and connect_status = 0'
email_select_result
=
test_env_conn
.
select_many_value
(
sql
=
email_select_sql
)
if
email_select_result
:
email_shop_num
=
len
(
email_select_result
)
if
whatsapp_id_list
:
whatsapp_select_sql
=
f
'select * from `whatsapp_phone` where waba_id in
{
whatsapp_id_list
}
and status = "CONNECTED" and brand_id =
{
shopifyIntegrationData
.
brandId
}
'
whatsapp_select_result
=
test_env_conn
.
select_many_value
(
sql
=
whatsapp_select_sql
)
if
whatsapp_select_result
:
whatsapp_shop_num
=
len
(
whatsapp_select_result
)
setattr
(
shopifyIntegrationData
,
'shopify_shop_num'
,
shopify_shop_num
)
setattr
(
shopifyIntegrationData
,
'js_shop_num'
,
js_shop_num
)
setattr
(
shopifyIntegrationData
,
'email_shop_num'
,
email_shop_num
)
setattr
(
shopifyIntegrationData
,
'whatsapp_shop_num'
,
whatsapp_shop_num
)
setattr
(
shopifyIntegrationData
,
'facebook_shop_num'
,
facebook_shop_num
)
setattr
(
shopifyIntegrationData
,
'ins_shop_num'
,
ins_shop_num
)
macro_select_sql
=
f
'select * from `macro` where brand_id =
{
shopifyIntegrationData
.
brandId
}
and deleted_at is null'
macro_select_result
=
test_env_conn
.
select_many_value
(
sql
=
macro_select_sql
)
if
macro_select_result
:
macro_num
=
len
(
macro_select_result
)
setattr
(
shopifyIntegrationData
,
'macro_num'
,
macro_num
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment