承接 wxlmaidou/device 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wxlmaidou/device

最新稳定版本:v2.0.0

Composer 安装命令:

composer require wxlmaidou/device

包简介

swoole对接门禁设备tcp连接

README 文档

README

#device

使用方法

1.composer require wxlmaidou/device

//https://packagist.org/packages/wxlmaidou/device

2.tp6生成一个新的命令行类

3.在新生成的类中使用扩展中的trait

4.每当有事件触发但没有相关处理函数时 会触发trait的__call方法 如果该事件需要处理 则在新生成的命令行类中添加以该事件名 命名的方法

示例如下

<?php
declare (strict_types = 1);

namespace app\command;

use Maidou\Holiday\Holiday;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\input\Option;
use think\console\Output;
use Wxlmaidou\Device\Tcp;//引用扩展类的命名空间

class Hello extends Command
{

    use Tcp;

    protected function configure()
    {
        // 指令配置
        $this->setName('hello')
            ->setDescription('the hello command');
    }

    protected function execute(Input $input, Output $output)
    {
        $this->port = 8084;// 定义tcp的端口
        $this->do();
    }




    //自定义事件同步事件触发时的方法 此处是给客户端返回信息
    public function TIME_SYSNC_REQ($res,$fd){

        $time = date("YmdHis");
        $sendxmlData =
            '<TIME_SYSNC_RES>
            <uuid>'.$res['uuid'].'</uuid>
            <ret>0</ret>
            <time>'.$time.'</time>
            <uploadInterval>0001</uploadInterval>
            <dataStartTime>0001</dataStartTime>
            <dataEndTime>2359</dataEndTime>
            </TIME_SYSNC_RES>';
        $this->server->send($fd, $sendxmlData);
    }
}

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2023-06-28