|
@@ -370,76 +370,3 @@ func (c *AuditController) ChanceStoreChange() { |
|
@@ -370,76 +370,3 @@ func (c *AuditController) ChanceStoreChange() { |
370
|
msg = protocol.NewReturnResponse(nil, nil)
|
370
|
msg = protocol.NewReturnResponse(nil, nil)
|
371
|
return
|
371
|
return
|
372
|
} |
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, ¶m); 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
|
- imageData []models.ChanceDataImage
|
|
|
396
|
- speedchsData []models.ChanceDataSpeechs
|
|
|
397
|
- videosData []models.ChanceDataVideos
|
|
|
398
|
- )
|
|
|
399
|
- chanceData, err = models.GetChanceDataByChanceId(chanceId)
|
|
|
400
|
- rsp := []map[string]interface{}{}
|
|
|
401
|
- if err != nil {
|
|
|
402
|
- msg = protocol.NewReturnResponse(nil, nil)
|
|
|
403
|
- return
|
|
|
404
|
- }
|
|
|
405
|
- json.Unmarshal([]byte(chanceData.Images), &imageData)
|
|
|
406
|
- json.Unmarshal([]byte(chanceData.Speechs), &speedchsData)
|
|
|
407
|
- json.Unmarshal([]byte(chanceData.Videos), &videosData)
|
|
|
408
|
- videoMapData := []map[string]interface{}{}
|
|
|
409
|
- for i := range videosData {
|
|
|
410
|
- m := map[string]interface{}{
|
|
|
411
|
- "path": videosData[i].Path,
|
|
|
412
|
- "cover": map[string]string{
|
|
|
413
|
- "path": videosData[i].Cover.Path,
|
|
|
414
|
- },
|
|
|
415
|
- }
|
|
|
416
|
- videoMapData = append(videoMapData, m)
|
|
|
417
|
- }
|
|
|
418
|
- rsp = append(rsp, map[string]interface{}{
|
|
|
419
|
- "type": 1, "data": videoMapData,
|
|
|
420
|
- })
|
|
|
421
|
-
|
|
|
422
|
- imgMapData := []map[string]interface{}{}
|
|
|
423
|
- for i := range imageData {
|
|
|
424
|
- m := map[string]interface{}{
|
|
|
425
|
- "path": imageData[i].Path,
|
|
|
426
|
- }
|
|
|
427
|
- imgMapData = append(imgMapData, m)
|
|
|
428
|
- }
|
|
|
429
|
- rsp = append(rsp, map[string]interface{}{
|
|
|
430
|
- "type": 2, "data": imgMapData,
|
|
|
431
|
- })
|
|
|
432
|
- speedchMapData := []map[string]interface{}{}
|
|
|
433
|
- for i := range speedchsData {
|
|
|
434
|
- m := map[string]interface{}{
|
|
|
435
|
- "path": speedchsData[i].Path,
|
|
|
436
|
- }
|
|
|
437
|
- speedchMapData = append(speedchMapData, m)
|
|
|
438
|
- }
|
|
|
439
|
- rsp = append(rsp, map[string]interface{}{
|
|
|
440
|
- "type": 3, "data": speedchMapData,
|
|
|
441
|
- })
|
|
|
442
|
- msg = protocol.NewReturnResponse(rsp, nil)
|
|
|
443
|
- return
|
|
|
444
|
-
|
|
|
445
|
-} |
|
|