123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- package http
- import (
- "go-common/app/admin/main/search/model"
- bm "go-common/library/net/http/blademaster"
- )
- func businessList(ctx *bm.Context) {
- p := &model.ParamMngBusiness{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- list, total, err := svr.BusinessList(ctx, p.Name, p.Pn, p.Ps)
- if err != nil {
- ctx.JSON(nil, err)
- return
- }
- data := make(map[string]interface{}, 2)
- data["list"] = list
- data["page"] = &model.Page{
- Pn: p.Pn,
- Ps: p.Ps,
- Total: total,
- }
- ctx.JSON(data, nil)
- }
- func businessAll(ctx *bm.Context) {
- ctx.JSON(svr.BusinessAll(ctx))
- }
- func businessInfo(ctx *bm.Context) {
- p := &model.ParamMngBusiness{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.BusinessInfo(ctx, p.ID))
- }
- func addBusiness(ctx *bm.Context) {
- p := &model.ParamMngBusiness{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- b := &model.MngBusiness{Name: p.Name, Desc: p.Desc, AppsJSON: "[]"}
- ctx.JSON(svr.AddBusiness(ctx, b))
- }
- func updateBusiness(ctx *bm.Context) {
- p := &model.ParamMngBusiness{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- b := &model.MngBusiness{ID: p.ID, Name: p.Name, Desc: p.Desc, AppsJSON: p.Apps}
- ctx.JSON(nil, svr.UpdateBusiness(ctx, b))
- }
- func updateBusinessApp(ctx *bm.Context) {
- p := &model.ParamMngBusinessApp{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(nil, svr.UpdateBusinessApp(ctx, p.Business, p.App, p.IncrWay, p.IsJob, p.IncrOpen))
- }
- func assetList(ctx *bm.Context) {
- p := &model.ParamMngAsset{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- list, total, err := svr.AssetList(ctx, p.Type, p.Name, p.Pn, p.Ps)
- if err != nil {
- ctx.JSON(nil, err)
- return
- }
- data := make(map[string]interface{}, 2)
- data["list"] = list
- data["page"] = &model.Page{
- Pn: p.Pn,
- Ps: p.Ps,
- Total: total,
- }
- ctx.JSON(data, nil)
- }
- func assetAll(ctx *bm.Context) {
- ctx.JSON(svr.AssetAll(ctx))
- }
- func assetInfo(ctx *bm.Context) {
- p := &model.ParamMngAsset{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.AssetInfo(ctx, p.ID))
- }
- func addAsset(ctx *bm.Context) {
- p := &model.ParamMngAsset{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- a := &model.MngAsset{Name: p.Name, Type: p.Type, Config: p.Config, Desc: p.Desc}
- ctx.JSON(svr.AddAsset(ctx, a))
- }
- func updateAsset(ctx *bm.Context) {
- p := &model.ParamMngAsset{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- a := &model.MngAsset{ID: p.ID, Name: p.Name, Type: p.Type, Config: p.Config, Desc: p.Desc}
- ctx.JSON(nil, svr.UpdateAsset(ctx, a))
- }
- func appList(ctx *bm.Context) {
- p := &model.MngApp{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.AppList(ctx, p.Business))
- }
- func appInfo(ctx *bm.Context) {
- p := &model.MngApp{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.AppInfo(ctx, p.ID))
- }
- func addApp(ctx *bm.Context) {
- p := &model.MngApp{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.AddApp(ctx, p))
- }
- func updateApp(ctx *bm.Context) {
- p := &model.MngApp{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(nil, svr.UpdateApp(ctx, p))
- }
- func countlist(ctx *bm.Context) {
- ctx.JSON(svr.MngCountList(ctx))
- }
- func count(ctx *bm.Context) {
- p := &model.MngCount{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.MngCount(ctx, p))
- }
- func percent(ctx *bm.Context) {
- p := &model.MngCount{}
- if err := ctx.Bind(p); err != nil {
- return
- }
- ctx.JSON(svr.MngPercent(ctx, p))
- }
|