|
|
@@ -93,66 +93,32 @@ func AddPeriod(eg *xorm.Engine, sess *xorm.Session, req map[string]string) int { |
|
|
|
return 2 |
|
|
|
} |
|
|
|
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 |
|
|
|
switch req["pvd"] { |
|
|
|
case "0": |
|
|
|
period = base.CpsPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandCpsPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
case "1": |
|
|
|
period = base.MallPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandMallPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
case "2": |
|
|
|
period = base.MemberUplvPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandMemberUplvPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
case "3": |
|
|
|
req["price"] = "0" |
|
|
|
period = base.NewMemberPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandNewMemberPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
} |
|
|
|
if period == 0 { |
|
|
@@ -163,6 +129,7 @@ func AddPeriod(eg *xorm.Engine, sess *xorm.Session, req map[string]string) int { |
|
|
|
Time: time.Now(), |
|
|
|
UpdateTime: time.Now(), |
|
|
|
Sum: req["amount"], |
|
|
|
Type: base.ReturnType, |
|
|
|
HasReturnMoney: "0", |
|
|
|
Period: period, |
|
|
|
Price: req["price"], |
|
|
@@ -189,64 +156,32 @@ func AddPeriodEg(eg *xorm.Engine, req map[string]string) int { |
|
|
|
return 2 |
|
|
|
} |
|
|
|
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 |
|
|
|
switch req["pvd"] { |
|
|
|
case "0": |
|
|
|
period = base.CpsPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandCpsPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
case "1": |
|
|
|
period = base.MallPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandMallPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
case "2": |
|
|
|
period = base.MemberUplvPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandMemberUplvPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
case "3": |
|
|
|
req["price"] = "0" |
|
|
|
period = base.NewMemberPeriod |
|
|
|
if base.ReturnType == 1 { |
|
|
|
period = base.HandNewMemberPeriod |
|
|
|
} |
|
|
|
break |
|
|
|
} |
|
|
|
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"]), |
|
|
|
Time: time.Now(), |
|
|
|
UpdateTime: time.Now(), |
|
|
|
Type: base.ReturnType, |
|
|
|
Sum: req["amount"], |
|
|
|
HasReturnMoney: "0", |
|
|
|
Price: req["price"], |
|
|
|