本文整理汇总了PHP中Messages::insert方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::insert方法的具体用法?PHP Messages::insert怎么用?PHP Messages::insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exec
public function exec()
{
$param = $this->param;
$flag['message'] = 'success';
// $flag['message'] = 'fail';
if ($flag['message'] == 'success') {
// 成功
$param['status'] = 1;
} else {
// 失败 入库,重试机制还没想好.
$param['status'] = 0;
$this->event_rs['err_no'] = 100;
$this->event_rs['err_msg'] = '发送邮件失败';
}
$param['create_time'] = time();
$param['mobile'] = '';
$message = new Messages();
$message->attributes = $param;
$rs = $message->insert();
return $this->event_rs;
}
示例2: getMessageFeed
$this->more = "order by msgid desc limit 20";
}
function getMessageFeed()
{
return $this->doQuery("select m.*, u1.username as username, u2.username as username_rec from (" . "(" . $this->getQueryStr() . ") as m " . "join " . "(select username, id from eyeds) as u1 " . "on u1.id = m.id " . "join " . "(select username, id from eyeds) as u2 " . "on u2.id = m.recid" . ") order by msgid desc");
}
}
$msgObj = new Messages($r);
$msgObj->checkTokenValid();
if ($r['action'] == 'send') {
// send message
// id, token, content, recid
$msgObj->checkInputHas(['content', 'recid']);
$msgObj->addInsertsFromArray($r, ['content', 'id', 'recid']);
$msgObj->addInsert('doc', date('Y-m-d H:i:s'));
$result = $msgObj->insert(ERR_NOUSER);
die(json_encode($rarr));
} else {
if ($r['action'] == 'feed') {
// get feed
// id, token
$msgObj->addSelection("recid={$r['id']} or id={$r['id']}");
$result = $msgObj->getMessageFeed();
$rarr['messages'] = array();
while ($row = $result->fetch_assoc()) {
$rarr['messages'][] = $row;
}
die(json_encode($rarr));
} else {
if ($r['action'] == 'feedbyuser') {
// get chat feed with a particular user
示例3: publicMessages
public static function publicMessages($uid, $content, $type, $title, $timedate = null, $money = null, $project = null, $total = null, $fee = null, $corpus = null)
{
$userInfo = User::model()->findByPk($uid);
if (!empty($userInfo)) {
$user_name = trim($userInfo->user_name);
//获取用户名除去左右空格
if ($timedate !== null && $money != null && $project === null && $total === null && $fee === null && $corpus === null) {
//提现成功
$content = str_replace(array('#UserName#', '#timedate', '#money'), array($user_name, $timedate, $money), $content);
} else {
if ($timedate !== null && $money != null && $project !== null && $total !== null && $fee === null && $corpus === null) {
//投资成功
$content = str_replace(array('#UserName#', '#timedate', '#project', '#money', '#total'), array($user_name, $timedate, $project, $money, $total), $content);
} else {
if ($timedate !== null && $money !== null && $total !== null && $project === null && $fee === null && $corpus === null) {
//充值成功
$content = str_replace(array('#UserName#', '#timedate', '#money', '#total'), array($user_name, $timedate, $money, $total), $content);
} else {
if ($fee !== null && $corpus !== null) {
//还款成功
$content = str_replace(array('#UserName#', '#project', '#fee', '#corpus', '#total'), array($user_name, $project, $fee, $corpus, $total), $content);
} else {
$content = str_replace('#UserName#', $user_name, $content);
}
}
}
}
$messages = new Messages();
$messages->uid = $uid;
$messages->title = $title;
$messages->contents = $content;
$messages->mobile = $userInfo->mobile;
$messages->create_time = time();
$messages->email = $userInfo->email;
$messages->type = $type;
return $messages->insert();
}
return false;
}