增加提现记录
This commit is contained in:
10
.idea/UniappTool.xml
generated
Normal file
10
.idea/UniappTool.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
|
||||||
|
<option name="generalBasePath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
|
||||||
|
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
|
||||||
|
<option name="scanNum" value="1" />
|
||||||
|
<option name="type" value="store" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
61
data/cash_out.go
Normal file
61
data/cash_out.go
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
package data
|
||||||
|
|
||||||
|
type (
|
||||||
|
CashOut struct {
|
||||||
|
ID uint64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement;comment:申请提现id" json:"id"`
|
||||||
|
CreateAt string `gorm:"column:create_at;type:varchar(191);comment:申请时间" json:"create_at"`
|
||||||
|
IsOut int `gorm:"column:is_out;type:bit(1);comment:是否转账" json:"is_out"`
|
||||||
|
Money string `gorm:"column:money;type:varchar(191);comment:提现金额" json:"money"`
|
||||||
|
OutAt string `gorm:"column:out_at;type:varchar(191);comment:转账时间" json:"out_at"`
|
||||||
|
RelationID string `gorm:"column:relation_id;type:varchar(191);comment:会员编号" json:"relation_id"`
|
||||||
|
UserID int64 `gorm:"column:user_id;type:bigint;comment:用户id" json:"user_id"`
|
||||||
|
Zhifubao string `gorm:"column:zhifubao;type:varchar(191);comment:支付宝账号" json:"zhifubao"`
|
||||||
|
ZhifubaoName string `gorm:"column:zhifubao_name;type:varchar(64);comment:支付宝姓名" json:"zhifubao_name"`
|
||||||
|
BankName string `gorm:"column:bank_name;type:varchar(64);comment:银行名称" json:"bank_name"`
|
||||||
|
Province string `gorm:"column:province;type:varchar(64);comment:省" json:"province"`
|
||||||
|
City string `gorm:"column:city;type:varchar(64);comment:市" json:"city"`
|
||||||
|
BankBranch string `gorm:"column:bank_branch;type:varchar(64);comment:开户行" json:"bank_branch"`
|
||||||
|
OrderNumber string `gorm:"column:order_number;type:varchar(191);comment:订单编号" json:"order_number"`
|
||||||
|
State int `gorm:"column:state;type:int;comment:状态 0待转账 1成功 -1退款 3待复审 4 定时任务发起提现" json:"state"`
|
||||||
|
Refund string `gorm:"column:refund;type:varchar(1000);comment:原因" json:"refund"`
|
||||||
|
Rate float64 `gorm:"column:rate;type:decimal(10,2);comment:手续费" json:"rate"`
|
||||||
|
SysUserID int64 `gorm:"column:sys_user_id;type:bigint;comment:代理用户id" json:"sys_user_id"`
|
||||||
|
UserType int `gorm:"column:user_type;type:int;comment:提现类型 1用户提现 2代理提现" json:"user_type"`
|
||||||
|
WithdrawType int `gorm:"column:withdraw_type;type:tinyint;default:0;comment:0红包提现 1手动体现" json:"withdraw_type"`
|
||||||
|
Pass int `gorm:"column:pass;type:tinyint(1);comment:提现通道 1原版 2撕耀 3通荷" json:"pass"`
|
||||||
|
UpdateTime string `gorm:"column:update_time;type:datetime;autoUpdateTime;comment:更新时间" json:"update_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
CashOutCopy1 struct {
|
||||||
|
ID uint64 `gorm:"column:id;type:bigint;primaryKey;autoIncrement;comment:申请提现id" json:"id"`
|
||||||
|
CreateAt string `gorm:"column:create_at;type:varchar(191);comment:申请时间" json:"create_at"`
|
||||||
|
IsOut int `gorm:"column:is_out;type:bit(1);comment:是否转账" json:"is_out"`
|
||||||
|
Money string `gorm:"column:money;type:varchar(191);comment:提现金额" json:"money"`
|
||||||
|
OutAt string `gorm:"column:out_at;type:varchar(191);comment:转账时间" json:"out_at"`
|
||||||
|
RelationID string `gorm:"column:relation_id;type:varchar(191);comment:会员编号" json:"relation_id"`
|
||||||
|
UserID int64 `gorm:"column:user_id;type:bigint;comment:用户id" json:"user_id"`
|
||||||
|
Zhifubao string `gorm:"column:zhifubao;type:varchar(191);comment:支付宝账号" json:"zhifubao"`
|
||||||
|
ZhifubaoName string `gorm:"column:zhifubao_name;type:varchar(64);comment:支付宝姓名" json:"zhifubao_name"`
|
||||||
|
BankName string `gorm:"column:bank_name;type:varchar(64);comment:银行名称" json:"bank_name"`
|
||||||
|
Province string `gorm:"column:province;type:varchar(64);comment:省" json:"province"`
|
||||||
|
City string `gorm:"column:city;type:varchar(64);comment:市" json:"city"`
|
||||||
|
BankBranch string `gorm:"column:bank_branch;type:varchar(64);comment:开户行" json:"bank_branch"`
|
||||||
|
OrderNumber string `gorm:"column:order_number;type:varchar(191);comment:订单编号" json:"order_number"`
|
||||||
|
State int `gorm:"column:state;type:int;comment:状态 0待转账 1成功 -1退款 3待复审 4 定时任务发起提现" json:"state"`
|
||||||
|
Refund string `gorm:"column:refund;type:varchar(1000);comment:原因" json:"refund"`
|
||||||
|
Rate float64 `gorm:"column:rate;type:decimal(10,2);comment:手续费" json:"rate"`
|
||||||
|
SysUserID int64 `gorm:"column:sys_user_id;type:bigint;comment:代理用户id" json:"sys_user_id"`
|
||||||
|
UserType int `gorm:"column:user_type;type:int;comment:提现类型 1用户提现 2代理提现" json:"user_type"`
|
||||||
|
WithdrawType int `gorm:"column:withdraw_type;type:tinyint;default:0;comment:0红包提现 1手动体现" json:"withdraw_type"`
|
||||||
|
Pass int `gorm:"column:pass;type:tinyint(1);comment:提现通道 1原版 2撕耀 3通荷" json:"pass"`
|
||||||
|
UpdateTime string `gorm:"column:update_time;type:datetime;autoUpdateTime;comment:更新时间" json:"update_time"`
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
func (CashOut) TableName() string {
|
||||||
|
return "cash_out"
|
||||||
|
}
|
||||||
|
|
||||||
|
func (CashOutCopy1) TableName() string {
|
||||||
|
return "cash_out_copy1"
|
||||||
|
}
|
||||||
@@ -23,6 +23,9 @@ type (
|
|||||||
TwoMoney float64 `json:"two_money" gorm:"column:two_money"`
|
TwoMoney float64 `json:"two_money" gorm:"column:two_money"`
|
||||||
TwoUserId int64 `json:"two_user_id" gorm:"column:two_user_id"`
|
TwoUserId int64 `json:"two_user_id" gorm:"column:two_user_id"`
|
||||||
PayTime string `json:"pay_time" gorm:"column:pay_time"`
|
PayTime string `json:"pay_time" gorm:"column:pay_time"`
|
||||||
|
IsValid int `json:"is_valid" gorm:"column:is_valid"`
|
||||||
|
AlipayUid string `json:"alipay_uid" gorm:"column:alipay_uid"`
|
||||||
|
AlipayPayCount string `json:"alipay_pay_count" gorm:"column:alipay_pay_count"`
|
||||||
PayDiamond float64 `json:"pay_diamond" gorm:"column:pay_diamond"`
|
PayDiamond float64 `json:"pay_diamond" gorm:"column:pay_diamond"`
|
||||||
Diamond int32 `json:"diamond" gorm:"column:diamond"`
|
Diamond int32 `json:"diamond" gorm:"column:diamond"`
|
||||||
}
|
}
|
||||||
@@ -49,6 +52,9 @@ type (
|
|||||||
TwoMoney float64 `json:"two_money" gorm:"column:two_money"`
|
TwoMoney float64 `json:"two_money" gorm:"column:two_money"`
|
||||||
TwoUserId int64 `json:"two_user_id" gorm:"column:two_user_id"`
|
TwoUserId int64 `json:"two_user_id" gorm:"column:two_user_id"`
|
||||||
PayTime string `json:"pay_time" gorm:"column:pay_time"`
|
PayTime string `json:"pay_time" gorm:"column:pay_time"`
|
||||||
|
IsValid int `json:"is_valid" gorm:"column:is_valid"`
|
||||||
|
AlipayUid string `json:"alipay_uid" gorm:"column:alipay_uid"`
|
||||||
|
AlipayPayCount string `json:"alipay_pay_count" gorm:"column:alipay_pay_count"`
|
||||||
PayDiamond float64 `json:"pay_diamond" gorm:"column:pay_diamond"`
|
PayDiamond float64 `json:"pay_diamond" gorm:"column:pay_diamond"`
|
||||||
Diamond int32 `json:"diamond" gorm:"column:diamond"`
|
Diamond int32 `json:"diamond" gorm:"column:diamond"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,6 +279,49 @@ func _execDiscSpinningRecord(db *gorm.DB, timeNow string, index int, totalCount
|
|||||||
_execDiscSpinningRecord(db, timeNow, index+1, totalCount)
|
_execDiscSpinningRecord(db, timeNow, index+1, totalCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func copyCashOut(db *gorm.DB, timeNow time.Time) {
|
||||||
|
record := &data.CashOut{}
|
||||||
|
start := timeNow.Format("2006-01-02 15:04:05")
|
||||||
|
first := db.Model(record).Where("create_at < ?", start).Order("create_at asc").First(record)
|
||||||
|
if first.RowsAffected == 0 {
|
||||||
|
fmt.Println("no cash_out data")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteTime := record.CreateAt
|
||||||
|
|
||||||
|
db.Debug().Where("create_at >= ?", deleteTime).Delete(&data.CashOutCopy1{})
|
||||||
|
|
||||||
|
var totalCount int64 = 0
|
||||||
|
db.Debug().Model(&data.CashOut{}).Where("create_at >= ?", deleteTime).Count(&totalCount)
|
||||||
|
|
||||||
|
_execCashOut(db, start, 0, totalCount)
|
||||||
|
|
||||||
|
db.Debug().Where("create_at < ?", start).Delete(&data.CashOut{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func _execCashOut(db *gorm.DB, timeNow string, index int, totalCount int64) {
|
||||||
|
var records []*data.CashOut
|
||||||
|
db.Debug().Where("create_at < ?", timeNow).Limit(1000).Offset(index * 1000).Find(&records)
|
||||||
|
fmt.Printf("index: %d, timeNow: %s ,cash_out count: %d, totalCount: %d\n", index, timeNow, len(records), totalCount)
|
||||||
|
if len(records) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var copyList []*data.CashOutCopy1
|
||||||
|
for _, record := range records {
|
||||||
|
recordCopy := &data.CashOutCopy1{}
|
||||||
|
CopyStruct(record, recordCopy)
|
||||||
|
copyList = append(copyList, recordCopy)
|
||||||
|
}
|
||||||
|
|
||||||
|
db.Create(©List)
|
||||||
|
|
||||||
|
//time.Sleep(1500 * time.Millisecond)
|
||||||
|
|
||||||
|
_execCashOut(db, timeNow, index+1, totalCount)
|
||||||
|
}
|
||||||
|
|
||||||
// CopyStruct 使用反射复制结构体
|
// CopyStruct 使用反射复制结构体
|
||||||
func CopyStruct(src, dst interface{}) {
|
func CopyStruct(src, dst interface{}) {
|
||||||
_ = copier.Copy(dst, src)
|
_ = copier.Copy(dst, src)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ func CopyData() {
|
|||||||
panic("dbList is nil")
|
panic("dbList is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
timeNow := time.Now().Add(-4 * 24 * time.Hour)
|
timeNow := time.Now().Add(-5 * 24 * time.Hour)
|
||||||
format := timeNow.Format("2006-01-02")
|
format := timeNow.Format("2006-01-02")
|
||||||
parse, _ := time.Parse("2006-01-02", format)
|
parse, _ := time.Parse("2006-01-02", format)
|
||||||
|
|
||||||
@@ -37,12 +37,14 @@ func CopyData() {
|
|||||||
time.Sleep(time.Second * 2)
|
time.Sleep(time.Second * 2)
|
||||||
copyUserMoneyDetails(db, parse)
|
copyUserMoneyDetails(db, parse)
|
||||||
time.Sleep(time.Second * 2)
|
time.Sleep(time.Second * 2)
|
||||||
copyCourseCollect(db, parse)
|
//copyCourseCollect(db, parse)
|
||||||
time.Sleep(time.Second * 2)
|
//time.Sleep(time.Second * 2)
|
||||||
copyCourseUser(db, parse)
|
//copyCourseUser(db, parse)
|
||||||
time.Sleep(time.Second * 2)
|
//time.Sleep(time.Second * 2)
|
||||||
copyDiscSpinningRecord(db, parse)
|
copyDiscSpinningRecord(db, parse)
|
||||||
time.Sleep(time.Second * 2)
|
time.Sleep(time.Second * 2)
|
||||||
|
copyCashOut(db, parse)
|
||||||
|
time.Sleep(time.Second * 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,17 +13,17 @@ dev:
|
|||||||
- duanju-4
|
- duanju-4
|
||||||
|
|
||||||
prod:
|
prod:
|
||||||
host: rm-2vc4acq5369l0y612mo.mysql.cn-chengdu.rds.aliyuncs.com
|
# host: rm-2vctx3yb1t2qv54el.mysql.cn-chengdu.rds.aliyuncs.com
|
||||||
# host: rm-2vc4acq5369l0y612.mysql.cn-chengdu.rds.aliyuncs.com
|
host: rm-2vctx3yb1t2qv54elto.mysql.cn-chengdu.rds.aliyuncs.com
|
||||||
name: video_user
|
name: manghe
|
||||||
password: VideoUser@1
|
password: Manghe163@
|
||||||
port: 3306
|
port: 3306
|
||||||
dbs:
|
dbs:
|
||||||
- duanju-0
|
- blindbox-0
|
||||||
- duanju-1
|
- blindbox-1
|
||||||
- duanju-2
|
- blindbox-2
|
||||||
- duanju-3
|
- blindbox-3
|
||||||
- duanju-4
|
- blindbox-4
|
||||||
|
|
||||||
|
|
||||||
#prod:
|
#prod:
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user