人人商城

mass.inc.php 1.1KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. global $_W, $_GPC;
  8. $id = intval($_W['cron']['extra']);
  9. $data = pdo_get('mc_mass_record', array('uniacid' => $_W['uniacid'], 'id' => $id));
  10. if(empty($data)) {
  11. $this->addCronLog($id, -1100, '未找到群发的设置信息');
  12. }
  13. $acc = WeAccount::createByUniacid();
  14. if(is_error($acc)) {
  15. $this->addCronLog($id, -1101, '创建公众号操作对象失败');
  16. }
  17. $status = $acc->fansSendAll($data['group'], $data['msgtype'], $data['media_id']);
  18. if(is_error($status)) {
  19. pdo_update('mc_mass_record', array('status' => 2, 'finalsendtime' => TIMESTAMP), array('uniacid' => $_W['uniacid'], 'id' => $id));
  20. $this->addCronLog($id, -1102, $status['message']);
  21. }
  22. pdo_update('mc_mass_record', array('status' => 0, 'finalsendtime' => TIMESTAMP), array('uniacid' => $_W['uniacid'], 'id' => $id));
  23. pdo_delete('core_cron', array('uniacid' => $_W['uniacid'], 'id' => $_W['cron']['id']));
  24. $this->addCronLog($id, 0, 'success');