Authored by mali

Merge branch 'test6.8.4' of http://git.yoho.cn/ufo/ufo-platform into test6.8.4

... ... @@ -69,7 +69,7 @@ public class QNLiveUtilService {
* @param endTime 摄像结束时间
*/
public void fetch(String fileKey, String liveM3u8Url, String startTime, String endTime) throws PlatformException {
logger.info("bucketManager.fetch begin fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime);
logger.info("bucketManager.fetch begin fileKey is :{}, liveM3u8Url is :{}, startTime is :{}, endTime is :{}.", fileKey, liveM3u8Url, startTime, endTime);
//实例化一个BucketManager对象
BucketManager bucketManager = new BucketManager(auth, cfg);
... ... @@ -79,17 +79,16 @@ public class QNLiveUtilService {
//要fetch的url "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1544425260&endtime=1544425440";
String fetchUrl = liveM3u8Url + "?starttime=" + startTime + "&endtime=" + endTime;
logger.info("bucketManager.fetch before fetchUrl is {}", fetchUrl);
if (null == fetchUrl) {
if (null == liveM3u8Url) {
throw new PlatformException(400);
}
try {
logger.info("bucketManager.fetch before fetchUrl is :{};BUCKET is :{};key is :{}.", fetchUrl, BUCKET, key);
FetchRet fetch = bucketManager.fetch(fetchUrl, BUCKET, key); //调用fetch方法抓取文件
logger.info("Resp is {} from bucketManager.fetch", fetch.key);
logger.info("Resp is {} from bucketManager.fetch key is :{}, hash is :{},fsize is :{},mimeType is :{}.", fetch.key, key, fetch.hash, fetch.fsize, fetch.mimeType);
} catch (QiniuException e) {
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 {
StringMap params = new StringMap().putWhen("force", 1, true).putNotEmpty("pipeline", PIPELINE).put("notifyURL", notifyUrl); //设置pipeline参数
try {
logger.info("method operater.pfop begin BUCKET is :{}, key is :{}, pfops is :{}, params is :{}.", BUCKET, key, pfops, params);
String persistId = operater.pfop(BUCKET, key, pfops, params);
logger.info("method transfer end fileKey is {}, mp4FileName is {} , persistid is {}", fileKey, mp4FileName, persistId);
... ... @@ -142,14 +143,12 @@ public class QNLiveUtilService {
OperationManager operater = new OperationManager(auth, cfg);
try {
OperationStatus operationStatus = operater.prefop(persistId);
logger.info("result queryPrefopStatus is {}, persistId is {}", operationStatus.code, persistId);
if (0 == operationStatus.code || 4 == operationStatus.code) { // 状态码 0:成功,1:等待处理,2:正在处理,3:处理失败,4:成功但通知失败
return "success";
} else if (1 == operationStatus.code || 2 == operationStatus.code) {
return "operating";
}
logger.info("result queryPrefopStatus is {}, persistId is {}", operationStatus.code, persistId);
} catch (QiniuException e) {
logger.error("method queryPrefopStatus find wrong persistId is {}, error is {}", persistId, e.response);
} catch (Exception e) {
... ...
... ... @@ -12,6 +12,7 @@ import com.qiniu.storage.model.FetchRet;
import com.qiniu.util.Auth;
import com.qiniu.util.StringMap;
import com.qiniu.util.UrlSafeBase64;
import com.yoho.ufo.exception.PlatformException;
import com.yoho.ufo.service.IQNUploadService;
import com.yoho.ufo.util.ImagesHelper;
import org.slf4j.Logger;
... ... @@ -64,17 +65,46 @@ public class QNUploadServiceImpl implements IQNUploadService {
*/
public static void main(String[] args) {
fetch();
public static void main(String[] args) throws Exception{
fetch("9790249123840_1545555597", "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8", "1545555597", "1545555619");
transfer();
}
public static void fetch(String fileKey, String liveM3u8Url, String startTime, String endTime) throws PlatformException {
logger.info("bucketManager.fetch begin fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime);
Auth auth = Auth.create("atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m", "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm");
//实例化一个BucketManager对象
BucketManager bucketManager = new BucketManager(auth, cfg);
//文件保存的空间名和文件名
String key = "ufo/live/m3u8/" + fileKey + ".m3u8"; // 例如 "ufo/live/m3u8/yohotest15.m3u8";
//要fetch的url "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1544425260&endtime=1544425440";
String fetchUrl = liveM3u8Url + "?starttime=" + startTime + "&endtime=" + endTime;
logger.info("bucketManager.fetch before fetchUrl is :{}.", fetchUrl);
if (null == fetchUrl) {
throw new PlatformException(400);
}
try {
FetchRet fetch = bucketManager.fetch(fetchUrl, "yhbflv", key); //调用fetch方法抓取文件
logger.info("Resp is {} from bucketManager.fetch key is :{}.", fetch.key, key);
} catch (QiniuException e) {
logger.error("bucketManager.fetch find wrong fileKey is {}, cameraIdentify is {}, startTime is {}, endTime is {} error is {}", fileKey, liveM3u8Url, startTime, endTime, e.response);
throw new PlatformException(400);
}
}
public static void fetch() {
//设置需要操作的账号的AK和SK
String ACCESS_KEY = "atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m";
String SECRET_KEY = "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm";
Auth auth = Auth.create(ACCESS_KEY, SECRET_KEY);
Auth auth = Auth.create("atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m", "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm");
//Zone z = Zone.zone0();
//Configuration c = new Configuration(z);
... ... @@ -83,15 +113,14 @@ public class QNUploadServiceImpl implements IQNUploadService {
BucketManager bucketManager = new BucketManager(auth, cfg);
//文件保存的空间名和文件名
String bucket = "yhbflv";
String key = "ufo/live/m3u8/yohotest15.m3u8";
String key = "ufo/live/m3u8/9790249123840_1545530300.m3u8";
//要fetch的url
String url = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1545291515&endtime=1545292115";
url = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8?starttime=1545530300&endtime=1545530313";
try {
//调用fetch方法抓取文件
FetchRet fetch = bucketManager.fetch(url, bucket, key);
FetchRet fetch = bucketManager.fetch(url, "yhbflv", key);
//fetch.
... ... @@ -105,7 +134,7 @@ public class QNUploadServiceImpl implements IQNUploadService {
// http://api.qiniu.com/status/get/prefop?id=z0.5c1b4c0138b9f349c8bb9c46 查看文件的状态
// http://flv01.static.yhbimg.com/ufo/live/mp4/yohotest15.mp4
private static void transfer() {
String m3u8Address = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8";
//String m3u8Address = "http://yoho-live-down.yohobuy.com/yoho13/yoho.m3u8";
//设置账号的AK,SK
String ACCESS_KEY = "atSf7xxIl8alEnsXbhC1bOD1GWVW3qYffz8SlB4m";
String SECRET_KEY = "pyoJzPygXIkFWrc1BAsH6tAJ0yweTchpJwGKEwhm";
... ... @@ -114,7 +143,8 @@ public class QNUploadServiceImpl implements IQNUploadService {
OperationManager operater = new OperationManager(auth, cfg);
//设置要转码的空间和key,并且这个key在你空间中存在
String bucket = "yhbflv";
String key = "ufo/live/m3u8/yohotest15.m3u8"; // 14 4 分钟 15 3分钟
String key = "ufo/live/m3u8/9790249123840_1545530300.m3u8"; // 14 4 分钟 15 3分钟
key = "ufo/live/m3u8/9790249123840_1545555597.m3u8";
//设置转码操作参数 1920x1080 1280x720 848x480
String fops = "avthumb/mp4/s/1280x720/vb/1m/an/1/hr/0/r/30";
... ... @@ -122,7 +152,7 @@ public class QNUploadServiceImpl implements IQNUploadService {
//设置转码的队列
String pipeline = "yoho-m3u8-to-mp4";
//可以对转码后的文件进行使用saveas参数自定义命名,当然也可以不指定文件会默认命名并保存在当前空间。
String urlbase64 = UrlSafeBase64.encodeToString("yhbflv:ufo/live/mp4/yohotest15.mp4");
String urlbase64 = UrlSafeBase64.encodeToString("yhbflv:ufo/live/mp4/9790249123840_1545555597.mp4");
String pfops = fops + "|saveas/" + urlbase64;
//设置pipeline参数 http://java-yohoufo-fore.test3.ingress.dev.yohocorp.com/ufo-gateway/ufoLive/ufo_avthumb_notify
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 {
String persistId = qNliveUtilService.transfer(fileName, fileName);
if (StringUtils.isEmpty(persistId) || "fail".equals(qNliveUtilService.queryPrefopStatus(persistId))) {
if (StringUtils.isEmpty(persistId)) {
LOGGER.error("qNliveUtilService.transfer find wrong persistId is {}", persistId);
throw new PlatformException(400);
}
... ... @@ -113,6 +114,8 @@ public class UfoLiveService implements ApplicationContextAware {
qiniuLiveRecordMapper.updateStatusBySkup(req.getSkup(), 1);
return getVedioFileUrl(qiniuLiveRecord);
} else if ("fail".equals(qNliveUtilService.queryPrefopStatus(qiniuLiveRecord.getPersistId()))) {
throw new PlatformException("上传失败,请重新录制", 400);
}
return null;
... ...
... ... @@ -708,7 +708,7 @@ function addRecordPage(skup, order_code, id) {
collapsible: true,
cache: false,
onClose : function() {
timedCount();
stopCount();
$(this).dialog('destroy');
},
buttons: [{
... ... @@ -787,7 +787,7 @@ function addRecordPage(skup, order_code, id) {
text: "取消",
iconCls: "icon-cancel",
handler: function () {
timedCount();
stopCount();
$(div).dialog("destroy");
}
}]
... ...
... ... @@ -135,7 +135,7 @@
<table border="0" style="width:99%;">
<tr style="height: 60px">
<td width="100%">
<input class="easyui-textbox" id="feedbackContent" name="feedbackContent" data-options="prompt:'请输入回访内容...',validType:'length[1,50]'" style="width: 100%;height: 100%;" />
<input class="easyui-textbox" id="feedbackContent" name="feedbackContent" data-options="prompt:'请输入回访内容...'" style="width: 100%;height: 100%;" />
</td>
</tr>
</table>
... ...