From afaf570d445a57732b0b4e7318573ca0e7131096 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 2 Dec 2024 17:23:26 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/advertising_callback.go | 21 +++++++++++++-------- src/model/user_feedback.go | 4 ++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/model/advertising_callback.go b/src/model/advertising_callback.go index 883fcf0..044de4e 100644 --- a/src/model/advertising_callback.go +++ b/src/model/advertising_callback.go @@ -1,12 +1,17 @@ package model +import ( + "time" +) + 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"` } diff --git a/src/model/user_feedback.go b/src/model/user_feedback.go index 25d76b4..a81073e 100644 --- a/src/model/user_feedback.go +++ b/src/model/user_feedback.go @@ -5,9 +5,9 @@ import ( ) 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)"` - 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"` Content string `json:"content" xorm:"comment('问题内容') VARCHAR(5000)"` Img string `json:"img" xorm:"comment('图片 [""]') VARCHAR(5000)"` From f24cbec9b309ccd7c03deea28369f2a31dc636e4 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Mon, 2 Dec 2024 21:19:28 +0800 Subject: [PATCH 2/6] add friend circle --- src/dao/egg_friend_circle_basic_dao.go | 10 +++++ .../egg_friend_circle_user_black_list_dao.go | 5 +++ .../egg_friend_circle_basic_implement.go | 41 +++++++++++++++++++ ...friend_circle_user_black_list_implement.go | 14 +++++++ src/model/egg_friend_circle_basic.go | 11 +++++ .../egg_friend_circle_user_black_list.go | 9 ++++ 6 files changed, 90 insertions(+) create mode 100644 src/dao/egg_friend_circle_basic_dao.go create mode 100644 src/dao/egg_friend_circle_user_black_list_dao.go create mode 100644 src/implement/egg_friend_circle_basic_implement.go create mode 100644 src/implement/egg_friend_circle_user_black_list_implement.go create mode 100644 src/model/egg_friend_circle_basic.go create mode 100644 src/model/egg_friend_circle_user_black_list.go diff --git a/src/dao/egg_friend_circle_basic_dao.go b/src/dao/egg_friend_circle_basic_dao.go new file mode 100644 index 0000000..a2512fd --- /dev/null +++ b/src/dao/egg_friend_circle_basic_dao.go @@ -0,0 +1,10 @@ +package dao + +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + +type EggFriendCircleBasicDao interface { + //TODO:: You can add specific method definitions here + EggFriendCircleBasicGetOne() (*model.EggFriendCircleBasic, error) + EggFriendCircleBasicInsert(m *model.EggFriendCircleBasic) (int, error) + UpdateEggFriendCircleBasic(m *model.EggFriendCircleBasic, columns ...string) (int64, error) +} diff --git a/src/dao/egg_friend_circle_user_black_list_dao.go b/src/dao/egg_friend_circle_user_black_list_dao.go new file mode 100644 index 0000000..d055e11 --- /dev/null +++ b/src/dao/egg_friend_circle_user_black_list_dao.go @@ -0,0 +1,5 @@ +package dao + +type EggFriendCircleUserBlackListDao interface { + //TODO:: You can add specific method definitions here +} diff --git a/src/implement/egg_friend_circle_basic_implement.go b/src/implement/egg_friend_circle_basic_implement.go new file mode 100644 index 0000000..82f08b5 --- /dev/null +++ b/src/implement/egg_friend_circle_basic_implement.go @@ -0,0 +1,41 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" + "xorm.io/xorm" +) + +func NewEggFriendCircleBasicDb(engine *xorm.Engine) dao.EggFriendCircleBasicDao { + return &EggFriendCircleBasicDb{Db: engine} +} + +type EggFriendCircleBasicDb struct { + Db *xorm.Engine +} + +func (e EggFriendCircleBasicDb) EggFriendCircleBasicGetOne() (*model.EggFriendCircleBasic, error) { + var m model.EggFriendCircleBasic + _, err := e.Db.Where("id >= ?", 1).Get(&m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err.Error()) + } + return &m, nil +} + +func (e EggFriendCircleBasicDb) EggFriendCircleBasicInsert(m *model.EggFriendCircleBasic) (int, error) { + _, err := e.Db.InsertOne(m) + if err != nil { + return 0, err + } + 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, err + } + return affected, nil +} diff --git a/src/implement/egg_friend_circle_user_black_list_implement.go b/src/implement/egg_friend_circle_user_black_list_implement.go new file mode 100644 index 0000000..5e90d1d --- /dev/null +++ b/src/implement/egg_friend_circle_user_black_list_implement.go @@ -0,0 +1,14 @@ +package implement + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "xorm.io/xorm" +) + +func NewEggFriendCircleUserBlackListDb(engine *xorm.Engine) dao.EggFriendCircleUserBlackListDao { + return &EggFriendCircleUserBlackListDb{Db: engine} +} + +type EggFriendCircleUserBlackListDb struct { + Db *xorm.Engine +} diff --git a/src/model/egg_friend_circle_basic.go b/src/model/egg_friend_circle_basic.go new file mode 100644 index 0000000..bfd6a47 --- /dev/null +++ b/src/model/egg_friend_circle_basic.go @@ -0,0 +1,11 @@ +package model + +type EggFriendCircleBasic struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + CommentIsRealName int `json:"comment_is_real_name" xorm:"not null default 1 comment('评论是否需要实名认证(1:是 2:否)') TINYINT(1)"` + PublishIsRealName int `json:"publish_is_real_name" xorm:"not null default 1 comment('发布是否需要实名认证(1:是 2:否)') TINYINT(1)"` + CommentNumsEveryDay int `json:"comment_nums_every_day" xorm:"not null default 0 comment('评论每天次数') INT(11)"` + PublishNumsEveryDay int `json:"publish_nums_every_day" xorm:"not null default 0 comment('发布每天次数') INT(11)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} diff --git a/src/model/egg_friend_circle_user_black_list.go b/src/model/egg_friend_circle_user_black_list.go new file mode 100644 index 0000000..2d50660 --- /dev/null +++ b/src/model/egg_friend_circle_user_black_list.go @@ -0,0 +1,9 @@ +package model + +type EggFriendCircleUserBlackList struct { + 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)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` +} From 86294a2891c487d61c876b662ccf25a396cdf295 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Tue, 3 Dec 2024 16:08:21 +0800 Subject: [PATCH 3/6] update --- src/dao/admin_dao.go | 1 + .../egg_friend_circle_user_black_list_dao.go | 4 ++++ src/implement/admin_implement.go | 19 +++++++++++++++++++ ...friend_circle_user_black_list_implement.go | 17 +++++++++++++++++ .../egg_friend_circle_user_black_list.go | 5 +++-- 5 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/dao/admin_dao.go b/src/dao/admin_dao.go index d3abd8f..1f3ebd5 100644 --- a/src/dao/admin_dao.go +++ b/src/dao/admin_dao.go @@ -16,6 +16,7 @@ type AdminDao interface { UpdateAdmin(m *model.Admin, columns ...string) (int64, error) AdminInsert(m *model.Admin) (int64, error) FindAdminRolePermissionGroup(admId int) (list []*AdminRolePermissionGroup, total int64, err error) + AdminFindByParams(params map[string]interface{}) ([]model.Admin, error) } type AdminRolePermissionGroup struct { diff --git a/src/dao/egg_friend_circle_user_black_list_dao.go b/src/dao/egg_friend_circle_user_black_list_dao.go index d055e11..8286f20 100644 --- a/src/dao/egg_friend_circle_user_black_list_dao.go +++ b/src/dao/egg_friend_circle_user_black_list_dao.go @@ -1,5 +1,9 @@ package dao +import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + type EggFriendCircleUserBlackListDao interface { //TODO:: You can add specific method definitions here + EggFriendCircleUserBlackListInsert(m *model.EggFriendCircleUserBlackList) (int, error) + EggFriendCircleUserBlackListDeleteById(id int) (int64, error) } diff --git a/src/implement/admin_implement.go b/src/implement/admin_implement.go index fcbae86..0375a7e 100644 --- a/src/implement/admin_implement.go +++ b/src/implement/admin_implement.go @@ -3,7 +3,9 @@ package implement import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" "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" + "fmt" "reflect" "xorm.io/xorm" ) @@ -124,3 +126,20 @@ func (a AdminDb) FindAdminRolePermissionGroup(admId int) (list []*dao.AdminRoleP FindAndCount(&list) 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 +} diff --git a/src/implement/egg_friend_circle_user_black_list_implement.go b/src/implement/egg_friend_circle_user_black_list_implement.go index 5e90d1d..35b2007 100644 --- a/src/implement/egg_friend_circle_user_black_list_implement.go +++ b/src/implement/egg_friend_circle_user_black_list_implement.go @@ -2,6 +2,8 @@ import ( "code.fnuoos.com/EggPlanet/egg_models.git/src/dao" + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" + zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" "xorm.io/xorm" ) @@ -12,3 +14,18 @@ func NewEggFriendCircleUserBlackListDb(engine *xorm.Engine) dao.EggFriendCircleU type EggFriendCircleUserBlackListDb struct { 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 +} diff --git a/src/model/egg_friend_circle_user_black_list.go b/src/model/egg_friend_circle_user_black_list.go index 2d50660..bad0269 100644 --- a/src/model/egg_friend_circle_user_black_list.go +++ b/src/model/egg_friend_circle_user_black_list.go @@ -2,8 +2,9 @@ package model type EggFriendCircleUserBlackList struct { 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"` UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` } From cabf4ae850c3436631d7bf72e6ff09fff2e42cbb Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Tue, 3 Dec 2024 16:30:21 +0800 Subject: [PATCH 4/6] update --- src/implement/egg_friend_circle_basic_implement.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/implement/egg_friend_circle_basic_implement.go b/src/implement/egg_friend_circle_basic_implement.go index 82f08b5..b5fd2ad 100644 --- a/src/implement/egg_friend_circle_basic_implement.go +++ b/src/implement/egg_friend_circle_basic_implement.go @@ -17,10 +17,13 @@ type EggFriendCircleBasicDb struct { func (e EggFriendCircleBasicDb) EggFriendCircleBasicGetOne() (*model.EggFriendCircleBasic, error) { var m model.EggFriendCircleBasic - _, err := e.Db.Where("id >= ?", 1).Get(&m) + 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 } From 82c8c99675a81fc119252e73990325e2d0d4f9ef Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 3 Dec 2024 18:12:31 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/advertising_callback.go | 1 + 1 file changed, 1 insertion(+) diff --git a/src/model/advertising_callback.go b/src/model/advertising_callback.go index 044de4e..648713a 100644 --- a/src/model/advertising_callback.go +++ b/src/model/advertising_callback.go @@ -14,4 +14,5 @@ type AdvertisingCallback struct { 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)"` } From 2e593fa11d5d2b4289a7422563a9c410a9a9c59e Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Tue, 3 Dec 2024 18:43:48 +0800 Subject: [PATCH 6/6] update --- src/implement/egg_friend_circle_basic_implement.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/implement/egg_friend_circle_basic_implement.go b/src/implement/egg_friend_circle_basic_implement.go index b5fd2ad..8720ae6 100644 --- a/src/implement/egg_friend_circle_basic_implement.go +++ b/src/implement/egg_friend_circle_basic_implement.go @@ -30,7 +30,7 @@ func (e EggFriendCircleBasicDb) EggFriendCircleBasicGetOne() (*model.EggFriendCi func (e EggFriendCircleBasicDb) EggFriendCircleBasicInsert(m *model.EggFriendCircleBasic) (int, error) { _, err := e.Db.InsertOne(m) if err != nil { - return 0, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return m.Id, nil } @@ -38,7 +38,7 @@ func (e EggFriendCircleBasicDb) EggFriendCircleBasicInsert(m *model.EggFriendCir 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, err + return 0, zhios_order_relate_logx.Error(err.Error()) } return affected, nil }