@@ -16,6 +16,7 @@ type AdminDao interface { | |||||
UpdateAdmin(m *model.Admin, columns ...string) (int64, error) | UpdateAdmin(m *model.Admin, columns ...string) (int64, error) | ||||
AdminInsert(m *model.Admin) (int64, error) | AdminInsert(m *model.Admin) (int64, error) | ||||
FindAdminRolePermissionGroup(admId int) (list []*AdminRolePermissionGroup, total int64, err error) | FindAdminRolePermissionGroup(admId int) (list []*AdminRolePermissionGroup, total int64, err error) | ||||
AdminFindByParams(params map[string]interface{}) ([]model.Admin, error) | |||||
} | } | ||||
type AdminRolePermissionGroup struct { | type AdminRolePermissionGroup struct { | ||||
@@ -4,4 +4,7 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type EggFriendCircleBasicDao interface { | type EggFriendCircleBasicDao interface { | ||||
EggFriendCircleBasicGet() (*model.EggFriendCircleBasic, error) | EggFriendCircleBasicGet() (*model.EggFriendCircleBasic, error) | ||||
EggFriendCircleBasicGetOne() (*model.EggFriendCircleBasic, error) | |||||
EggFriendCircleBasicInsert(m *model.EggFriendCircleBasic) (int, error) | |||||
UpdateEggFriendCircleBasic(m *model.EggFriendCircleBasic, columns ...string) (int64, error) | |||||
} | } |
@@ -4,4 +4,6 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type EggFriendCircleUserBlackListDao interface { | type EggFriendCircleUserBlackListDao interface { | ||||
EggFriendCircleUserBlackListGet(uid int64) (*model.EggFriendCircleUserBlackList, error) | EggFriendCircleUserBlackListGet(uid int64) (*model.EggFriendCircleUserBlackList, error) | ||||
EggFriendCircleUserBlackListInsert(m *model.EggFriendCircleUserBlackList) (int, error) | |||||
EggFriendCircleUserBlackListDeleteById(id int) (int64, error) | |||||
} | } |
@@ -3,7 +3,9 @@ package implement | |||||
import ( | import ( | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" | |||||
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | ||||
"fmt" | |||||
"reflect" | "reflect" | ||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -124,3 +126,20 @@ func (a AdminDb) FindAdminRolePermissionGroup(admId int) (list []*dao.AdminRoleP | |||||
FindAndCount(&list) | FindAndCount(&list) | ||||
return | return | ||||
} | } | ||||
func (a AdminDb) AdminFindByParams(params map[string]interface{}) ([]model.Admin, error) { | |||||
var m []model.Admin | |||||
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { | |||||
//指定In查询 | |||||
if err := a.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { | |||||
return nil, zhios_order_relate_logx.Warn(err) | |||||
} | |||||
} else { | |||||
var query = fmt.Sprintf("%s =?", params["key"]) | |||||
err := a.Db.Where(query, params["value"]).Find(&m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
} | |||||
return m, nil | |||||
} |
@@ -23,3 +23,30 @@ func (e EggFriendCircleBasicDb) EggFriendCircleBasicGet() (*model.EggFriendCircl | |||||
} | } | ||||
return &m, nil | return &m, nil | ||||
} | } | ||||
func (e EggFriendCircleBasicDb) EggFriendCircleBasicGetOne() (*model.EggFriendCircleBasic, error) { | |||||
var m model.EggFriendCircleBasic | |||||
has, err := e.Db.Where("id >= ?", 1).Get(&m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err.Error()) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return &m, nil | |||||
} | |||||
func (e EggFriendCircleBasicDb) EggFriendCircleBasicInsert(m *model.EggFriendCircleBasic) (int, error) { | |||||
_, err := e.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err.Error()) | |||||
} | |||||
return m.Id, nil | |||||
} | |||||
func (e EggFriendCircleBasicDb) UpdateEggFriendCircleBasic(m *model.EggFriendCircleBasic, columns ...string) (int64, error) { | |||||
affected, err := e.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err.Error()) | |||||
} | |||||
return affected, nil | |||||
} |
@@ -15,6 +15,21 @@ type EggFriendCircleUserBlackListDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (e EggFriendCircleUserBlackListDb) EggFriendCircleUserBlackListInsert(m *model.EggFriendCircleUserBlackList) (int, error) { | |||||
_, err := e.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err.Error()) | |||||
} | |||||
return m.Id, nil | |||||
} | |||||
func (e EggFriendCircleUserBlackListDb) EggFriendCircleUserBlackListDeleteById(id int) (int64, error) { | |||||
affected, err := e.Db.Where("id = ? ", id).Delete(model.EggFriendCircleUserBlackList{}) | |||||
if err != nil { | |||||
return 0, zhios_order_relate_logx.Error(err.Error()) | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (e EggFriendCircleUserBlackListDb) EggFriendCircleUserBlackListGet(uid int64) (*model.EggFriendCircleUserBlackList, error) { | func (e EggFriendCircleUserBlackListDb) EggFriendCircleUserBlackListGet(uid int64) (*model.EggFriendCircleUserBlackList, error) { | ||||
var m model.EggFriendCircleUserBlackList | var m model.EggFriendCircleUserBlackList | ||||
has, err := e.Db.Where("uid >= ?", uid).Get(&m) | has, err := e.Db.Where("uid >= ?", uid).Get(&m) | ||||
@@ -1,12 +1,18 @@ | |||||
package model | package model | ||||
import ( | |||||
"time" | |||||
) | |||||
type AdvertisingCallback struct { | type AdvertisingCallback struct { | ||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Platform string `json:"platform" xorm:"unique(platform) VARCHAR(255)"` | |||||
Oid string `json:"oid" xorm:"unique(platform) VARCHAR(255)"` | |||||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||||
Extra string `json:"extra" xorm:"VARCHAR(255)"` | |||||
SpaceId string `json:"space_id" xorm:"VARCHAR(255)"` | |||||
Amount string `json:"amount" xorm:"VARCHAR(255)"` | |||||
IsRun int `json:"is_run" xorm:"default 0 INT(1)"` | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Platform string `json:"platform" xorm:"unique(platform) VARCHAR(255)"` | |||||
Oid string `json:"oid" xorm:"unique(platform) VARCHAR(255)"` | |||||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||||
Extra string `json:"extra" xorm:"VARCHAR(255)"` | |||||
SpaceId string `json:"space_id" xorm:"VARCHAR(255)"` | |||||
Amount string `json:"amount" xorm:"VARCHAR(255)"` | |||||
IsRun int `json:"is_run" xorm:"default 0 INT(1)"` | |||||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||||
UniqId string `json:"uniq_id" xorm:"VARCHAR(255)"` | |||||
} | } |
@@ -2,8 +2,9 @@ package model | |||||
type EggFriendCircleUserBlackList struct { | type EggFriendCircleUserBlackList struct { | ||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | ||||
Uid int64 `json:"uid" xorm:"not null default 1 BIGINT(20)"` | |||||
AdmId int `json:"adm_id" xorm:"not null default 1 INT(11)"` | |||||
Uid int64 `json:"uid" xorm:"not null default 1 comment('用户id') BIGINT(20)"` | |||||
AdmId int `json:"adm_id" xorm:"not null default 1 comment('管理员id') INT(11)"` | |||||
Memo string `json:"memo" xorm:"not null comment('备注') TEXT"` | |||||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | ||||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | ||||
} | } |
@@ -5,9 +5,9 @@ import ( | |||||
) | ) | ||||
type UserFeedback struct { | type UserFeedback struct { | ||||
Id int `json:"id" xorm:"not null pk default 0 INT(11)"` | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | Uid int `json:"uid" xorm:"default 0 INT(11)"` | ||||
Type string `json:"type" xorm:"default '0' comment('问题类型') VARCHAR(255)"` | |||||
Type string `json:"type" xorm:"default '' comment('问题类型') VARCHAR(255)"` | |||||
Extra string `json:"extra" xorm:"comment('api请求头内容') TEXT"` | Extra string `json:"extra" xorm:"comment('api请求头内容') TEXT"` | ||||
Content string `json:"content" xorm:"comment('问题内容') VARCHAR(5000)"` | Content string `json:"content" xorm:"comment('问题内容') VARCHAR(5000)"` | ||||
Img string `json:"img" xorm:"comment('图片 [""]') VARCHAR(5000)"` | Img string `json:"img" xorm:"comment('图片 [""]') VARCHAR(5000)"` | ||||