Browse Source

im模型

master
huangjiajun 6 days ago
parent
commit
d60eb1a5ad
7 changed files with 130 additions and 0 deletions
  1. +25
    -0
      cmd_db_im.bat
  2. +19
    -0
      src/im/model/group.go
  3. +17
    -0
      src/im/model/group_notice.go
  4. +7
    -0
      src/im/model/group_notice_with_like_records.go
  5. +17
    -0
      src/im/model/group_user.go
  6. +27
    -0
      src/im/model/im_send_red_package_ord.go
  7. +18
    -0
      src/im/model/user.go

+ 25
- 0
cmd_db_im.bat View File

@@ -0,0 +1,25 @@
@echo off

set Table=*
set TName=""
set one=%1

if "%one%" NEQ "" (
set Table=%one%
set TName="^%one%$"
)

set BasePath="./"
set DBUSER="root"
set DBPSW="Fnuo123com@"
set DBNAME="egg-im"
set DBHOST="119.23.182.117"
set DBPORT="3306"

del "src\model\%Table%.go"

echo start reverse table %Table%

xorm reverse mysql "%DBUSER%:%DBPSW%@tcp(%DBHOST%:%DBPORT%)/%DBNAME%?charset=utf8" %BasePath%/etc/db_tpl %BasePath%/src/im/model/ %TName%

echo end

+ 19
- 0
src/im/model/group.go View File

@@ -0,0 +1,19 @@
package model

import (
"time"
)

type Group struct {
Id int64 `json:"id" xorm:"pk autoincr comment('自增主键') BIGINT(20)"`
Name string `json:"name" xorm:"not null comment('群组名称') VARCHAR(50)"`
AvatarUrl string `json:"avatar_url" xorm:"not null comment('群组头像') VARCHAR(255)"`
Introduction string `json:"introduction" xorm:"not null comment('群组简介') VARCHAR(255)"`
UserNum int `json:"user_num" xorm:"not null default 0 comment('群组人数') INT(11)"`
IsAllMemberBanned int `json:"is_all_member_banned" xorm:"not null default 2 comment('是否全员禁言(1:是 2:否)') TINYINT(1)"`
IsAllAddFriend int `json:"is_all_add_friend" xorm:"not null default 2 comment('是否允许加好友(1:是 2:否)') TINYINT(1)"`
Extra string `json:"extra" xorm:"not null comment('附加属性') VARCHAR(1024)"`
Kind int `json:"kind" xorm:"not null default 1 comment('群类型(1:用户创建 2:系统创建)') TINYINT(1)"`
CreateTime time.Time `json:"create_time" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') DATETIME"`
}

+ 17
- 0
src/im/model/group_notice.go View File

@@ -0,0 +1,17 @@
package model

import (
"time"
)

type GroupNotice struct {
Id int64 `json:"id" xorm:"pk autoincr comment('自增主键') BIGINT(20)"`
GroupId int64 `json:"group_id" xorm:"not null comment('组id') BIGINT(20)"`
UserId int64 `json:"user_id" xorm:"not null comment('发布用户id') BIGINT(20)"`
Content string `json:"content" xorm:"not null default '' comment('公告内容') VARCHAR(1500)"`
LikeNums int `json:"like_nums" xorm:"not null default 0 comment('点赞数量') INT(11)"`
ReadNums int `json:"read_nums" xorm:"not null default 0 comment('阅读数量') INT(11)"`
PublishType int `json:"publish_type" xorm:"not null default 1 comment('发布方式(1:仅发布 2:发布并通知 3:通知并置顶)') TINYINT(1)"`
CreateTime time.Time `json:"create_time" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') DATETIME"`
}

+ 7
- 0
src/im/model/group_notice_with_like_records.go View File

@@ -0,0 +1,7 @@
package model

type GroupNoticeWithLikeRecords struct {
Id int64 `json:"id" xorm:"pk autoincr comment('自增主键') BIGINT(20)"`
GroupId int64 `json:"group_id" xorm:"not null comment('组id') BIGINT(20)"`
UserId int64 `json:"user_id" xorm:"not null comment('点赞用户id') BIGINT(20)"`
}

+ 17
- 0
src/im/model/group_user.go View File

@@ -0,0 +1,17 @@
package model

