spring:
  application:
    name: haha-admin

  # 数据库配置
  datasource:
    url: jdbc:mysql://server.kuaiyuman.cn:3306/haha?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&useServerPrepStmts=true&cachePrepStmts=true&prepStmtCacheSize=250&prepStmtCacheSqlLimit=2048
    username: root
    password: KuaiyuMan/*-
    driver-class-name: com.mysql.cj.jdbc.Driver
    # HikariCP 连接池配置
    hikari:
      # 最小空闲连接数
      minimum-idle: 3
      # 最大连接池大小
      maximum-pool-size: 10
      # 连接最大存活时间（毫秒），建议小于数据库的 wait_timeout
      max-lifetime: 1800000
      # 空闲连接超时时间
      idle-timeout: 300000
      # 连接超时时间
      connection-timeout: 30000
      # 连接测试查询
      connection-test-query: SELECT 1
      # 保持连接活跃的频率（毫秒）
      keepalive-time: 30000

  # Redis 配置
  data:
    redis:
      host: server.kuaiyuman.cn
      port: 6379
      password: KtXA^Zx!TZmLEy(@JjB@2(TVG0kdy5)&
      database: 9
      timeout: 30000
      # 连接配置
      lettuce:
        pool:
          max-active: 20
          max-wait: 5000
          max-idle: 10
          min-idle: 5
          # 连接耗尽时等待时间（毫秒）
          time-between-eviction-runs: 60000
        # 关闭超时时间
        shutdown-timeout: 200
        # 刷新配置
        refresh:
          # 刷新周期（毫秒）
          period: 30000
          # 最小刷新间隔
          min: 5000

# MyBatis-Plus 配置
mybatis-plus:
  mapper-locations: classpath*:mapper/**/*.xml
  configuration:
    map-underscore-to-camel-case: true
  global-config:
    db-config:
      id-type: ASSIGN_ID
    enable-sql-runner: false

# 服务器配置
server:
  port: 7070
  servlet:
    context-path: /admin

# Sa-Token 配置
sa-token:
  # token 名称(同时也是 cookie 名称)
  token-name: adminAccessToken
  # token 有效期(单位:秒) - 8小时
  timeout: 28800
  # token 临时有效期(单位:秒)
  active-timeout: -1
  # 是否允许同一账号多地同时登录
  is-concurrent: true
  # 同一账号最大登录数量
  max-login-count: 1
  # token 风格
  token-style: uuid
  # 是否输出操作日志
  is-log: true

# 微信小程序配置
wechat:
  # 支付配置 - 供支付分定时同步任务使用
  pay:
    app-id: wxb1cbe4678e0175f2 # 小程序appid
    mch-id: 1108941936 # 商户号
    v3-api-key: 7P5nbvnQpfj6cXpWrywtYstvJk5frjdK
    notify-url: https://dev-haha.kuaiyuman.cn/api/payment/callback/wechat
    private-key-path: classpath:cert/apiclient_key.pem
    merchant-serial-number: 58F965A745DF42AA4C8603EE6B2B663E1B100553
    service-id: 00004000000000178152595581906374
    pay-score-notify-url: https://dev-haha.kuaiyuman.cn/api/payment/callback/wechat_payscore
    wechat-pay-public-key-id: PUB_KEY_ID_0111089419362026062400382393001400
    wechat-pay-public-key-path: classpath:cert/pub_key.pem
  # 管理端小程序（haha-admin-mp）配置 - 用于补货员微信登录等
  admin-miniapp:
    app-id: 2601051549145878 # todo 要替换
    secret: 06e1be59332b00de0baad82002cdbcb5 # todo 要替换

# 哈哈零售 API 配置
haha:
  api:
    app-id: 2601051549145878
    app-secret: 06e1be59332b00de0baad82002cdbcb5
    base-url: http://api.hahabianli.com/

  # 日志配置
  log:
    # 慢请求阈值（毫秒）
    slow-request-threshold: 3000
    # 是否启用敏感信息脱敏
    enable-sensitive-mask: true
    # 是否启用请求日志
    enable-request-log: true

# 企得宝 ERP SDK 配置
qdb:
  client-id:
  client-secret:
  api-url: https://api.7debao.com/router/api

# 设备离线预警配置
device:
  alert:
    enabled: true
    cooldown-minutes: 30
    scan-interval-minutes: 5
    weak-signal-threshold: 2
    wechat-work:
      webhook-url: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_KEY_HERE

# 日志配置
logging:
  level:
    root: info
    com.haha.admin: debug
  file:
    # 日志文件路径(相对于项目启动目录) - 按应用隔离子目录，避免 admin/miniapp 互相覆盖
    path: ./logs/admin
    name: ./logs/admin/haha-admin.log
