瀏覽代碼

更新

master
huangjiajun 1 年之前
父節點
當前提交
1228423214
共有 3 個文件被更改,包括 72 次插入0 次删除
  1. +30
    -0
      db/model/fin_user_flow.go
  2. +23
    -0
      db/model/fin_withdraw_apply.go
  3. +19
    -0
      hdl/hdl_upgrade.go

+ 30
- 0
db/model/fin_user_flow.go 查看文件

@@ -0,0 +1,30 @@
package model

import (
"time"
)

type FinUserFlow struct {
Id int64 `json:"id" xorm:"pk autoincr comment('流水编号') BIGINT(20)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
Type int `json:"type" xorm:"not null default 0 comment('0收入,1支出') TINYINT(1)"`
Amount string `json:"amount" xorm:"not null default 0.0000 comment('变动金额') DECIMAL(11,4)"`
BeforeAmount string `json:"before_amount" xorm:"not null default 0.0000 comment('变动前金额') DECIMAL(11,4)"`
AfterAmount string `json:"after_amount" xorm:"not null default 0.0000 comment('变动后金额') DECIMAL(11,4)"`
SysFee string `json:"sys_fee" xorm:"not null default 0.0000 comment('手续费') DECIMAL(11,4)"`
PaymentType int `json:"payment_type" xorm:"not null default 1 comment('1支付宝,2微信.3手动转账') TINYINT(1)"`
OrdType string `json:"ord_type" xorm:"not null default '' comment('订单类型taobao,jd,pdd,vip,suning,kaola,own自营,withdraw提现') VARCHAR(20)"`
OrdId string `json:"ord_id" xorm:"not null default '' comment('对应订单编号') VARCHAR(50)"`
OrdTitle string `json:"ord_title" xorm:"not null default '' comment('订单标题') VARCHAR(50)"`
OrdAction int `json:"ord_action" xorm:"not null default 0 comment('10自购,11推广,12团队,20提现,21消费') TINYINT(2)"`
OrdTime int `json:"ord_time" xorm:"not null default 0 comment('下单时间or提现时间') INT(11)"`
OrdDetail string `json:"ord_detail" xorm:"not null default '' comment('记录商品ID或提现账号') VARCHAR(50)"`
ExpectedTime string `json:"expected_time" xorm:"not null default '0' comment('预期到账时间,字符串用于直接显示,结算后清除内容') VARCHAR(30)"`
State int `json:"state" xorm:"not null default 1 comment('1未到账,2已到账') TINYINT(1)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(2000)"`
OtherId int64 `json:"other_id" xorm:"not null default 0 comment('其他关联订单,具体根据订单类型判断') BIGINT(20)"`
AliOrdId string `json:"ali_ord_id" xorm:"default '' comment('支付宝订单号') VARCHAR(128)"`
CreateAt time.Time `json:"create_at" xorm:"created not null default CURRENT_TIMESTAMP comment('创建时间') TIMESTAMP"`
UpdateAt time.Time `json:"update_at" xorm:"updated not null default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
TransferData string `json:"transfer_data" xorm:" TEXT"`
}

+ 23
- 0
db/model/fin_withdraw_apply.go 查看文件

@@ -0,0 +1,23 @@
package model

import (
"time"
)

type FinWithdrawApply struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户ID') index INT(10)"`
AdmId int `json:"adm_id" xorm:"not null default 0 comment('审核人ID,0为系统自动') INT(10)"`
Amount string `json:"amount" xorm:"not null default 0.00 comment('提现金额') DECIMAL(10,2)"`
Memo string `json:"memo" xorm:"not null default '' comment('备注,失败请备注原因') VARCHAR(500)"`
Type int `json:"type" xorm:"not null default 1 comment('提现类型;1:手动;2:自动') TINYINT(1)"`
WithdrawAccount string `json:"withdraw_account" xorm:"not null default '' comment('提现账号') VARCHAR(64)"`
WithdrawName string `json:"withdraw_name" xorm:"not null default '' comment('提现人姓名') VARCHAR(12)"`
Reason int `json:"reason" xorm:"not null default 0 comment('审核失败(驳回理由);1:当前账号不满足提现规则;2:账号异常;3:资金异常') TINYINT(1)"`
CreateAt time.Time `json:"create_at" xorm:"not null default CURRENT_TIMESTAMP comment('申请时间') TIMESTAMP"`
UpdateAt time.Time `json:"update_at" xorm:"not null default CURRENT_TIMESTAMP comment('处理时间') TIMESTAMP"`
State int `json:"state" xorm:"not null default 0 comment('0申请中,1通过,2完成,3失败') TINYINT(1)"`
BankData string `json:"bank_data" xorm:"not null default '' comment('') VARCHAR(600)" `
Platform string `json:"platform" xorm:"not null default '' comment('') VARCHAR(255)" `
WithdrawMoney string `json:"withdraw_money" xorm:"not null default '' comment('') VARCHAR(255)" `
}

+ 19
- 0
hdl/hdl_upgrade.go 查看文件

@@ -335,6 +335,8 @@ func GetTaskName(id int) string {
return "团队N条线中各有N个相应等级用户"
case 18:
return "小区累计自营消费金额"
case 20:
return "累计收益(结算)"
default:
return "无效名称"
}
@@ -348,6 +350,23 @@ func GetFinishCount(blockStarChain string, engine *xorm.Engine, uid interface{},
hasPay := false
var payOrdId int64
switch task.TaskType {
case 20:
sum, _ := engine.Where("type=0 and uid=?", uid).Sum(&model.FinUserFlow{}, "amount")
mallSum, _ := engine.Where("uid=? AND type=? and ord_title=?", uid, 1, "订单退款").Sum(&model.FinUserFlow{}, "amount")
deSum2, _ := engine.Where("uid=? AND type=? and ord_type=?", uid, 0, "withdraw").Sum(&model.FinUserFlow{}, "amount")
deSum3, _ := engine.Where("uid=? AND type=? and ord_title like ?", uid, 1, "%扣除%").Sum(&model.FinUserFlow{}, "amount")
dsCheck, _ := db.SysCfgGetOne(engine, "ds_check")
money := sum - deSum2 - deSum3 + mallSum
if dsCheck != nil && dsCheck.Val == "1" {
withdrawingSuccess, _ := engine.Where("uid=? ", uid).In("state", []string{"1", "2"}).Sum(&model.FinWithdrawApply{}, "amount")
sql := `SELECT cast(SUM(LEFT(olr.amount,LENGTH(olr.amount)-2)) as decimal(50,4)) AS amount FROM ord_list_relate olr JOIN ord_list ol ON olr.oid = ol.ord_id WHERE olr.level=0 and olr.uid = " . $uid . " AND ol.state IN (0,1,2,3) and ol.is_transfer=1;`
nativeString, _ := db.QueryNativeString(engine, sql)
money = withdrawingSuccess
for _, v := range nativeString {
money += zhios_condition_statistics_utils.StrToFloat64(v["amount"])
}
}
return zhios_condition_statistics_utils.Float64ToStr(money), hasPay, payOrdId
case 1:
// 累计自购数
stime := time.Date(t.Year(), t.Month(), t.Day()-task.WithinDays, t.Hour(), 0, 0, 0, t.Location()).Unix()


Loading…
取消
儲存