| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- use think\migration\Migrator;
- class SeedVccPaymentCateData extends Migrator
- {
- public function up(): void
- {
- $now = time();
- // type=1 付款方式 [type, title, value, is_other, sort]
- $rows = [
- [1, '现金', 1, 0, 1],
- [1, '银行卡', 2, 0, 2],
- [1, '支票', 3, 0, 3],
- [1, '电汇', 4, 0, 4],
- [1, '汇票', 5, 0, 5],
- [1, '贷记', 6, 0, 6],
- [1, '其他', 7, 0, 7],
- ];
- $values = [];
- foreach ($rows as $row) {
- $title = $this->getAdapter()->getConnection()->quote($row[1]);
- $values[] = "({$row[0]}, {$title}, {$row[2]}, {$row[3]}, {$row[4]}, 1, {$now}, 0)";
- }
- $sql = "INSERT INTO `oa_vcc_payment_cate` (`type`, `title`, `value`, `is_other`, `sort`, `status`, `create_time`, `delete_time`) VALUES "
- . implode(',', $values);
- $this->execute($sql);
- }
- public function down(): void
- {
- $this->execute("DELETE FROM `oa_vcc_payment_cate`");
- }
- }
|