|
@@ -92,9 +92,7 @@ func (dao *EmployeeDao) CalculatePersonUnReadNotification(uid int64) (map[string |
|
@@ -92,9 +92,7 @@ func (dao *EmployeeDao) CalculatePersonUnReadNotification(uid int64) (map[string |
92
|
// 计算个人素币收益,昨日收益:做任务验收获得的素币+额外增加-扣除素币-兑换物资-兑换现金
|
92
|
// 计算个人素币收益,昨日收益:做任务验收获得的素币+额外增加-扣除素币-兑换物资-兑换现金
|
93
|
func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{}, error) {
|
93
|
func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{}, error) {
|
94
|
var incomeSuMoney float64
|
94
|
var incomeSuMoney float64
|
95
|
- //var expendSuMoney float64
|
|
|
96
|
var incomeSuMoneyOfYesterday float64
|
95
|
var incomeSuMoneyOfYesterday float64
|
97
|
- //var expendSuMoneyOfYesterday float64
|
|
|
98
|
tx := dao.transactionContext.PgTx
|
96
|
tx := dao.transactionContext.PgTx
|
99
|
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
|
97
|
suMoneyTransactionRecordModel := new(models.SuMoneyTransactionRecord)
|
100
|
yesterday := time.Now().Local().AddDate(0, 0, -1)
|
98
|
yesterday := time.Now().Local().AddDate(0, 0, -1)
|
|
@@ -102,41 +100,20 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ |
|
@@ -102,41 +100,20 @@ func (dao *EmployeeDao) CalculatePersonSuMoney(uid int64) (map[string]interface{ |
102
|
if err := tx.Model(suMoneyTransactionRecordModel).
|
100
|
if err := tx.Model(suMoneyTransactionRecordModel).
|
103
|
ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
|
101
|
ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
|
104
|
Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
|
102
|
Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
|
105
|
- //Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3})).
|
|
|
106
|
Where(`su_money_transaction_record.record_type = ?`, 2).
|
103
|
Where(`su_money_transaction_record.record_type = ?`, 2).
|
107
|
Where(`su_money_transaction_record.create_time > ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, yesterday.Location())).
|
104
|
Where(`su_money_transaction_record.create_time > ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, yesterday.Location())).
|
108
|
Where(`su_money_transaction_record.create_time < ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 23, 59, 59, 0, yesterday.Location())).
|
105
|
Where(`su_money_transaction_record.create_time < ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 23, 59, 59, 0, yesterday.Location())).
|
109
|
Select(&incomeSuMoneyOfYesterday); err != nil {
|
106
|
Select(&incomeSuMoneyOfYesterday); err != nil {
|
110
|
return nil, err
|
107
|
return nil, err
|
111
|
}
|
108
|
}
|
112
|
- //// 昨日支出
|
|
|
113
|
- //if err := tx.Model(suMoneyTransactionRecordModel).
|
|
|
114
|
- // ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
|
|
|
115
|
- // Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
|
|
|
116
|
- // //Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{1, 4, 5})).
|
|
|
117
|
- // Where(`su_money_transaction_record.record_type = ?`, 2).
|
|
|
118
|
- // Where(`su_money_transaction_record.create_time > ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 0, 0, 0, 0, yesterday.Location())).
|
|
|
119
|
- // Where(`su_money_transaction_record.create_time < ?`, time.Date(yesterday.Year(), yesterday.Month(), yesterday.Day(), 23, 59, 59, 0, yesterday.Location())).
|
|
|
120
|
- // Select(&expendSuMoneyOfYesterday); err != nil {
|
|
|
121
|
- // return nil, err
|
|
|
122
|
- //}
|
|
|
123
|
// 收益
|
109
|
// 收益
|
124
|
if err := tx.Model(suMoneyTransactionRecordModel).
|
110
|
if err := tx.Model(suMoneyTransactionRecordModel).
|
125
|
ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
|
111
|
ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
|
126
|
Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
|
112
|
Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
|
127
|
- //Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{2, 3, 6})).
|
|
|
128
|
Where(`su_money_transaction_record.record_type = ?`, 2).
|
113
|
Where(`su_money_transaction_record.record_type = ?`, 2).
|
129
|
Select(&incomeSuMoney); err != nil {
|
114
|
Select(&incomeSuMoney); err != nil {
|
130
|
return nil, err
|
115
|
return nil, err
|
131
|
}
|
116
|
}
|
132
|
- //// 支出
|
|
|
133
|
- //if err := tx.Model(suMoneyTransactionRecordModel).
|
|
|
134
|
- // ColumnExpr("sum(su_money_transaction_record.su_money) AS income_su_money").
|
|
|
135
|
- // Where(`su_money_transaction_record.employee @> '{"uid":?}'`, uid).
|
|
|
136
|
- // Where(`su_money_transaction_record.record_type IN (?)`, pg.In([]int{1, 4, 5})).
|
|
|
137
|
- // Select(&expendSuMoney); err != nil {
|
|
|
138
|
- // return nil, err
|
|
|
139
|
- //}
|
|
|
140
|
return map[string]interface{}{
|
117
|
return map[string]interface{}{
|
141
|
"incomeSuMoney": incomeSuMoney,
|
118
|
"incomeSuMoney": incomeSuMoney,
|
142
|
"incomeSuMoneyOfYesterday": incomeSuMoneyOfYesterday,
|
119
|
"incomeSuMoneyOfYesterday": incomeSuMoneyOfYesterday,
|