Browse Source

更新

master
huangjiajun 2 weeks ago
parent
commit
8d1a7ae9ed
2 changed files with 15 additions and 8 deletions
  1. +8
    -7
      db/model/subsidy_total.go
  2. +7
    -1
      rule/consume_integral_settlement.go

+ 8
- 7
db/model/subsidy_total.go View File

@@ -1,11 +1,12 @@
package model

type SubsidyTotal struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Date int `json:"date" xorm:"default 0 INT(11)"`
DayPayAmount string `json:"day_pay_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
NowAmount string `json:"now_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
DayIntegral string `json:"day_integral" xorm:"default 0.000000 DECIMAL(20,6)"`
AllAmount string `json:"all_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
AllIntegral string `json:"all_integral" xorm:"default 0.000000 DECIMAL(20,6)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Date int `json:"date" xorm:"default 0 INT(11)"`
DayPayAmount string `json:"day_pay_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
NowAmount string `json:"now_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
DayIntegral string `json:"day_integral" xorm:"default 0.000000 DECIMAL(20,6)"`
AllAmount string `json:"all_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
AllIntegral string `json:"all_integral" xorm:"default 0.000000 DECIMAL(20,6)"`
AllIntegralAmount string `json:"all_integral_amount" xorm:"default 0.000000 DECIMAL(20,6)"`
}

+ 7
- 1
rule/consume_integral_settlement.go View File

@@ -281,7 +281,12 @@ func Total(sess *xorm.Session, date, dayPayAmount string) error {
if len(queryNativeStringAllIntegral) > 0 {
AllIntegral = queryNativeStringAllIntegral[0]["amount"]
}

sqlAllIntegralAmount := "SELECT SUM(amount) as amount FROM subsidy_with_user where kind(1,2) and is_give=0 "
queryNativeStringAllIntegralAmount, _ := db.QueryNativeStringSess(sess, sqlAllIntegralAmount)
AllIntegralAmount := "0"
if len(queryNativeStringAllIntegralAmount) > 0 {
AllIntegralAmount = queryNativeStringAllIntegralAmount[0]["amount"]
}
var data model.SubsidyTotal
sess.Where("date=?", date1).Get(&data)
if data.Id == 0 {
@@ -296,6 +301,7 @@ func Total(sess *xorm.Session, date, dayPayAmount string) error {
data.DayIntegral = DayIntegral
data.AllAmount = AllAmount
data.AllIntegral = AllIntegral
data.AllIntegralAmount = AllIntegralAmount
update, err := sess.Where("id=?", data.Id).Update(&data)
if update == 0 || err != nil {
return errors.New("失败")


Loading…
Cancel
Save