Giter Club home page Giter Club logo

ithings's People

Contributors

cooclsee avatar fish2016 avatar gleke avatar godlei6 avatar hehaokun2814 avatar kevwan avatar lbs0019873800lbs avatar lczz89 avatar rbtyang avatar suixinio avatar wwhai avatar zhuangpengli avatar znonymous29 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ithings's Issues

ithings的post接口不支持带XX.XX的json名字规则的数据。

向apisvr发送POST json数据时,如下json的数据格式会出现解析异常。
{ "api.apiDebug" : "1", "api.secret" : "035c73f7-bb6b-4889-a715-d9eb2d1925cc", "ffmpeg.bin" : "/usr/local/bin/ffmpeg", "ffmpeg.cmd" : "%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s", "ffmpeg.log" : "./ffmpeg/ffmpeg.log", "general.mediaServerId" : "your_server_id", "general.addMuteAudio" : "1", "general.enableVhost" : "1", "general.flowThreshold" : "1024", }
Uploading d68bdf465cb3e565c4eab4de77dfc91.png…
带点的json名无法正常被解析。

测试示例见附件
post接收json数据异常.txt

latest image run with error: "userName not right"

latest image run error

./init.db.sh  
docker-compose logs --tail 100 ithings

ithings | 2023-04-03T15:51:52.537+08:00 info auth.(*LoginLogic).Login req=&{Username:ddsvr Password:iThings ClientID:dd.rpc/e4756ba1-088c-c289-8853-845b49d3e3ca Ip:172.19.0.8 Certificate:} caller
=auth/loginLogic.go:31 trace=13e6e546367c3a04d4e00cfc93f8c582 span=51c6ef7dc8b2d497
ithings | 2023-04-03T15:51:52.538+08:00 info deviceauth.(*LoginAuthLogic).LoginAuth req=username:"ddsvr" password:"iThings" clientID:"dd.rpc/e4756ba1-088c-c289-8853-845b49d3e3ca" ip:"172.19.0.8"c
aller=deviceauth/loginAuthLogic.go:103 trace=13e6e546367c3a04d4e00cfc93f8c582 span=51c6ef7dc8b2d497
ithings | 2023-04-03T15:51:52.538+08:00 error auth.(*LoginLogic).Login.rpc.ManageDevice req=&{ddsvr iThings dd.rpc/e4756ba1-088c-c289-8853-845b49d3e3ca 172.19.0.8 } err={"code":100006,"msg":"参数
错误","details":["userName not right"]} caller=auth/loginLogic.go:52 trace=13e6e546367c3a04d4e00cfc93f8c582 span=51c6ef7dc8b2d497
ithings | 2023-04-03T15:51:52.538+08:00 error 【http handle err】router:/api/v1/things/device/auth/login err: {"code":100006,"msg":"参数错误","details":["userName not right"]} caller=result/
httpResult.go:29 trace=13e6e546367c3a04d4e00cfc93f8c582 span=51c6ef7dc8b2d497
ithings | 2023-04-03T15:51:52.538+08:00 info [HTTP] 400 - POST /api/v1/things/device/auth/login - 172.19.0.7:41456 - duration=0.7ms caller=handler/loghandler.go:160 trace=13e6e546
367c3a04d4e00cfc93f8c582 span=51c6ef7dc8b2d497
ithings | 2023-04-03T15:51:52.538+08:00 info mqtt client connect attempt broker:tcp://172.19.0.7:1883 caller=clients/mqtt.go:45
ithings | 2023-04-03T15:51:52.539+08:00 info auth.(*LoginLogic).Login req=&{Username:ddsvr Password:iThings ClientID:dd.rpc/e4756ba1-088c-c289-8853-845b49d3e3ca Ip:172.19.0.8 Certificate:} caller
=auth/loginLogic.go:31 trace=beff4ceedfdfaa02e847c9efd898a262 span=1a3d4901d4b72dc3
ithings | 2023-04-03T15:51:52.539+08:00 info deviceauth.(*LoginAuthLogic).LoginAuth req=username:"ddsvr" password:"iThings" clientID:"dd.rpc/e4756ba1-088c-c289-8853-845b49d3e3ca" ip:"172.19.0.8"c
aller=deviceauth/loginAuthLogic.go:103 trace=beff4ceedfdfaa02e847c9efd898a262 span=1a3d4901d4b72dc3
ithings | 2023-04-03T15:51:52.539+08:00 info [HTTP] 400 - POST /api/v1/things/device/auth/login - 172.19.0.7:43627 - duration=0.3ms caller=handler/loghandler.go:160 trace=beff4cee
dfdfaa02e847c9efd898a262 span=1a3d4901d4b72dc3
ithings | 2023-04-03T15:51:52.539+08:00 error auth.(*LoginLogic).Login.rpc.ManageDevice req=&{ddsvr iThings dd.rpc/e4756ba1-088c-c289-8853-845b49d3e3ca 172.19.0.8 } err={"code":100006,"msg":"参数
错误","details":["userName not right"]} caller=auth/loginLogic.go:52 trace=beff4ceedfdfaa02e847c9efd898a262 span=1a3d4901d4b72dc3
ithings | 2023-04-03T15:51:52.539+08:00 error 【http handle err】router:/api/v1/things/device/auth/login err: {"code":100006,"msg":"参数错误","details":["userName not right"]} caller=result/
httpResult.go:29 trace=beff4ceedfdfaa02e847c9efd898a262 span=1a3d4901d4b72dc3
ithings | 2023-04-03T15:51:56.534+08:00 info mqtt Connect failure caller=clients/mqtt.go:54
ithings | 2023-04-03T15:51:56.534+08:00 error NewDevClient errmqtt client connect failure caller=svc/serviceContext.go:20

image version:
docker pull ghcr.io/i4de/ithings:sha256-daf2e7b10b71be69584c44808099437c29ce915a5cd70e773e0428daad2e055b.sig

前后端自动打包

  1. 前端实现打tag的时候自动cicd生成release包
  2. 后端实现自动部署
  3. 后端实现打tag的时候生成docker-compose release包

后端-设备调试日志

设备日志主要用于平台远程查看设备运行日志,平台可通过下发消息,通知设备进行日志上报,日志级别包括错误、警告、信息和调试。

后端-设备远程配置

功能概述
设备使用场景中,对于需要更新系统参数(如:设备的 IP、端口号和串口参数等)的设备,可采用远程配置功能对设备系统参数进行更新。

功能详情
设备远程配置分为物联网平台主动下发和设备端主动请求两种配置更新方式。对于同一产品下所有设备均需更新配置的场景,可采用物联网平台主动下发的形式,将配置信息通过远程配置 Topic 下发到同一产品下的所有设备中。对于部分设备更新配置信息的场景,可采用设备端主动请求远程配置 Topic 的方式来完成。

设备主动请求配置信息

远程配置请求 Topic:$config/up/get/${productid}/${devicename}
远程配置订阅回复 Topic:$config/down/get/${productid}/${devicename}

物联网平台推送配置信息给设备端

远程配置订阅通知 Topic:$config/down/push/${productid}

后端-设备影子

设备影子充当中介,支持设备和用户应用程序查看和更新设备状态。设备、用户应用程序、设备影子三者之间通过两个特殊的 Topic 来实现通信:

$shadow/operation/up/${productId}/${deviceName}:用于发布(上行)消息,可实现对设备影子数据的 get/update 操作。
$shadow/operation/down/${productId}/${deviceName}:用于订阅(下行)消息,影子服务端通过此 Topic 发送应答和推送消息。

后端-ota升级

$ota/up/report/${productID}/${deviceName}   设备上报版本号(上行)
$ota/up/progress/${productID}/${deviceName}   设备上报下载进度(上行)
$ota/down/update/${productID}/${deviceName}   服务器端推送ota信息(下行)

[优化] 在数据量大的时候获取最新的物模型数据会比较慢

问题原因:
tdengine在针对select * 最新数据的时候优化不够好,后续版本会优化
td优化方案:切换成last_row,并执行: alter database ithings cachemodel 'both' cachesize 200;
打开td缓存: 测试后查询速度0.036秒

解决方案:

  1. 切换为并发查询(已合并master),原来页面需要1分钟现在893ms
  2. 修改为last_row方案(但是td这边后续会有改动)不采取
  3. 将最新数据缓存到Redis上 -- 后续安排

需要做第三点

apisvr模块启动之后,通过mqttx发送测试消息报表不存在,是否因为设备离线,未生成表导致?

版本:master
报错信息

2023-02-22T18:44:19.963+08:00    info   sql taosQuery: insert into `device_property_25Mjq9jn0je_Test-Device_test` (ts, param) values ('2023-02-22T18:44:19.959+08:00',1);       duration=0.0ms caller=taosRestful/connection.go:180
2023-02-22T18:44:19.963+08:00    error  deviceMsgEvent.(*ThingLogic).HandlePropertyReport.InsertPropertyData err={"code":100008,"msg":"数据库错误","details":["SchemaDataRepo.InsertPropertiesData.InsertPropertyData identifier:test param:1 err:[0x2603] Table does not exist"]}      caller=deviceMsgEvent/thing.go:97       trace=ec6cf1ad8c1f9fea48e762b9c40ed616  span=c9befb34de400012
2023-02-22T18:44:19.965+08:00    info   sql taosQuery: insert into `device_hublog_25Mjq9jn0je_Test-Device` using `model_common_hublog` tags('25Mjq9jn0je','Test-Device')(`ts`, `content`, `topic`, `action`, `requestID`, `trance_id`, `result_type`) values ('2023-02-22T18:44:19.959+08:00','{
    "method": "report",
    "clientToken": "afwegafeegfa",
    "params": {
      "test": 1
    }
}
','$thing/up/property/25Mjq9jn0je/Test-Device','property','afwegafeegfa','ec6cf1ad8c1f9fea48e762b9c40ed616',100008);    duration=0.0ms  caller=taosRestful/connection.go:180
2023-02-22T18:44:19.965+08:00    info   DeviceMsgHandle.deviceResp.PublishToDev msg:{"DeviceNames":"","Payload":"{\"method\":\"reportReply\",\"clientToken\":\"afwegafeegfa\",\"timestamp\":1677062659963,\"code\":100008,\"status\":\"数据库错误\"}","ProductID":"","Timestamp":"2023-02-22T18:44:19.963140843+08:00","Topic":"$thing/down/property/25Mjq9jn0je/Test-Device"}  caller=deviceMsgEvent/deviceMsg.go:92   trace=ec6cf1ad8c1f9fea48e762b9c40ed616  span=c9befb34de400012
2023-02-22T18:44:19.965+08:00    info   deviceMsgEvent.(*DeviceMsgHandle).Thing req:{"DeviceNames":"Test-Device","Payload":"{                     \n    \"method\": \"report\",            \n    \"clientToken\": \"afwegafeegfa\",   \n    \"params\": { \n      \"test\": 1\n    }\n}\n","ProductID":"25Mjq9jn0je","Timestamp":"2023-02-22T18:44:19.959+08:00","Topic":"$thing/up/property/25Mjq9jn0je/Test-Device"} resp:{"DeviceNames":"","Payload":"{\"method\":\"reportReply\",\"clientToken\":\"afwegafeegfa\",\"timestamp\":1677062659963,\"code\":100008,\"status\":\"数据库错误\"}","ProductID":"","Timestamp":"2023-02-22T18:44:19.963140843+08:00","Topic":"$thing/down/property/25Mjq9jn0je/Test-Device"} err:{"code":100008,"msg":"数据库错误","details":["SchemaDataRepo.InsertPropertiesData.InsertPropertyData identifier:test param:1 err:[0x2603] Table does not exist"]}    caller=deviceMsgEvent/deviceMsg.go:39   trace=ec6cf1ad8c1f9fea48e762b9c40ed616  span=c9befb34de400012
2023-02-22T18:44:19.965+08:00    error  nats subscription|subject:device.up.thing.25Mjq9jn0je.Test-Device,body:{"timestamp":1677062659959,"productID":"25Mjq9jn0je","deviceName":"Test-Device","topic":"$thing/up/property/25Mjq9jn0je/Test-Device","payload":"eyAgICAgICAgICAgICAgICAgICAgIAogICAgIm1ldGhvZCI6ICJyZXBvcnQiLCAgICAgICAgICAgIAogICAgImNsaWVudFRva2VuIjogImFmd2VnYWZlZWdmYSIsICAgCiAgICAicGFyYW1zIjogeyAKICAgICAgInRlc3QiOiAxCiAgICB9Cn0K"},err:{"code":100008,"msg":"数据库错误","details":["SchemaDataRepo.InsertPropertiesData.InsertPropertyData identifier:test param:1 err:[0x2603] Table does not exist"]} duration=0.0ms  caller=events/nats.go:28        trace=ec6cf1ad8c1f9fea48e762b9c40ed616  span=c9befb34de400012

后台登录安全控制(默认情况下不需要验证码)

默认情况下不需要验证码

需要进行以下维度的安全控制:

  1. 用户连续输错密码x次 -- 需要输入验证码
  2. 用户连续输错密码y次 -- 封禁账号登录n 分钟
  3. ip x小时内累计输错密码y次 -- 封禁ip登录 x分钟

设备管理-设备-批量导入

  • 支持 校验文件格式(仅csv, <=700KB, <=1k条)
  • 支持 不同产品混合导入
  • 支持 导出失败清单,重新导入

几个建议

  1. todolist 用起来,可以试试 project 功能
  2. git commit 规范一下
  3. github actions CI、CD用起来

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.