|
@@ -93,66 +93,32 @@ func AddPeriod(eg *xorm.Engine, sess *xorm.Session, req map[string]string) int { |
|
|
return 2 |
|
|
return 2 |
|
|
} |
|
|
} |
|
|
date := GetCycle(eg) |
|
|
date := GetCycle(eg) |
|
|
if base.ReturnType == 1 { //手动的 |
|
|
|
|
|
var data models.ServiceAwardReturnFlow |
|
|
|
|
|
get, _ := sess.Where("coin_id=? and type=? and pvd=? and uid=?", req["coin_id"], 1, req["pvd"], req["uid"]).Get(&data) |
|
|
|
|
|
if get == false { |
|
|
|
|
|
data = models.ServiceAwardReturnFlow{ |
|
|
|
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
|
|
|
Time: time.Now(), |
|
|
|
|
|
UpdateTime: time.Now(), |
|
|
|
|
|
Type: 1, |
|
|
|
|
|
Pvd: zhios_order_relate_utils.StrToInt(req["pvd"]), |
|
|
|
|
|
CoinId: base.CoinId, |
|
|
|
|
|
Date: zhios_order_relate_utils.StrToInt(date["now"]), |
|
|
|
|
|
LastDate: zhios_order_relate_utils.StrToInt(date["last"]), |
|
|
|
|
|
} |
|
|
|
|
|
insert, err := sess.Insert(&data) |
|
|
|
|
|
if insert == 0 || err != nil { |
|
|
|
|
|
return 3 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
data.Price = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(data.Price) + zhios_order_relate_utils.StrToFloat64(req["price"])) |
|
|
|
|
|
data.Sum = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(data.Sum) + zhios_order_relate_utils.StrToFloat64(req["amount"])) |
|
|
|
|
|
data.UpdateTime = time.Now() |
|
|
|
|
|
update, err := sess.Where("id=?", data.Id).Cols("sum,update_time").Update(&data) |
|
|
|
|
|
if update == 0 || err != nil { |
|
|
|
|
|
return 3 |
|
|
|
|
|
} |
|
|
|
|
|
data1 := models.ServiceAwardReturnFlowHand{ |
|
|
|
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
|
|
|
Time: time.Now(), |
|
|
|
|
|
UpdateTime: time.Now(), |
|
|
|
|
|
Sum: req["amount"], |
|
|
|
|
|
Type: 1, |
|
|
|
|
|
HasReturnMoney: "0", |
|
|
|
|
|
Price: req["price"], |
|
|
|
|
|
Pvd: zhios_order_relate_utils.StrToInt(req["pvd"]), |
|
|
|
|
|
CoinId: base.CoinId, |
|
|
|
|
|
Date: zhios_order_relate_utils.StrToInt(date["now"]), |
|
|
|
|
|
LastDate: zhios_order_relate_utils.StrToInt(date["last"]), |
|
|
|
|
|
Oid: zhios_order_relate_utils.StrToInt64(req["oid"]), |
|
|
|
|
|
} |
|
|
|
|
|
update, err = sess.Insert(&data1) |
|
|
|
|
|
if update == 0 || err != nil { |
|
|
|
|
|
return 3 |
|
|
|
|
|
} |
|
|
|
|
|
return 1 |
|
|
|
|
|
} |
|
|
|
|
|
period := 0 |
|
|
period := 0 |
|
|
switch req["pvd"] { |
|
|
switch req["pvd"] { |
|
|
case "0": |
|
|
case "0": |
|
|
period = base.CpsPeriod |
|
|
period = base.CpsPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandCpsPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
case "1": |
|
|
case "1": |
|
|
period = base.MallPeriod |
|
|
period = base.MallPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandMallPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
case "2": |
|
|
case "2": |
|
|
period = base.MemberUplvPeriod |
|
|
period = base.MemberUplvPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandMemberUplvPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
case "3": |
|
|
case "3": |
|
|
req["price"] = "0" |
|
|
req["price"] = "0" |
|
|
period = base.NewMemberPeriod |
|
|
period = base.NewMemberPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandNewMemberPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
|
if period == 0 { |
|
|
if period == 0 { |
|
@@ -163,6 +129,7 @@ func AddPeriod(eg *xorm.Engine, sess *xorm.Session, req map[string]string) int { |
|
|
Time: time.Now(), |
|
|
Time: time.Now(), |
|
|
UpdateTime: time.Now(), |
|
|
UpdateTime: time.Now(), |
|
|
Sum: req["amount"], |
|
|
Sum: req["amount"], |
|
|
|
|
|
Type: base.ReturnType, |
|
|
HasReturnMoney: "0", |
|
|
HasReturnMoney: "0", |
|
|
Period: period, |
|
|
Period: period, |
|
|
Price: req["price"], |
|
|
Price: req["price"], |
|
@@ -189,64 +156,32 @@ func AddPeriodEg(eg *xorm.Engine, req map[string]string) int { |
|
|
return 2 |
|
|
return 2 |
|
|
} |
|
|
} |
|
|
date := GetCycle(eg) |
|
|
date := GetCycle(eg) |
|
|
|
|
|
|
|
|
if base.ReturnType == 1 { //手动的 |
|
|
|
|
|
var data models.ServiceAwardReturnFlow |
|
|
|
|
|
get, _ := eg.Where("coin_id=? and type=? and pvd=? and uid=?", req["coin_id"], 1, req["pvd"], req["uid"]).Get(&data) |
|
|
|
|
|
if get == false { |
|
|
|
|
|
data = models.ServiceAwardReturnFlow{ |
|
|
|
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
|
|
|
Time: time.Now(), |
|
|
|
|
|
UpdateTime: time.Now(), |
|
|
|
|
|
Type: 1, |
|
|
|
|
|
Pvd: zhios_order_relate_utils.StrToInt(req["pvd"]), |
|
|
|
|
|
CoinId: base.CoinId, |
|
|
|
|
|
Date: zhios_order_relate_utils.StrToInt(date["now"]), |
|
|
|
|
|
LastDate: zhios_order_relate_utils.StrToInt(date["last"]), |
|
|
|
|
|
} |
|
|
|
|
|
insert, err := eg.Insert(&data) |
|
|
|
|
|
if insert == 0 || err != nil { |
|
|
|
|
|
return 3 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
data.Price = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(data.Price) + zhios_order_relate_utils.StrToFloat64(req["price"])) |
|
|
|
|
|
data.Sum = zhios_order_relate_utils.Float64ToStr(zhios_order_relate_utils.StrToFloat64(data.Sum) + zhios_order_relate_utils.StrToFloat64(req["amount"])) |
|
|
|
|
|
data.UpdateTime = time.Now() |
|
|
|
|
|
update, err := eg.Where("id=?", data.Id).Cols("sum,update_time").Update(&data) |
|
|
|
|
|
if update == 0 || err != nil { |
|
|
|
|
|
return 3 |
|
|
|
|
|
} |
|
|
|
|
|
data1 := models.ServiceAwardReturnFlowHand{ |
|
|
|
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
|
|
|
Time: time.Now(), |
|
|
|
|
|
UpdateTime: time.Now(), |
|
|
|
|
|
Sum: req["amount"], |
|
|
|
|
|
Type: 1, |
|
|
|
|
|
HasReturnMoney: "0", |
|
|
|
|
|
Price: req["price"], |
|
|
|
|
|
Pvd: zhios_order_relate_utils.StrToInt(req["pvd"]), |
|
|
|
|
|
CoinId: base.CoinId, |
|
|
|
|
|
Date: zhios_order_relate_utils.StrToInt(date["now"]), |
|
|
|
|
|
LastDate: zhios_order_relate_utils.StrToInt(date["last"]), |
|
|
|
|
|
Oid: zhios_order_relate_utils.StrToInt64(req["oid"]), |
|
|
|
|
|
} |
|
|
|
|
|
eg.Insert(&data1) |
|
|
|
|
|
return 1 |
|
|
|
|
|
} |
|
|
|
|
|
period := 0 |
|
|
period := 0 |
|
|
switch req["pvd"] { |
|
|
switch req["pvd"] { |
|
|
case "0": |
|
|
case "0": |
|
|
period = base.CpsPeriod |
|
|
period = base.CpsPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandCpsPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
case "1": |
|
|
case "1": |
|
|
period = base.MallPeriod |
|
|
period = base.MallPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandMallPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
case "2": |
|
|
case "2": |
|
|
period = base.MemberUplvPeriod |
|
|
period = base.MemberUplvPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandMemberUplvPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
case "3": |
|
|
case "3": |
|
|
req["price"] = "0" |
|
|
req["price"] = "0" |
|
|
period = base.NewMemberPeriod |
|
|
period = base.NewMemberPeriod |
|
|
|
|
|
if base.ReturnType == 1 { |
|
|
|
|
|
period = base.HandNewMemberPeriod |
|
|
|
|
|
} |
|
|
break |
|
|
break |
|
|
} |
|
|
} |
|
|
if period == 0 { |
|
|
if period == 0 { |
|
@@ -257,6 +192,7 @@ func AddPeriodEg(eg *xorm.Engine, req map[string]string) int { |
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
Uid: zhios_order_relate_utils.StrToInt(req["uid"]), |
|
|
Time: time.Now(), |
|
|
Time: time.Now(), |
|
|
UpdateTime: time.Now(), |
|
|
UpdateTime: time.Now(), |
|
|
|
|
|
Type: base.ReturnType, |
|
|
Sum: req["amount"], |
|
|
Sum: req["amount"], |
|
|
HasReturnMoney: "0", |
|
|
HasReturnMoney: "0", |
|
|
Price: req["price"], |
|
|
Price: req["price"], |
|
|