PetJsonConfig.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace App\Module\Game\DCache;
  3. use App\Module\LCache\DQueueJob;
  4. /**
  5. * 宠物配置表缓存
  6. */
  7. class PetJsonConfig extends DQueueJob
  8. {
  9. /**
  10. * 获取新数据
  11. *
  12. * @param array $parameter 参数
  13. * @return mixed
  14. */
  15. static public function getNewData(array $parameter = [])
  16. {
  17. // 为了兼容旧版本,返回一个包含所有宠物配置的数据结构
  18. $petConfigData = PetConfigJsonConfig::getNewData($parameter);
  19. $petLevelConfigData = PetLevelJsonConfig::getNewData($parameter);
  20. $petSkillConfigData = PetSkillJsonConfig::getNewData($parameter);
  21. return [
  22. 'pet_config' => $petConfigData,
  23. 'pet_level_config' => $petLevelConfigData,
  24. 'pet_skill_config' => $petSkillConfigData,
  25. 'success' => true,
  26. 'generated_ts' => time(),
  27. 'message' => '宠物配置已拆分为三个独立文件,请使用各自的缓存类获取'
  28. ];
  29. }
  30. /**
  31. * 获取缓存时间(秒)
  32. *
  33. * @return int
  34. */
  35. static public function getTtl(): int
  36. {
  37. return 3600; // 1小时
  38. }
  39. /**
  40. * 获取防重复执行时间(秒)
  41. *
  42. * @return int
  43. */
  44. static public function getPreventDuplication(): int
  45. {
  46. return 600; // 10分钟
  47. }
  48. /**
  49. * 获取必需参数索引
  50. *
  51. * @return array
  52. */
  53. static public function getRequiredArgIndex(): array
  54. {
  55. return [];
  56. }
  57. }