Browse Source

实名

master
huangjiajun 1 day ago
parent
commit
ce6177f29c
4 changed files with 67 additions and 12 deletions
  1. +4
    -11
      app/hdl/hdl_demo.go
  2. +14
    -0
      app/hdl/hdl_user_real_name.go
  3. +2
    -1
      app/router/router.go
  4. +47
    -0
      app/svc/svc_user_real_name.go

+ 4
- 11
app/hdl/hdl_demo.go View File

@@ -4,11 +4,10 @@ import (
"applet/app/e"
"applet/app/lib/aes"
"applet/app/lib/aes/md"
md2 "applet/app/md"
"applet/app/svc"
"applet/app/utils"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"encoding/json"
"fmt"
"github.com/gin-gonic/gin"
"io/ioutil"
"strconv"
@@ -46,15 +45,9 @@ func Demo(c *gin.Context) {
return
}
func Demo1(c *gin.Context) {
ch, err := rabbit.Cfg.Pool.GetChannel()
if err == nil {
defer ch.Release()
}
arg := md2.AdvertisingWatch{Id: "3"}
err = ch.PublishV2(md2.EggAdvertisingQueueExchange, arg, md2.EggAdvertisingSmash)
if err != nil {
ch.PublishV2(md2.EggAdvertisingQueueExchange, arg, md2.EggAdvertisingSmash)
}
state, _, _, err := svc.GetCertifyQuery(c, "17")
fmt.Println(state)
fmt.Println(err)
}

func TestCreateSign(c *gin.Context) {


+ 14
- 0
app/hdl/hdl_user_real_name.go View File

@@ -19,6 +19,20 @@ func GetRealNameAuthBase(c *gin.Context) {
svc.GetRealNameAuthBase(c)
}

// GetRealNameAuthState
// @Summary 实名认证-基础信息
// @Tags 实名认证
// @Description 实名认证-分类
// @Accept json
// @Produce json
// @param Authorization header string true "验证参数Bearer和token空格拼接"
// @Success 200 {object} md.RealNameAuthBasicData "具体数据"
// @Failure 400 {object} md.Response "具体错误"
// @Router /api/v1/faceRealName/state [get]
func GetRealNameAuthState(c *gin.Context) {
svc.GetRealNameAuthState(c)
}

// RealNameSave
// @Summary 实名认证-保存
// @Tags 实名认证


+ 2
- 1
app/router/router.go View File

@@ -174,7 +174,8 @@ func route(r *gin.RouterGroup) {
}
rFaceRealName := r.Group("/faceRealName") // 实名认证
{
rFaceRealName.GET("/base", hdl.GetRealNameAuthBase) //实名认证基础
rFaceRealName.GET("/base", hdl.GetRealNameAuthBase) //实名认证基础
rFaceRealName.GET("/state", hdl.GetRealNameAuthState) //实名认证基础
rFaceRealName.POST("/save", hdl.RealNameSave)
}
}


+ 47
- 0
app/svc/svc_user_real_name.go View File

@@ -66,6 +66,53 @@ func GetRealNameAuthBase(c *gin.Context) {
e.OutSuc(c, res, nil)
return
}
func GetRealNameAuthState(c *gin.Context) {
var res = &md.RealNameAuthBasicData{
AuthState: "0",
IsNeedGetEnergy: "1",
TipStr: "请前往蛋蛋乐园获取能量",
}
res.AuthState = "0"
//判断审核状态
eg := db.Db
user := GetUser(c)
egg_system_rules.Init(cfg.RedisAddr)
amount := GetSysCfgStr("user_real_name_money")
_, can := egg_energy.CheckActivityCoinToAlipayRealName(db.Db, user.Id, amount)
if can {
res.IsNeedGetEnergy = "0"
}
NewUserRealNameAuthDb := implement.NewUserRealNameAuthDb(eg)
list, _ := NewUserRealNameAuthDb.GetRealNameAuthByUid(utils.Int64ToStr(user.Id))
if list != nil {
//如果是审核中的订单,判断是否人脸识别 调用人脸识别获取结果
if list.State != 1 && list.CertifyId != "" {
state, _, _, err := GetCertifyQuery(c, utils.Int64ToStr(user.Id))
if err == nil {
list.State = state
}
}
res.AuthState = utils.IntToStr(list.State)
if list.State == 0 { //人脸识别 支付了但是没扫脸的情况 设置成没审核状态
res.AuthState = "0"
}
if list.IsPay == 0 {
res.AuthState = "0"
}
if list.IsPay == 1 {
res.IsNeedGetEnergy = "0"
}
}
if res.AuthState == "1" {
res.IsNeedGetEnergy = "0"
if user.IsRealName == 0 {
user.IsRealName = 1
eg.Where("id=?", user.Id).Cols("is_real_name").Update(user)
}
}
e.OutSuc(c, res, nil)
return
}

func RealNameSave(c *gin.Context) {
var args md.RealNameAuthAddRequest


Loading…
Cancel
Save