فهرست منبع

修改预约取消校验bug

guodj 4 سال پیش
والد
کامیت
35322ed120
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 2 2
      service/reservation/reservation.go
  2. 1 1
      service/srv/user.go

+ 2 - 2
service/reservation/reservation.go

@@ -120,7 +120,7 @@ func (s Service) Cancel(userInfo request.UserInfo, id int) error {
 	if int32(entity.UserId) != userInfo.Id {
 		return errors.New("当前预约只能由预约人取消")
 	}
-	if entity.StartTime.Sub(gtime.Now()) > 0 {
+	if entity.StartTime.Sub(gtime.Now()) <= 0 {
 		return errors.New("预约开始不允许取消")
 	}
 	updatedMap := service.SetUpdatedMap(&userInfo)
@@ -396,7 +396,7 @@ func (s Service) getCurrentWeekReservation(ctx context.Context, req model.Reserv
 				StartTime: fmt.Sprintf("%.2v:%.2v", startAt.Hour(), startAt.Minute()),
 				Tel:       usersMap[v.UserId].Mobile,
 				Uid:       v.UserId,
-				Uname:     v.UserName,
+				Uname:     usersMap[v.UserId].Realname,
 				Week:      common.GetCNWeekday(v.StartTime),
 			})
 		}

+ 1 - 1
service/srv/user.go

@@ -12,7 +12,7 @@ import (
 func GetUserList(ctx context.Context, ids []int64, tenant string) ([]user_def.UserInfoList, error) {
 	userService := micro_srv.InitMicroSrvClient("User", "micro_srv.admin")
 	rsp := &comm_def.CommonMsg{}
-	err := userService.Call(context.TODO(), "GetUserInfoById", &comm_def.IdsReq{
+	err := userService.Call(ctx, "GetUserInfoById", &comm_def.IdsReq{
 		Tenant: tenant,
 		Ids:    ids,
 	}, rsp)