Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 6 days ago
parent
commit
e3c2ca7737
9 changed files with 158 additions and 35 deletions
  1. +3
    -2
      app/hdl/hdl_points_center.go
  2. +2
    -2
      app/hdl/hdl_wallet.go
  3. +9
    -6
      app/md/md.wallet.go
  4. +59
    -6
      app/svc/svc_withdraw_apply.go
  5. +16
    -5
      docs/docs.go
  6. +13
    -3
      docs/swagger.json
  7. +10
    -2
      docs/swagger.yaml
  8. +44
    -6
      etc/cfg.yml
  9. +2
    -3
      go.mod

+ 3
- 2
app/hdl/hdl_points_center.go View File

@@ -15,6 +15,7 @@ import (
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule"
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy"
enum2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/enum"
md3 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
svc2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/svc"
es2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/utils/es"
@@ -372,7 +373,7 @@ func GetPriceCurve(c *gin.Context) {
// continue
//}
yData = append(yData, results[0]["price"])
xData = append(xData, results[0]["date"]+" "+results[0]["hour"]+":00")
xData = append(xData, results[0]["hour"]+":00")
}
}
yData = append(yData, m.Price)
@@ -477,7 +478,7 @@ func ExchangeEnergy(c *gin.Context) {
}

// 6. 更改动态数据
err = egg_energy.DealAvailableEggEnergyCoin(session, int(enum.EggEnergyExchangeAccountBalance), eggEnergyCoreData, md3.DealAvailableEggEnergyCoinReq{
err = egg_energy.DealAvailableEggEnergyCoin(session, int(enum2.EggEnergyExchangeAccountBalance), eggEnergyCoreData, md3.DealAvailableEggEnergyCoinReq{
Amount: req.EnergyAmount,
AmountFee: calcPriceReductionFormula.AmountFee,
BeforePrice: calcPriceReductionFormula.BeforePrice,


+ 2
- 2
app/hdl/hdl_wallet.go View File

@@ -182,7 +182,7 @@ func WithdrawApply(c *gin.Context) {
e.OutErr(c, e.ERR, "支付宝用户信息未授权")
return
}
if aliInfo.OpenId != "" {
if aliInfo.OpenId == "" {
e.OutErr(c, e.ERR, "支付宝用户授权信息有误")
return
}
@@ -367,7 +367,7 @@ func GetWithdrawCondition(c *gin.Context) {

//1. 判断是否为第一次提现
isFirst := false
has, err := db.Db.Where("uid = ?", user.Id).Get(model.FinWithdrawApply{})
has, err := db.Db.Where("uid = ?", user.Id).Get(&model.FinWithdrawApply{})
if !has { //第一次提现
isFirst = true
}


+ 9
- 6
app/md/md.wallet.go View File

@@ -32,12 +32,15 @@ type WithdrawApplyReq struct {
}

type GetWithdrawConditionResp struct {
IsNeedRealName bool `json:"is_need_real_name"` // 是否需要实名
IsRealName bool `json:"is_real_name"` // 是否实名
IsBindAlipay bool `json:"is_bind_alipay"` // 是否绑定阿里账户
IsBindWx bool `json:"is_bind_wx"` // 是否绑定微信账户
IsCanWithdraw bool `json:"is_can_withdraw"` // 是否能提现
NotWithdrawReason string `json:"not_withdraw_reason"` // 不能提现原因
IsFirst bool `json:"is_first"` // 是否第一次提现
FirstNeedRealName bool `json:"first_need_real_name"` // 第一次提现是否需要实名
FirstWithdrawAmountLimit string `json:"first_withdraw_amount_limit"` // 第一次提现金额限制
IsNeedRealName bool `json:"is_need_real_name"` // 是否需要实名
IsRealName bool `json:"is_real_name"` // 是否实名
IsBindAlipay bool `json:"is_bind_alipay"` // 是否绑定阿里账户
IsBindWx bool `json:"is_bind_wx"` // 是否绑定微信账户
IsCanWithdraw bool `json:"is_can_withdraw"` // 是否能提现
NotWithdrawReason string `json:"not_withdraw_reason"` // 不能提现原因
}

type BindAlipayAccountReq struct {


+ 59
- 6
app/svc/svc_withdraw_apply.go View File

@@ -244,15 +244,68 @@ func GetWithdrawCondition(user *model.User, setting *model.FinWithdrawSetting, i
}
}

// 5. 首次提现判断
//5、验证“提现频率”
var frequency md.WithdrawFrequencySettingStruct
utils.Unserialize([]byte(setting.FrequencySet), &frequency)
if frequency.Duration == 2 {
day := now.Weekday()
if !utils.InArr(utils.IntToStr(int(day)), frequency.Num) {
resp.IsCanWithdraw = false
resp.NotWithdrawReason = "非可提现日期"
}
}
if frequency.Duration == 3 {
day := now.Day()
if !utils.InArr(utils.IntToStr(day), frequency.Num) {
resp.IsCanWithdraw = false
resp.NotWithdrawReason = "非可提现日期"
}
}
if setting.WithdrawNumsLimit > 0 {
var withdrawNums int64
var startOfDay, endOfDay time.Time
if frequency.Duration == 1 { //按天
startOfDay = time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
endOfDay = startOfDay.Add(24 * time.Hour)
}
if frequency.Duration == 2 { //按周
startOfDay = utils.GetStartOfWeek(now)
endOfDay = startOfDay.Add(7 * 24 * time.Hour)
}
if frequency.Duration == 3 { //按月
startOfDay = utils.GetFirstDateOfMonth(now)
endOfDay = utils.GetLastDateOfMonth(now)
}
withdrawNums, err := db.Db.Where("create_at >= ?", startOfDay.Format("2006-01-02 15:04:05")).
And("create_at < ?", endOfDay.Format("2006-01-02 15:04:05")).
And("uid =?", user.Id).
And("state != 3"). //失败不计入
Count(&model.FinWithdrawApply{})
if err != nil {
resp.IsCanWithdraw = false
resp.NotWithdrawReason = err.Error()
}
if int(withdrawNums) >= setting.WithdrawNumsLimit {
resp.IsCanWithdraw = false
resp.NotWithdrawReason = "当前已无可提现次数"
}
}

// 6. 首次提现判断
if isFirst {
resp.IsFirst = true
var firstWithdrawSet md.FirstWithdrawSet
utils.Unserialize([]byte(setting.FirstWithdrawSet), &firstWithdrawSet)
if firstWithdrawSet.IsNeedRealName == 0 {
resp.IsNeedRealName = false
resp.IsCanWithdraw = true
resp.NotWithdrawReason = ""
}

resp.FirstNeedRealName = func(firstWithdrawSetIsNeedRealName int) bool {
if firstWithdrawSet.IsNeedRealName == 1 {
return true
}
return false
}(firstWithdrawSet.IsNeedRealName)
resp.NotWithdrawReason = ""
resp.FirstWithdrawAmountLimit = firstWithdrawSet.FirstWithdrawAmountLimit
resp.IsCanWithdraw = true
}

return resp


+ 16
- 5
docs/docs.go View File

@@ -1,5 +1,4 @@
// Code generated by swaggo/swag. DO NOT EDIT.

// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs

import "github.com/swaggo/swag"
@@ -3323,9 +3322,7 @@ const docTemplate = `{
"name": "req",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
"schema": {}
}
],
"responses": {
@@ -5186,6 +5183,14 @@ const docTemplate = `{
"md.GetWithdrawConditionResp": {
"type": "object",
"properties": {
"first_need_real_name": {
"description": "第一次提现是否需要实名",
"type": "boolean"
},
"first_withdraw_amount_limit": {
"description": "第一次提现金额限制",
"type": "string"
},
"is_bind_alipay": {
"description": "是否绑定阿里账户",
"type": "boolean"
@@ -5198,6 +5203,10 @@ const docTemplate = `{
"description": "是否能提现",
"type": "boolean"
},
"is_first": {
"description": "是否第一次提现",
"type": "boolean"
},
"is_need_real_name": {
"description": "是否需要实名",
"type": "boolean"
@@ -6611,6 +6620,8 @@ var SwaggerInfo = &swag.Spec{
Description: "APP客户端-Api接口",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}

func init() {


+ 13
- 3
docs/swagger.json View File

@@ -3316,9 +3316,7 @@
"name": "req",
"in": "body",
"required": true,
"schema": {
"type": "object"
}
"schema": {}
}
],
"responses": {
@@ -5179,6 +5177,14 @@
"md.GetWithdrawConditionResp": {
"type": "object",
"properties": {
"first_need_real_name": {
"description": "第一次提现是否需要实名",
"type": "boolean"
},
"first_withdraw_amount_limit": {
"description": "第一次提现金额限制",
"type": "string"
},
"is_bind_alipay": {
"description": "是否绑定阿里账户",
"type": "boolean"
@@ -5191,6 +5197,10 @@
"description": "是否能提现",
"type": "boolean"
},
"is_first": {
"description": "是否第一次提现",
"type": "boolean"
},
"is_need_real_name": {
"description": "是否需要实名",
"type": "boolean"


+ 10
- 2
docs/swagger.yaml View File

@@ -754,6 +754,12 @@ definitions:
type: object
md.GetWithdrawConditionResp:
properties:
first_need_real_name:
description: 第一次提现是否需要实名
type: boolean
first_withdraw_amount_limit:
description: 第一次提现金额限制
type: string
is_bind_alipay:
description: 是否绑定阿里账户
type: boolean
@@ -763,6 +769,9 @@ definitions:
is_can_withdraw:
description: 是否能提现
type: boolean
is_first:
description: 是否第一次提现
type: boolean
is_need_real_name:
description: 是否需要实名
type: boolean
@@ -3920,8 +3929,7 @@ paths:
in: body
name: req
required: true
schema:
type: object
schema: {}
produces:
- application/json
responses:


+ 44
- 6
etc/cfg.yml View File

@@ -9,22 +9,60 @@ srv_addr: ':4000'
redis_addr: '127.0.0.1:6379'
redis_password: ''


#db:
# host: '119.23.182.117:3306'
# name: 'egg'
# user: 'root'
# psw: 'Fnuo123com@'
# show_log: true
# max_lifetime: 30
# max_open_conns: 100
# max_idle_conns: 100
# path: 'tmp/%s.log'
db:
host: '119.23.182.117:3306'
host: 'advertisement-db.rwlb.rds.aliyuncs.com:3306'
name: 'egg'
user: 'root'
psw: 'Fnuo123com@'
user: 'canal'
psw: 'DengBiao@1997'
show_log: true
max_lifetime: 30
max_open_conns: 100
max_idle_conns: 100
path: 'tmp/%s.log'

#db_back:
# host: '119.23.182.117:3306'
# name: 'egg-data-back-up'
# user: 'root'
# psw: 'Fnuo123com@'
# show_log: true
# path: 'tmp/%s.log'

db_back:
host: 'advertisement-db.rwlb.rds.aliyuncs.com:3306'
name: 'egg-data-back-up'
user: 'canal'
psw: 'DengBiao@1997'
show_log: true
path: 'tmp/%s.log'

#im_db:
# host: '119.23.182.117:3306'
# name: 'egg-im'
# user: 'root'
# psw: 'Fnuo123com@'
# show_log: true
# max_lifetime: 30
# max_open_conns: 100
# max_idle_conns: 100
# path: 'tmp/%s.log'

im_db:
host: '119.23.182.117:3306'
host: 'advertisement-db.rwlb.rds.aliyuncs.com:3306'
name: 'egg-im'
user: 'root'
psw: 'Fnuo123com@'
user: 'canal'
psw: 'DengBiao@1997'
show_log: true
max_lifetime: 30
max_open_conns: 100


+ 2
- 3
go.mod View File

@@ -15,7 +15,7 @@ require (
github.com/go-playground/universal-translator v0.18.1
github.com/go-playground/validator/v10 v10.20.0
github.com/go-redis/redis v6.15.9+incompatible
github.com/gomodule/redigo v2.0.0+incompatible
github.com/gomodule/redigo v1.9.2
github.com/jinzhu/copier v0.4.0
github.com/makiuchi-d/gozxing v0.0.0-20210324052758-57132e828831
github.com/qiniu/api.v7/v7 v7.8.2
@@ -33,11 +33,10 @@ require (

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241214095356-fdac2df9537f
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241214095427-b3f9e6ed2446
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241215151712-d253a63d8ae1
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/gin-contrib/sessions v1.0.1
github.com/go-pay/crypto v0.0.1
github.com/go-pay/gopay v1.5.101
github.com/go-pay/xlog v0.0.2


Loading…
Cancel
Save