本文整理汇总了PHP中Msg::setStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP Msg::setStatus方法的具体用法?PHP Msg::setStatus怎么用?PHP Msg::setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Msg
的用法示例。
在下文中一共展示了Msg::setStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twitter_process_messages
/**
* loop through twitter messages, put them to database and send them to qaul app
*/
function twitter_process_messages($data, $type)
{
foreach ($data as $item) {
// check if message already exists
$msg = MsgQuery::create()->filterByTwitterid($item->id_str)->findOne();
if (!$msg) {
// save message in data base
$msg = new Msg();
$msg->setType($type);
$msg->setName($item->user->screen_name);
$msg->setMsg($item->text);
$msg->setIp(get_qaul_setting('ip'));
$msg->setTime($item->created_at);
$msg->setStatus(0);
$msg->setTwitterid($item->id_str);
$msg->save();
// send message to qaul app
twitter_send2qaul($msg);
}
}
}
示例2: elseif
$data = json_decode($json, false);
// loop through messages
foreach ($data->messages as $message) {
// check if message is connection
if ($message->type == 13 || $message->type == 3) {
// don't do anything
} elseif ($message->type == 11 || $message->type == 12) {
// don't do anything
// message was already added before sending it to the qaul app
} elseif (file_check_msg($message->msg)) {
// schedule file
file_schedule($message);
} elseif ($message->type == 1) {
// don't do anything
} elseif ($message->type == 2) {
// put message into data base
$msg = new Msg();
$msg->setType($message->type);
$msg->setName($message->name);
$msg->setMsg($message->msg);
$msg->setIp($message->ip);
$msg->setTime($message->time);
$msg->setStatus(0);
$msg->save();
// send message via twitter
$txt = twitter_message_string_utf8($msg->getMsg(), $msg->getName());
twitter_send2twitter($txt);
// wait before sending the next message
sleep(1);
}
}