@@ -514,7 +514,7 @@ func SetBasicCentralKitchenForSchool(c *gin.Context) { | |||||
set.IsOpenTeacherReportMealForMonth = req.IsOpenTeacherReportMealForMonth | set.IsOpenTeacherReportMealForMonth = req.IsOpenTeacherReportMealForMonth | ||||
set.IsOpenTeacherReportMealForSemester = req.IsOpenTeacherReportMealForSemester | set.IsOpenTeacherReportMealForSemester = req.IsOpenTeacherReportMealForSemester | ||||
set.UpdateAt = now.Format("2006-01-02 15:04:05") | set.UpdateAt = now.Format("2006-01-02 15:04:05") | ||||
_, err2 := centralKitchenForSchoolSetDb.CentralKitchenForSchoolSetUpdate(set.Id, set, "is_open_teacher_report_meal", "is_open_report_meal_for_day", "is_open_report_meal_for_month", "is_open_report_meal_for_semester", "update_at") | |||||
_, err2 := centralKitchenForSchoolSetDb.CentralKitchenForSchoolSetUpdate(set.Id, set, "is_open_teacher_report_meal", "is_open_report_meal_for_day", "is_open_report_meal_for_month", "is_open_report_meal_for_semester", "is_open_teacher_report_meal_for_semester", "update_at") | |||||
if err2 != nil { | if err2 != nil { | ||||
e.OutErr(c, e.ERR_DB_ORM, err2.Error()) | e.OutErr(c, e.ERR_DB_ORM, err2.Error()) | ||||
return | return | ||||
@@ -102,6 +102,21 @@ func SchoolBelowGrade(c *gin.Context) { | |||||
return | return | ||||
} | } | ||||
//func SchoolBelowPeriod(c *gin.Context) { | |||||
// periodId := c.DefaultQuery("period_id", "") | |||||
// gradeDb := db.GradeDb{} | |||||
// gradeDb.Set(utils.StrToInt(enterpriseId)) | |||||
// gradeList, err := gradeDb.FindGrade() | |||||
// if err != nil { | |||||
// e.OutErr(c, e.ERR_DB_ORM, err.Error()) | |||||
// return | |||||
// } | |||||
// e.OutSuc(c, map[string]interface{}{ | |||||
// "list": gradeList, | |||||
// }, nil) | |||||
// return | |||||
//} | |||||
func SchoolGradeBelowClass(c *gin.Context) { | func SchoolGradeBelowClass(c *gin.Context) { | ||||
gradeId := c.DefaultQuery("grade_id", "") | gradeId := c.DefaultQuery("grade_id", "") | ||||
enterpriseId := c.DefaultQuery("enterprise_id", "") | enterpriseId := c.DefaultQuery("enterprise_id", "") | ||||
@@ -9,7 +9,7 @@ type CentralKitchenForSchoolExportRecordsListReq struct { | |||||
} | } | ||||
type CentralKitchenForSchoolDataStatisticsExportReq struct { | type CentralKitchenForSchoolDataStatisticsExportReq struct { | ||||
Kind int `json:"kind" binding:"required" label:"导出类型"` | |||||
Kinds []int `json:"kinds" binding:"required" label:"导出类型"` | |||||
StartDate string `json:"start_date" binding:"required" label:"起始时间"` | StartDate string `json:"start_date" binding:"required" label:"起始时间"` | ||||
EndDate string `json:"end_date" binding:"required" label:"截止时间"` | EndDate string `json:"end_date" binding:"required" label:"截止时间"` | ||||
MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"` | MealKindList []int `json:"meal_kind_list" label:"就餐类型(1:早餐 2:午餐 3:晚餐)"` | ||||
@@ -6,7 +6,11 @@ import ( | |||||
"applet/app/customer/md" | "applet/app/customer/md" | ||||
"applet/app/customer/svc" | "applet/app/customer/svc" | ||||
"applet/app/e" | "applet/app/e" | ||||
"context" | |||||
"github.com/chromedp/chromedp" | |||||
"github.com/chromedp/chromedp/device" | |||||
"github.com/gin-gonic/gin" | "github.com/gin-gonic/gin" | ||||
"io/ioutil" | |||||
) | ) | ||||
func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(c *gin.Context) { | func CurlAlipayPlanetEcocampusApiRosterSignUpInfo(c *gin.Context) { | ||||
@@ -33,3 +37,45 @@ func Demo(c *gin.Context) { | |||||
e.OutSuc(c, nil, nil) | e.OutSuc(c, nil, nil) | ||||
return | return | ||||
} | } | ||||
func SanHu(c *gin.Context) { | |||||
url := c.DefaultQuery("url", "") | |||||
if url == "" { | |||||
e.OutErr(c, e.ERR_NO_DATA, "网址不能为空") | |||||
return | |||||
} | |||||
ctx, cancel := chromedp.NewContext(context.Background()) | |||||
defer cancel() | |||||
var b1, b2 []byte | |||||
if err := chromedp.Run(ctx, | |||||
// emulate iPhone 7 landscape | |||||
chromedp.Emulate(device.IPhone8Plus), | |||||
chromedp.Navigate(url), | |||||
chromedp.CaptureScreenshot(&b1), | |||||
// reset | |||||
chromedp.Emulate(device.Reset), | |||||
// set really large viewport | |||||
chromedp.EmulateViewport(1920, 2000), | |||||
chromedp.Navigate(url), | |||||
chromedp.CaptureScreenshot(&b2), | |||||
); err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
if err := ioutil.WriteFile("./static/template/sanHu/IPhone8Plus.png", b1, 0777); err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
if err := ioutil.WriteFile("./static/template/sanHu/Pc.png", b2, 0777); err != nil { | |||||
e.OutErr(c, e.ERR, err.Error()) | |||||
return | |||||
} | |||||
e.OutSuc(c, map[string]interface{}{ | |||||
"iphone8_plus": "https://zs.zehaochi.net/template/sanHu/IPhone8Plus.png", | |||||
"pc": "https://zs.zehaochi.net/template/sanHu/Pc.png", | |||||
}, nil) | |||||
return | |||||
} |
@@ -0,0 +1,70 @@ | |||||
package db | |||||
import ( | |||||
"applet/app/db/model" | |||||
"applet/app/utils/logx" | |||||
"reflect" | |||||
"xorm.io/xorm" | |||||
) | |||||
type PeriodDb struct { | |||||
Db *xorm.Engine `json:"db"` | |||||
EnterpriseId int `json:"enterprise_id"` | |||||
} | |||||
func (PeriodDb *PeriodDb) Set(enterpriseId int) { // set方法 | |||||
PeriodDb.Db = Db | |||||
PeriodDb.EnterpriseId = enterpriseId | |||||
} | |||||
func (PeriodDb *PeriodDb) FindPeriod() (*[]model.Period, error) { | |||||
var m []model.Period | |||||
if err := PeriodDb.Db.Desc("id").Where("enterprise_id =?", PeriodDb.EnterpriseId).Find(&m); err != nil { | |||||
return nil, logx.Error(err) | |||||
} | |||||
return &m, nil | |||||
} | |||||
func (PeriodDb *PeriodDb) PeriodDeleteBySession(id interface{}) (int64, error) { | |||||
if reflect.TypeOf(id).Kind() == reflect.Slice { | |||||
return PeriodDb.Db.In("id", id).Delete(model.Period{}) | |||||
} else { | |||||
return PeriodDb.Db.Where("id = ?", id).Delete(model.Period{}) | |||||
} | |||||
} | |||||
func (PeriodDb *PeriodDb) ClassDeleteBySessionForEnterprise(session *xorm.Session, enterpriseId interface{}) (int64, error) { | |||||
if reflect.TypeOf(enterpriseId).Kind() == reflect.Slice { | |||||
return session.In("enterprise_id", enterpriseId).Delete(model.Period{}) | |||||
} else { | |||||
return session.Where("enterprise_id = ?", enterpriseId).Delete(model.Period{}) | |||||
} | |||||
} | |||||
func (PeriodDb *PeriodDb) PeriodInsert(m *model.Period) (int, error) { | |||||
_, err := PeriodDb.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} | |||||
func (PeriodDb *PeriodDb) PeriodUpdate(m *model.Period, columns ...string) (int64, error) { | |||||
affected, err := PeriodDb.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (PeriodDb *PeriodDb) GetPeriod(id int) (m *model.Period, err error) { | |||||
m = new(model.Period) | |||||
has, err := PeriodDb.Db.Where("id =?", id).Get(m) | |||||
if err != nil { | |||||
return nil, logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} |
@@ -5,6 +5,7 @@ type Grade struct { | |||||
EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('单位id') INT(11)"` | EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('单位id') INT(11)"` | ||||
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` | Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` | ||||
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` | Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` | ||||
PeriodId int `json:"period_id" xorm:"not null default 0 comment('学段id') INT(11)"` | |||||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | ||||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | ||||
} | } |
@@ -0,0 +1,17 @@ | |||||
package model | |||||
import ( | |||||
"time" | |||||
) | |||||
type Period struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
EnterpriseId int `json:"enterprise_id" xorm:"not null default 0 comment('单位id') INT(11)"` | |||||
Name string `json:"name" xorm:"not null default '' comment('名称') VARCHAR(255)"` | |||||
Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` | |||||
BreakfastUnitPrice string `json:"breakfast_unit_price" xorm:"not null default 0.00 comment('早餐-单价') DECIMAL(4,2)"` | |||||
LunchUnitPrice string `json:"lunch_unit_price" xorm:"not null default 0.00 comment('午餐-单价') DECIMAL(4,2)"` | |||||
DinnerUnitPrice string `json:"dinner_unit_price" xorm:"not null default 0.00 comment('晚餐-单价') DECIMAL(4,2)"` | |||||
CreateAt time.Time `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||||
UpdateAt time.Time `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||||
} |
@@ -140,6 +140,7 @@ func rEnterprise(r *gin.RouterGroup) { | |||||
r.POST("/updateState", hdl2.EnterpriseUpdateState) | r.POST("/updateState", hdl2.EnterpriseUpdateState) | ||||
r.POST("/addGrade", hdl2.EnterpriseAddGrade) | r.POST("/addGrade", hdl2.EnterpriseAddGrade) | ||||
r.GET("/detail", hdl2.Detail) | r.GET("/detail", hdl2.Detail) | ||||
//r.GET("/schoolBelowPeriod", hdl2.SchoolBelowPeriod) //"学校"下年级 | |||||
r.GET("/schoolBelowGrade", hdl2.SchoolBelowGrade) //"学校"下年级 | r.GET("/schoolBelowGrade", hdl2.SchoolBelowGrade) //"学校"下年级 | ||||
r.GET("/schoolGradeBelowClass", hdl2.SchoolGradeBelowClass) //"学校"年级下班级 | r.GET("/schoolGradeBelowClass", hdl2.SchoolGradeBelowClass) //"学校"年级下班级 | ||||
r.POST("/setCentralKitchenForSchoolWithSpecForSystem", hdl2.SetCentralKitchenForSchoolWithSpecForSystem) //"央厨-学校-套餐-系统" 价格设置 | r.POST("/setCentralKitchenForSchoolWithSpecForSystem", hdl2.SetCentralKitchenForSchoolWithSpecForSystem) //"央厨-学校-套餐-系统" 价格设置 | ||||
@@ -266,7 +267,7 @@ func AdminRoute(r *gin.RouterGroup) { | |||||
r.Use(mw.Auth) //检测登录状态 | r.Use(mw.Auth) //检测登录状态 | ||||
r.GET("/userInfo", hdl2.UserInfo) //用户信息 | r.GET("/userInfo", hdl2.UserInfo) //用户信息 | ||||
r.GET("/sysCfg", hdl2.GetSysCfg) //基础配置-获取 | r.GET("/sysCfg", hdl2.GetSysCfg) //基础配置-获取 | ||||
rOss(r.Group("/oss")) | rOss(r.Group("/oss")) | ||||
rComm(r.Group("/comm")) | rComm(r.Group("/comm")) | ||||
@@ -15,6 +15,7 @@ func CustomerInit(r *gin.RouterGroup) { | |||||
rSelfSupportForSchool(r.Group("/selfSupportForSchool")) | rSelfSupportForSchool(r.Group("/selfSupportForSchool")) | ||||
rUserIdentity(r.Group("/userIdentity")) | rUserIdentity(r.Group("/userIdentity")) | ||||
r.GET("/sanHu", hdl.SanHu) | |||||
r.POST("/test", hdl.Demo) | r.POST("/test", hdl.Demo) | ||||
r.POST("/curlAlipayPlanetEcocampusApiRosterSignUpInfoTest", hdl.CurlAlipayPlanetEcocampusApiRosterSignUpInfo) | r.POST("/curlAlipayPlanetEcocampusApiRosterSignUpInfoTest", hdl.CurlAlipayPlanetEcocampusApiRosterSignUpInfo) | ||||
@@ -5,6 +5,7 @@ go 1.15 | |||||
require ( | require ( | ||||
github.com/360EntSecGroup-Skylar/excelize v1.4.1 | github.com/360EntSecGroup-Skylar/excelize v1.4.1 | ||||
github.com/boombuler/barcode v1.0.1 | github.com/boombuler/barcode v1.0.1 | ||||
github.com/chromedp/chromedp v0.9.2 // indirect | |||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible | github.com/dgrijalva/jwt-go v3.2.0+incompatible | ||||
github.com/forgoer/openssl v0.0.0-20201023062029-c3112b0c8700 | github.com/forgoer/openssl v0.0.0-20201023062029-c3112b0c8700 | ||||
github.com/gin-gonic/gin v1.6.3 | github.com/gin-gonic/gin v1.6.3 | ||||