scanpay.inc.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. defined('IN_IA') or exit('Access Denied');
  3. global $_W, $_GPC;
  4. paycenter_check_login();
  5. $user_permission = permission_account_user('system');
  6. $op = !empty($_GPC['op']) ? safe_gpc_string($_GPC['op']) : 'index';
  7. if ($_W['account']['level'] != ACCOUNT_SERVICE_VERIFY) {
  8. message('公众号权限不足', '', 'error');
  9. }
  10. if ('post' == $op) {
  11. if (checksubmit()) {
  12. $fee = !empty($_GPC['fee']) ? safe_gpc_string($_GPC['fee']) : message('收款金额有误', '', 'error');
  13. $body = !empty($_GPC['body']) ? safe_gpc_string($_GPC['body']) : '收银台收款' . $fee;
  14. $data = array(
  15. 'uniacid' => $_W['uniacid'],
  16. 'clerk_id' => $_W['user']['clerk_id'],
  17. 'clerk_type' => $_W['user']['clerk_type'],
  18. 'store_id' => $_W['user']['store_id'],
  19. 'body' => $body,
  20. 'fee' => $fee,
  21. 'final_fee' => $fee,
  22. 'credit_status' => 1,
  23. 'createtime' => TIMESTAMP,
  24. );
  25. table('paycenter_order')->fill($data)->save();
  26. $id = pdo_insertid();
  27. header('location:' . $this->createMobileUrl('scanpay', array('op' => 'qrcode', 'id' => $id)));
  28. die;
  29. }
  30. }
  31. if ('qrcode' == $op) {
  32. $id = intval($_GPC['id']);
  33. $order = table('paycenter_order')->getById($id, $_W['uniacid']);
  34. if (empty($order)) {
  35. message('订单不存在或已删除', '', 'error');
  36. }
  37. if (1 == $order['status']) {
  38. message('该订单已付款', '', 'error');
  39. }
  40. }
  41. if ('list' == $op) {
  42. $period = intval($_GPC['period']);
  43. $where = array(
  44. 'uniacid' => $_W['uniacid'],
  45. 'status' => 1,
  46. 'clerk_id' => $_W['user']['clerk_id'],
  47. );
  48. if ($period <= 0) {
  49. $starttime = strtotime(date('Y-m-d')) + $period * 86400;
  50. $endtime = $starttime + 86400;
  51. $where['paytime >='] = $starttime;
  52. $where['paytime <='] = $endtime;
  53. }
  54. $orders = table('paycenter_order')
  55. ->where($where)
  56. ->orderby(array('paytime' => 'DESC'))
  57. ->getall();
  58. }
  59. if ('detail' == $op) {
  60. $id = intval($_GPC['id']);
  61. $order = table('paycenter_order')->getById($id, $_W['uniacid']);
  62. if (empty($order)) {
  63. message('订单不存在', '', '');
  64. } else {
  65. $store_id = $order['store_id'];
  66. $types = paycenter_order_types();
  67. $trade_types = paycenter_order_trade_types();
  68. $status = paycenter_order_status();
  69. $store_info = pdo_get('activity_stores', array('id' => $store_id, 'uniacid' => $_W['uniacid']), array('business_name'));
  70. }
  71. }
  72. include $this->template('scanpay');