Pārlūkot izejas kodu

实名认证

master
huangjiajun pirms 6 dienas
vecāks
revīzija
bdf6315267
3 mainītis faili ar 100 papildinājumiem un 0 dzēšanām
  1. +13
    -0
      src/dao/user_real_name_auth_dao.go
  2. +62
    -0
      src/implement/user_real_name_auth_implement.go
  3. +25
    -0
      src/model/user_real_name_auth.go

+ 13
- 0
src/dao/user_real_name_auth_dao.go Parādīt failu

@@ -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)
}

+ 62
- 0
src/implement/user_real_name_auth_implement.go Parādīt failu

@@ -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
}

+ 25
- 0
src/model/user_real_name_auth.go Parādīt failu

@@ -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)"`
}

Notiek ielāde…
Atcelt
Saglabāt