Merge branch 'test6.8.4' of http://git.yoho.cn/ufo/ufo-platform into test6.8.4
Showing
5 changed files
with
57 additions
and
25 deletions
@@ -69,7 +69,7 @@ public class QNLiveUtilService { | @@ -69,7 +69,7 @@ public class QNLiveUtilService { | ||
69 | * @param endTime 摄像结束时间 | 69 | * @param endTime 摄像结束时间 |
70 | */ | 70 | */ |
71 | public void fetch(String fileKey, String liveM3u8Url, String startTime, String endTime) throws PlatformException { | 71 | public void fetch(String fileKey, String liveM3u8Url, String startTime, String endTime) throws PlatformException { |
72 | - logger.info("bucketManager.fetch begin fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime); | 72 | + logger.info("bucketManager.fetch begin fileKey is :{}, liveM3u8Url is :{}, startTime is :{}, endTime is :{}.", fileKey, liveM3u8Url, startTime, endTime); |
73 | 73 | ||
74 | //实例化一个BucketManager对象 | 74 | //实例化一个BucketManager对象 |
75 | BucketManager bucketManager = new BucketManager(auth, cfg); | 75 | BucketManager bucketManager = new BucketManager(auth, cfg); |
@@ -79,17 +79,16 @@ public class QNLiveUtilService { | @@ -79,17 +79,16 @@ public class QNLiveUtilService { | ||
79 | 79 | ||
80 | //要fetch的url "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1544425260&endtime=1544425440"; | 80 | //要fetch的url "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1544425260&endtime=1544425440"; |
81 | String fetchUrl = liveM3u8Url + "?starttime=" + startTime + "&endtime=" + endTime; | 81 | String fetchUrl = liveM3u8Url + "?starttime=" + startTime + "&endtime=" + endTime; |
82 | - | ||
83 | - logger.info("bucketManager.fetch before fetchUrl is {}", fetchUrl); | ||
84 | - | ||
85 | - if (null == fetchUrl) { | 82 | + if (null == liveM3u8Url) { |
86 | throw new PlatformException(400); | 83 | throw new PlatformException(400); |
87 | } | 84 | } |
88 | 85 | ||
89 | try { | 86 | try { |
87 | + logger.info("bucketManager.fetch before fetchUrl is :{};BUCKET is :{};key is :{}.", fetchUrl, BUCKET, key); | ||
88 | + | ||
90 | FetchRet fetch = bucketManager.fetch(fetchUrl, BUCKET, key); //调用fetch方法抓取文件 | 89 | FetchRet fetch = bucketManager.fetch(fetchUrl, BUCKET, key); //调用fetch方法抓取文件 |
91 | 90 | ||
92 | - logger.info("Resp is {} from bucketManager.fetch", fetch.key); | 91 | + logger.info("Resp is {} from bucketManager.fetch key is :{}, hash is :{},fsize is :{},mimeType is :{}.", fetch.key, key, fetch.hash, fetch.fsize, fetch.mimeType); |
93 | 92 | ||
94 | } catch (QiniuException e) { | 93 | } catch (QiniuException e) { |
95 | logger.error("bucketManager.fetch find wrong fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime, e.response); | 94 | logger.error("bucketManager.fetch find wrong fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime, e.response); |
@@ -116,6 +115,8 @@ public class QNLiveUtilService { | @@ -116,6 +115,8 @@ public class QNLiveUtilService { | ||
116 | 115 | ||
117 | StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("pipeline", PIPELINE).put("notifyURL", notifyUrl); //设置pipeline参数 | 116 | StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("pipeline", PIPELINE).put("notifyURL", notifyUrl); //设置pipeline参数 |
118 | try { | 117 | try { |
118 | + logger.info("method operater.pfop begin BUCKET is :{}, key is :{}, pfops is :{}, params is :{}.", BUCKET, key, pfops, params); | ||
119 | + | ||
119 | String persistId = operater.pfop(BUCKET, key, pfops, params); | 120 | String persistId = operater.pfop(BUCKET, key, pfops, params); |
120 | 121 | ||
121 | logger.info("method transfer end fileKey is {}, mp4FileName is {} , persistid is {}", fileKey, mp4FileName, persistId); | 122 | logger.info("method transfer end fileKey is {}, mp4FileName is {} , persistid is {}", fileKey, mp4FileName, persistId); |
@@ -142,14 +143,12 @@ public class QNLiveUtilService { | @@ -142,14 +143,12 @@ public class QNLiveUtilService { | ||
142 | OperationManager operater = new OperationManager(auth, cfg); | 143 | OperationManager operater = new OperationManager(auth, cfg); |
143 | try { | 144 | try { |
144 | OperationStatus operationStatus = operater.prefop(persistId); | 145 | OperationStatus operationStatus = operater.prefop(persistId); |
145 | - | 146 | + logger.info("result queryPrefopStatus is {}, persistId is {}", operationStatus.code, persistId); |
146 | if (0 == operationStatus.code || 4 == operationStatus.code) { // 状态码 0:成功,1:等待处理,2:正在处理,3:处理失败,4:成功但通知失败 | 147 | if (0 == operationStatus.code || 4 == operationStatus.code) { // 状态码 0:成功,1:等待处理,2:正在处理,3:处理失败,4:成功但通知失败 |
147 | return "success"; | 148 | return "success"; |
148 | } else if (1 == operationStatus.code || 2 == operationStatus.code) { | 149 | } else if (1 == operationStatus.code || 2 == operationStatus.code) { |
149 | return "operating"; | 150 | return "operating"; |
150 | } | 151 | } |
151 | - | ||
152 | - logger.info("result queryPrefopStatus is {}, persistId is {}", operationStatus.code, persistId); | ||
153 | } catch (QiniuException e) { | 152 | } catch (QiniuException e) { |
154 | logger.error("method queryPrefopStatus find wrong persistId is {}, error is {}", persistId, e.response); | 153 | logger.error("method queryPrefopStatus find wrong persistId is {}, error is {}", persistId, e.response); |
155 | } catch (Exception e) { | 154 | } catch (Exception e) { |
@@ -12,6 +12,7 @@ import com.qiniu.storage.model.FetchRet; | @@ -12,6 +12,7 @@ import com.qiniu.storage.model.FetchRet; | ||
12 | import com.qiniu.util.Auth; | 12 | import com.qiniu.util.Auth; |
13 | import com.qiniu.util.StringMap; | 13 | import com.qiniu.util.StringMap; |
14 | import com.qiniu.util.UrlSafeBase64; | 14 | import com.qiniu.util.UrlSafeBase64; |
15 | +import com.yoho.ufo.exception.PlatformException; | ||
15 | import com.yoho.ufo.service.IQNUploadService; | 16 | import com.yoho.ufo.service.IQNUploadService; |
16 | import com.yoho.ufo.util.ImagesHelper; | 17 | import com.yoho.ufo.util.ImagesHelper; |
17 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
@@ -64,17 +65,46 @@ public class QNUploadServiceImpl implements IQNUploadService { | @@ -64,17 +65,46 @@ public class QNUploadServiceImpl implements IQNUploadService { | ||
64 | */ | 65 | */ |
65 | 66 | ||
66 | 67 | ||
67 | - public static void main(String[] args) { | ||
68 | - fetch(); | 68 | + public static void main(String[] args) throws Exception{ |
69 | + fetch("9790249123840_1545555597", "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8", "1545555597", "1545555619"); | ||
69 | transfer(); | 70 | transfer(); |
70 | } | 71 | } |
71 | 72 | ||
73 | + public static void fetch(String fileKey, String liveM3u8Url, String startTime, String endTime) throws PlatformException { | ||
74 | + logger.info("bucketManager.fetch begin fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime); | ||
75 | + | ||
76 | + Auth auth = Auth.create("atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m", "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm"); | ||
77 | + //实例化一个BucketManager对象 | ||
78 | + BucketManager bucketManager = new BucketManager(auth, cfg); | ||
79 | + | ||
80 | + //文件保存的空间名和文件名 | ||
81 | + String key = "ufo/live/m3u8/" + fileKey + ".m3u8"; // 例如 "ufo/live/m3u8/yohotest15.m3u8"; | ||
82 | + | ||
83 | + //要fetch的url "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1544425260&endtime=1544425440"; | ||
84 | + String fetchUrl = liveM3u8Url + "?starttime=" + startTime + "&endtime=" + endTime; | ||
85 | + | ||
86 | + logger.info("bucketManager.fetch before fetchUrl is :{}.", fetchUrl); | ||
87 | + | ||
88 | + if (null == fetchUrl) { | ||
89 | + throw new PlatformException(400); | ||
90 | + } | ||
91 | + | ||
92 | + try { | ||
93 | + FetchRet fetch = bucketManager.fetch(fetchUrl, "yhbflv", key); //调用fetch方法抓取文件 | ||
94 | + | ||
95 | + logger.info("Resp is {} from bucketManager.fetch key is :{}.", fetch.key, key); | ||
96 | + | ||
97 | + } catch (QiniuException e) { | ||
98 | + logger.error("bucketManager.fetch find wrong fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime, e.response); | ||
99 | + | ||
100 | + throw new PlatformException(400); | ||
101 | + } | ||
102 | + } | ||
103 | + | ||
72 | 104 | ||
73 | public static void fetch() { | 105 | public static void fetch() { |
74 | //设置需要操作的账号的AK和SK | 106 | //设置需要操作的账号的AK和SK |
75 | - String ACCESS_KEY = "atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m"; | ||
76 | - String SECRET_KEY = "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm"; | ||
77 | - Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY); | 107 | + Auth auth = Auth.create("atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m", "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm"); |
78 | 108 | ||
79 | //Zone z = Zone.zone0(); | 109 | //Zone z = Zone.zone0(); |
80 | //Configuration c = new Configuration(z); | 110 | //Configuration c = new Configuration(z); |
@@ -83,15 +113,14 @@ public class QNUploadServiceImpl implements IQNUploadService { | @@ -83,15 +113,14 @@ public class QNUploadServiceImpl implements IQNUploadService { | ||
83 | BucketManager bucketManager = new BucketManager(auth, cfg); | 113 | BucketManager bucketManager = new BucketManager(auth, cfg); |
84 | 114 | ||
85 | //文件保存的空间名和文件名 | 115 | //文件保存的空间名和文件名 |
86 | - String bucket = "yhbflv"; | ||
87 | - String key = "ufo/live/m3u8/yohotest15.m3u8"; | 116 | + String key = "ufo/live/m3u8/9790249123840_1545530300.m3u8"; |
88 | 117 | ||
89 | //要fetch的url | 118 | //要fetch的url |
90 | String url = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1545291515&endtime=1545292115"; | 119 | String url = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1545291515&endtime=1545292115"; |
91 | - | 120 | +url = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1545530300&endtime=1545530313"; |
92 | try { | 121 | try { |
93 | //调用fetch方法抓取文件 | 122 | //调用fetch方法抓取文件 |
94 | - FetchRet fetch = bucketManager.fetch(url, bucket, key); | 123 | + FetchRet fetch = bucketManager.fetch(url, "yhbflv", key); |
95 | 124 | ||
96 | //fetch. | 125 | //fetch. |
97 | 126 | ||
@@ -105,7 +134,7 @@ public class QNUploadServiceImpl implements IQNUploadService { | @@ -105,7 +134,7 @@ public class QNUploadServiceImpl implements IQNUploadService { | ||
105 | // http://api.qiniu.com/status/get/prefop?id=z0.5c1b4c0138b9f349c8bb9c46 查看文件的状态 | 134 | // http://api.qiniu.com/status/get/prefop?id=z0.5c1b4c0138b9f349c8bb9c46 查看文件的状态 |
106 | // http://flv01.static.yhbimg.com/ufo/live/mp4/yohotest15.mp4 | 135 | // http://flv01.static.yhbimg.com/ufo/live/mp4/yohotest15.mp4 |
107 | private static void transfer() { | 136 | private static void transfer() { |
108 | - String m3u8Address = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8"; | 137 | + //String m3u8Address = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8"; |
109 | //设置账号的AK,SK | 138 | //设置账号的AK,SK |
110 | String ACCESS_KEY = "atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m"; | 139 | String ACCESS_KEY = "atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m"; |
111 | String SECRET_KEY = "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm"; | 140 | String SECRET_KEY = "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm"; |
@@ -114,7 +143,8 @@ public class QNUploadServiceImpl implements IQNUploadService { | @@ -114,7 +143,8 @@ public class QNUploadServiceImpl implements IQNUploadService { | ||
114 | OperationManager operater = new OperationManager(auth, cfg); | 143 | OperationManager operater = new OperationManager(auth, cfg); |
115 | //设置要转码的空间和key,并且这个key在你空间中存在 | 144 | //设置要转码的空间和key,并且这个key在你空间中存在 |
116 | String bucket = "yhbflv"; | 145 | String bucket = "yhbflv"; |
117 | - String key = "ufo/live/m3u8/yohotest15.m3u8"; // 14 4 分钟 15 3分钟 | 146 | + String key = "ufo/live/m3u8/9790249123840_1545530300.m3u8"; // 14 4 分钟 15 3分钟 |
147 | + key = "ufo/live/m3u8/9790249123840_1545555597.m3u8"; | ||
118 | //设置转码操作参数 1920x1080 1280x720 848x480 | 148 | //设置转码操作参数 1920x1080 1280x720 848x480 |
119 | String fops = "avthumb/mp4/s/1280x720/vb/1m/an/1/hr/0/r/30"; | 149 | String fops = "avthumb/mp4/s/1280x720/vb/1m/an/1/hr/0/r/30"; |
120 | 150 | ||
@@ -122,7 +152,7 @@ public class QNUploadServiceImpl implements IQNUploadService { | @@ -122,7 +152,7 @@ public class QNUploadServiceImpl implements IQNUploadService { | ||
122 | //设置转码的队列 | 152 | //设置转码的队列 |
123 | String pipeline = "yoho-m3u8-to-mp4"; | 153 | String pipeline = "yoho-m3u8-to-mp4"; |
124 | //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间。 | 154 | //可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间。 |
125 | - String urlbase64 = UrlSafeBase64.encodeToString("yhbflv:ufo/live/mp4/yohotest15.mp4"); | 155 | + String urlbase64 = UrlSafeBase64.encodeToString("yhbflv:ufo/live/mp4/9790249123840_1545555597.mp4"); |
126 | String pfops = fops + "|saveas/" + urlbase64; | 156 | String pfops = fops + "|saveas/" + urlbase64; |
127 | //设置pipeline参数 http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/ufoLive/ufo_avthumb_notify | 157 | //设置pipeline参数 http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/ufoLive/ufo_avthumb_notify |
128 | StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("pipeline", pipeline).put("notifyURL", "http://testapi.yohops.com/ufoLive/ufo_avthumb_notify"); | 158 | StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("pipeline", pipeline).put("notifyURL", "http://testapi.yohops.com/ufoLive/ufo_avthumb_notify"); |
@@ -65,7 +65,8 @@ public class UfoLiveService implements ApplicationContextAware { | @@ -65,7 +65,8 @@ public class UfoLiveService implements ApplicationContextAware { | ||
65 | 65 | ||
66 | String persistId = qNliveUtilService.transfer(fileName, fileName); | 66 | String persistId = qNliveUtilService.transfer(fileName, fileName); |
67 | 67 | ||
68 | - if (StringUtils.isEmpty(persistId) || "fail".equals(qNliveUtilService.queryPrefopStatus(persistId))) { | 68 | + if (StringUtils.isEmpty(persistId)) { |
69 | + LOGGER.error("qNliveUtilService.transfer find wrong persistId is {}", persistId); | ||
69 | throw new PlatformException(400); | 70 | throw new PlatformException(400); |
70 | } | 71 | } |
71 | 72 | ||
@@ -113,6 +114,8 @@ public class UfoLiveService implements ApplicationContextAware { | @@ -113,6 +114,8 @@ public class UfoLiveService implements ApplicationContextAware { | ||
113 | qiniuLiveRecordMapper.updateStatusBySkup(req.getSkup(), 1); | 114 | qiniuLiveRecordMapper.updateStatusBySkup(req.getSkup(), 1); |
114 | 115 | ||
115 | return getVedioFileUrl(qiniuLiveRecord); | 116 | return getVedioFileUrl(qiniuLiveRecord); |
117 | + } else if ("fail".equals(qNliveUtilService.queryPrefopStatus(qiniuLiveRecord.getPersistId()))) { | ||
118 | + throw new PlatformException("上传失败,请重新录制", 400); | ||
116 | } | 119 | } |
117 | 120 | ||
118 | return null; | 121 | return null; |
@@ -708,7 +708,7 @@ function addRecordPage(skup, order_code, id) { | @@ -708,7 +708,7 @@ function addRecordPage(skup, order_code, id) { | ||
708 | collapsible: true, | 708 | collapsible: true, |
709 | cache: false, | 709 | cache: false, |
710 | onClose : function() { | 710 | onClose : function() { |
711 | - timedCount(); | 711 | + stopCount(); |
712 | $(this).dialog('destroy'); | 712 | $(this).dialog('destroy'); |
713 | }, | 713 | }, |
714 | buttons: [{ | 714 | buttons: [{ |
@@ -787,7 +787,7 @@ function addRecordPage(skup, order_code, id) { | @@ -787,7 +787,7 @@ function addRecordPage(skup, order_code, id) { | ||
787 | text: "取消", | 787 | text: "取消", |
788 | iconCls: "icon-cancel", | 788 | iconCls: "icon-cancel", |
789 | handler: function () { | 789 | handler: function () { |
790 | - timedCount(); | 790 | + stopCount(); |
791 | $(div).dialog("destroy"); | 791 | $(div).dialog("destroy"); |
792 | } | 792 | } |
793 | }] | 793 | }] |
@@ -135,7 +135,7 @@ | @@ -135,7 +135,7 @@ | ||
135 | <table border="0" style="width:99%;"> | 135 | <table border="0" style="width:99%;"> |
136 | <tr style="height: 60px"> | 136 | <tr style="height: 60px"> |
137 | <td width="100%"> | 137 | <td width="100%"> |
138 | - <input class="easyui-textbox" id="feedbackContent" name="feedbackContent" data-options="prompt:'请输入回访内容...',validType:'length[1,50]'" style="width: 100%;height: 100%;" /> | 138 | + <input class="easyui-textbox" id="feedbackContent" name="feedbackContent" data-options="prompt:'请输入回访内容...'" style="width: 100%;height: 100%;" /> |
139 | </td> | 139 | </td> |
140 | </tr> | 140 | </tr> |
141 | </table> | 141 | </table> |
-
Please register or login to post a comment