123456789101112131415161718192021222324252627 |
- <?php
- use app\common\model\user\Withdraw;
- use think\migration\Seeder;
- class UpdateYeahMonthToUserWithdrawalsSeeder extends Seeder
- {
- /**
- * Run Method.
- *
- * Write your database seeder using this method.
- *
- * More information on writing seeders is available here:
- * http://docs.phinx.org/en/latest/seeding.html
- */
- public function run()
- {
- $m = new Withdraw();
- $lists = $m->field('id,create_time')->select();
- if ($lists){
- foreach ($lists as $list){
- $ym = substr($list['create_time'],0,4).substr($list['create_time'],5,2);
- $m->where('id',$list['id'])->update(['year_month'=>intval($ym)]);
- }
- }
- }
- }
|