:feature: 更新微信状态显示逻辑,添加设备绑定提示,并优化消息结构
Some checks failed
BuildImage / build-image (push) Has been cancelled
Some checks failed
BuildImage / build-image (push) Has been cancelled
This commit is contained in:
parent
b256d82855
commit
fb94ce31a6
@ -95,6 +95,8 @@ func CreateRobot(c *fiber.Ctx) error {
|
||||
Nickname: robotName,
|
||||
Status: model.RobotStatusOffline,
|
||||
}
|
||||
// 处理一下设备 Id 和设备名称,防止后面出现空值
|
||||
robot.CheckDevice()
|
||||
|
||||
db := model.GetDB()
|
||||
if err = db.Create(&robot).Error; err != nil {
|
||||
@ -230,10 +232,6 @@ func RobotLogin(c *fiber.Ctx) error {
|
||||
}
|
||||
return fiber.NewError(fiber.StatusInternalServerError, "查询数据库失败")
|
||||
}
|
||||
// 处理一下设备信息
|
||||
if robot.CheckDevice() {
|
||||
db.Save(&robot)
|
||||
}
|
||||
|
||||
// 检查机器人是否已在线,如果在线则无需登录
|
||||
if robot.Status == model.RobotStatusOnline {
|
||||
|
@ -5,19 +5,6 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// ContentType 表示消息类型的枚举
|
||||
type ContentType string
|
||||
|
||||
const (
|
||||
ContentTypeText ContentType = "text"
|
||||
ContentTypeImage ContentType = "image"
|
||||
ContentTypeVoice ContentType = "voice"
|
||||
ContentTypeVideo ContentType = "video"
|
||||
ContentTypeFile ContentType = "file"
|
||||
ContentTypeLocation ContentType = "location"
|
||||
ContentTypeSystem ContentType = "system"
|
||||
)
|
||||
|
||||
// Message 表示微信消息
|
||||
type Message struct {
|
||||
BaseModel
|
||||
@ -32,6 +19,7 @@ type Message struct {
|
||||
FromUser string // 发送者
|
||||
GroupUser string // 群成员
|
||||
ToUser string // 接收者
|
||||
FileUrl string `gorm:"column:file_url"` // 文件地址
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
|
@ -114,7 +114,13 @@
|
||||
|
||||
<!-- 操作区域 -->
|
||||
<div class="bg-gray-50 px-6 py-3 flex justify-between items-center">
|
||||
<span class="text-xs text-gray-500">微信状态: {{if eq .Status "online"}}在线{{else}}离线{{end}}</span>
|
||||
<span class="text-xs text-gray-500">
|
||||
{{if .WechatID}}
|
||||
微信状态: {{if eq .Status "online"}}在线{{else}}离线{{end}}
|
||||
{{else}}
|
||||
初始化完成,待绑定微信账号
|
||||
{{end}}
|
||||
</span>
|
||||
<div class="flex space-x-2">
|
||||
<a href="/admin/robots/{{.ID}}" class="p-1.5 rounded-md text-gray-600 hover:bg-gray-100 hover:text-gray-900" title="查看详情">
|
||||
<i class="fas fa-eye"></i>
|
||||
|
@ -56,7 +56,11 @@
|
||||
<div class="flex justify-between text-sm">
|
||||
<span class="text-gray-600">状态</span>
|
||||
<span class="{{if eq .Robot.Status "online"}}text-emerald-600{{else if eq .Robot.Status "error"}}text-red-600{{else}}text-gray-600{{end}}">
|
||||
{{if eq .Robot.Status "online"}}在线{{else if eq .Robot.Status "error"}}错误{{else}}离线{{end}}
|
||||
{{if .robot.WechatID}}
|
||||
{{if eq .Robot.Status "online"}}在线{{else if eq .Robot.Status "error"}}错误{{else}}离线{{end}}
|
||||
{{else}}
|
||||
待绑定微信号
|
||||
{{end}}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex justify-between text-sm">
|
||||
|
Loading…
x
Reference in New Issue
Block a user