mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-11-14 05:03:49 +08:00
更新2.1.2版本,优化部门、角色权限,增加上下级关系;增加登录、系统、短信日志;优化省市区编码
This commit is contained in:
@@ -28,6 +28,8 @@ type AdminDeptColumns struct {
|
||||
Leader string // 负责人
|
||||
Phone string // 联系电话
|
||||
Email string // 邮箱
|
||||
Level string // 关系树等级
|
||||
Tree string // 关系树
|
||||
Sort string // 排序
|
||||
Status string // 部门状态
|
||||
CreatedAt string // 创建时间
|
||||
@@ -44,6 +46,8 @@ var adminDeptColumns = AdminDeptColumns{
|
||||
Leader: "leader",
|
||||
Phone: "phone",
|
||||
Email: "email",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// DemoDao is the data access object for table hg_demo.
|
||||
type DemoDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns DemoColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// DemoColumns defines and stores column names for table hg_demo.
|
||||
type DemoColumns struct {
|
||||
Id string // ID
|
||||
CategoryId string // 分类ID
|
||||
Flag string // 标签
|
||||
Title string // 标题
|
||||
Description string // 描述
|
||||
Content string // 内容
|
||||
Image string // 单图
|
||||
Images string // 多图
|
||||
Attachfile string // 附件
|
||||
Attachfiles string // 多附件
|
||||
Map string // 动态键值对
|
||||
Star string // 推荐星
|
||||
Price string // 价格
|
||||
Views string // 浏览次数
|
||||
ActivityAt string // 活动时间
|
||||
StartAt string // 开启时间
|
||||
EndAt string // 结束时间
|
||||
Switch string // 开关
|
||||
Sort string // 排序
|
||||
Avatar string // 头像
|
||||
Sex string // 性别
|
||||
Qq string // qq
|
||||
Email string // 邮箱
|
||||
Mobile string // 手机号码
|
||||
Hobby string // 爱好
|
||||
Channel string // 渠道
|
||||
Pid string // 上级ID
|
||||
Level string // 树等级
|
||||
Tree string // 关系树
|
||||
Remark string // 备注
|
||||
Status string // 状态
|
||||
CreatedBy string // 创建者
|
||||
UpdatedBy string // 更新者
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
DeletedAt string // 删除时间
|
||||
}
|
||||
|
||||
// demoColumns holds the columns for table hg_demo.
|
||||
var demoColumns = DemoColumns{
|
||||
Id: "id",
|
||||
CategoryId: "category_id",
|
||||
Flag: "flag",
|
||||
Title: "title",
|
||||
Description: "description",
|
||||
Content: "content",
|
||||
Image: "image",
|
||||
Images: "images",
|
||||
Attachfile: "attachfile",
|
||||
Attachfiles: "attachfiles",
|
||||
Map: "map",
|
||||
Star: "star",
|
||||
Price: "price",
|
||||
Views: "views",
|
||||
ActivityAt: "activity_at",
|
||||
StartAt: "start_at",
|
||||
EndAt: "end_at",
|
||||
Switch: "switch",
|
||||
Sort: "sort",
|
||||
Avatar: "avatar",
|
||||
Sex: "sex",
|
||||
Qq: "qq",
|
||||
Email: "email",
|
||||
Mobile: "mobile",
|
||||
Hobby: "hobby",
|
||||
Channel: "channel",
|
||||
Pid: "pid",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
Remark: "remark",
|
||||
Status: "status",
|
||||
CreatedBy: "created_by",
|
||||
UpdatedBy: "updated_by",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
DeletedAt: "deleted_at",
|
||||
}
|
||||
|
||||
// NewDemoDao creates and returns a new DAO object for table data access.
|
||||
func NewDemoDao() *DemoDao {
|
||||
return &DemoDao{
|
||||
group: "default",
|
||||
table: "hg_demo",
|
||||
columns: demoColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *DemoDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *DemoDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *DemoDao) Columns() DemoColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *DemoDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *DemoDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *DemoDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -21,6 +21,7 @@ type SysLogDao struct {
|
||||
// SysLogColumns defines and stores column names for table hg_sys_log.
|
||||
type SysLogColumns struct {
|
||||
Id string // 日志ID
|
||||
ReqId string // 对外ID
|
||||
AppId string // 应用ID
|
||||
MerchantId string // 商户ID
|
||||
MemberId string // 用户ID
|
||||
@@ -36,10 +37,9 @@ type SysLogColumns struct {
|
||||
ErrorCode string // 报错code
|
||||
ErrorMsg string // 报错信息
|
||||
ErrorData string // 报错日志
|
||||
ReqId string // 对外ID
|
||||
Timestamp string // 响应时间
|
||||
UserAgent string // UA信息
|
||||
TakeUpTime string // 请求耗时
|
||||
Timestamp string // 响应时间
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
@@ -48,6 +48,7 @@ type SysLogColumns struct {
|
||||
// sysLogColumns holds the columns for table hg_sys_log.
|
||||
var sysLogColumns = SysLogColumns{
|
||||
Id: "id",
|
||||
ReqId: "req_id",
|
||||
AppId: "app_id",
|
||||
MerchantId: "merchant_id",
|
||||
MemberId: "member_id",
|
||||
@@ -63,10 +64,9 @@ var sysLogColumns = SysLogColumns{
|
||||
ErrorCode: "error_code",
|
||||
ErrorMsg: "error_msg",
|
||||
ErrorData: "error_data",
|
||||
ReqId: "req_id",
|
||||
Timestamp: "timestamp",
|
||||
UserAgent: "user_agent",
|
||||
TakeUpTime: "take_up_time",
|
||||
Timestamp: "timestamp",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
|
||||
91
server/internal/dao/internal/sys_login_log.go
Normal file
91
server/internal/dao/internal/sys_login_log.go
Normal file
@@ -0,0 +1,91 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysLoginLogDao is the data access object for table hg_sys_login_log.
|
||||
type SysLoginLogDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns SysLoginLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysLoginLogColumns defines and stores column names for table hg_sys_login_log.
|
||||
type SysLoginLogColumns struct {
|
||||
Id string // 日志ID
|
||||
ReqId string // 请求ID
|
||||
MemberId string // 用户ID
|
||||
Username string // 用户名
|
||||
Response string // 响应数据
|
||||
LoginAt string // 登录时间
|
||||
ErrMsg string // 错误提示
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// sysLoginLogColumns holds the columns for table hg_sys_login_log.
|
||||
var sysLoginLogColumns = SysLoginLogColumns{
|
||||
Id: "id",
|
||||
ReqId: "req_id",
|
||||
MemberId: "member_id",
|
||||
Username: "username",
|
||||
Response: "response",
|
||||
LoginAt: "login_at",
|
||||
ErrMsg: "err_msg",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysLoginLogDao creates and returns a new DAO object for table data access.
|
||||
func NewSysLoginLogDao() *SysLoginLogDao {
|
||||
return &SysLoginLogDao{
|
||||
group: "default",
|
||||
table: "hg_sys_login_log",
|
||||
columns: sysLoginLogColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysLoginLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysLoginLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysLoginLogDao) Columns() SysLoginLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysLoginLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysLoginLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysLoginLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -20,40 +20,34 @@ type SysProvincesDao struct {
|
||||
|
||||
// SysProvincesColumns defines and stores column names for table hg_sys_provinces.
|
||||
type SysProvincesColumns struct {
|
||||
Id string // 省市区ID
|
||||
Title string // 栏目名称
|
||||
ShortTitle string // 缩写
|
||||
Areacode string // 区域编码
|
||||
Zipcode string // 邮政编码
|
||||
Pinyin string // 拼音
|
||||
Lng string // 经度
|
||||
Lat string // 纬度
|
||||
Pid string // 父栏目
|
||||
Level string // 关系树等级
|
||||
Tree string // 关系
|
||||
Sort string // 排序
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
Id string // 省市区ID
|
||||
Title string // 栏目名称
|
||||
Pinyin string // 拼音
|
||||
Lng string // 经度
|
||||
Lat string // 纬度
|
||||
Pid string // 父栏目
|
||||
Level string // 关系树等级
|
||||
Tree string // 关系
|
||||
Sort string // 排序
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysProvincesColumns holds the columns for table hg_sys_provinces.
|
||||
var sysProvincesColumns = SysProvincesColumns{
|
||||
Id: "id",
|
||||
Title: "title",
|
||||
ShortTitle: "short_title",
|
||||
Areacode: "areacode",
|
||||
Zipcode: "zipcode",
|
||||
Pinyin: "pinyin",
|
||||
Lng: "lng",
|
||||
Lat: "lat",
|
||||
Pid: "pid",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
Id: "id",
|
||||
Title: "title",
|
||||
Pinyin: "pinyin",
|
||||
Lng: "lng",
|
||||
Lat: "lat",
|
||||
Pid: "pid",
|
||||
Level: "level",
|
||||
Tree: "tree",
|
||||
Sort: "sort",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysProvincesDao creates and returns a new DAO object for table data access.
|
||||
|
||||
91
server/internal/dao/internal/sys_serve_log.go
Normal file
91
server/internal/dao/internal/sys_serve_log.go
Normal file
@@ -0,0 +1,91 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysServeLogDao is the data access object for table hg_sys_serve_log.
|
||||
type SysServeLogDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns SysServeLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysServeLogColumns defines and stores column names for table hg_sys_serve_log.
|
||||
type SysServeLogColumns struct {
|
||||
Id string // 日志ID
|
||||
TraceId string // 链路ID
|
||||
LevelFormat string // 日志级别
|
||||
Content string // 日志内容
|
||||
Stack string // 打印堆栈
|
||||
Line string // 调用行
|
||||
TriggerNs string // 触发时间(ns)
|
||||
Status string // 状态
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 修改时间
|
||||
}
|
||||
|
||||
// sysServeLogColumns holds the columns for table hg_sys_serve_log.
|
||||
var sysServeLogColumns = SysServeLogColumns{
|
||||
Id: "id",
|
||||
TraceId: "trace_id",
|
||||
LevelFormat: "level_format",
|
||||
Content: "content",
|
||||
Stack: "stack",
|
||||
Line: "line",
|
||||
TriggerNs: "trigger_ns",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysServeLogDao creates and returns a new DAO object for table data access.
|
||||
func NewSysServeLogDao() *SysServeLogDao {
|
||||
return &SysServeLogDao{
|
||||
group: "default",
|
||||
table: "hg_sys_serve_log",
|
||||
columns: sysServeLogColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysServeLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysServeLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysServeLogDao) Columns() SysServeLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysServeLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysServeLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysServeLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
89
server/internal/dao/internal/sys_sms_log.go
Normal file
89
server/internal/dao/internal/sys_sms_log.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// ==========================================================================
|
||||
// Code generated by GoFrame CLI tool. DO NOT EDIT.
|
||||
// ==========================================================================
|
||||
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/gogf/gf/v2/database/gdb"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
// SysSmsLogDao is the data access object for table hg_sys_sms_log.
|
||||
type SysSmsLogDao struct {
|
||||
table string // table is the underlying table name of the DAO.
|
||||
group string // group is the database configuration group name of current DAO.
|
||||
columns SysSmsLogColumns // columns contains all the column names of Table for convenient usage.
|
||||
}
|
||||
|
||||
// SysSmsLogColumns defines and stores column names for table hg_sys_sms_log.
|
||||
type SysSmsLogColumns struct {
|
||||
Id string // 主键
|
||||
Event string // 事件
|
||||
Mobile string // 手机号
|
||||
Code string // 验证码或短信内容
|
||||
Times string // 验证次数
|
||||
Ip string // ip地址
|
||||
Status string // 状态(1未验证,2已验证)
|
||||
CreatedAt string // 创建时间
|
||||
UpdatedAt string // 更新时间
|
||||
}
|
||||
|
||||
// sysSmsLogColumns holds the columns for table hg_sys_sms_log.
|
||||
var sysSmsLogColumns = SysSmsLogColumns{
|
||||
Id: "id",
|
||||
Event: "event",
|
||||
Mobile: "mobile",
|
||||
Code: "code",
|
||||
Times: "times",
|
||||
Ip: "ip",
|
||||
Status: "status",
|
||||
CreatedAt: "created_at",
|
||||
UpdatedAt: "updated_at",
|
||||
}
|
||||
|
||||
// NewSysSmsLogDao creates and returns a new DAO object for table data access.
|
||||
func NewSysSmsLogDao() *SysSmsLogDao {
|
||||
return &SysSmsLogDao{
|
||||
group: "default",
|
||||
table: "hg_sys_sms_log",
|
||||
columns: sysSmsLogColumns,
|
||||
}
|
||||
}
|
||||
|
||||
// DB retrieves and returns the underlying raw database management object of current DAO.
|
||||
func (dao *SysSmsLogDao) DB() gdb.DB {
|
||||
return g.DB(dao.group)
|
||||
}
|
||||
|
||||
// Table returns the table name of current dao.
|
||||
func (dao *SysSmsLogDao) Table() string {
|
||||
return dao.table
|
||||
}
|
||||
|
||||
// Columns returns all column names of current dao.
|
||||
func (dao *SysSmsLogDao) Columns() SysSmsLogColumns {
|
||||
return dao.columns
|
||||
}
|
||||
|
||||
// Group returns the configuration group name of database of current dao.
|
||||
func (dao *SysSmsLogDao) Group() string {
|
||||
return dao.group
|
||||
}
|
||||
|
||||
// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
|
||||
func (dao *SysSmsLogDao) Ctx(ctx context.Context) *gdb.Model {
|
||||
return dao.DB().Model(dao.table).Safe().Ctx(ctx)
|
||||
}
|
||||
|
||||
// Transaction wraps the transaction logic using function f.
|
||||
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
|
||||
// It commits the transaction and returns nil if function f returns nil.
|
||||
//
|
||||
// Note that, you should not Commit or Rollback the transaction in function f
|
||||
// as it is automatically handled by this function.
|
||||
func (dao *SysSmsLogDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) {
|
||||
return dao.Ctx(ctx).Transaction(ctx, f)
|
||||
}
|
||||
@@ -7,7 +7,6 @@ package dao
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/dao/internal"
|
||||
"hotgo/internal/model/entity"
|
||||
@@ -67,7 +66,6 @@ func (dao *sysDictTypeDao) GetTypes(ctx context.Context, id int64) (types []stri
|
||||
types = append(types, v.String())
|
||||
}
|
||||
|
||||
g.Log().Warningf(ctx, "types:%+v", types)
|
||||
return types, nil
|
||||
}
|
||||
|
||||
@@ -81,7 +79,6 @@ func (dao *sysDictTypeDao) GetType(ctx context.Context, id int64) (types string,
|
||||
return types, err
|
||||
}
|
||||
|
||||
g.Log().Warningf(ctx, "GetType types:%+v", list.String())
|
||||
return list.String(), nil
|
||||
}
|
||||
|
||||
|
||||
@@ -8,19 +8,19 @@ import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalDemoDao is internal type for wrapping internal DAO implements.
|
||||
type internalDemoDao = *internal.DemoDao
|
||||
// internalSysLoginLogDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysLoginLogDao = *internal.SysLoginLogDao
|
||||
|
||||
// demoDao is the data access object for table hg_demo.
|
||||
// sysLoginLogDao is the data access object for table hg_sys_login_log.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type demoDao struct {
|
||||
internalDemoDao
|
||||
type sysLoginLogDao struct {
|
||||
internalSysLoginLogDao
|
||||
}
|
||||
|
||||
var (
|
||||
// Demo is globally public accessible object for table hg_demo operations.
|
||||
Demo = demoDao{
|
||||
internal.NewDemoDao(),
|
||||
// SysLoginLog is globally public accessible object for table hg_sys_login_log operations.
|
||||
SysLoginLog = sysLoginLogDao{
|
||||
internal.NewSysLoginLogDao(),
|
||||
}
|
||||
)
|
||||
|
||||
@@ -31,20 +31,20 @@ var (
|
||||
// Fill with you ideas below.
|
||||
|
||||
// GetRegion 获取省市编码对应的地区名称
|
||||
func (dao *sysProvincesDao) GetRegion(ctx context.Context, province int, city int, spilt ...string) (string, error) {
|
||||
|
||||
func (dao *sysProvincesDao) GetRegion(ctx context.Context, province int64, city int64, spilt ...string) (string, error) {
|
||||
var (
|
||||
provinceName *gvar.Var
|
||||
cityName *gvar.Var
|
||||
err error
|
||||
)
|
||||
// TODO 默认分隔符
|
||||
|
||||
// 分隔符
|
||||
spiltSymbol := "-"
|
||||
if len(spilt) > 0 {
|
||||
spiltSymbol = spilt[0]
|
||||
}
|
||||
|
||||
if province > 0 {
|
||||
if province > 0 && province < 999999 {
|
||||
provinceName, err = dao.Ctx(ctx).Where("id", province).Fields("title").Value()
|
||||
if err != nil {
|
||||
err = gerror.Wrap(err, consts.ErrorORM)
|
||||
|
||||
27
server/internal/dao/sys_serve_log.go
Normal file
27
server/internal/dao/sys_serve_log.go
Normal file
@@ -0,0 +1,27 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalSysServeLogDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysServeLogDao = *internal.SysServeLogDao
|
||||
|
||||
// sysServeLogDao is the data access object for table hg_sys_serve_log.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysServeLogDao struct {
|
||||
internalSysServeLogDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysServeLog is globally public accessible object for table hg_sys_serve_log operations.
|
||||
SysServeLog = sysServeLogDao{
|
||||
internal.NewSysServeLogDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
43
server/internal/dao/sys_sms_log.go
Normal file
43
server/internal/dao/sys_sms_log.go
Normal file
@@ -0,0 +1,43 @@
|
||||
// =================================================================================
|
||||
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
// =================================================================================
|
||||
|
||||
package dao
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
"hotgo/internal/dao/internal"
|
||||
)
|
||||
|
||||
// internalSysSmsLogDao is internal type for wrapping internal DAO implements.
|
||||
type internalSysSmsLogDao = *internal.SysSmsLogDao
|
||||
|
||||
// sysSmsLogDao is the data access object for table hg_sys_sms_log.
|
||||
// You can define custom methods on it to extend its functionality as you wish.
|
||||
type sysSmsLogDao struct {
|
||||
internalSysSmsLogDao
|
||||
}
|
||||
|
||||
var (
|
||||
// SysSmsLog is globally public accessible object for table hg_sys_sms_log operations.
|
||||
SysSmsLog = sysSmsLogDao{
|
||||
internal.NewSysSmsLogDao(),
|
||||
}
|
||||
)
|
||||
|
||||
// Fill with you ideas below.
|
||||
|
||||
// NowDayCount 当天发送次数
|
||||
func (dao *sysSmsLogDao) NowDayCount(ctx context.Context, event, mobile string) (count int, err error) {
|
||||
count, err = dao.Ctx(ctx).
|
||||
Where("mobile", mobile).
|
||||
Where("event", event).
|
||||
WhereGTE("created_at", gtime.Now().Format("Y-m-d")).
|
||||
Count()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user