|
- package hdl
-
- import (
- "applet/app/admin/lib/validate"
- "applet/app/admin/md"
- "applet/app/db"
- "applet/app/e"
- "applet/app/utils"
- "github.com/gin-gonic/gin"
- )
-
- func CentralKitchenForSchoolDataStatisticsList(c *gin.Context) {
- var req md.CentralKitchenForSchoolExportRecordsListReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
- if req.Limit == 0 {
- req.Limit = 10
- }
- if req.Page == 0 {
- req.Page = 10
- }
- centralKitchenForSchoolExportRecordsDb := db.CentralKitchenForSchoolExportRecordsDb{}
- centralKitchenForSchoolExportRecordsDb.Set()
- list, total, err := centralKitchenForSchoolExportRecordsDb.CentralKitchenForSchoolExportRecordsList(req)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
-
- e.OutSuc(c, map[string]interface{}{
- "list": list,
- "total": total,
- "kind": []map[string]interface{}{
- {
- "name": "订单列表",
- "value": 1,
- },
- {
- "name": "退款申请表",
- "value": 2,
- },
- {
- "name": "学校预定统计表",
- "value": 3,
- },
- {
- "name": "班级明细表",
- "value": 4,
- },
- {
- "name": "退款明细表",
- "value": 5,
- },
- {
- "name": "收款统计表",
- "value": 6,
- },
- {
- "name": "班级收款明细表",
- "value": 7,
- },
- {
- "name": "学校预定数量统计表",
- "value": 8,
- },
- },
- }, nil)
- return
- }
-
- func CentralKitchenForSchoolDataStatisticsDelete(c *gin.Context) {
- id := c.Param("id")
- centralKitchenForSchoolExportRecordsDb := db.CentralKitchenForSchoolExportRecordsDb{}
- centralKitchenForSchoolExportRecordsDb.Set()
- centralKitchenForSchoolExportRecords, err := centralKitchenForSchoolExportRecordsDb.GetCentralKitchenForSchoolExportRecords(utils.StrToInt(id))
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
- if centralKitchenForSchoolExportRecords == nil {
- e.OutErr(c, e.ERR_NO_DATA, "未查询到相关记录")
- return
- }
- _, err = centralKitchenForSchoolExportRecordsDb.CentralKitchenForSchoolExportRecordsDelete(id)
- if err != nil {
- e.OutErr(c, e.ERR_DB_ORM, err.Error())
- return
- }
- e.OutSuc(c, "success", nil)
- return
- }
-
- func CentralKitchenForSchoolDataStatisticsExport(c *gin.Context) {
- var req md.CentralKitchenForSchoolDataStatisticsExportReq
- err := c.ShouldBindJSON(&req)
- if err != nil {
- err = validate.HandleValidateErr(err)
- err1 := err.(e.E)
- e.OutErr(c, err1.Code, err1.Error())
- return
- }
-
- e.OutSuc(c, map[string]interface{}{
- "msg": "导出成功,请稍后刷新数据列表",
- }, nil)
- return
- }
|