20260525061908_seed_price_adjust_cate_data.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use think\migration\Migrator;
  3. class SeedPriceAdjustCateData extends Migrator
  4. {
  5. public function up(): void
  6. {
  7. $now = time();
  8. foreach ($this->data() as [$type, $title, $value, $isOther, $sort]) {
  9. $this->execute("INSERT INTO `oa_price_adjust_cate`
  10. (`type`, `title`, `value`, `is_other`, `sort`, `status`, `create_time`, `delete_time`)
  11. VALUES ({$type}, '{$title}', {$value}, {$isOther}, {$sort}, 1, {$now}, 0)");
  12. }
  13. }
  14. public function down(): void
  15. {
  16. foreach ($this->data() as [$type, $title]) {
  17. $this->execute("DELETE FROM `oa_price_adjust_cate` WHERE `type` = {$type} AND `title` = '{$title}'");
  18. }
  19. }
  20. /**
  21. * @return array<int, array{0:int,1:string,2:int,3:int,4:int}> [type, title, value, is_other, sort]
  22. */
  23. protected function data(): array
  24. {
  25. return [
  26. // 客户交易主要场景(type=1)
  27. [1, '广告服务类:Facebook、Google、Tiktok等', 1, 0, 1],
  28. [1, '平台电商类:速卖通、Ebay、亚马逊等', 2, 0, 2],
  29. [1, '钱包类:PayPal消费类、WeChatPay、wise等', 3, 0, 3],
  30. [1, '订阅类:娱乐服务', 4, 0, 4],
  31. [1, '游戏类', 5, 0, 5],
  32. [1, '航空机旅', 6, 0, 6],
  33. [1, '留学缴费', 7, 0, 7],
  34. [1, 'SAAS:云', 8, 0, 8],
  35. [1, '其他-需在备注中说明', 9, 1, 9],
  36. // 卡BIN(type=2)
  37. [2, '投流组(G/A/Q/P)', 1, 0, 1],
  38. [2, '电商组(D/P/Q/G)', 2, 0, 2],
  39. [2, 'Q卡', 3, 0, 3],
  40. [2, 'A卡', 4, 0, 4],
  41. [2, 'V卡', 5, 0, 5],
  42. // 卡类型(type=3)
  43. [3, '储值卡', 1, 0, 1],
  44. [3, '共享卡', 2, 0, 2],
  45. ];
  46. }
  47. }