server:
  port: 8081 # 用户端端口

spring:
  application:
    name: 1818-user-server
  # 静态资源配置
  web:
    resources:
      static-locations: classpath:/static/
      add-mappings: true # 启用默认的静态资源映射
      chain:
        strategy:
            enabled: true # 启用内容策略
            paths: /**
  # 文件上传配置
  servlet:
    multipart:
      enabled: true
      max-file-size: 15MB        # 单个文件最大15MB（微信视频最大10MB）
      max-request-size: 20MB     # 整个请求最大20MB
      file-size-threshold: 2MB   # 文件大于2MB时写入磁盘
  # --- DataSource Configuration ---
  datasource:
    url: jdbc:mysql://localhost:3306/1818ai?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&createDatabaseIfNotExist=true
    username: 1818ai
    password: XtBLxcZ8Nwa32raC
#    username: root
#    password: 1234
    driver-class-name: com.mysql.cj.jdbc.Driver

  sql:
    init:
      mode: never  # 不自动执行初始化脚本
      schema-locations: classpath:schema.sql
      data-locations: classpath:data.sql
      continue-on-error: true
  # --- Redis Configuration ---
  data:
    redis:
      host: localhost
      port: 6379
      password:
      database: 0 # 使用0号数据库
      timeout: 1800000
      lettuce:
        pool:
          max-active: 8
          max-wait: -1ms
          max-idle: 8
          min-idle: 0
  # --- Jackson Configuration ---
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8

mybatis:
  mapper-locations: classpath:mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true # 自动将下划线命名转为驼峰命名

logging:
  level:
    com.dora: debug # 设置项目包的日志级别为debug
    org.springframework: info

# --- Custom Properties ---
jwt:
  secret: "DoraUserServerSecretKeyForHS512AlgorithmIsVeryLongAndSecureEnoughNow12345" # 已替换为符合HS512要求的超长密钥
  expiration: 604800000 # 7天
  # 86400000 # 24 hours  1分钟
  header: "Authorization"
  token-head: "Bearer " 
  device-limit: 3 # 最大同时登录设备数
  cleanup-interval: 3600000 # token清理间隔(1小时)

# --- 短信配置 ---
ly:
  sms:
    accessKeyId: LTAI5t68do3qVXx5Rufugt3X
    accessKeySecret: 2vD9ToIff49Vph4JQXsn0Cy8nXQfzA
    signName: 星洋智慧
    verifyTemplateCode: SMS_491985030 

# --- 阿里云OSS配置 ---
aliyun:
  oss:
    endpoint: https://oss-cn-hangzhou.aliyuncs.com
    bucket-name: oss-1818ai-user-img
    region: cn-hangzhou
    user-img-folder: user_img
    expiration-seconds: 3600
    access-key-id: LTAI5t68do3qVXx5Rufugt3X
    access-key-secret: 2vD9ToIff49Vph4JQXsn0Cy8nXQfzA
  # --- 阿里云视频点播配置 ---
  vod:
    region: cn-shanghai
    access-key-id: LTAI5t68do3qVXx5Rufugt3X
    access-key-secret: 2vD9ToIff49Vph4JQXsn0Cy8nXQfzA
    role-arn: acs:ram::1234567890123456:role/aliyunosstokengeneratorrole
    role-session-name: vod-upload-session
    storage-location: outin-ee5e3ce2678511f0912a00163e32b0a3.oss-cn-shanghai.aliyuncs.com
    policy: |
      {
        "Version": "1",
        "Statement": [
          {
            "Action": "vod:*",
            "Resource": "*",
            "Effect": "Allow"
          }
        ]
      }
  # --- 阿里云身份认证服务配置 ---
  cloudauth:
    region: cn-hangzhou
    endpoint: cloudauth.aliyuncs.com
    # 直接从配置文件读取认证信息
    access-key-id: LTAI5t68do3qVXx5Rufugt3X
    access-key-secret: 2vD9ToIff49Vph4JQXsn0Cy8nXQfzA
    connection-timeout: 10000
    response-timeout: 10000
    # 身份认证配置
    biz-type: ID_2META  # 身份证二要素验证
    param-type: normal  # 参数类型：normal表示不加密

# --- SpringDoc OpenAPI & Knife4j Configuration ---
springdoc:
  swagger-ui:
    path: /swagger-ui.html
    tags-sorter: alpha
    operations-sorter: alpha
  api-docs:
    path: /v3/api-docs
  group-configs:
    - group: 'default'
      paths-to-match: '/**'
      packages-to-scan: com.dora.controller # 确保扫描正确的controller包

knife4j:
  enable: true
  setting:
    language: zh_cn

# --- Swagger API文档基本认证配置 ---
swagger:
  basic-auth:
    username: apidoc      # API文档访问用户名
    password: 1818ai@2024  # API文档访问密码 

# --- 微信支付配置 ---
wx2:
  # appID
  appid: wx514ee01702ec6672
  # 商户ID
  mchId: 1723398705
  # 商户号KEY
  mchKey: 7a4s4f4fs78wevx45ewf5463fds2EFSf
  # 全局交易类型， JSAPI=小程序，NATIVE: 二维码，APP: app支付，MWEB: H5支付，MICROPAY：付款码支付
  tradeType: NATIVE
  # 回调地址
  notifyUrl: https://www.1818ai.com/user/pay/callback
  # 证书路径（需要配置全路径）
  certUrl: /www/wwwroot/cret_weixin_pay/apiclient_cert.p12
  # HTTP(S) 连接超时时间，单位毫秒
  connectTimeout: 60000
  # HTTP(S) 读数据超时时间，单位毫秒
  readTimeout: 60000

# --- 实名认证限制配置 ---
identity-verify:
  daily-limit: 3 # 每日认证请求次数限制
  redis-key-prefix: "identity_verify_daily" # Redis key前缀
  enable-limit: true # 是否启用限制功能

# --- 微信公众号配置 ---
wx:
  mp:
    # 公众号appID（需要从微信公众号后台获取）
    appid: wx514ee01702ec6672
    # 公众号appsecret（需要从微信公众号后台获取）
    secret: 2b1a5e98108549c4564eda5a46807b02
    # 服务器验证token（自定义，与公众号后台配置一致）
    token: dortoek1818ai2025
    # 消息加密密钥（从公众号后台获取或随机生成）
    aesKey: d9mepo7DNs9q8HoFrx0ivlcIelX5Y84Q4QFfRK05Yq3

# --- ai模型配置 ---
ai:
  api:
    base-url: https://api.apiyi.com/v1/chat/completions
    # api key
    api-key: "sk-yrudP11MOLK8JlBfAeAfE74fBcFf4182Aa3a7a6b8c15D605"
    connect-timeout: 10000 # 10 seconds
    read-timeout: 300000   # 5 minutes
  # 多服务商配置（新架构）
  providers:
    openai:
      enabled: true
      base-url: https://api.apiyi.com/v1/chat/completions
      api-key: "sk-yrudP11MOLK8JlBfAeAfE74fBcFf4182Aa3a7a6b8c15D605"
      connect-timeout: 10000
      read-timeout: 300000
    runninghub:
      enabled: true
      base-url: https://www.runninghub.cn
      submit-url: /task/openapi/ai-app/run
      status-url: /task/openapi/status
      output-url: /task/openapi/outputs
      default-webapp-id: "1973555977595301890"
      api-key: "5c44cef12da3470e9f24da70c63787dc"
      polling-interval: 10000    # 轮询间隔（毫秒）- 10秒
      max-polling-times: 60      # 最大轮询次数（10分钟）
      max-polling-tasks: 100     # 最大并发轮询任务数
      queue-check-interval: 5000 # 队列检查间隔（毫秒）- 5秒
      task-timeout-minutes: 15   # RunningHub任务超时时间（分钟）- 视频生成需要更长时间
      connect-timeout: 10000
      read-timeout: 300000
    suchuang:
      enabled: true
      base-url: https://api.wuyinkeji.com
      submit-url: /api/sora2/submit
      detail-url: /api/sora2/detail
      api-key: "LjRbm04mXO4CICPXJgPmfOaNij"
      polling-interval: 10000    # 轮询间隔（毫秒）- 10秒
      task-timeout-minutes: 15   # 速创任务超时时间（分钟）
      connect-timeout: 10000
      read-timeout: 300000
  queue:
    scan-interval: 5000 # 队列扫描间隔（毫秒）
    max-concurrent: 50 # 每个模型允许的最大并发处理数
    timeout-hours: 24 # 队列任务超时时间（小时），超过此时间自动取消
  task:
    timeout-scan-interval: 60000 # 任务超时检查间隔（毫秒）
    timeout-minutes: 10 # 任务处理超时时间（分钟）