spring:
  application:
    name: haha-miniapp

  # 数据库配置
  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
      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: 8
      timeout: 10000
      lettuce:
        pool:
          max-active: 10
          max-wait: 3000
          max-idle: 8
          min-idle: 2
          time-between-eviction-runs: 30000
        shutdown-timeout: 100

  # 数据库初始化
  sql:
    init:
      enabled: true
      mode: always
      schema-locations: classpath:sql/user.sql
      encoding: UTF-8

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

# 服务器配置
server:
  port: 7077
  servlet:
    context-path: /api

# 微信小程序配置
wechat:
  # 支付配置 - 供支付分定时同步任务使用
  pay:
    app-id: wxb1cbe4678e0175f2 # 小程序appid
    mch-id: 1108941936 # 商户号
    v3-api-key: 7P5nbvnQpfj6cXpWrywtYstvJk5frjdK
    api-v2-key: # TODO: 请填写商户平台-API安全中的APIv2密钥（32位），用于 openBusinessView 签名
    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
  # 小程序配置
  miniapp:
    # 用户端小程序（haha-mp）
    app-id: wxb1cbe4678e0175f2
    secret: 26c00fd986c628799653aca98803e5a5
    # 微信客服消息回调 Token（需与微信公众平台配置一致）
    customer-service-token: haha_cs_token_2026
  admin-miniapp:
    app-id: wxb1cbe4678e0175f2 # todo 要替换
    secret: 26c00fd986c628799653aca98803e5a5 # todo 要替换


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

  # 公共配置
  common:
    # 图片域名前缀
    image-domain-prefix: https://img.hahabianli.com/

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

# Sa-Token 配置
sa-token:
  # token 名称（同时也是 cookie 名称）
  token-name: accessToken
  # token 有效期（单位：秒）- 7天
  timeout: 604800
  # token 临时有效期（单位：秒）
  active-timeout: -1
  # 是否允许同一账号多地同时登录
  is-concurrent: true
  # 同一账号最大登录数量
  max-login-count: 10
  # token 风格
  token-style: uuid
  # 是否输出操作日志
  is-log: true
  # 是否在登录后的 WebSocket 连接中输出 token
  is-read-cookie: false
  # 是否在登录后的请求体里返回 token
  is-read-body: false
  # 是否从 header 中读取 token
  is-read-header: true

# 设备离线预警配置
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
