作者 tangxvhui

。。

@@ -348,14 +348,20 @@ func (c *AuditController) ChanceStoreChange() { @@ -348,14 +348,20 @@ func (c *AuditController) ChanceStoreChange() {
348 msg = protocol.BadRequestParam("1") 348 msg = protocol.BadRequestParam("1")
349 return 349 return
350 } 350 }
351 - // companyId := c.GetCompanyId() 351 + companyId := c.GetCompanyId()
352 var ( 352 var (
353 chanceData *models.Chance 353 chanceData *models.Chance
354 err error 354 err error
355 ) 355 )
356 - chanceId, _ := strconv.ParseInt(param.ChanceId, 64, 10) 356 + chanceId, _ := strconv.ParseInt(param.ChanceId, 10, 64)
357 chanceData, err = models.GetChanceById(chanceId) 357 chanceData, err = models.GetChanceById(chanceId)
358 if err != nil { 358 if err != nil {
  359 + log.Error("获取chance数据失败,err;%s", err)
  360 + msg = protocol.BadRequestParam("1")
  361 + return
  362 + }
  363 + if chanceData.CompanyId != companyId {
  364 + log.Error("chance数据的公司不一致")
359 msg = protocol.BadRequestParam("1") 365 msg = protocol.BadRequestParam("1")
360 return 366 return
361 } 367 }
@@ -364,3 +370,29 @@ func (c *AuditController) ChanceStoreChange() { @@ -364,3 +370,29 @@ func (c *AuditController) ChanceStoreChange() {
364 msg = protocol.NewReturnResponse(nil, nil) 370 msg = protocol.NewReturnResponse(nil, nil)
365 return 371 return
366 } 372 }
  373 +
  374 +//GetChangeMedia 获取机会的图片、音频、视频的地址
  375 +//@router /v1/chance/media
  376 +func (c *AuditController) GetChangeMedia() {
  377 + var msg *protocol.ResponseMessage
  378 + defer func() {
  379 + c.ResposeJson(msg)
  380 + }()
  381 + type Parameter struct {
  382 + ChanceId string `json:"chance_id"`
  383 + CheckSum string `json:"check_sum"`
  384 + }
  385 + var param Parameter
  386 + if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
  387 + log.Error("json 解析失败", err)
  388 + msg = protocol.BadRequestParam("1")
  389 + return
  390 + }
  391 + // chanceId, _ := strconv.ParseInt(param.ChanceId, 10, 64)
  392 + // var (
  393 + // err error
  394 + // chanceData models.ChanceData
  395 + // )
  396 + // models.GetChanceDataByChanceId(chanceId)
  397 + return
  398 +}
@@ -260,6 +260,8 @@ type RequestAuditList struct { @@ -260,6 +260,8 @@ type RequestAuditList struct {
260 CreateTimeEndS string `json:"create_time_end"` // 260 CreateTimeEndS string `json:"create_time_end"` //
261 Code string `json:"code"` //机会编码 261 Code string `json:"code"` //机会编码
262 UserName string `json:"user_name"` //提交人姓名 262 UserName string `json:"user_name"` //提交人姓名
  263 + StoreType string `json:"store_type"` //分类 【-1:全部】【0:机会池】【1:储备池】
  264 + ReserveType int `json:"reserve_type"` //储备池分类id
263 } 265 }
264 266
265 type ResponseAuditList struct { 267 type ResponseAuditList struct {
@@ -10,6 +10,7 @@ import ( @@ -10,6 +10,7 @@ import (
10 serverabc "oppmg/services/rbac" 10 serverabc "oppmg/services/rbac"
11 "oppmg/storage/redisdata" 11 "oppmg/storage/redisdata"
12 "oppmg/utils" 12 "oppmg/utils"
  13 + "strconv"
13 "strings" 14 "strings"
14 "time" 15 "time"
15 ) 16 )
@@ -272,6 +273,22 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 @@ -272,6 +273,22 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
272 datasql.WriteString(s) 273 datasql.WriteString(s)
273 countsql.WriteString(s) 274 countsql.WriteString(s)
274 } 275 }
  276 + if param.ReserveType > 0 {
  277 + cond = append(cond, param.ReserveType)
  278 + s := ` And a.reserve_type_id=? `
  279 + datasql.WriteString(s)
  280 + countsql.WriteString(s)
  281 + }
  282 + if len(param.StoreType) > 0 {
  283 + storeType, _ := strconv.Atoi(param.StoreType)
  284 + if storeType >= 0 {
  285 + cond = append(cond, storeType)
  286 + s := ` And a.type=? `
  287 + datasql.WriteString(s)
  288 + countsql.WriteString(s)
  289 + }
  290 + }
  291 +
275 dataStart := (param.PageIndex - 1) * param.PageSize 292 dataStart := (param.PageIndex - 1) * param.PageSize
276 datasql.WriteString(fmt.Sprintf(` ORDER BY a.create_at DESC limit %d,%d `, dataStart, param.PageSize)) 293 datasql.WriteString(fmt.Sprintf(` ORDER BY a.create_at DESC limit %d,%d `, dataStart, param.PageSize))
277 err = utils.ExecuteQueryOne(&cnt, countsql.String(), cond...) 294 err = utils.ExecuteQueryOne(&cnt, countsql.String(), cond...)
@@ -301,7 +318,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64 @@ -301,7 +318,7 @@ func GetAuditList(param protocol.RequestAuditList, companyid int64, userid int64
301 CommentTotal: v.CommentTotal, 318 CommentTotal: v.CommentTotal,
302 UserName: v.NickName, 319 UserName: v.NickName,
303 CreateTime: 0, 320 CreateTime: 0,
304 - ReserveType: "", 321 + ReserveType: "未设置",
305 StoreType: v.StoreType, 322 StoreType: v.StoreType,
306 StoreTypeName: models.ChanceStoreTypeMap[v.StoreType], 323 StoreTypeName: models.ChanceStoreTypeMap[v.StoreType],
307 } 324 }