topphp/topphp-meter-api

v1.1.4 2020-11-09 10:27 UTC

This package is auto-updated.

Last update: 2024-04-09 18:20:00 UTC


README

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

本模块集成了水电表的api

目前对接了拓强水电表 接口地址:http://doc-api.tqdianbiao.com/#/home/welcome

Structure

组件结构

bin/        
build/
docs/
config/
src/
tests/
vendor/

3个文件使用说明

TqMeter/AsyncApi/EleMeterClient.php 异步电表接口
TqMeter/AsyncApi/WaterMeterClient.php 异步水表接口
MeterClient.php 同步水电表操作接口

完成以下接口对接

---------------同步接口---------------
采集器添加
采集器删除
查询N个采集器
查询全部采集器
电能表添加
电能表删除
电能表档案查询
水表添加
水表删除
水表档案查询
操作状态查询
取消操作

---------------异步接口---------------
抄电表数据
设置电表参数
电表拉闸
电表合闸
电表清零_同步模式
电表清零_非同步模式
电表开户_同步模式
电表开户_非同步模式
电表充值_同步模式
电表充值_非同步模式

抄水表数据
水表关阀
水表开阀
水表清零
Mbus水表充值_同步模式
Mbus水表充值_非同步模式
Lora水表充值_同步模式
Lora水表充值_非同步模式

Lora普通预付费水表设置水价
Lora阶梯预付费水表设置水价

---------------第一套数据接口--------------
查询历史数据接口
查询设备列表和当前状态
查询采集器列表和当前状态
查询价格档案
查询用户档案
查询参数档案
查询电表当前状态数据
查询水表当前状态数据

Install

Via Composer

$ composer require topphp/topphp-meter-api

Usage

//同步
$gateway = new MeterClient();
$res     = $gateway->setAuthCode('37577f8fb62a7b14ba55cc6faec5a142')
    ->setNonce('XOfX547SeCIlhufeeBBwgZIN')
    ->collectorQuery([]);
var_dump($res);

// 异步
$gateway = new EleMeterClient();
$res     = $gateway->setAuthCode('37577f8fb62a7b14ba55cc6faec5a142')
    ->setNonce('XOfX547SeCIlhufeeBBwgZIN')
    ->setNotifyUrl('')
    ->eleSecurityOpenAccount([
        [
            "opr_id"      => $gateway->generateOperateId(),
            "time_out"    => 0,
            "must_online" => true,
            "retry_times" => 1,
            "cid"         => "19020618114",
            "address"     => "000066660942",
            "params"      => [
                "money" => "100",
            ]
        ],
    ], '');
var_dump($res);

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email sleep@kaituocn.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.