Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
rudern
物联大师
提交
cbcf3d03
物
物联大师
项目概览
rudern
/
物联大师
通知
5
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
物
物联大师
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cbcf3d03
编写于
9月 09, 2020
作者:
J
Jason
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
可以正常搜索了
上级
6b2cd26b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
31 addition
and
18 deletion
+31
-18
dtu/channel.go
dtu/channel.go
+6
-6
portal/src/app/main/channel/channel.component.ts
portal/src/app/main/channel/channel.component.ts
+1
-1
web/api/channel.go
web/api/channel.go
+13
-6
web/api/link.go
web/api/link.go
+11
-5
未找到文件。
dtu/channel.go
浏览文件 @
cbcf3d03
...
...
@@ -190,7 +190,7 @@ func (c *Client) receive(conn net.Conn) {
}
else
{
b
=
[]
byte
(
c
.
HeartBeatContent
)
}
if
bytes
.
Compare
(
b
,
buf
)
==
0
{
if
bytes
.
Compare
(
b
,
buf
[
:
n
]
)
==
0
{
continue
}
}
...
...
@@ -284,7 +284,7 @@ func (c *Server) receive(conn net.Conn) {
return
}
serial
,
err
:=
c
.
baseChannel
.
checkRegister
(
buf
)
serial
,
err
:=
c
.
baseChannel
.
checkRegister
(
buf
[
:
n
]
)
if
err
!=
nil
{
_
,
_
=
link
.
Send
([]
byte
(
err
.
Error
()))
return
...
...
@@ -327,7 +327,7 @@ func (c *Server) receive(conn net.Conn) {
//处理剩余内容
if
c
.
RegisterMax
>
0
&&
n
>
c
.
RegisterMax
{
link
.
onData
(
buf
[
c
.
RegisterMax
:
])
link
.
onData
(
buf
[
c
.
RegisterMax
:
n
])
}
}
...
...
@@ -435,7 +435,7 @@ func (c *PacketServer) receive() {
}
else
{
b
=
[]
byte
(
c
.
HeartBeatContent
)
}
if
bytes
.
Compare
(
b
,
buf
)
==
0
{
if
bytes
.
Compare
(
b
,
buf
[
:
n
]
)
==
0
{
continue
}
}
...
...
@@ -447,7 +447,7 @@ func (c *PacketServer) receive() {
//第一个包作为注册包
if
c
.
RegisterEnable
{
serial
,
err
:=
c
.
baseChannel
.
checkRegister
(
buf
)
serial
,
err
:=
c
.
baseChannel
.
checkRegister
(
buf
[
:
n
]
)
if
err
!=
nil
{
_
,
_
=
link
.
Send
([]
byte
(
err
.
Error
()))
return
...
...
@@ -489,7 +489,7 @@ func (c *PacketServer) receive() {
//处理剩余内容
if
c
.
RegisterMax
>
0
&&
n
>
c
.
RegisterMax
{
link
.
onData
(
buf
[
c
.
RegisterMax
:
])
link
.
onData
(
buf
[
c
.
RegisterMax
:
n
])
}
}
else
{
link
.
onData
(
buf
[
:
n
])
...
...
portal/src/app/main/channel/channel.component.ts
浏览文件 @
cbcf3d03
...
...
@@ -80,7 +80,7 @@ export class ChannelComponent implements OnInit {
nzWidth
:
500
,
nzContent
:
ChannelEditComponent
,
nzContentParams
:
{
channel
:
c
||
{
net
:
'
tcp
'
,
addr
:
'
:1843
'
,
is_server
:
true
}
channel
:
c
||
{
net
:
'
tcp
'
,
addr
:
'
:1843
'
,
role
:
'
server
'
}
}
});
}
...
...
web/api/channel.go
浏览文件 @
cbcf3d03
...
...
@@ -23,15 +23,22 @@ func channels(ctx *gin.Context) {
cond
:=
make
([]
q
.
Matcher
,
0
)
//过滤条件
for
_
,
filter
:=
range
body
.
Filters
{
cond
=
append
(
cond
,
q
.
In
(
filter
.
Key
,
filter
.
Value
))
if
len
(
filter
.
Value
)
>
0
{
cond
=
append
(
cond
,
q
.
In
(
filter
.
Key
,
filter
.
Value
))
}
}
//关键字
if
body
.
Keyword
!=
""
{
cond
=
append
(
cond
,
q
.
Re
(
"name"
,
body
.
Keyword
),
q
.
Re
(
"addr"
,
body
.
Keyword
))
cond
=
append
(
cond
,
q
.
Or
(
q
.
Re
(
"Name"
,
body
.
Keyword
),
q
.
Re
(
"Addr"
,
body
.
Keyword
),
))
}
query
:=
db
.
DB
(
"channel"
)
.
Select
(
cond
...
)
cnt
,
err
:=
query
.
Count
(
&
cs
)
//计算总数
cnt
,
err
:=
query
.
Count
(
&
model
.
Channel
{})
if
err
!=
nil
{
replyError
(
ctx
,
err
)
return
...
...
@@ -48,7 +55,7 @@ func channels(ctx *gin.Context) {
query
=
query
.
OrderBy
(
body
.
SortKey
)
}
}
else
{
query
=
query
.
OrderBy
(
"
i
d"
)
.
Reverse
()
query
=
query
.
OrderBy
(
"
I
d"
)
.
Reverse
()
}
err
=
query
.
Find
(
&
cs
)
...
...
@@ -163,7 +170,7 @@ func getChannelFromUri(ctx *gin.Context) (*model.Channel, error) {
}
var
channel
model
.
Channel
err
:=
db
.
DB
(
"channel"
)
.
One
(
"
i
d"
,
pid
.
Id
,
&
channel
)
err
:=
db
.
DB
(
"channel"
)
.
One
(
"
I
d"
,
pid
.
Id
,
&
channel
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -177,7 +184,7 @@ func channelGet(ctx *gin.Context) {
return
}
var
channel
model
.
Channel
err
:=
db
.
DB
(
"channel"
)
.
One
(
"
i
d"
,
pid
.
Id
,
&
channel
)
err
:=
db
.
DB
(
"channel"
)
.
One
(
"
I
d"
,
pid
.
Id
,
&
channel
)
if
err
!=
nil
{
replyError
(
ctx
,
err
)
return
...
...
web/api/link.go
浏览文件 @
cbcf3d03
...
...
@@ -25,17 +25,23 @@ func links(ctx *gin.Context) {
cond
:=
make
([]
q
.
Matcher
,
0
)
//过滤条件
for
_
,
filter
:=
range
body
.
Filters
{
cond
=
append
(
cond
,
q
.
In
(
filter
.
Key
,
filter
.
Value
))
if
len
(
filter
.
Value
)
>
0
{
cond
=
append
(
cond
,
q
.
In
(
filter
.
Key
,
filter
.
Value
))
}
}
//关键字
if
body
.
Keyword
!=
""
{
cond
=
append
(
cond
,
q
.
Re
(
"name"
,
body
.
Keyword
),
q
.
Re
(
"serial"
,
body
.
Keyword
),
q
.
Re
(
"addr"
,
body
.
Keyword
))
cond
=
append
(
cond
,
q
.
Or
(
q
.
Re
(
"Name"
,
body
.
Keyword
),
q
.
Re
(
"Serial"
,
body
.
Keyword
),
q
.
Re
(
"Addr"
,
body
.
Keyword
),
))
}
query
:=
db
.
DB
(
"
channel
"
)
.
Select
(
cond
...
)
query
:=
db
.
DB
(
"
link
"
)
.
Select
(
cond
...
)
//计算总数
cnt
,
err
:=
query
.
Count
(
&
ls
)
cnt
,
err
:=
query
.
Count
(
&
model
.
Link
{}
)
if
err
!=
nil
{
replyError
(
ctx
,
err
)
return
...
...
@@ -52,7 +58,7 @@ func links(ctx *gin.Context) {
query
=
query
.
OrderBy
(
body
.
SortKey
)
}
}
else
{
query
=
query
.
OrderBy
(
"
i
d"
)
.
Reverse
()
query
=
query
.
OrderBy
(
"
I
d"
)
.
Reverse
()
}
err
=
query
.
Find
(
&
ls
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录