人人商城

receive.php 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. error_reporting(0);
  3. require '../../../../../framework/bootstrap.inc.php';
  4. require '../../../../../addons/ewei_shopv2/defines.php';
  5. require '../../../../../addons/ewei_shopv2/core/inc/functions.php';
  6. require '../../../../../addons/ewei_shopv2/core/inc/plugin_model.php';
  7. global $_W;
  8. global $_GPC;
  9. ignore_user_abort();
  10. set_time_limit(0);
  11. $sets = pdo_fetchall('select uniacid,receive from ' . tablename('ewei_shop_groups_set'));
  12. foreach ($sets as $set) {
  13. $_W['uniacid'] = $set['uniacid'];
  14. if (empty($_W['uniacid'])) {
  15. continue;
  16. }
  17. $days = intval($set['receive']);
  18. if ($days <= 0) {
  19. continue;
  20. }
  21. $daytimes = 86400 * $days;
  22. $p = p('groups');
  23. $pcoupon = com('coupon');
  24. $orders = pdo_fetchall('select id from ' . tablename('ewei_shop_groups_order') . (' where uniacid=' . $_W['uniacid'] . ' and status=2 and sendtime + ' . $daytimes . ' <=unix_timestamp() '), array(), 'id');
  25. if (!empty($orders)) {
  26. $orderkeys = array_keys($orders);
  27. $orderids = implode(',', $orderkeys);
  28. if (!empty($orderids)) {
  29. pdo_query('update ' . tablename('ewei_shop_groups_order') . ' set status=3,finishtime=' . time() . ' where id in (' . $orderids . ')');
  30. }
  31. }
  32. }
  33. ?>