本文整理汇总了PHP中Notify::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::save方法的具体用法?PHP Notify::save怎么用?PHP Notify::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSetMsg
public function actionSetMsg()
{
$data = Yii::$app->request->post();
$phone = User::findOne(['phone' => $data['phone']]);
$info = CollectInteract::findOne(['userid' => $phone['id'], 'msg' => $data['msg']]);
if ($info) {
echo json_encode(array('flag' => 0, 'msg' => 'Already collect!'));
return;
}
$to = Message::findOne(['id' => $data['msg']]);
$model2 = new Notify();
$model2->from = $phone['id'];
$model2->to = $to['userid'];
$model2->message = '收藏';
$model2->created_at = time();
if (!$model2->save()) {
echo json_encode(array('flag' => 0, 'msg' => 'Collect fail!'));
return;
}
$model = new CollectInteract();
$model->userid = $phone['id'];
$model->msg = $data['msg'];
$model->created_at = time();
if ($model->save()) {
echo json_encode(array('flag' => 1, 'msg' => 'Collect success!'));
} else {
echo json_encode(array('flag' => 0, 'msg' => 'Collect fail!'));
}
}
示例2: isset
<?php
ignore_user_abort(true);
set_time_limit(90);
$id = isset($_GET['id']) ? $_GET['id'] : null;
$state = isset($_GET['state']) ? $_GET['state'] : null;
$notify = new Notify($id);
if (!$notify->hasAccess()) {
Ajax::outputError('You don\'t have access to this notification');
}
if (!($json = $notify->getJSONContent())) {
Ajax::output('Could not generate default json params!');
}
//doar pe ON se mai poate pune
$params = json_decode($json, true);
$params['configs']['state'] = 'ON';
if (!$notify->updateJSON_Data($params)) {
Ajax::outputError('Could not update json params.');
}
//doar pe ON se mai poate pune
$notify->id = $id;
$notify->state = $state == 'ON';
$notify->save();