@@ -3,7 +3,7 @@ | |||||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | ||||
type EggEnergyUserWatchRecordsDao interface { | 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) | EggEnergyUserWatchRecordsGetOneByParams(params map[string]interface{}) (*model.EggEnergyUserWatchRecords, error) | ||||
} | } |
@@ -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) | |||||
} |
@@ -16,23 +16,23 @@ type EggEnergyUserWatchRecordsDb struct { | |||||
Db *xorm.Engine | 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 { | if err != nil { | ||||
return 0, err | 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 ( | var ( | ||||
affected int64 | affected int64 | ||||
err error | err error | ||||
) | ) | ||||
if forceColums != nil { | 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 { | } else { | ||||
affected, err = e.Db.Where("id=?", id).Update(OneCirclesUserWatchRecords) | |||||
affected, err = e.Db.Where("id=?", id).Update(userWatchRecords) | |||||
} | } | ||||
if err != nil { | if err != nil { | ||||
return 0, err | return 0, err | ||||
@@ -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 | |||||
} |
@@ -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)"` | |||||
} |