人人商城

livenotice.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. global $_W;
  7. global $_GPC;
  8. ignore_user_abort();
  9. set_time_limit(0);
  10. $sets = pdo_fetchall('select uniacid,livenoticetime from ' . tablename('ewei_shop_live_setting'));
  11. foreach ($sets as $key => $value) {
  12. global $_W;
  13. global $_GPC;
  14. $_W['uniacid'] = $value['uniacid'];
  15. if (empty($_W['uniacid'])) {
  16. continue;
  17. }
  18. $params = array(':uniacid' => $_W['uniacid']);
  19. $times = intval($value['livenoticetime']) * 60;
  20. $livetime = $times + time();
  21. $sql = 'select id,livetime from ' . tablename('ewei_shop_live') . ' where uniacid = :uniacid and subscribenotice = 0 and livetime > ' . time() . ' and livetime < ' . $livetime . ' and status = 1 and subscribe > 0 ';
  22. $lives = pdo_fetchall($sql, $params);
  23. if (!empty($lives)) {
  24. foreach ($lives as $k => $val) {
  25. $sql_favorite = 'select openid from ' . tablename('ewei_shop_live_favorite') . ' where uniacid = :uniacid and roomid = ' . $val['id'] . ' and deleted = 0 ';
  26. $favorites = pdo_fetchall($sql_favorite, $params);
  27. foreach ($favorites as $v) {
  28. }
  29. pdo_update('ewei_shop_live', array('subscribenotice' => 1), array('id' => $val['id']));
  30. }
  31. }
  32. }
  33. ?>