silentlun/yii2-getui-v2

GetuiPush extension for YII2

Installs: 41

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

1.1 2021-11-22 09:38 UTC

This package is not auto-updated.

Last update: 2025-06-10 20:11:34 UTC


README

本插件适用于uniapp开发的APP。其他框架开发的APP,需要修改intent参数。

因iOS不显示个推的通知消息,目前只有透传消息功能,如需个推通知消息功能可自行修改Push.php文件。

Installation 安装

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist silentlun/yii2-getui-v2 "*"

or add

"silentlun/yii2-getui-v2": "*"

to the require section of your composer.json file.

使用方法

1.配置组件 :

    'components' => [
        'getui' => [
            'class' => 'silentlun\getui\Push',
            'appName' => 'com.xxx.app', //APP包名
            'appId' => 'xxxx', //个推APPID
            'appKey' => 'xxxxx', //个推APPKEY
            'masterSecret' => 'xxxxx', //个推masterSecret
            'host' => 'https://restapi.getui.com',
        ],
    ],

2.执行群推 pushToAll

    public function actionPush()
    {
        $data = [
            'title' => '系统通知标题',
            'body' => '系统通知内容',
            'payload' => [], //自定义参数
        ];
        
        $result = Yii::$app->getui->pushToAll($data);
        if ($result['code'] == 0) {
            echo 'success';
        } else {
            echo $result['msg'];
        }
    }
    

3.执行cid单推 pushToSingleByCid

    public function actionPush()
    {
        $data = [
            'title' => '系统通知标题',
            'body' => '系统通知内容',
            'payload' => [], //自定义参数
        ];
        $cid = 'd6d5f5df5d8e6b4eb9557bbdd98bb449';
        $result = Yii::$app->getui->pushToSingleByCid($cid, $data);
        if ($result['code'] == 0) {
            echo 'success';
        } else {
            echo $result['msg'];
        }
    }
    

4.执行cid批量推 pushToListByCid

    public function actionPush()
    {
        $data = [
            'title' => '系统通知标题',
            'body' => '系统通知内容',
            'payload' => [], //自定义参数
        ];
        $cids = [
            'd6d5f5df5d8e6b4eb9557bbdd98b34c9', 
            'd6d5f5df5d8e6b4eb9557bbdd98b4444',
            'd6d5f5df5d8e6b4eb9557bbdd98b4444',
        ];
        
        $result = Yii::$app->getui->pushToListByCid($cids, $data);
        if ($result['code'] == 0) {
            echo 'success';
        } else {
            echo $result['msg'];
        }
    }
    

其他接口

待完善。。。