Commit a2acd60d authored by Quxl's avatar Quxl
parents 137da567 636f0358
package com.egolm.film.api.web; package com.egolm.film.api.web;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -20,6 +21,9 @@ import com.aliyuncs.vod.model.v20170321.RefreshUploadVideoResponse; ...@@ -20,6 +21,9 @@ import com.aliyuncs.vod.model.v20170321.RefreshUploadVideoResponse;
import com.egolm.common.HttpUtil; import com.egolm.common.HttpUtil;
import com.egolm.common.StringUtil; import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx; import com.egolm.common.bean.Rjx;
import com.egolm.common.exception.HttpRequestException;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.Messages; import com.egolm.film.api.service.Messages;
import com.egolm.film.util.AliyunSign; import com.egolm.film.util.AliyunSign;
import com.egolm.film.util.AliyunUtil; import com.egolm.film.util.AliyunUtil;
...@@ -49,6 +53,9 @@ public class AliyunApiController { ...@@ -49,6 +53,9 @@ public class AliyunApiController {
@Autowired @Autowired
private Messages messages; private Messages messages;
@Autowired
private JdbcTemplate jdbcTemplate;
@ResponseBody @ResponseBody
@ApiOperation("获取点播授权Auth") @ApiOperation("获取点播授权Auth")
@ApiImplicitParams({ @ApiImplicitParams({
...@@ -245,4 +252,91 @@ public class AliyunApiController { ...@@ -245,4 +252,91 @@ public class AliyunApiController {
return result; return result;
} }
@ResponseBody
@ApiOperation("修改视频信息")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "index", dataType = "String", required = false, value = "页码", defaultValue = ""),
@ApiImplicitParam(paramType = "query", name = "limit", dataType = "String", required = false, value = "每页显示数", defaultValue = ""),
})
@RequestMapping(value = "/updateVideoInfo",method=RequestMethod.GET)
public Object updateVideoInfo(HttpServletRequest request) {
String index = request.getParameter("index");
String limit = request.getParameter("limit");
Page page = new Page();
page.setIndex(Long.valueOf(index));
page.setLimit(Long.valueOf(limit));
page.setLimitKey("upload_time desc ");
String sql = "SELECT en_name,cn_name,upload_id,upload_state,upload_time from fc_member_film where upload_id is not null and upload_state=1 and cn_name != '' and cn_name = en_name and upload_time <='2019-02-14 12:36:47' ";
List<Map<String,Object>> list = jdbcTemplate.limit(sql, page);
if(list != null && list.size()>0) {
for(Map<String,Object> map:list) {
String en_name = map.get("en_name")+"";
String cn_name = map.get("cn_name")+"";
String upload_id = map.get("upload_id")+"";
System.out.println(upload_id+"----"+cn_name+"-----"+en_name);
String title = cn_name;
Map<String,String> privateParams = new HashMap<String,String>();
privateParams.put("Action", "UpdateVideoInfo");
privateParams.put("VideoId", upload_id);
privateParams.put("Title", title);
privateParams.put("CateId", cateID);
//生成公共参数,不需要修改
Map<String, String> publicParams = AliyunSign.generatePublicParamters();
//生成OpenAPI地址,不需要修改
String URL = AliyunSign.generateOpenAPIURL(publicParams, privateParams);
//发送HTTP GET 请求
String result = HttpUtil.get(URL);
System.out.println(result);
}
}
/*
//生成私有参数,不同API需要修改
return result;
*/
return "处理完成";
}
@ResponseBody
@ApiOperation("获取视频信息")
@ApiImplicitParams({
})
@RequestMapping(value = "/getVideoList",method=RequestMethod.GET)
public Object getVideoList(HttpServletRequest request) {
Map<String,String> privateParams = new HashMap<String,String>();
privateParams.put("Action", "GetVideoList");
privateParams.put("CateId", cateID);
//生成公共参数,不需要修改
Map<String, String> publicParams = AliyunSign.generatePublicParamters();
//生成OpenAPI地址,不需要修改
String URL = AliyunSign.generateOpenAPIURL(publicParams, privateParams);
//发送HTTP GET 请求
String result = HttpUtil.get(URL);
System.out.println(result);
JSONObject obj = JSONObject.parseObject(result);
if(obj.containsKey("VideoList")) {
JSONObject VideoList = obj.getJSONObject("VideoList");
JSONArray Video = VideoList.getJSONArray("Video");
for(int i = 0;i<Video.size();i++) {
JSONObject v = Video.getJSONObject(i);
if(v.getString("Title").contains("测试")) {
System.out.println(v.getString("VideoId"));
}
}
}
return "处理完成";
}
} }
...@@ -18,7 +18,7 @@ com.egolm.film.email.smtp.from=filmpassword@siff.com ...@@ -18,7 +18,7 @@ com.egolm.film.email.smtp.from=filmpassword@siff.com
com.egolm.film.email.smtp.username=filmpassword@siff.com com.egolm.film.email.smtp.username=filmpassword@siff.com
com.egolm.film.email.smtp.password=siffstvf2018 com.egolm.film.email.smtp.password=siffstvf2018
spring.datasource.url=jdbc:mysql://rm-uf690z5r42mm16f3r.mysql.rds.aliyuncs.com:3306/film_2019?useSSL=false&useUnicode=true&characterEncoding=utf8 spring.datasource.url=jdbc:mysql://rm-uf690z5r42mm16f3rho.mysql.rds.aliyuncs.com:3306/film_2019?useSSL=false&useUnicode=true&characterEncoding=utf8
spring.datasource.username=filmdb spring.datasource.username=filmdb
spring.datasource.password=SMG@film#2018 spring.datasource.password=SMG@film#2018
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment