1
0
forked from erp-dev/erp

feat: tasks for sync products and customers

This commit is contained in:
2025-12-08 22:22:18 +08:00
parent fc18f71615
commit a36a7e5265
14 changed files with 717 additions and 248 deletions

View File

@@ -53,6 +53,13 @@ CSRF_TRUSTED_ORIGINS = env.list('CSRF_TRUSTED_ORIGINS', default=[
'https://yuwenerp.yuwen.cloud',
])
# 明道云同步配置
MDY_MERCHANT_ID = env.int('MDY_MERCHANT_ID', default=1)
MDY_PRODUCT_CATEGORY_ID = env.int('MDY_PRODUCT_CATEGORY_ID', default=1)
MDY_SYNC_PAGE_SIZE = env.int('MDY_SYNC_PAGE_SIZE', default=100)
MDY_SYNC_MAX_PAGES = env.int('MDY_SYNC_MAX_PAGES', default=2)
MDY_SYNC_MAX_RECORDS = env.int('MDY_SYNC_MAX_RECORDS', default=200)
# CORS 配置
CORS_ALLOW_ALL_ORIGINS = DEBUG # 开发环境允许所有源,生产环境需要配置白名单
@@ -303,4 +310,22 @@ CELERY_BEAT_SCHEDULE = {
'filename_prefix': 'db-backup',
},
},
'mdy_product_sync': {
'task': 'api_v1.tasks.sync_mdy_products',
'schedule': crontab(hour='*/1', minute=0),
'kwargs': {
'page_size': MDY_SYNC_PAGE_SIZE,
'max_pages': MDY_SYNC_MAX_PAGES,
'max_records': MDY_SYNC_MAX_RECORDS,
},
},
'mdy_customer_sync': {
'task': 'api_v1.tasks.sync_mdy_customers',
'schedule': crontab(hour='*/1', minute=0),
'kwargs': {
'page_size': MDY_SYNC_PAGE_SIZE,
'max_pages': MDY_SYNC_MAX_PAGES,
'max_records': MDY_SYNC_MAX_RECORDS,
},
},
}