ut8ia/yii2-ecoclient

ecotower聚合服务器的客户端库

dev-master 2019-10-10 08:22 UTC

This package is auto-updated.

Last update: 2024-09-10 19:27:49 UTC


README

ecotower服务的客户端库。

根据swagger api: https://app.swaggerhub.com/apis/ut8ia/ecoTower/1.0.0

安装时,在composer.json中添加以下内容:

    "ut8ia/yii2-ecoclient": "*",

在params.php或params-local.php中设置表名前缀和凭证

'ecoclient' => [
    'dbTablesPrefix' => 'ecoclient_',
    'apikey' => 'kjS0h234o14SwN6go1ssr6P22nP3PMd4',
    'hashkey'=>'luef786642gg523465',
    'apihost' => 'https://api.ecotower-aggregator.org'    
]

应用迁移

./yii migrate --migrationPath=vendor/ut8ia/yii2-ecoclient/migrations

在main.php中配置模块

'modules' => [
...
        'ecoclient' => [
            'class' => 'ut8ia\ecoclient\modules\ecoclient\Ecoclient'
        ]
    ]

尝试通过cron控制台调用{城市ID}从城市获取报告

./yii ecoclient/retrieve/cityreport 1

您还可以使用您的报告的web视图示例

https://yoursite.com/ecoclient/display