yiier/yii2-notification

为Yii2的通知

安装次数: 20

依赖: 0

建议者: 0

安全: 0

星标: 3

关注者: 4

分支: 1

开放问题: 0

类型:yii2-extension

v0.3 2021-08-27 10:57 UTC

This package is auto-updated.

Last update: 2024-08-29 05:13:52 UTC


README

为Yii2的通知

Latest Stable Version Total Downloads Latest Unstable Version License

安装

安装此扩展的首选方法是通过composer

运行以下命令之一

php composer.phar require --prefer-dist yiier/yii2-notification "*"

或者

"yiier/yii2-notification": "*"

将以下内容添加到您的composer.json文件的require部分。

迁移

运行以下命令

$ php yii migrate --migrationPath=@yiier/notification/migrations/

使用方法

配置

按照以下方式配置Controller类:

<?php
use yiier\notification\actions\NotificationAction;


class NotificationController extends Controller
{
    public function actions()
    {
        return [
            'do' => [
                'class' => NotificationAction::className(),
            ]
        ];
    }
}

URL

POST: http://xxxxxxxxxxxxxx/notification/do
Form Data: action=read_all

POST: http://xxxxxxxxxxxxxx/notification/do
Form Data: action=read_all&ids=1,2,3

POST: http://xxxxxxxxxxxxxx/notification/do
Form Data: action=delete_all

POST: http://xxxxxxxxxxxxxx/notification/do
Form Data: action=delete_all&ids=1,2,3

POST: http://xxxxxxxxxxxxxx/notification/do
Form Data: action=delete&id=1

action=delete您可以使用action=Notification::DEL_ACTION

http响应成功(code==200)返回json

{"code":200,"data":0,"message":"success"}

http响应失败(code==500)返回json

{"code":500,"data":"","message":"xxxx"}

更多Notification