forked from free-lancers/electricity_bill_calc_service
		
	Merge branch '0.2' of https://git.archgrid.xyz/free-lancers/electricity_bill_calc_service into 0.2
This commit is contained in:
		| @@ -9,6 +9,7 @@ import ( | |||||||
| 	"electricity_bill_calc/tools" | 	"electricity_bill_calc/tools" | ||||||
| 	"electricity_bill_calc/types" | 	"electricity_bill_calc/types" | ||||||
| 	"fmt" | 	"fmt" | ||||||
|  | 	"log" | ||||||
| 	"time" | 	"time" | ||||||
|  |  | ||||||
| 	"github.com/doug-martin/goqu/v9" | 	"github.com/doug-martin/goqu/v9" | ||||||
| @@ -238,8 +239,11 @@ func (ur _UserRepository) FindUser(keyword *string, userType int16, state *bool, | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if state != nil { | 	if state != nil { | ||||||
| 		userQuery = userQuery.Where(goqu.Ex{"u.enabled": state}) | 		//userQuery = userQuery.Where(goqu.C("u.enabled").Eq(*state)) | ||||||
| 		countQuery = countQuery.Where(goqu.Ex{"u.enabled": state}) | 		userQuery = userQuery.Where(goqu.Ex{"u.enabled": *state}) | ||||||
|  | 		countQuery = countQuery.Where(goqu.Ex{"u.enabled": *state}) | ||||||
|  | 		//countQuery = countQuery.Where(goqu.C("u.enabled").Eq(*state)) | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	userQuery.Order(goqu.I("u.created_at").Desc()) | 	userQuery.Order(goqu.I("u.created_at").Desc()) | ||||||
| @@ -249,8 +253,9 @@ func (ur _UserRepository) FindUser(keyword *string, userType int16, state *bool, | |||||||
|  |  | ||||||
| 	userSql, userParams, _ := userQuery.Prepared(true).ToSQL() | 	userSql, userParams, _ := userQuery.Prepared(true).ToSQL() | ||||||
| 	countSql, countParams, _ := countQuery.Prepared(true).ToSQL() | 	countSql, countParams, _ := countQuery.Prepared(true).ToSQL() | ||||||
|  | 	log.Println(">>>>>>>>>>>", userSql) | ||||||
| 	if err := pgxscan.Select(ctx, global.DB, &userWithDetails, userSql, userParams...); err != nil { | 	if err := pgxscan.Select(ctx, global.DB, &userWithDetails, userSql, userParams...); err != nil { | ||||||
| 		ur.log.Error("从数据库查询用户列表失败。", zap.Error(err)) | 		ur.log.Error("从数据库查询用户列表失败。》》》》》》》》》》》》》》", zap.Error(err)) | ||||||
| 		return make([]*model.UserWithDetail, 0), 0, err | 		return make([]*model.UserWithDetail, 0), 0, err | ||||||
| 	} | 	} | ||||||
| 	if err := pgxscan.Get(ctx, global.DB, &userCount, countSql, countParams...); err != nil { | 	if err := pgxscan.Get(ctx, global.DB, &userCount, countSql, countParams...); err != nil { | ||||||
|   | |||||||
| @@ -4,7 +4,7 @@ import ( | |||||||
| 	"electricity_bill_calc/model" | 	"electricity_bill_calc/model" | ||||||
| 	"electricity_bill_calc/model/calculate" | 	"electricity_bill_calc/model/calculate" | ||||||
| 	"electricity_bill_calc/repository" | 	"electricity_bill_calc/repository" | ||||||
| 	"fmt" | 	"electricity_bill_calc/types" | ||||||
| 	"github.com/shopspring/decimal" | 	"github.com/shopspring/decimal" | ||||||
| 	"time" | 	"time" | ||||||
| 	"unsafe" | 	"unsafe" | ||||||
| @@ -44,7 +44,10 @@ func PooledMetersCalculate(report *model.ReportIndex, periodStart time.Time, | |||||||
| func determinePublicMeterConsumptions(meterId string, periodStart time.Time, | func determinePublicMeterConsumptions(meterId string, periodStart time.Time, | ||||||
| 	periodEnd time.Time, readings []model.MeterReading, | 	periodEnd time.Time, readings []model.MeterReading, | ||||||
| 	meterDetail model.MeterDetail, summary calculate.Summary) (calculate.Meter, error) { | 	meterDetail model.MeterDetail, summary calculate.Summary) (calculate.Meter, error) { | ||||||
| 	fmt.Println(meterDetail.DetachedAt) | 	if meterDetail.DetachedAt == nil { | ||||||
|  | 		zeroTime := time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC) | ||||||
|  | 		meterDetail.DetachedAt = &types.DateTime{Time: zeroTime} | ||||||
|  | 	} | ||||||
| 	startReading, err := DeterminePublicMeterStartReading(meterId, periodStart, meterDetail.DetachedAt.Time, readings) | 	startReading, err := DeterminePublicMeterStartReading(meterId, periodStart, meterDetail.DetachedAt.Time, readings) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return calculate.Meter{}, err | 		return calculate.Meter{}, err | ||||||
|   | |||||||
| @@ -12,9 +12,9 @@ Server: | |||||||
|   ReadTimeout: 60 |   ReadTimeout: 60 | ||||||
|   WriteTimeout: 60 |   WriteTimeout: 60 | ||||||
| Redis: | Redis: | ||||||
|   Host: 127.0.0.1 |   Host: 192.168.88.129 | ||||||
|   Port: 6379 |   Port: 6379 | ||||||
|   Password: |   Password: 123456 | ||||||
|   DB: 1 |   DB: 1 | ||||||
| Service: | Service: | ||||||
|   MaxSessionLife: 2h |   MaxSessionLife: 2h | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user