Merge branch 'test' of git.oa00.com:recook/backend_v2 into test

master
kanade 3 years ago
commit 488a29a573

@ -1,6 +1,7 @@
package withdrawals
import (
"github.com/shopspring/decimal"
"path/filepath"
"recook/internal/back"
"recook/internal/dbc"
@ -59,11 +60,12 @@ func QueryIncomplete(c *gin.Context) {
var array []user.Withdraw
dbc.DB.Limit(10).Offset(p.Page*10).Order("created_at desc").Find(&array, where, p.MinMoney, p.MaxMoney, p.ID, p.Name)
type moneyType struct {
Monet float32 `gorm:"column:all_amount"`
Monet float32 `gorm:"column:all_amount"`
ActualAmountCount decimal.Decimal `gorm:"column:actual_amount_count"`
}
var moneyAll []moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
var moneyAll moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount, sum(actual_amount) as actual_amount_count").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
for key, _info := range array {
information := user.Information{}
@ -72,14 +74,11 @@ func QueryIncomplete(c *gin.Context) {
array[key].UserTrueNo = information.IDCard
array[key].UserPhone = information.Mobile
}
money := float32(0.0)
if len(moneyAll) > 0 {
money = moneyAll[0].Monet
}
back.Suc(c, "", gin.H{
"total": count,
"list": array,
"money": money,
"total": count,
"list": array,
"money": moneyAll.Monet,
"actualAmountCount": moneyAll.ActualAmountCount,
})
}
@ -194,11 +193,12 @@ func QueryWaitcomplete(c *gin.Context) {
var array []user.Withdraw
dbc.DB.Limit(10).Offset(p.Page*10).Order("created_at desc").Find(&array, where, p.MinMoney, p.MaxMoney, p.ID, p.Name)
type moneyType struct {
Monet float32 `gorm:"column:all_amount"`
Monet float32 `gorm:"column:all_amount"`
ActualAmountCount decimal.Decimal `gorm:"column:actual_amount_count"`
}
var moneyAll []moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
var moneyAll moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount, sum(actual_amount) as actual_amount_count").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
for key, _info := range array {
information := user.Information{}
@ -207,14 +207,12 @@ func QueryWaitcomplete(c *gin.Context) {
array[key].UserTrueNo = information.IDCard
array[key].UserPhone = information.Mobile
}
money := float32(0.0)
if len(moneyAll) > 0 {
money = moneyAll[0].Monet
}
back.Suc(c, "", gin.H{
"total": count,
"list": array,
"money": money,
"total": count,
"list": array,
"money": moneyAll.Monet,
"actualAmountCount": moneyAll.ActualAmountCount,
})
}
@ -250,11 +248,12 @@ func QueryFail(c *gin.Context) {
var array []user.Withdraw
dbc.DB.Limit(10).Offset(p.Page*10).Order("created_at desc").Find(&array, where, p.MinMoney, p.MaxMoney, p.ID, p.Name)
type moneyType struct {
Monet float32 `gorm:"column:all_amount"`
Monet float32 `gorm:"column:all_amount"`
ActualAmountCount decimal.Decimal `gorm:"column:actual_amount_count"`
}
var moneyAll []moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
var moneyAll moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount, sum(actual_amount) as actual_amount_count").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
for key, _info := range array {
information := user.Information{}
@ -263,14 +262,11 @@ func QueryFail(c *gin.Context) {
array[key].UserTrueNo = information.IDCard
array[key].UserPhone = information.Mobile
}
money := float32(0.0)
if len(moneyAll) > 0 {
money = moneyAll[0].Monet
}
back.Suc(c, "", gin.H{
"total": count,
"list": array,
"money": money,
"total": count,
"list": array,
"money": moneyAll.Monet,
"actualAmountCount": moneyAll.ActualAmountCount,
})
}
@ -309,11 +305,12 @@ func QueryComplete(c *gin.Context) {
dbc.DB.Limit(10).Offset(p.Page*10).Order("created_at desc").Find(&array, where, p.MinMoney, p.MaxMoney, p.ID, p.Name)
type moneyType struct {
Monet float32 `gorm:"column:all_amount"`
Monet float32 `gorm:"column:all_amount"`
ActualAmountCount decimal.Decimal `gorm:"column:actual_amount_count"`
}
var moneyAll []moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
var moneyAll moneyType
dbc.DB.Table((&user.Withdraw{}).TableName()).Select("sum(amount) as all_amount, sum(actual_amount) as actual_amount_count").Where(where, p.MinMoney, p.MaxMoney, p.ID, p.Name).Scan(&moneyAll)
for key, _info := range array {
information := user.Information{}
@ -322,13 +319,10 @@ func QueryComplete(c *gin.Context) {
array[key].UserTrueNo = information.IDCard
array[key].UserPhone = information.Mobile
}
money := float32(0.0)
if len(moneyAll) > 0 {
money = moneyAll[0].Monet
}
back.Suc(c, "", gin.H{
"total": count,
"list": array,
"money": money,
"total": count,
"list": array,
"money": moneyAll.Monet,
"actualAmountCount": moneyAll.ActualAmountCount,
})
}

@ -46,7 +46,7 @@ func (*Personal) Add(c *gin.Context) {
information.Nickname = args.Nickname
information.Level = 10
registerUser.UserAdd(c, &user.Login{}, &information, args.Phone)
aliyun.Sms.SendMessage("18857392027", aliyun.SUCCESS, map[string]string{})
aliyun.Sms.SendMessage(args.Phone, aliyun.SUCCESS, map[string]string{})
back.Suc(c, "操作成功", nil)
}

@ -19,7 +19,7 @@ func (*copartnerLogic) Very(inviteNo string) error {
return errors.New("邀请码不存在")
}
if topCode.EndTime.Before(time.Now()) {
return errors.New("邀请码过期")
return errors.New("邀请码已失效")
}
return nil
}

Loading…
Cancel
Save