|
@@ -95,6 +95,7 @@ func handleZhiosOrderTotalSecond(msg []byte) error { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
now := time.Unix(int64(ordData.CreateAt), 0).Format("200601") |
|
|
now := time.Unix(int64(ordData.CreateAt), 0).Format("200601") |
|
|
|
|
|
nowDay := time.Unix(int64(ordData.CreateAt), 0).Format("20060102") |
|
|
isTotal := ordData.IsTotal |
|
|
isTotal := ordData.IsTotal |
|
|
if ordData.OrderFormType >= 0 { |
|
|
if ordData.OrderFormType >= 0 { |
|
|
if ordData.IsTotal == 1 && ordData.State != 4 { |
|
|
if ordData.IsTotal == 1 && ordData.State != 4 { |
|
@@ -149,6 +150,41 @@ func handleZhiosOrderTotalSecond(msg []byte) error { |
|
|
sess.Rollback() |
|
|
sess.Rollback() |
|
|
return errors.New("失败") |
|
|
return errors.New("失败") |
|
|
} |
|
|
} |
|
|
|
|
|
var userStatistics1 model.UserDayAmount |
|
|
|
|
|
sess.Where("uid=? and date=?", v.Uid, nowDay).Get(&userStatistics1) |
|
|
|
|
|
if userStatistics1.Id == 0 { |
|
|
|
|
|
userStatistics1 = model.UserDayAmount{ |
|
|
|
|
|
Date: utils.StrToInt(now), |
|
|
|
|
|
Uid: v.Uid, |
|
|
|
|
|
} |
|
|
|
|
|
has, err := sess.Insert(&userStatistics1) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
if has == 0 { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
return errors.New("失败") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
isupdate1 := 0 |
|
|
|
|
|
if ordData.State == 4 && ordData.IsTotal == 1 { |
|
|
|
|
|
isupdate1 = 1 |
|
|
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4) |
|
|
|
|
|
} |
|
|
|
|
|
if ordData.State != 4 && ordData.IsTotal == 0 { |
|
|
|
|
|
isupdate1 = 1 |
|
|
|
|
|
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4) |
|
|
|
|
|
} |
|
|
|
|
|
update1, err1 := sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics1) |
|
|
|
|
|
if err1 != nil { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
return err |
|
|
|
|
|
} |
|
|
|
|
|
if update1 == 0 && isupdate1 == 1 { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
return errors.New("失败") |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|