123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- package http
- import (
- "go-common/app/admin/main/manager/model"
- "go-common/library/ecode"
- bm "go-common/library/net/http/blademaster"
- )
- // cateSecExtList .
- func cateSecExtList(c *bm.Context) {
- arg := new(model.CateSecExt)
- if err := c.Bind(arg); err != nil {
- return
- }
- c.JSON(mngSvc.CateSecExtList(c, arg))
- }
- // AssociationList .
- func associationList(c *bm.Context) {
- // Display all record
- arg := new(model.Association)
- if err := c.Bind(arg); err != nil {
- return
- }
- if arg.BusinessID < 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(mngSvc.AssociationList(c, arg))
- }
- // addCateSecExt .
- func addCateSecExt(c *bm.Context) {
- arg := new(model.CateSecExt)
- if err := c.Bind(arg); err != nil {
- return
- }
- c.JSON(nil, mngSvc.AddCateSecExt(c, arg))
- }
- // updateCateSecExt .
- func updateCateSecExt(c *bm.Context) {
- arg := new(model.CateSecExt)
- if err := c.Bind(arg); err != nil {
- return
- }
- if arg.ID <= 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(nil, mngSvc.UpdateCateSecExt(c, arg))
- }
- // banCateSecExt .
- func banCateSecExt(c *bm.Context) {
- arg := new(model.CateSecExt)
- if err := c.Bind(arg); err != nil {
- return
- }
- if arg.ID <= 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(nil, mngSvc.BanCateSecExt(c, arg))
- }
- // addAssociation .
- func addAssociation(c *bm.Context) {
- arg := new(model.Association)
- if err := c.Bind(arg); err != nil {
- return
- }
- c.JSON(nil, mngSvc.AddAssociation(c, arg))
- }
- // updateAssociation .
- func updateAssociation(c *bm.Context) {
- arg := new(model.Association)
- if err := c.Bind(arg); err != nil {
- return
- }
- if arg.ID <= 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(nil, mngSvc.UpdateAssociation(c, arg))
- }
- // banAssocaition .
- func banAssociation(c *bm.Context) {
- arg := new(model.Association)
- if err := c.Bind(arg); err != nil {
- return
- }
- if arg.ID <= 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(nil, mngSvc.BanAssociation(c, arg))
- }
- // addReason .
- func addReason(c *bm.Context) {
- arg := new(model.Reason)
- if err := c.Bind(arg); err != nil {
- return
- }
- if uid, exists := c.Get("uid"); exists {
- arg.UID = uid.(int64)
- }
- c.JSON(nil, mngSvc.AddReason(c, arg))
- }
- // updateReason .
- func updateReason(c *bm.Context) {
- arg := new(model.Reason)
- if err := c.Bind(arg); err != nil {
- return
- }
- if uid, exists := c.Get("uid"); exists {
- arg.UID = uid.(int64)
- }
- if arg.ID <= 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(nil, mngSvc.UpdateReason(c, arg))
- }
- // reasonList .
- func reasonList(c *bm.Context) {
- arg := new(model.SearchReasonParams)
- if err := c.Bind(arg); err != nil {
- return
- }
- data, total, err := mngSvc.ReasonList(c, arg)
- if err != nil {
- c.JSON(nil, err)
- return
- }
- page := map[string]int64{
- "num": arg.PN,
- "size": arg.PS,
- "total": total,
- }
- c.JSON(map[string]interface{}{
- "page": page,
- "data": data,
- }, err)
- }
- // batchUpdateReasonState .
- func batchUpdateReasonState(c *bm.Context) {
- arg := new(model.BatchUpdateReasonState)
- if err := c.Bind(arg); err != nil {
- return
- }
- c.JSON(nil, mngSvc.BatchUpdateReasonState(c, arg))
- }
- // dropList .
- func dropDownList(c *bm.Context) {
- arg := new(model.Association)
- if err := c.Bind(arg); err != nil {
- return
- }
- if arg.BusinessID < 0 {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(mngSvc.DropDownList(c, arg))
- }
- // businessAttr .
- func businessAttr(c *bm.Context) {
- arg := &model.BusinessAttr{}
- if err := c.Bind(arg); err != nil {
- c.JSON(nil, ecode.RequestErr)
- return
- }
- c.JSON(mngSvc.BusinessAttr(c, arg))
- }
|