20260527110003_seed_fee_refund_cate_data.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. use think\migration\Migrator;
  3. class SeedFeeRefundCateData 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_fee_refund_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_fee_refund_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, '账户', 1, 0, 1],
  28. [1, '卡', 2, 0, 2],
  29. // 退款项(type=2,单选)
  30. [2, '小额手续费', 1, 0, 1],
  31. [2, '失败手续费', 2, 0, 2],
  32. [2, '开卡手续费', 3, 0, 3],
  33. [2, '充值手续费', 4, 0, 4],
  34. [2, '退款手续费', 5, 0, 5],
  35. [2, '撤销手续费', 6, 0, 6],
  36. [2, '销卡退值金额', 7, 0, 7],
  37. [2, '其他-需备注说明', 9, 1, 9],
  38. // 退款原因(type=3,单选)
  39. [3, '约定,已过审批', 1, 0, 1],
  40. [3, '特殊情况', 2, 0, 2],
  41. ];
  42. }
  43. }