From c804ef08331ca7c5521b2c5979d410a6801ad943 Mon Sep 17 00:00:00 2001 From: denghy Date: Thu, 25 Apr 2019 18:37:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=BF=80=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/OldActivityTest.php | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/tests/OldActivityTest.php b/tests/OldActivityTest.php index e5845677..fb017b40 100644 --- a/tests/OldActivityTest.php +++ b/tests/OldActivityTest.php @@ -28,10 +28,39 @@ foreach ($data as $item) { $month = $content['1']; $attributes['type'] = 10; - $attributes['valid_start_time'] = $item[2]; + $attributes['valid_start_time'] = strtotime($item[3]); $attributes['valid_end_time'] = strtotime("+{$month} month", $attributes['valid_start_time']); $attributes['valid_end_time'] = strtotime('-1 second', $attributes['valid_end_time']); - $attributes['create_time'] = $item[2]; + $attributes['create_time'] = strtotime($item[3]); + $attributes['task_number'] = 'jh20190425'; + + DB::transaction(function () use ($attributes) { + unset($attributes['id']); + DB::connection('vd_old')->table('ckb_custom_handle_log')->insert($attributes); + DB::connection('vd_old')->table('ckb_custom')->where('custom_no', $attributes['custom_no'])->update([ + 'card_cycle_start' => $attributes['valid_start_time'], + 'card_cycle_end' => $attributes['valid_end_time'], + ]); + DB::connection('vd_old')->table('ckb_user_package')->where('custom_no', $attributes['custom_no'])->update([ + 'service_start_time' => $attributes['valid_start_time'], + 'service_end_time' => $attributes['valid_end_time'], + ]); + }); + } + } + + if (count($rows) == 2 && ($rows[0]['type'] == 10 || $rows[1]['type'] == 10)) { + echo '*' . PHP_EOL; + $attributes = $rows[0]; + + if (preg_match('/_(\d+)MONTH/', $attributes['content'], $content)) { + $month = $content['1']; + + $attributes['type'] = 10; + $attributes['valid_start_time'] = strtotime($item[3]); + $attributes['valid_end_time'] = strtotime("+{$month} month", $attributes['valid_start_time']); + $attributes['valid_end_time'] = strtotime('-1 second', $attributes['valid_end_time']); + $attributes['create_time'] = strtotime($item[3]); $attributes['task_number'] = 'jh20190425'; DB::transaction(function () use ($attributes) {