| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- use think\migration\Migrator;
- class SeedWithdrawCateData extends Migrator
- {
- public function up(): void
- {
- $now = time();
- foreach ($this->data() as [$type, $title, $value, $isOther, $sort]) {
- $this->execute("INSERT INTO `oa_withdraw_cate`
- (`type`, `title`, `value`, `is_other`, `sort`, `status`, `create_time`, `delete_time`)
- VALUES ({$type}, '{$title}', {$value}, {$isOther}, {$sort}, 1, {$now}, 0)");
- }
- }
- public function down(): void
- {
- foreach ($this->data() as [$type, $title]) {
- $this->execute("DELETE FROM `oa_withdraw_cate` WHERE `type` = {$type} AND `title` = '{$title}'");
- }
- }
- /**
- * @return array<int, array{0:int,1:string,2:int,3:int,4:int}> [type, title, value, is_other, sort]
- */
- protected function data(): array
- {
- return [
- // 客户交易场景(type=1)
- [1, 'Facebook', 1, 0, 1],
- [1, '其他-需在备注中说明', 9, 1, 9],
- // 提现类型(type=2)
- [2, '清退提现(全额提现)', 1, 0, 1],
- [2, '部分提现', 2, 0, 2],
- ];
- }
- }
|