init.php 1.3 KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. defined('IN_IA') or exit('Access Denied');
  3. function checkOrder() {
  4. global $_GPC, $_W;
  5. $where=" where uniacid = :uniacid and status = :status and is_out_time = :is_out_time";
  6. $data[':uniacid'] = $_W['uniacid'];
  7. $data[':status'] = 10;
  8. $data[':is_out_time'] = 0;
  9. $sql = "select * from " . tablename("zh_jdgjb_order") . $where . " order by id desc ";
  10. $list = pdo_fetchall($sql, $data);
  11. if (count($list) > 0) {
  12. foreach ($list as $keyOrder => $order) {
  13. if (time() > strtotime($order['departure_time'])) {
  14. pdo_update('zh_jdgjb_order', array('is_out_time' => 1), array('id' => $order['id']));
  15. $orderData[':uniacid'] = $_W['uniacid'];
  16. $orderData[':user_id'] = $order['user_id'];
  17. $orderData[':is_out_time'] = 1;
  18. $orderData[':is_re_pay'] = 0;
  19. $sqlOrder = "select * from " . tablename("zh_jdgjb_order") . " where uniacid = :uniacid and user_id = :user_id and is_out_time = :is_out_time and is_re_pay = :is_re_pay order by id desc ";
  20. $result = pdo_fetchall($sqlOrder, $orderData);
  21. if (count($result) >= 2) {
  22. pdo_update('zh_jdgjb_user', array('level_id' => 0, 'type' => 1), array('id' => $order['user_id']));
  23. }
  24. }
  25. }
  26. }
  27. }