transfer.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?php
  2. return [
  3. /*
  4. |--------------------------------------------------------------------------
  5. | Transfer模块配置
  6. |--------------------------------------------------------------------------
  7. |
  8. | Transfer模块的核心配置选项
  9. |
  10. */
  11. // 模块基本信息
  12. 'name' => 'Transfer',
  13. 'version' => '1.0.0',
  14. 'description' => '资金划转模块',
  15. // 默认配置
  16. 'defaults' => [
  17. // 默认汇率
  18. 'exchange_rate' => 1.0000,
  19. // 默认货币类型
  20. 'currency_id' => 2, // 钻石
  21. // 默认资金账户类型
  22. 'fund_id' => 2,
  23. // 金额精度
  24. 'amount_precision' => 10,
  25. // 汇率精度
  26. 'rate_precision' => 4,
  27. ],
  28. // 限制配置
  29. 'limits' => [
  30. // 最小转出金额
  31. 'min_transfer_amount' => '0.0000000001',
  32. // 最大转出金额
  33. 'max_transfer_amount' => '999999999.9999999999',
  34. // 每日转出次数限制
  35. 'daily_transfer_count' => 10,
  36. // 每日转出金额限制
  37. 'daily_transfer_amount' => '50000.0000000000',
  38. // 业务ID最小长度
  39. 'out_order_id_min_length' => 3,
  40. // 业务ID最大长度
  41. 'out_order_id_max_length' => 100,
  42. ],
  43. // 外部API配置
  44. 'api' => [
  45. // 请求超时时间(秒)
  46. 'timeout' => 30,
  47. // 连接超时时间(秒)
  48. 'connect_timeout' => 10,
  49. // 重试次数
  50. 'retry_times' => 3,
  51. // 重试间隔(秒)
  52. 'retry_delay' => 2,
  53. // 签名算法
  54. 'signature_method' => 'md5',
  55. // User-Agent
  56. 'user_agent' => 'Transfer-Module/1.0',
  57. ],
  58. // 回调配置
  59. 'callback' => [
  60. // 最大重试次数
  61. 'max_retries' => 3,
  62. // 重试延迟(分钟)
  63. 'retry_delays' => [1, 2, 4], // 指数退避
  64. // 回调超时时间(秒)
  65. 'timeout' => 30,
  66. // 回调数据最大大小(字节)
  67. 'max_data_size' => 1024,
  68. ],
  69. // 队列配置
  70. 'queue' => [
  71. // 默认队列名称
  72. 'default' => 'transfer',
  73. // 回调队列名称
  74. 'callback' => 'transfer_callback',
  75. // 任务最大尝试次数
  76. 'max_tries' => 3,
  77. // 任务超时时间(秒)
  78. 'timeout' => 120,
  79. // 失败任务保留时间(秒)
  80. 'failed_job_retention' => 86400, // 24小时
  81. ],
  82. // 日志配置
  83. 'logging' => [
  84. // 是否启用详细日志
  85. 'detailed' => true,
  86. // 日志级别
  87. 'level' => 'info',
  88. // 是否记录API请求响应
  89. 'log_api_requests' => true,
  90. // 是否记录回调数据
  91. 'log_callback_data' => true,
  92. // 敏感字段(不记录到日志)
  93. 'sensitive_fields' => [
  94. 'password',
  95. 'token',
  96. 'secret',
  97. 'key',
  98. 'signature',
  99. ],
  100. ],
  101. // 缓存配置
  102. 'cache' => [
  103. // 缓存前缀
  104. 'prefix' => 'transfer:',
  105. // 应用配置缓存时间(秒)
  106. 'app_config_ttl' => 3600, // 1小时
  107. // 统计数据缓存时间(秒)
  108. 'stats_ttl' => 300, // 5分钟
  109. // 是否启用缓存
  110. 'enabled' => true,
  111. ],
  112. // 监控配置
  113. 'monitoring' => [
  114. // 是否启用性能监控
  115. 'performance' => true,
  116. // 是否启用错误监控
  117. 'error_tracking' => true,
  118. // 慢查询阈值(毫秒)
  119. 'slow_query_threshold' => 1000,
  120. // 慢API阈值(毫秒)
  121. 'slow_api_threshold' => 5000,
  122. ],
  123. // 安全配置
  124. 'security' => [
  125. // 是否启用签名验证
  126. 'signature_verification' => true,
  127. // 是否启用IP白名单
  128. 'ip_whitelist_enabled' => false,
  129. // IP白名单
  130. 'ip_whitelist' => [],
  131. // 是否启用频率限制
  132. 'rate_limiting' => true,
  133. // 频率限制配置
  134. 'rate_limit' => [
  135. 'max_attempts' => 60, // 每分钟最大请求次数
  136. 'decay_minutes' => 1, // 重置时间
  137. ],
  138. ],
  139. // 通知配置
  140. 'notifications' => [
  141. // 是否启用通知
  142. 'enabled' => true,
  143. // 通知渠道
  144. 'channels' => ['mail', 'database'],
  145. // 需要通知的事件
  146. 'events' => [
  147. 'order_failed' => true,
  148. 'api_error' => true,
  149. 'callback_failed' => true,
  150. 'daily_summary' => true,
  151. ],
  152. // 通知接收者
  153. 'recipients' => [
  154. 'admin@example.com',
  155. ],
  156. ],
  157. // 开发配置
  158. 'development' => [
  159. // 是否启用调试模式
  160. 'debug' => env('APP_DEBUG', false),
  161. // 是否启用SQL日志
  162. 'sql_logging' => false,
  163. // 是否启用API模拟
  164. 'api_mock' => false,
  165. // 模拟响应延迟(毫秒)
  166. 'mock_delay' => 1000,
  167. ],
  168. ];