import (
"time"
)

type GroupUser struct {
Id int64 `json:"id" xorm:"pk autoincr comment('自增主键') BIGINT(20)"`
GroupId int64 `json:"group_id" xorm:"not null comment('组id') unique(uk_group_id_user_id) BIGINT(20)"`
UserId int64 `json:"user_id" xorm:"not null comment('用户id') index unique(uk_group_id_user_id) BIGINT(20)"`
MemberType int `json:"member_type" xorm:"not null comment('成员类型,1:群主 2:普通成员 3:管理员') TINYINT(4)"`
Remarks string `json:"remarks" xorm:"not null comment('备注') VARCHAR(20)"`
Extra string `json:"extra" xorm:"not null comment('附加属性') VARCHAR(1024)"`
Status int `json:"status" xorm:"not null comment('状态') TINYINT(255)"`
CreateTime time.Time `json:"create_time" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') DATETIME"`
}

+ 27
- 0
src/im/model/im_send_red_package_ord.go View File

@@ -0,0 +1,27 @@
package model

import (
"time"
)

type ImSendRedPackageOrd struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int64 `json:"uid" xorm:"not null comment('用户id') BIGINT(20)"`
ImUid int `json:"im_uid" xorm:"not null comment('im对应用户id') INT(11)"`
OrdNo string `json:"ord_no" xorm:"not null comment('订单号') VARCHAR(255)"`
State int `json:"state" xorm:"not null comment('红包状态(0:未领取 1:领取中 2:领取完 3:已过期)') TINYINT(3)"`
Amount string `json:"amount" xorm:"not null comment('金额') DECIMAL(10,2)"`
RedPacketBalanceAmount string `json:"red_packet_balance_amount" xorm:"not null comment('红包余额') DECIMAL(10,2)"`
RedPacketType int `json:"red_packet_type" xorm:"not null comment('红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包)') TINYINT(3)"`
RedPacketNums int `json:"red_packet_nums" xorm:"not null comment('红包数量') INT(11)"`
RedPacketBalanceNums int `json:"red_packet_balance_nums" xorm:"not null comment('红包剩余数量') INT(11)"`
WaitDrawUserIds string `json:"wait_draw_user_ids" xorm:"not null comment('待领取用户id(逗号分割)') VARCHAR(255)"`
WaitDrawImUserIds string `json:"wait_draw_im_user_ids" xorm:"not null comment('待领取im用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserIds string `json:"received_user_ids" xorm:"not null comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedImUserIds string `json:"received_im_user_ids" xorm:"not null comment('已领取im用户id(逗号分割)') VARCHAR(255)"`
ReceivedTimes string `json:"received_times" xorm:"not null comment('已领取时间(逗号分割)') VARCHAR(255)"`
ReceivedUserAmount string `json:"received_user_amount" xorm:"not null comment('已领取用户金额(逗号分割)') VARCHAR(255)"`
ImData string `json:"im_data" xorm:"comment('im数据') TEXT"`
CreateTime time.Time `json:"create_time" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') DATETIME"`
}

+ 18
- 0
src/im/model/user.go View File

@@ -0,0 +1,18 @@
package model

import (
"time"
)

type User struct {
Id int64 `json:"id" xorm:"pk autoincr comment('自增主键') BIGINT(20)"`
PhoneNumber string `json:"phone_number" xorm:"not null comment('手机号') unique VARCHAR(20)"`
Nickname string `json:"nickname" xorm:"not null comment('昵称') VARCHAR(20)"`
Sex int `json:"sex" xorm:"not null comment('性别,0:未知;1:男;2:女') TINYINT(4)"`
AvatarUrl string `json:"avatar_url" xorm:"not null comment('用户头像链接') VARCHAR(256)"`
Extra string `json:"extra" xorm:"not null comment('附加属性') VARCHAR(1024)"`
CreateTime time.Time `json:"create_time" xorm:"not null default CURRENT_TIMESTAMP comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default CURRENT_TIMESTAMP comment('更新时间') DATETIME"`
IsAutoAddedFriends int `json:"is_auto_added_friends" xorm:"not null default 0 comment('是否自动被添加好友') TINYINT(1)"`
CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客服id') INT(11)"`
}

Loading…
Cancel
Save