123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- require_once(BASE_HELPER_PATH . '/mcard/mcard.php');
- require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
- class vrorder_helper
- {
- //提供给商家管理后台.
- public static function extend_order_info($order)
- {
- global $config;
- $handlers = $config['vgoods_handlers'];
- $goods_id = $order['goods_id'];
- if(array_key_exists($goods_id,$handlers))
- {
- $handler = $handlers[$goods_id];
- if($handler['type'] == 'oil_card' || $handler['type'] == 'phone_card') {
- $mod_card = Model('card_key');
- $item = $mod_card->where(['order_id' => $order['order_id']])->find();
- if(!empty($item)) {
- $ret = [];
- $ret['接收卡'] = $item['receive_card_no'];
- $ret['卡类别'] = mtopcard\scard_type($item['receive_card_type']);
- $ret['卡号'] = $item['card_no'];
- $ret['卡密'] = $item['card_key'];
- return $ret;
- }
- }
- elseif($handler['type'] == 'member_card') {
- return [];
- }
- else {
- return [];
- }
- }
- else {
- return [];
- }
- }
- //取消虚拟订单时的状态
- public static function unfreeze_extra($order)
- {
- global $config;
- $handlers = $config['vgoods_handlers'];
- $goods_id = $order['goods_id'];
- if(array_key_exists($goods_id,$handlers))
- {
- $handler = $handlers[$goods_id];
- if($handler['type'] == 'oil_card' || $handler['type'] == 'phone_card')
- {
- $mod_card = Model('card_key');
- $item = $mod_card->where(['order_id' => $order['order_id']])->find();
- if(!empty($item)) {
- $card_id = $item['card_id'];
- $mod_card->reuse($card_id);
- }
- }
- }
- }
- }
|