|
|
@@ -22,6 +22,42 @@ import ( |
|
|
|
|
|
|
|
// Demo 测试 |
|
|
|
func Demo(c *gin.Context) { |
|
|
|
var m []model.CentralKitchenForSchoolUserWithDay |
|
|
|
eg := db.Db |
|
|
|
if err1 := eg.Where("state = 3").Asc("id").Find(&m); err1 != nil { |
|
|
|
e.OutErr(c, e.ERR, err1.Error()) |
|
|
|
return |
|
|
|
} |
|
|
|
now := time.Now() |
|
|
|
var records []int |
|
|
|
for _, v := range m { |
|
|
|
mm := new(model.CentralKitchenForSchoolUserRefundDay) |
|
|
|
has, err := db.Db.Where("records_id =? and state = 1", v.Id).Get(mm) |
|
|
|
if err != nil { |
|
|
|
fmt.Println(err) |
|
|
|
return |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
centralKitchenForSchoolUserRefundDayDb := db.CentralKitchenForSchoolUserRefundDayDb{} |
|
|
|
centralKitchenForSchoolUserRefundDayDb.Set(0) |
|
|
|
_, err = centralKitchenForSchoolUserRefundDayDb.CentralKitchenForSchoolUserRefundDayInsert(&model.CentralKitchenForSchoolUserRefundDay{ |
|
|
|
OutTradeNo: v.OrdNo, |
|
|
|
OutRequestNo: "", |
|
|
|
Uid: v.Uid, |
|
|
|
IdentityId: v.IdentityId, |
|
|
|
RecordsId: v.Id, |
|
|
|
State: enum.CentralKitchenForSchoolUserRefundDayStateForAuditing, |
|
|
|
Amount: v.Amount, |
|
|
|
Memo: "fill", |
|
|
|
CreateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
UpdateAt: now.Format("2006-01-02 15:04:05"), |
|
|
|
}) |
|
|
|
records = append(records, v.Id) |
|
|
|
} |
|
|
|
} |
|
|
|
e.OutSuc(c, records, nil) |
|
|
|
return |
|
|
|
|
|
|
|
var req md.CentralKitchenForSchoolOrderRefundAuditReq |
|
|
|
err := c.ShouldBindJSON(&req) |
|
|
|
if err != nil { |
|
|
|