|
@@ -19,7 +19,6 @@ require_once(BASE_HELPER_PATH . '/util_helper.php');
|
|
|
require_once(BASE_HELPER_PATH . '/order_helper.php');
|
|
|
require_once(BASE_HELPER_PATH . '/bonus_helper.php');
|
|
|
require_once(BASE_HELPER_PATH . '/vrorder_helper.php');
|
|
|
-
|
|
|
use mcard;
|
|
|
|
|
|
class TestMemberCard extends TestCase
|
|
@@ -31,6 +30,53 @@ class TestMemberCard extends TestCase
|
|
|
Base::run_util();
|
|
|
}
|
|
|
|
|
|
+ public function testLoadTopcards()
|
|
|
+ {
|
|
|
+ global $config;
|
|
|
+ $spec_card = $config['vgoods_spec_card'];
|
|
|
+
|
|
|
+ $vr_order = Model();
|
|
|
+ $topcard = Model('topcard');
|
|
|
+ $member_topcard = Model('member_topcard');
|
|
|
+
|
|
|
+ $i = 0;
|
|
|
+ while (true)
|
|
|
+ {
|
|
|
+ $start = $i * 1000;
|
|
|
+ $items = $vr_order->table('vr_order')->field('*')->order('order_id asc')->limit("{$start},1000")->select();
|
|
|
+ if(empty($items)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ $i++;
|
|
|
+
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
+ $member_id = intval($item['buyer_id']);
|
|
|
+ $add_time = intval($item['add_time']);
|
|
|
+ $payment_time = intval($item['payment_time']);
|
|
|
+ $goods_id = intval($item['goods_id']);
|
|
|
+ $amount = $spec_card[$goods_id];
|
|
|
+ $order_state = intval($item['order_state']);
|
|
|
+
|
|
|
+ $extra_info = json_decode($item['extra_info'],true);
|
|
|
+ $card_no = $extra_info['input']['card_no'];
|
|
|
+ $card_type = mtopcard\topcard_type($extra_info['input']['card_type']);
|
|
|
+
|
|
|
+ if(!$topcard->add($card_no,$card_type,$add_time)) {
|
|
|
+ Log::record("{$card_no} 已经录入",Log::DEBUG);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(in_array($order_state,[ORDER_STATE_PAY, ORDER_STATE_SEND, ORDER_STATE_SUCCESS]))
|
|
|
+ {
|
|
|
+ $ret = $topcard->add_money($card_no,$amount,$payment_time);
|
|
|
+ if(!$ret) {
|
|
|
+ Log::record("{$card_no} add money fail.",Log::DEBUG);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public function testDate()
|
|
|
{
|
|
|
$now = time();
|