refill_order_manual.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. class refill_order_manualControl extends SystemControl
  3. {
  4. public function __construct()
  5. {
  6. parent::__construct();
  7. }
  8. public function indexOp()
  9. {
  10. $model_refill_order = Model('refill_order');
  11. $condition['inner_status'] = 0;
  12. $order_list = [];
  13. if (!empty($_GET['order_sn'])) {
  14. $condition['refill_order.order_sn'] = $_GET['order_sn'];
  15. $merchants = [];
  16. $merchant_list = Model('')->table('merchant')->limit(1000)->select();
  17. foreach ($merchant_list as $key => $value) {
  18. $merchants[$value['mchid']] = $value;
  19. }
  20. $order_list = $model_refill_order->getMerchantOrderList($condition, 50, 'refill_order.*,vr_order.order_state', 'refill_order.order_time desc');
  21. foreach ($order_list as $order_id => $order_info) {
  22. $order_list[$order_id]['card_type_text'] = $this->scard_type($order_info['card_type']);
  23. $order_list[$order_id]['mch_name'] = $merchants[$order_info['mchid']]['company_name'];
  24. if ($order_info['notify_time'] > 0) {
  25. $diff_time = $order_info['notify_time'] - $order_info['order_time'];
  26. } else {
  27. $diff_time = time() - $order_info['order_time'];
  28. }
  29. $order_list[$order_id]['diff_time_text'] = $this->elapse_time($diff_time);
  30. $order_list[$order_id]['diff_time'] = $diff_time;
  31. $order_list[$order_id]['quality_text'] = $this->quality_format($order_info['quality'],$order_info['card_type']);
  32. $order_list[$order_id]['org_quality_text'] = $this->quality_format($order_info['org_quality'],$order_info['card_type']);
  33. }
  34. }
  35. Tpl::output('order_list', $order_list);
  36. Tpl::showpage('refill.order.manual.index');
  37. }
  38. public function notify_manual_merchantOp()
  39. {
  40. $order_id = $_GET['order_id'];
  41. $type = $_GET['type'];
  42. $mod_order = Model('vr_order');
  43. $order_info = $mod_order->getOrderInfo(['order_id' => $order_id]);
  44. if ((time() - $order_info['order_time']) < 3600) {
  45. showMessage('订单时间未超过1小时', 'index.php?act=refill_order&op=index');
  46. }
  47. $mod_refill = Model('refill_order');
  48. $logic_vr_order = Logic("vr_order");
  49. $order_info = Model('vr_order')->getOrderInfo(['order_id' => $order_id]);
  50. if ($type == 'success') {
  51. $logic_vr_order->changeOrderStateSuccess($order_id);
  52. $mod_refill->edit($order_id, ['notify_state' =>1, 'notify_time' => time()]);
  53. QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true]);
  54. } elseif ($type == 'cancel') {
  55. $logic_vr_order->changeOrderStateCancel($order_info, '', "充值失败");
  56. $mod_refill->edit($order_id, ['notify_state' =>1, 'notify_time' => time()]);
  57. QueueClient::push("NotifyMerchantComplete", ['order_id' => $order_id, 'manual' => true]);
  58. } else {
  59. showMessage('手动操作类型错误', 'index.php?act=refill_order&op=index');
  60. }
  61. showMessage('操作成功');
  62. }
  63. }