From bdf6315267cbf7d519af421542198c2a85bbe878 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 28 Nov 2024 19:06:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=9E=E5=90=8D=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dao/user_real_name_auth_dao.go | 13 ++++ .../user_real_name_auth_implement.go | 62 +++++++++++++++++++ src/model/user_real_name_auth.go | 25 ++++++++ 3 files changed, 100 insertions(+) create mode 100644 src/dao/user_real_name_auth_dao.go create mode 100644 src/implement/user_real_name_auth_implement.go create mode 100644 src/model/user_real_name_auth.go diff --git a/src/dao/user_real_name_auth_dao.go b/src/dao/user_real_name_auth_dao.go new file mode 100644 index 0000000..1c8c702 --- /dev/null +++ b/src/dao/user_real_name_auth_dao.go @@ -0,0 +1,13 @@ +package dao + +import ( + "code.fnuoos.com/EggPlanet/egg_models.git/src/model" +) + +type UserRealNameAuthDao interface { + GetRealNameAuthByUid(uid string) (m *model.UserRealNameAuth, err error) + GetRealNameAuthByUidWithState(uid, state string) (m *model.UserRealNameAuth, err error) + GetRealNameAuthCount(uid int, cardNo string) (int64, error) + GetRealNameAuthByOid(oid string) (*model.UserRealNameAuth, error) + GetRealNameAuth(uid int) (*model.UserRealNameAuth, error) +} diff --git a/src/implement/user_real_name_auth_implement.go b/src/implement/user_real_name_auth_implement.go new file mode 100644 index 0000000..a6d89ca --- /dev/null +++ b/src/implement/user_real_name_auth_implement.go @@ -0,0 +1,62 @@ +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 NewUserRealNameAuthDb(engine *xorm.Engine) dao.UserRealNameAuthDao { + return &UserRealNameAuthDb{Db: engine} +} + +type UserRealNameAuthDb struct { + Db *xorm.Engine +} + +func (u UserRealNameAuthDb) GetRealNameAuthByUid(uid string) (m *model.UserRealNameAuth, err error) { + m = new(model.UserRealNameAuth) + has, err := u.Db.Where("uid=?", uid).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} +func (u UserRealNameAuthDb) GetRealNameAuthByUidWithState(uid, state string) (m *model.UserRealNameAuth, err error) { + m = new(model.UserRealNameAuth) + has, err := u.Db.Where("uid = ? and state=?", uid, state).Get(m) + if err != nil { + return nil, zhios_order_relate_logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} +func (u UserRealNameAuthDb) GetRealNameAuthCount(uid int, cardNo string) (int64, error) { + var m model.UserRealNameAuth + has, err := u.Db.Where("uid <> ? AND state = ? and card_no = ?", uid, 1, cardNo).Count(&m) + if has == 0 || err != nil { + return 0, err + } + return has, nil +} +func (u UserRealNameAuthDb) GetRealNameAuthByOid(oid string) (*model.UserRealNameAuth, error) { + var m model.UserRealNameAuth + if has, err := u.Db.Where("oid = ? ", oid).Get(&m); err != nil || !has { + return nil, err + } + return &m, nil +} + +func (u UserRealNameAuthDb) GetRealNameAuth(uid int) (*model.UserRealNameAuth, error) { + var m model.UserRealNameAuth + if has, err := u.Db.Where("uid = ? ", uid).In("is_pay", []string{"1", "5"}).Get(&m); err != nil || !has { + return nil, err + } + return &m, nil +} diff --git a/src/model/user_real_name_auth.go b/src/model/user_real_name_auth.go new file mode 100644 index 0000000..cdc9746 --- /dev/null +++ b/src/model/user_real_name_auth.go @@ -0,0 +1,25 @@ +package model + +import ( + "time" +) + +type UserRealNameAuth struct { + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + Uid int `json:"uid" xorm:"comment('用户id') index INT(11)"` + RealName string `json:"real_name" xorm:"comment('真实姓名') VARCHAR(255)"` + CardNo string `json:"card_no" xorm:"comment('身份证号') VARCHAR(255)"` + FrontImg string `json:"front_img" xorm:"comment('身份证正面(国徽面)') VARCHAR(255)"` + BackImg string `json:"back_img" xorm:"comment('身份证反面(人像面)') VARCHAR(255)"` + State int `json:"state" xorm:"comment('0未审核 1通过 2拒绝') TINYINT(1)"` + AuditType int `json:"audit_type" xorm:"comment('审核类型:1自动 2手动') TINYINT(1)"` + IsPay int `json:"is_pay" xorm:"not null default 0 comment('是否支付,0:否 ,1:是') 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"` + Oid string `json:"oid" xorm:"default '' comment('订单号') VARCHAR(50)"` + Msg string `json:"msg" xorm:"comment('调用支付宝实名接口数据') LONGTEXT"` + CertifyId string `json:"certify_id" xorm:"default '' comment('支付宝的实名认证id') VARCHAR(255)"` + Amount float64 `json:"amount" xorm:"default 0.00 comment('付款金额') DOUBLE(11,2)"` + AlipayOid string `json:"alipay_oid" xorm:"default '' comment('支付宝人脸识别订单号(会变化)') VARCHAR(50)"` + IsCheck int `json:"is_check" xorm:"default 0 INT(1)"` +} From 408f683bcf3b6d94cc1d5df1c95c79e7ca773ee9 Mon Sep 17 00:00:00 2001 From: shenjiachi Date: Thu, 28 Nov 2024 19:16:52 +0800 Subject: [PATCH 2/2] update --- src/dao/egg_energy_user_watch_records_dao.go | 4 ++-- .../egg_energy_user_watch_records_implement.go | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/dao/egg_energy_user_watch_records_dao.go b/src/dao/egg_energy_user_watch_records_dao.go index f8d5b47..d1ab8c9 100644 --- a/src/dao/egg_energy_user_watch_records_dao.go +++ b/src/dao/egg_energy_user_watch_records_dao.go @@ -3,7 +3,7 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" type EggEnergyUserWatchRecordsDao interface { - EggEnergyUserWatchRecordsInsert(OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) - EggEnergyUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) + EggEnergyUserWatchRecordsInsert(userWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) + EggEnergyUserWatchRecordsUpdate(id interface{}, userWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) EggEnergyUserWatchRecordsGetOneByParams(params map[string]interface{}) (*model.EggEnergyUserWatchRecords, error) } diff --git a/src/implement/egg_energy_user_watch_records_implement.go b/src/implement/egg_energy_user_watch_records_implement.go index b942310..9acd11c 100644 --- a/src/implement/egg_energy_user_watch_records_implement.go +++ b/src/implement/egg_energy_user_watch_records_implement.go @@ -16,23 +16,23 @@ type EggEnergyUserWatchRecordsDb struct { Db *xorm.Engine } -func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsInsert(OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) { - _, err := e.Db.InsertOne(OneCirclesUserWatchRecords) +func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsInsert(userWatchRecords *model.EggEnergyUserWatchRecords) (int64, error) { + _, err := e.Db.InsertOne(userWatchRecords) if err != nil { return 0, err } - return OneCirclesUserWatchRecords.Id, nil + return userWatchRecords.Id, nil } -func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsUpdate(id interface{}, OneCirclesUserWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) { +func (e EggEnergyUserWatchRecordsDb) EggEnergyUserWatchRecordsUpdate(id interface{}, userWatchRecords *model.EggEnergyUserWatchRecords, forceColums ...string) (int64, error) { var ( affected int64 err error ) if forceColums != nil { - affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(OneCirclesUserWatchRecords) + affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(userWatchRecords) } else { - affected, err = e.Db.Where("id=?", id).Update(OneCirclesUserWatchRecords) + affected, err = e.Db.Where("id=?", id).Update(userWatchRecords) } if err != nil { return 0, err