|
|
@@ -8,6 +8,7 @@ import ( |
|
|
|
"applet/app/utils" |
|
|
|
"github.com/gin-gonic/gin" |
|
|
|
"strings" |
|
|
|
"time" |
|
|
|
) |
|
|
|
|
|
|
|
func StoreWithdrawFlow(c *gin.Context) { |
|
|
@@ -68,9 +69,10 @@ func StoreWithdrawTotal(c *gin.Context) { |
|
|
|
var allAmount float64 = 0 |
|
|
|
var waitAmount float64 = 0 |
|
|
|
var failAmount float64 = 0 |
|
|
|
allAmount, _ = svc.MasterDb(c).Where("parent_uid=?", user.Info.Uid).And("state=?", 1).Sum(&model.CommunityTeamStoreWithdrawApply{}, "amount") |
|
|
|
waitAmount, _ = svc.MasterDb(c).Where("parent_uid=?", user.Info.Uid).And("state=?", 0).Sum(&model.CommunityTeamStoreWithdrawApply{}, "amount") |
|
|
|
failAmount, _ = svc.MasterDb(c).Where("parent_uid=?", user.Info.Uid).And("state=?", 3).Sum(&model.CommunityTeamStoreWithdrawApply{}, "amount") |
|
|
|
req["agent_uid"] = utils.IntToStr(user.Info.Uid) |
|
|
|
allAmount, _ = db.CommWhere(svc.MasterDb(c), req).And("state=?", 1).Sum(&model.CommunityTeamStoreWithdrawApply{}, "amount") |
|
|
|
waitAmount, _ = db.CommWhere(svc.MasterDb(c), req).And("state=?", 0).Sum(&model.CommunityTeamStoreWithdrawApply{}, "amount") |
|
|
|
failAmount, _ = db.CommWhere(svc.MasterDb(c), req).And("state=?", 3).Sum(&model.CommunityTeamStoreWithdrawApply{}, "amount") |
|
|
|
res := []map[string]string{ |
|
|
|
{"name": "累计提现金额(元):" + utils.Float64ToStr(allAmount), "tip": "统计提现成功的金额"}, |
|
|
|
{"name": "审核中金额(元):" + utils.Float64ToStr(waitAmount), "tip": "统计正在审核中的金额"}, |
|
|
@@ -109,7 +111,10 @@ func StoreWithdrawAudit(c *gin.Context) { |
|
|
|
} |
|
|
|
data.State = utils.StrToInt(req["state"]) |
|
|
|
data.Memo = req["memo"] |
|
|
|
update, err := sess.Where("id=?", data.Id).Cols("state,memo").Update(data) |
|
|
|
if data.State == 1 { |
|
|
|
data.PaymentDate = time.Now().Format("2006-01-02 15:04:05") |
|
|
|
} |
|
|
|
update, err := sess.Where("id=?", data.Id).Cols("state,payment_date,memo").Update(data) |
|
|
|
if update == 0 || err != nil { |
|
|
|
sess.Rollback() |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "审核失败")) |
|
|
@@ -125,12 +130,7 @@ func StoreWithdrawAuditAll(c *gin.Context) { |
|
|
|
e.OutErr(c, e.ERR_INVALID_ARGS, err) |
|
|
|
return |
|
|
|
} |
|
|
|
count, _ := svc.MasterDb(c).In("id", strings.Split(req["ids"], ",")).And("state>0").Count(&model.CommunityTeamStoreWithdrawApply{}) |
|
|
|
if count > 0 { |
|
|
|
e.OutErr(c, 400, e.NewErr(400, "存在已处理的记录")) |
|
|
|
return |
|
|
|
} |
|
|
|
svc.MasterDb(c).In("id", strings.Split(req["ids"], ",")).Cols("state").Update(&model.CommunityTeamStoreWithdrawApply{State: 1}) |
|
|
|
svc.MasterDb(c).In("id", strings.Split(req["ids"], ",")).And("state=0").Cols("state,payment_date").Update(&model.CommunityTeamStoreWithdrawApply{State: 1, PaymentDate: time.Now().Format("2006-01-02 15:04:05")}) |
|
|
|
e.OutSuc(c, "success", nil) |
|
|
|
return |
|
|
|
} |
|
|
|