Files
goauto/server/config/settings.yml
T
QiuSWandClaude Opus 5 3e82ad6570 feat(yeeke): complete admin surface, scheduling and tests for return sync #336
Builds on cf70021, which added the read-only yeeke client/session/sync core
but left it unreachable and unconfigurable. This commit:

- Wires config.ExtConfig.Yeeke (settings.yml + config.yaml + GOAUTO_YEEKE_*
  env vars), mirroring the existing SYB credential pattern exactly, with a
  dedicated OcrURL and shared OCR client from sybclient.
- Adds yeeke.StartSync as the single entry point for both a manual admin
  trigger and the scheduled job, sharing one in-memory gate plus the existing
  DB-level unique active_slot lease so they can never run concurrently.
- Fixes sync.go bugs found in review: Service.Sync always returned a nil
  error even when the run failed (start/resume semantics were untestable),
  item upserts on ctx-less s.db calls, and no error_message/last_success_at
  was ever recorded on the run row.
- Adds status_unrecognized to yeeke_return_package: an unknown claim status
  is preserved verbatim and flagged rather than silently bucketed.
- Adds the admin read-only surface (GET .../sync-runs, GET
  .../sync-runs/:runId, POST .../sync) under /api/admin/v1/yeeke-returns,
  visible to admin and purchaser per the #336 review comment, registered as
  a GoAuto access module/menu group and purchaser API.
- Registers GoAutoYeekeReturnSync in the existing job/lease framework
  (app/jobs), seeded disabled (Status 2) by a new version-local migration,
  following 1786701600000_syb_hourly_sync_job.go's pattern exactly.
- Expands tests: session reuse/bounded re-login/timeout-preserves-cache in
  yeekeclient; paging robustness (total changing mid-run, duplicate page,
  empty page, timeout, simulated restart/resume), idempotent upserts,
  unrecognized-status flagging, active_slot lease contention, StartSync gate
  contention, and a credential/captcha redaction check in yeeke; settings.yml
  binding and env var precedence in config.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTDbDcwbDw1TSAcE6wfh2F
2026-09-23 11:03:46 +08:00

99 lines
3.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
settings:
application:
# dev开发环境 test测试环境 prod线上环境
mode: dev
# 服务器ip,默认使用 0.0.0.0
host: 0.0.0.0
# 服务名称
name: testApp
# 端口号
port: 8000 # 服务端口号
readtimeout: 1
writertimeout: 620
# 数据权限功能开关
enabledp: false
logger:
# 日志存放路径
path: temp/logs
# 日志输出,file:文件,default:命令行,其他:命令行
stdout: '' #控制台日志,启用后,不输出到文件
# 日志等级, trace, debug, info, warn, error, fatal
# trace 会打出每个请求的访问日志(common/middleware/logger.go)。
# 默认 info:正常运行只保留启动信息、警告和错误;排查请求问题时改回 debug。
level: info
# 数据库日志开关
enableddb: false
jwt:
# token 密钥,生产环境时及的修改
secret: go-admin
# token 过期时间 单位:秒
timeout: 3600
database:
# 数据库类型 mysql, sqlite3, postgres, sqlserver
# sqlserver: sqlserver://用户名:密码@地址?database=数据库名
driver: mysql
# 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms
source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
# databases:
# 'locaohost:8000':
# driver: mysql
# # 数据库连接字符串 mysql 缺省信息 charset=utf8&parseTime=True&loc=Local&timeout=1000ms
# source: user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
# registers:
# - sources:
# - user:password@tcp(127.0.0.1:3306)/dbname?charset=utf8&parseTime=True&loc=Local&timeout=1000ms
gen:
# 代码生成读取的数据库名称
dbname: dbname
# 代码生成是使用前端代码存放位置,需要指定到src文件夹,相对路径
frontpath: ../go-admin-ui/src
extend: # 扩展项使用说明
demo:
name: data
# 顺云宝(SYB)ERP,见 docs/12-syb-erp-interface.md §8。
# `[必须]` 账号密码不在这里,走环境变量 GOAUTO_SYB_USERNAME / GOAUTO_SYB_PASSWORD,
# 以免凭据进 Git。
syb:
baseurl: https://www.shunyunbaoerp.com
pagesize: 50
maxmatches: 10000
# 验证码自动识别服务。留空 = 禁用,只走手工输入弹窗,不报错。
# `[必须]` 验证码图片会被发送到这个地址;换成别人运营的服务前要重新评估。
ocrurl: https://ocr.ilapage.cn/ocr
ocrmaxattempts: 5
# yeeke(mmt.yeeke.com)退货包裹只读对接,见 #336。
# `[必须]` 账号密码不在这里,走环境变量 GOAUTO_YEEKE_USERNAME / GOAUTO_YEEKE_PASSWORD,
# 以免凭据进 Git。
yeeke:
baseurl: https://mmt.yeeke.com
pagesize: 100
maxpages: 10000
retry: 2
# 验证码识别服务,与 SYB 共用(#336 已批准)。
ocrurl: https://ocr.ilapage.cn/ocr
ocrmaxattempts: 5
cache:
# redis:
# addr: 127.0.0.1:6379
# password: xxxxxx
# db: 2
# key存在即可
memory: ''
queue:
memory:
poolSize: 100
# redis:
# addr: 127.0.0.1:6379
# password: xxxxxx
# producer:
# streamMaxLength: 100
# approximateMaxLength: true
# consumer:
# visibilityTimeout: 60
# bufferSize: 100
# concurrency: 10
# blockingTimeout: 5
# reclaimInterval: 1
locker:
redis: