作者 tangxvhui

调整

@@ -268,7 +268,7 @@ func (c *AuditController) ChanceReserveTypeList() { @@ -268,7 +268,7 @@ func (c *AuditController) ChanceReserveTypeList() {
268 } 268 }
269 companyId := c.GetCompanyId() 269 companyId := c.GetCompanyId()
270 list := serveaudit.GetReserveTypeLsit(param.PageIndex, param.PageSize, companyId) 270 list := serveaudit.GetReserveTypeLsit(param.PageIndex, param.PageSize, companyId)
271 - msg = protocol.NewReturnResponse(list, nil) 271 + msg = protocol.NewPageDataResponse(list, nil)
272 return 272 return
273 } 273 }
274 274
@@ -330,3 +330,37 @@ func (c *AuditController) DeleteReserveType() { @@ -330,3 +330,37 @@ func (c *AuditController) DeleteReserveType() {
330 msg = protocol.NewReturnResponse(nil, err) 330 msg = protocol.NewReturnResponse(nil, err)
331 return 331 return
332 } 332 }
  333 +
  334 +//ChanceStoreChange 机会数据变更存储类型
  335 +//@router /v1/chance/store/change
  336 +func (c *AuditController) ChanceStoreChange() {
  337 + var msg *protocol.ResponseMessage
  338 + defer func() {
  339 + c.ResposeJson(msg)
  340 + }()
  341 + type Parameter struct {
  342 + ChanceId string `json:"chance_id"`
  343 + StoreType int8 `json:"store_type"`
  344 + }
  345 + var param Parameter
  346 + if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
  347 + log.Error("json 解析失败", err)
  348 + msg = protocol.BadRequestParam("1")
  349 + return
  350 + }
  351 + // companyId := c.GetCompanyId()
  352 + var (
  353 + chanceData *models.Chance
  354 + err error
  355 + )
  356 + chanceId, _ := strconv.ParseInt(param.ChanceId, 64, 10)
  357 + chanceData, err = models.GetChanceById(chanceId)
  358 + if err != nil {
  359 + msg = protocol.BadRequestParam("1")
  360 + return
  361 + }
  362 + chanceData.StoreType = param.StoreType
  363 + err = models.UpdateChanceById(chanceData, []string{"StoreType"})
  364 + msg = protocol.NewReturnResponse(nil, nil)
  365 + return
  366 +}
@@ -115,6 +115,7 @@ func init() { @@ -115,6 +115,7 @@ func init() {
115 beego.NSRouter("/reserve_type/list", &controllers.AuditController{}, "post:ChanceReserveTypeList"), 115 beego.NSRouter("/reserve_type/list", &controllers.AuditController{}, "post:ChanceReserveTypeList"),
116 beego.NSRouter("/reserve_type/delete", &controllers.AuditController{}, "post:DeleteReserveType"), 116 beego.NSRouter("/reserve_type/delete", &controllers.AuditController{}, "post:DeleteReserveType"),
117 beego.NSRouter("/reserve_type/edit", &controllers.AuditController{}, "post:EditReserveType"), 117 beego.NSRouter("/reserve_type/edit", &controllers.AuditController{}, "post:EditReserveType"),
  118 + beego.NSRouter("/store/change", &controllers.AuditController{}, "post:ChanceStoreChange"),
118 ), 119 ),
119 beego.NSNamespace("/rank", 120 beego.NSNamespace("/rank",
120 beego.NSRouter("/type/list", &controllers.RankController{}, "post:GetRankType"), 121 beego.NSRouter("/type/list", &controllers.RankController{}, "post:GetRankType"),