| | |
| | | ctx.Ok() |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags SaleChance |
| | | // @Summary 获取销售机会列表 |
| | | // @Produce application/json |
| | | // @Success 200 {object} contextx.Response{data=response.SaleChanceResponse} |
| | | // @Router /api/saleChance/list [get] |
| | | func (s *SaleChanceApi) List(c *gin.Context) { |
| | | ctx, ok := contextx.NewContext(c, nil) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | errCode, list := saleChanceService.GetSaleChanceList() |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.SaleChanceResponse{ |
| | | List: list, |
| | | }) |
| | | } |
| | | |
| | | // checkSaleChanceParams |
| | | // 检查销售机会参数 |
| | |
| | | |
| | | return ecode.OK, sc |
| | | } |
| | | |
| | | // List |
| | | // |
| | | // @Tags SaleChance |
| | | // @Summary 销售机会列表 |
| | | // @Produce application/json |
| | | // @Param object body request.GetSaleChanceList true "参数" |
| | | // @Success 200 {object} contextx.Response{data=response.SaleChanceResponse} |
| | | // @Router /api/saleChance/list [post] |
| | | func (con *SaleChanceApi) List(c *gin.Context) { |
| | | var params request.GetSaleChanceList |
| | | ctx, ok := contextx.NewContext(c, ¶ms) |
| | | if !ok { |
| | | return |
| | | } |
| | | |
| | | saleChances, errCode := saleChanceService.GetSaleChanceList(params.Page, params.PageSize, params.Keyword) |
| | | if errCode != ecode.OK { |
| | | ctx.Fail(errCode) |
| | | return |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.SaleChanceResponse{ |
| | | List: saleChances, |
| | | Count: len(saleChances), |
| | | }) |
| | | } |