作者 tangxvhui

bug 修复

@@ -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, &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 - 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 -}  
@@ -2,7 +2,7 @@ package routers @@ -2,7 +2,7 @@ package routers
2 2
3 import ( 3 import (
4 "oppmg/controllers" 4 "oppmg/controllers"
5 - 5 + "oppmg/controllers/openapi"
6 "oppmg/middleware" 6 "oppmg/middleware"
7 7
8 "github.com/astaxie/beego" 8 "github.com/astaxie/beego"
@@ -172,7 +172,7 @@ func init() { @@ -172,7 +172,7 @@ func init() {
172 nsCommon := beego.NewNamespace("/common", 172 nsCommon := beego.NewNamespace("/common",
173 beego.NSBefore(middleware.AllowOption), 173 beego.NSBefore(middleware.AllowOption),
174 beego.NSBefore(middleware.LogRequestData), 174 beego.NSBefore(middleware.LogRequestData),
175 - beego.NSRouter("/common/chance/media", &controllers.AuditController{}, "post:GetChangeMedia"), 175 + beego.NSRouter("/common/chance/media", &openapi.OpenApiController{}, "post:GetChangeMedia"), //外链获取机会的图片、视频、音频数据
176 ) 176 )
177 beego.AddNamespace(nsV1) 177 beego.AddNamespace(nsV1)
178 beego.AddNamespace(nsAuth) 178 beego.AddNamespace(nsAuth)
@@ -181,6 +181,5 @@ func init() { @@ -181,6 +181,5 @@ func init() {
181 beego.SetStaticPath("/log", beego.AppConfig.String("log_filename")) 181 beego.SetStaticPath("/log", beego.AppConfig.String("log_filename"))
182 beego.SetStaticPath("/file/opp", beego.AppConfig.String("file_save_path")) 182 beego.SetStaticPath("/file/opp", beego.AppConfig.String("file_save_path"))
183 beego.SetStaticPath("/static", "./static") 183 beego.SetStaticPath("/static", "./static")
184 - //外链获取机会的图片、视频、音频数据  
185 184
186 } 185 }