vrorder_helper.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. require_once(BASE_HELPER_PATH . '/mcard/mcard.php');
  3. require_once(BASE_HELPER_PATH . '/mtopcard/mtopcard.php');
  4. class vrorder_helper
  5. {
  6. //提供给商家管理后台.
  7. public static function extend_order_info($order)
  8. {
  9. global $config;
  10. $handlers = $config['vgoods_handlers'];
  11. $goods_id = $order['goods_id'];
  12. if(array_key_exists($goods_id,$handlers))
  13. {
  14. $handler = $handlers[$goods_id];
  15. if($handler['type'] == 'oil_card' || $handler['type'] == 'phone_card') {
  16. $mod_card = Model('card_key');
  17. $item = $mod_card->where(['order_id' => $order['order_id']])->find();
  18. if(!empty($item)) {
  19. $ret = [];
  20. $ret['接收卡'] = $item['receive_card_no'];
  21. $ret['卡类别'] = mtopcard\scard_type($item['receive_card_type']);
  22. $ret['卡号'] = $item['card_no'];
  23. $ret['卡密'] = $item['card_key'];
  24. return $ret;
  25. }
  26. }
  27. elseif($handler['type'] == 'member_card') {
  28. return [];
  29. }
  30. else {
  31. return [];
  32. }
  33. }
  34. else {
  35. return [];
  36. }
  37. }
  38. //取消虚拟订单时的状态
  39. public static function unfreeze_extra($order)
  40. {
  41. global $config;
  42. $handlers = $config['vgoods_handlers'];
  43. $goods_id = $order['goods_id'];
  44. if(array_key_exists($goods_id,$handlers))
  45. {
  46. $handler = $handlers[$goods_id];
  47. if($handler['type'] == 'oil_card' || $handler['type'] == 'phone_card')
  48. {
  49. $mod_card = Model('card_key');
  50. $item = $mod_card->where(['order_id' => $order['order_id']])->find();
  51. if(!empty($item)) {
  52. $card_id = $item['card_id'];
  53. $mod_card->reuse($card_id);
  54. }
  55. }
  56. }
  57. }
  58. }