= '{$stime}'"; $stmt = $_PDO->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); $str = ''; echo "\n\nSQL:".$sql; if(!empty($result)){ foreach($result as $k=>$v){ $mobile = $v['phone']; $name = (!empty($v['is_update_name']) && !empty($v['name'])) ? $v['name'] : $v['nickname']; $res = YPSMS::sendNewRed($mobile, $name, $flag); $str .= $mobile.','; } } return trim($str,','); } function sendToMsg2($stime, $etime){ $_PDO=DB_PDO::getInstance( conf::$DB_CONF ); $sql = "select u.phone,wx2.nickname,u2.name,u2.is_update_name from users as u left join user_weixin wx on wx.user_id=u.id left join users u2 on u2.invite_code=wx.invite_code left join user_weixin wx2 on wx2.user_id=u2.id where u.origin=0 and wx.is_login=0 and u.created_at < '{$etime}' and u.created_at >= '{$stime}'"; $stmt = $_PDO->prepare($sql); $stmt->execute(); $result = $stmt->fetchAll(PDO::FETCH_ASSOC); $str = ''; echo "\n\nSQL:".$sql; if(!empty($result)){ foreach($result as $k=>$v){ $mobile = $v['phone']; $name = (!empty($v['is_update_name']) && !empty($v['name'])) ? $v['name'] : $v['nickname']; $res = YPSMS::sendNewRed2($mobile, $name); $str .= $mobile.','; } } return trim($str,','); }