diff --git a/app/customer/hdl/hdl_user.go b/app/customer/hdl/hdl_user.go index d64b63a..8e76e08 100644 --- a/app/customer/hdl/hdl_user.go +++ b/app/customer/hdl/hdl_user.go @@ -63,6 +63,9 @@ func UserInfo(c *gin.Context) { } tmp["month_statistic"] = monthStatistic tmp["day_statistic"] = dayStatistic + + //判断是否存在欠费 + } if v.UserIdentity.Identity == enum.UserIdentityForSelfSupportForWorker { diff --git a/app/customer/md/md_order.go b/app/customer/md/md_order.go index cd110fa..3afbceb 100644 --- a/app/customer/md/md_order.go +++ b/app/customer/md/md_order.go @@ -22,15 +22,16 @@ type CentralKitchenForSchoolOrderRefundListReq struct { } type CentralKitchenForSchoolOrderRefundListResp struct { - OutTradeNo string `json:"out_trade_no" label:"订单号"` - OutRequestNo string `json:"out_request_no" label:"退款请求号"` - Kind int `json:"kind" label:"预定类型"` - CreateAt string `json:"create_at" label:"申请时间"` - RefundDate string `json:"refund_date" label:"退款时间"` - Date string `json:"date" label:"预定时间"` - State int `json:"state" label:"退款状态"` - Memo string `json:"memo" label:"备注"` - Amount string `json:"amount" label:"退款金额"` + OutTradeNo string `json:"out_trade_no" label:"订单号"` + OutRequestNo string `json:"out_request_no" label:"退款请求号"` + Kind int `json:"kind" label:"预定类型"` + CreateAt string `json:"create_at" label:"申请时间"` + RefundDate string `json:"refund_date" label:"退款时间"` + Date string `json:"date" label:"预定时间"` + State int `json:"state" label:"退款状态"` + Memo string `json:"memo" label:"备注"` + Amount string `json:"amount" label:"退款金额"` + EnterpriseName string `json:"enterprise_name" label:"学校名称"` } type CentralKitchenForSchoolMyReserveResp struct { diff --git a/app/customer/svc/order/svc_central_kitchen_for_school_order.go b/app/customer/svc/order/svc_central_kitchen_for_school_order.go index 5b9de38..09159d7 100644 --- a/app/customer/svc/order/svc_central_kitchen_for_school_order.go +++ b/app/customer/svc/order/svc_central_kitchen_for_school_order.go @@ -114,24 +114,34 @@ func CentralKitchenForSchoolOrderRefund(req md.CentralKitchenForSchoolOrderRefun func CentralKitchenForSchoolOrderRefundList(req md.CentralKitchenForSchoolOrderRefundListReq) (resp []md.CentralKitchenForSchoolOrderRefundListResp, total int64, err error) { var m []*db.CentralKitchenForSchoolUserRefundDayWithCentralKitchenForSchoolUserWithDay sess := db.Db.Where("central_kitchen_for_school_user_refund_day.identity_id =?", req.UserIdentityId) + if req.State != 0 { + sess = sess.And("central_kitchen_for_school_user_refund_day.state = ?", req.State) + } total, err = sess.Desc("central_kitchen_for_school_user_refund_day.id"). Join("LEFT", "central_kitchen_for_school_user_with_day", "central_kitchen_for_school_user_refund_day.records_id = central_kitchen_for_school_user_with_day.id"). Limit(req.Limit, (req.Page-1)*req.Limit).FindAndCount(&m) if err != nil { return nil, 0, err } + userIdentityDb := db.UserIdentityDb{} + userIdentityDb.Set(req.UserIdentityId) + identity, err := userIdentityDb.UserIdentity(req.UserIdentityId) + if err != nil { + return nil, 0, err + } for _, v := range m { resp = append(resp, md.CentralKitchenForSchoolOrderRefundListResp{ - OutTradeNo: v.CentralKitchenForSchoolUserRefundDay.OutTradeNo, - OutRequestNo: v.CentralKitchenForSchoolUserRefundDay.OutRequestNo, - Kind: v.CentralKitchenForSchoolUserWithDay.Kind, - CreateAt: v.CentralKitchenForSchoolUserRefundDay.CreateAt, - RefundDate: v.CentralKitchenForSchoolUserRefundDay.RefundDate, - Date: v.CentralKitchenForSchoolUserWithDay.Date, - State: v.CentralKitchenForSchoolUserRefundDay.State, - Memo: v.CentralKitchenForSchoolUserRefundDay.Memo, - Amount: v.CentralKitchenForSchoolUserRefundDay.Amount, + OutTradeNo: v.CentralKitchenForSchoolUserRefundDay.OutTradeNo, + OutRequestNo: v.CentralKitchenForSchoolUserRefundDay.OutRequestNo, + Kind: v.CentralKitchenForSchoolUserWithDay.Kind, + CreateAt: v.CentralKitchenForSchoolUserRefundDay.CreateAt, + RefundDate: v.CentralKitchenForSchoolUserRefundDay.RefundDate, + Date: v.CentralKitchenForSchoolUserWithDay.Date, + State: v.CentralKitchenForSchoolUserRefundDay.State, + Memo: v.CentralKitchenForSchoolUserRefundDay.Memo, + Amount: v.CentralKitchenForSchoolUserRefundDay.Amount, + EnterpriseName: identity.Enterprise.Name, }) } return diff --git a/app/db/db_user_identity.go b/app/db/db_user_identity.go index 9bc8097..c776916 100644 --- a/app/db/db_user_identity.go +++ b/app/db/db_user_identity.go @@ -53,6 +53,19 @@ func (userIdentityDb *UserIdentityDb) FindUserIdentity() (*[]UserIdentityWithEnt return &m, nil } +func (userIdentityDb *UserIdentityDb) UserIdentity(id int) (m *UserIdentityWithEnterprise, err error) { + m = new(UserIdentityWithEnterprise) + has, err := userIdentityDb.Db.Join("LEFT", "enterprise", "user_identity.enterprise_id = enterprise.id"). + And("user_identity.id =?", id).Desc("user_identity.id").Get(m) + if err != nil { + return nil, logx.Error(err) + } + if has == false { + return nil, nil + } + return m, nil +} + func (userIdentityDb *UserIdentityDb) UserIdentityInsert(m *model.UserIdentity) (int, error) { _, err := userIdentityDb.Db.InsertOne(m) if err != nil {