BaseConst.php 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <?php
  2. namespace App\Consts;
  3. class BaseConst
  4. {
  5. /**
  6. * 一天86400秒
  7. */
  8. const ONE_DAY_SECONDS = 86400;
  9. /**
  10. * 一周 86400 * 7 秒
  11. */
  12. const ONE_WEEK_SECONDS = 604800;
  13. /**
  14. * 一个月 86400 * 31 秒
  15. */
  16. const ONE_MONTH_SECONDS = 2678400;
  17. /**
  18. * 一天24*60分钟
  19. */
  20. const ONE_DAY_MINITUES = 1440;
  21. /**
  22. * 一分钟60秒
  23. */
  24. const ONE_MINUTE_SECONDS = 60;
  25. /**
  26. * 一小时3600秒
  27. */
  28. const ONE_HOUR = 3600;
  29. /**
  30. * 一年365天
  31. */
  32. const ONE_YEAR_DAYS = 365;
  33. /**
  34. * 默认锁时长
  35. */
  36. const LOCK_DEFAULT_SECONDS = 5;
  37. /**
  38. * 显示7天以前数据
  39. */
  40. const DATE_RANGE_DAYS = 7;
  41. /**
  42. * 默认分页数量
  43. */
  44. const DEFAULT_LENGTH = 15;
  45. /**
  46. * 每日分享量(达到该数值可获得一天会员)
  47. */
  48. const DAILY_SHARE_NUM = 5;
  49. /**
  50. * 初级vip等级
  51. */
  52. const JUNIOR_VIP_LEVEL = 1;
  53. /**
  54. * 高级vip登记等级
  55. */
  56. const SENIOR_VIP_LEVEL = 2;
  57. const USER_SCOPE = [
  58. '1' => '补充模板未覆盖人群',
  59. '2' => '付费用户',
  60. '3' => '派单用户'
  61. ];
  62. const PRODUCT_TYPE = [
  63. 'WEEK' => '周卡',
  64. 'MONTH' => '月卡',
  65. 'QUARTER' => '季卡',
  66. 'YEAR' => '年卡'
  67. ];
  68. const VOLC_PIC_MODELS = ['doubao-seedream-5-0-260128', 'doubao-seedream-5-0-lite-260128', 'doubao-seedream-4-5-251128'];
  69. /**
  70. * 动漫策划(chatForAce)失败重试时循环使用的模型列表
  71. *
  72. * 重试顺序:第 1 次重试用第 1 个模型,第 2 次用第 2 个……超出列表长度后从头循环;
  73. * 首次请求仍使用用户/剧集选择的原模型,只在重试时切换。
  74. * 需要调整时直接改这里的模型名即可(放在最前面的优先被重试使用)。
  75. */
  76. const ANIME_CHAT_RETRY_MODELS = [
  77. 'baidu-gpt-5.6-terra',
  78. 'deepseek-v4-flash',
  79. 'gpt-5.6-terra',
  80. ];
  81. /**
  82. * 批量生成分集(batch:generate-episodes)单集最大重跑次数
  83. *
  84. * 指"整集重新生成"的外层次数,超过后标记为失败并发送钉钉通知;
  85. * 单次生成内部的换模型重试由 ANIME_CHAT_RETRY_MODELS 控制,两者叠加生效。
  86. */
  87. const BATCH_EPISODE_MAX_RETRY_COUNT = 2;
  88. // GPT Image 系(含百度渠道:表里带 baidu- 前缀,调用上游时去掉前缀)
  89. const GPT_IMAGE2_MODELS = ['gpt-image-2', 'baidu-gpt-image-2', 'baidu-gpt-image-2.5-flare', 'baidu-gpt-image-2.5-sunburst'];
  90. const NANO_BANANA_MODELS = ['NanoBanana2', 'NanoBananaPro', 'GptImage2'];
  91. const GPT_TEXT_MODELS = ['gpt-5.4', 'gpt-5.6-terra', 'gpt-5.6-sol', 'gpt-5.6-luna', 'gpt-6-astra'];
  92. const GEMINI_TEXT_MODELS = [
  93. 'gemini-3-pro-preview',
  94. 'gemini-3-flash-preview',
  95. 'gemini-3.1-pro-preview',
  96. 'gemini-3.1-flash-image-preview-t',
  97. 'gemini-3.6-flash'
  98. ];
  99. // 百度 AI 网关 GLM 文生文模型(前端入参名)
  100. const BAIDU_GLM_TEXT_MODELS = ['baidu-glm-5.2', 'baidu-glm-5.3'];
  101. // 百度 AI 网关 GLM 模型映射:前端名 -> 网关真实模型名
  102. const BAIDU_GLM_MODEL_MAP = [
  103. 'baidu-glm-5.2' => 'glm-5.2',
  104. 'baidu-glm-5.3' => 'glm-5.3',
  105. ];
  106. // 百度 BO-CHAT(GPT 文生文)模型(前端入参名)
  107. const BAIDU_GPT_CHAT_TEXT_MODELS = [
  108. 'baidu-gpt-5.6-luna',
  109. 'baidu-gpt-5.6-sol',
  110. 'baidu-gpt-5.6-terra',
  111. 'baidu-gpt-6-astra',
  112. 'baidu-gpt-6-luna',
  113. 'baidu-gpt-6-sol',
  114. 'baidu-gpt-6.1-sol',
  115. ];
  116. // 百度 BO-CHAT 模型映射:前端名 -> 上游真实模型名(去掉 baidu- 前缀)
  117. const BAIDU_GPT_CHAT_MODEL_MAP = [
  118. 'baidu-gpt-5.6-luna' => 'gpt-5.6-luna',
  119. 'baidu-gpt-5.6-sol' => 'gpt-5.6-sol',
  120. 'baidu-gpt-5.6-terra' => 'gpt-5.6-terra',
  121. 'baidu-gpt-6-astra' => 'gpt-6-astra',
  122. 'baidu-gpt-6-luna' => 'gpt-6-luna',
  123. 'baidu-gpt-6-sol' => 'gpt-6-sol',
  124. 'baidu-gpt-6.1-sol' => 'gpt-6.1-sol',
  125. ];
  126. // 火山写作奖励计划接入点(使用该接入点可在第二天根据前一天使用量获取免费额度)
  127. const MODELS_MAP = [
  128. 'doubao-seed-2-0-pro-260215' => 'ep-20260422093628-pv5vj',
  129. 'doubao-seed-2-0-lite-260215' => 'ep-20260422093559-9fsgl',
  130. 'doubao-seed-2-0-mini-260215' => 'ep-20260422093505-qkj4z',
  131. 'deepseek-v3-2-251201' => 'ep-20260422092942-7kh9p',
  132. 'doubao-seedream-4-5-251128' => 'ep-20260422092419-6lvp9',
  133. 'doubao-seedream-5-0-lite-260128' => 'ep-20260903150621-49nrm',
  134. 'doubao-seedream-5-0-pro-260628' => 'ep-20260903141837-drhcf',
  135. 'doubao-seedance-1-5-pro-251215' => 'ep-20260422091940-g4knb',
  136. ];
  137. /**
  138. * 图片生成:分辨率档位(2k/3k/4k)与画面比例对应的尺寸映射表
  139. *
  140. * 统一入口,所有图片生成入口均应引用本常量,禁止在业务代码中重复维护尺寸表。
  141. *
  142. * 自定义尺寸约束(4k 档按此校准,长边尽量逼近 4k):
  143. * 1. 宽、高均须为 16 的倍数;
  144. * 2. 长边与短边比例介于 1:3 ~ 3:1;
  145. * 3. 长边不超过 3840(等于 3840 可用);
  146. * 4. 总像素数介于 655,360 ~ 8,294,400。
  147. */
  148. const IMAGE_RESOLUTION_SIZE_MAP = [
  149. '2k' => [
  150. '1:1' => ['width' => 2048, 'height' => 2048],
  151. '4:3' => ['width' => 2304, 'height' => 1728],
  152. '3:4' => ['width' => 1728, 'height' => 2304],
  153. '16:9' => ['width' => 2848, 'height' => 1600],
  154. '9:16' => ['width' => 1600, 'height' => 2848],
  155. '3:2' => ['width' => 2496, 'height' => 1664],
  156. '2:3' => ['width' => 1664, 'height' => 2496],
  157. '21:9' => ['width' => 3136, 'height' => 1344],
  158. '2:1' => ['width' => 2048, 'height' => 1024],
  159. '1:2' => ['width' => 1024, 'height' => 2048],
  160. '3:1' => ['width' => 2448, 'height' => 816],
  161. '1:3' => ['width' => 816, 'height' => 2448],
  162. ],
  163. '3k' => [
  164. '1:1' => ['width' => 3072, 'height' => 3072],
  165. '4:3' => ['width' => 3456, 'height' => 2592],
  166. '3:4' => ['width' => 2592, 'height' => 3456],
  167. '16:9' => ['width' => 3840, 'height' => 2160],
  168. '9:16' => ['width' => 2160, 'height' => 3840],
  169. '2:3' => ['width' => 2496, 'height' => 3744],
  170. '3:2' => ['width' => 3744, 'height' => 2496],
  171. '21:9' => ['width' => 3440, 'height' => 1440],
  172. '2:1' => ['width' => 3072, 'height' => 1536],
  173. '1:2' => ['width' => 1536, 'height' => 3072],
  174. '3:1' => ['width' => 2976, 'height' => 992],
  175. '1:3' => ['width' => 992, 'height' => 2976],
  176. ],
  177. '4k' => [
  178. // 4k 受 829 万像素上限约束:长边能到 3840 的取 3840,够不到的取该比例下的最大可行值
  179. '1:1' => ['width' => 2880, 'height' => 2880],
  180. '3:4' => ['width' => 2480, 'height' => 3328],
  181. '4:3' => ['width' => 3328, 'height' => 2480],
  182. '16:9' => ['width' => 3840, 'height' => 2160],
  183. '9:16' => ['width' => 2160, 'height' => 3840],
  184. '2:3' => ['width' => 2336, 'height' => 3536],
  185. '3:2' => ['width' => 3536, 'height' => 2336],
  186. // 21:9 长边取 3840,短边 1648 使总像素 ≥ 6MP,计费仍归入 4k 档
  187. '21:9' => ['width' => 3840, 'height' => 1648],
  188. '2:1' => ['width' => 3840, 'height' => 1920],
  189. '1:2' => ['width' => 1920, 'height' => 3840],
  190. '3:1' => ['width' => 3840, 'height' => 1280],
  191. '1:3' => ['width' => 1280, 'height' => 3840],
  192. ],
  193. ];
  194. /**
  195. * 画面比例配置(默认 2k 档尺寸)
  196. */
  197. const IMAGE_RATIOS = self::IMAGE_RESOLUTION_SIZE_MAP['2k'];
  198. }