|
@@ -37,8 +37,8 @@ func (c *ApiController) GetList() *JsonResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *ApiController) GetPage() *JsonResult {
|
|
func (c *ApiController) GetPage() *JsonResult {
|
|
|
- params := c.buildParams()
|
|
|
|
|
- moduleId := c.Ctx.URLParamInt64Default("moduleId", 0)
|
|
|
|
|
|
|
+ params := c.buildParams()
|
|
|
|
|
+ moduleId := c.Ctx.URLParamInt64Default("moduleId", 0)
|
|
|
if moduleId <= 0 {
|
|
if moduleId <= 0 {
|
|
|
return ResultErr("参数不完整", nil)
|
|
return ResultErr("参数不完整", nil)
|
|
|
}
|
|
}
|
|
@@ -62,9 +62,8 @@ func (c *ApiController) GetById(moduleId, apiId int64) *JsonResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *ApiController) Create() *JsonResult {
|
|
func (c *ApiController) Create() *JsonResult {
|
|
|
- userId := c.GetCurUserId()
|
|
|
|
|
-
|
|
|
|
|
- api := datamodels.Api{}
|
|
|
|
|
|
|
+ userId := c.GetCurUserId()
|
|
|
|
|
+ api := datamodels.Api{}
|
|
|
if err := c.Ctx.ReadJSON(&api); err != nil {
|
|
if err := c.Ctx.ReadJSON(&api); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
return ResultErr("读取数据失败", nil)
|
|
|
}
|
|
}
|
|
@@ -78,9 +77,8 @@ func (c *ApiController) Create() *JsonResult {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *ApiController) Update() *JsonResult {
|
|
func (c *ApiController) Update() *JsonResult {
|
|
|
- userId := c.GetCurUserId()
|
|
|
|
|
-
|
|
|
|
|
- api := datamodels.Api{}
|
|
|
|
|
|
|
+ userId := c.GetCurUserId()
|
|
|
|
|
+ api := datamodels.Api{}
|
|
|
if err := c.Ctx.ReadJSON(&api); err != nil {
|
|
if err := c.Ctx.ReadJSON(&api); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
return ResultErr("读取数据失败", nil)
|
|
|
}
|
|
}
|
|
@@ -105,7 +103,7 @@ func (c *ApiController) DeleteByID(moduleId, apiId int64) *JsonResult {
|
|
|
userId := c.GetCurUserId()
|
|
userId := c.GetCurUserId()
|
|
|
|
|
|
|
|
m := make(map[string]interface{})
|
|
m := make(map[string]interface{})
|
|
|
- m["moduleId"] = moduleId
|
|
|
|
|
|
|
+ m["moduleId"] = moduleId
|
|
|
m["apiId"] = apiId
|
|
m["apiId"] = apiId
|
|
|
m["deletedBy"] = userId
|
|
m["deletedBy"] = userId
|
|
|
if err := c.Service.Delete(m); err != nil {
|
|
if err := c.Service.Delete(m); err != nil {
|