上传服务器支持分流s3上传
This commit is contained in:
29
act/act.go
Normal file
29
act/act.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package act
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type act struct {
|
||||
}
|
||||
|
||||
type Sql struct {
|
||||
UID uint64 `gorm:"primaryKey;comment:玩家编号"`
|
||||
ActID int `gorm:"primaryKey;comment:活动编号"`
|
||||
Action string `gorm:"type:text;comment:活动配置"`
|
||||
UpdatedAt *gtime.Time `gorm:"index;comment:更新时间"`
|
||||
}
|
||||
|
||||
func New() *act {
|
||||
|
||||
return &act{}
|
||||
}
|
||||
|
||||
func (s *act) CreateTable(name string) {
|
||||
|
||||
//prefix := g.DB().GetPrefix()
|
||||
//
|
||||
//g.DB()
|
||||
//g.DB().Exec(gctx.New())
|
||||
|
||||
}
|
||||
13
act/act.sql
Normal file
13
act/act.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
create table shiningu_game_act
|
||||
(
|
||||
uid bigint not null comment '玩家编号',
|
||||
act_id int not null comment '活动编号',
|
||||
action text null comment '活动配置',
|
||||
updated_at datetime null comment '更新时间',
|
||||
primary key (uid, act_id)
|
||||
)
|
||||
comment '玩家活动数据' charset = utf8mb4;
|
||||
|
||||
create index shiningu_game_act_uid_index
|
||||
on shiningu_game_act (uid);
|
||||
|
||||
19
act/save.go
Normal file
19
act/save.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package act
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
// 查询表格时候存在
|
||||
func (s *act) TableExists(name string) bool {
|
||||
Prefix := g.DB().GetPrefix()
|
||||
get, err := g.DB().TableFields(gctx.New(), Prefix+name)
|
||||
if err != nil {
|
||||
g.Log().Error(gctx.New(), err)
|
||||
}
|
||||
if get != nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user