Commit 6ced39900cdcb7e80014d3b9dccc64ad2b92868b

Authored by 王言钊
1 parent a5a8336c

增加本地测试环境

@@ -231,7 +231,6 @@ @@ -231,7 +231,6 @@
231 </dependency> 231 </dependency>
232 </dependencies> 232 </dependencies>
233 </plugin> 233 </plugin>
234 -  
235 </plugins> 234 </plugins>
236 </build> 235 </build>
237 236
@@ -249,6 +248,16 @@ @@ -249,6 +248,16 @@
249 </profile> 248 </profile>
250 <!-- 生产环境 --> 249 <!-- 生产环境 -->
251 <profile> 250 <profile>
  251 + <id>test</id>
  252 + <activation>
  253 + <activeByDefault>false</activeByDefault>
  254 + </activation>
  255 + <properties>
  256 + <environment>test</environment>
  257 + </properties>
  258 + </profile>
  259 + <!-- 生产环境 -->
  260 + <profile>
252 <id>prod</id> 261 <id>prod</id>
253 <activation> 262 <activation>
254 <activeByDefault>false</activeByDefault> 263 <activeByDefault>false</activeByDefault>
src/main/java/com/cnlive/shenhe/ShenheApplication.java
@@ -30,17 +30,25 @@ public class ShenheApplication extends SpringBootServletInitializer { @@ -30,17 +30,25 @@ public class ShenheApplication extends SpringBootServletInitializer {
30 //url的前缀 30 //url的前缀
31 private static final String CAS_SERVER_URL_PREFIX = "https://user.cnlive.com/OpenSSO2"; 31 private static final String CAS_SERVER_URL_PREFIX = "https://user.cnlive.com/OpenSSO2";
32 private static final String CAS_SERVER_LOGIN_URL = "https://user.cnlive.com/OpenSSO2/login"; 32 private static final String CAS_SERVER_LOGIN_URL = "https://user.cnlive.com/OpenSSO2/login";
33 - //本机的名称  
34 - private static final String SERVER_NAME = "http://test.shen.cnlive.com:82"; 33 + /**
  34 + * 本机的名称
  35 + */
  36 + @Value("${SERVER_NAME}")
  37 + private String SERVER_NAME ;
35 38
36 - //登录入口  
37 - private static final String SERVICE_LOGIN = "http://test.shen.cnlive.com:82/users/login"; 39 + /**
  40 + * 登录入口
  41 + */
  42 + @Value("${SERVICE_LOGIN}")
  43 + private String SERVICE_LOGIN ;
38 44
39 - //登出  
40 - private static final String SERVICE_LOGINOUT = "http://test.shen.cnlive.com:82/users/logout"; 45 + /**
  46 + * 登出
  47 + */
  48 + @Value("${SERVICE_LOGINOUT}")
  49 + private String SERVICE_LOGINOUT ;
41 50
42 public static void main(String[] args) { 51 public static void main(String[] args) {
43 -// SpringApplication.run(ShenheApplication.class, args);  
44 SpringApplicationBuilder builder = new SpringApplicationBuilder(ShenheApplication.class); 52 SpringApplicationBuilder builder = new SpringApplicationBuilder(ShenheApplication.class);
45 builder.headless(true).run(args); 53 builder.headless(true).run(args);
46 // 设置Headless模式,linux系统下 54 // 设置Headless模式,linux系统下
@@ -81,6 +89,7 @@ public class ShenheApplication extends SpringBootServletInitializer { @@ -81,6 +89,7 @@ public class ShenheApplication extends SpringBootServletInitializer {
81 Map<String, String> initParameters = new HashMap<String, String>(); 89 Map<String, String> initParameters = new HashMap<String, String>();
82 initParameters.put("casServerLoginUrl", CAS_SERVER_LOGIN_URL); 90 initParameters.put("casServerLoginUrl", CAS_SERVER_LOGIN_URL);
83 initParameters.put("service", SERVICE_LOGIN); 91 initParameters.put("service", SERVICE_LOGIN);
  92 + System.out.println("==========================="+SERVICE_LOGIN);
84 initParameters.put("ignorePattern", "/api/*|/logging/*"); 93 initParameters.put("ignorePattern", "/api/*|/logging/*");
85 registration.setInitParameters(initParameters); 94 registration.setInitParameters(initParameters);
86 // 设定加载的顺序 95 // 设定加载的顺序
src/main/java/com/cnlive/shenhe/controller/UsersController.java
@@ -15,6 +15,7 @@ import org.jasig.cas.client.authentication.AttributePrincipal; @@ -15,6 +15,7 @@ import org.jasig.cas.client.authentication.AttributePrincipal;
15 import org.slf4j.Logger; 15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory; 16 import org.slf4j.LoggerFactory;
17 import org.springframework.beans.factory.annotation.Autowired; 17 import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.beans.factory.annotation.Value;
18 import org.springframework.stereotype.Controller; 19 import org.springframework.stereotype.Controller;
19 import org.springframework.ui.Model; 20 import org.springframework.ui.Model;
20 import org.springframework.web.bind.annotation.*; 21 import org.springframework.web.bind.annotation.*;
@@ -41,6 +42,15 @@ public class UsersController extends BaseController { @@ -41,6 +42,15 @@ public class UsersController extends BaseController {
41 @Autowired 42 @Autowired
42 SitesServiceImpl sitesService; 43 SitesServiceImpl sitesService;
43 44
  45 + /**
  46 + * 登录入口
  47 + */
  48 + @Value("${SERVICE_LOGIN}")
  49 + private String SERVICE_LOGIN ;
  50 +
  51 + @Value("${spring.localhost.url}")
  52 + private String redirecpageturl;
  53 +
44 @GetMapping(value = "/{id}") 54 @GetMapping(value = "/{id}")
45 @ResponseBody 55 @ResponseBody
46 public Object getTest(@PathVariable Integer id) { 56 public Object getTest(@PathVariable Integer id) {
@@ -51,13 +61,13 @@ public class UsersController extends BaseController { @@ -51,13 +61,13 @@ public class UsersController extends BaseController {
51 public String index(HttpServletRequest request) { 61 public String index(HttpServletRequest request) {
52 AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal(); 62 AttributePrincipal principal = (AttributePrincipal) request.getUserPrincipal();
53 if (CommonUtils.isNull(principal)) { 63 if (CommonUtils.isNull(principal)) {
54 - return "redirect:https://user.cnlive.com/OpenSSO2/login?service=http://shen.cnlive.com/users/login"; 64 + return "redirect:https://user.cnlive.com/OpenSSO2/login?service="+SERVICE_LOGIN;
55 } 65 }
56 //用户ID 66 //用户ID
57 String id = principal.getName(); 67 String id = principal.getName();
58 if (CommonUtils.isNotEmpty(id)) { 68 if (CommonUtils.isNotEmpty(id)) {
59 ShyUsers user = usersService.get(Integer.parseInt(id)); 69 ShyUsers user = usersService.get(Integer.parseInt(id));
60 - if (CommonUtils.isNotNull(user) && user.getState()) { 70 + if (CommonUtils.isNotNull(user) && user.getState()){
61 SessionUser sessionUser = new SessionUser(); 71 SessionUser sessionUser = new SessionUser();
62 sessionUser.setUserId(user.getUser_id()); 72 sessionUser.setUserId(user.getUser_id());
63 sessionUser.setSpid(Integer.parseInt(principal.getAttributes().get("new_sp_id").toString())); 73 sessionUser.setSpid(Integer.parseInt(principal.getAttributes().get("new_sp_id").toString()));
@@ -67,7 +77,7 @@ public class UsersController extends BaseController { @@ -67,7 +77,7 @@ public class UsersController extends BaseController {
67 sessionUser.setLogo(user.getUser_logo()); 77 sessionUser.setLogo(user.getUser_logo());
68 sessionUser.setMaster(user.getMaster()); 78 sessionUser.setMaster(user.getMaster());
69 request.getSession().setAttribute(SessionUser.SESSION_KEY, sessionUser); 79 request.getSession().setAttribute(SessionUser.SESSION_KEY, sessionUser);
70 - return "redirect:http://shen.cnlive.com/videos/page?video_title=&start_date=&end_date=&state=0&receive=0&video_priority="; 80 + return "redirect:"+redirecpageturl+"/videos/page?video_title=&start_date=&end_date=&state=0&receive=0&video_priority=";
71 } 81 }
72 } 82 }
73 return "page/error.html"; 83 return "page/error.html";
src/main/resources/application-dev.properties
@@ -71,6 +71,15 @@ platformValue=10011438 @@ -71,6 +71,15 @@ platformValue=10011438
71 #\u672C\u673A\u5730\u5740 71 #\u672C\u673A\u5730\u5740
72 spring.localhost.url=http://test.shen.cnlive.com 72 spring.localhost.url=http://test.shen.cnlive.com
73 73
  74 +#\u672C\u673A\u7684\u540D\u79F0
  75 +SERVER_NAME=http://test.shen.cnlive.com:82
  76 +
  77 +#\u767B\u5F55\u5165\u53E3
  78 +SERVICE_LOGIN=http://test.shen.cnlive.com:82/users/login
  79 +
  80 +#\u767B\u51FA
  81 +SERVICE_LOGINOUT=http://test.shen.cnlive.com:82/users/logout
  82 +
74 #\u62BD\u5E27\u5E38\u91CF 83 #\u62BD\u5E27\u5E38\u91CF
75 avsmple_appKey=1eac30dfbee311e7a2f0fa163e771cf9 84 avsmple_appKey=1eac30dfbee311e7a2f0fa163e771cf9
76 avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771cf9 85 avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771cf9
src/main/resources/application-test.properties 0 → 100644
  1 +server.port=80
  2 +
  3 +spring.datasource.url=jdbc:mysql://120.92.102.31:3306/new_shy?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false
  4 +spring.datasource.username=root
  5 +spring.datasource.password=M345sdfss4!
  6 +
  7 +spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
  8 +
  9 +server.tomcat.protocol_header=x-forwarded-proto
  10 +server.use-forward-headers=true
  11 +
  12 +spring.jpa.properties.hibernate.hbm2ddl.auto=update
  13 +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
  14 +spring.jpa.show-sql= true
  15 +
  16 +server.tomcat.uri-encoding=UTF-8
  17 +spring.http.encoding.charset=UTF-8
  18 +spring.http.encoding.enabled=true
  19 +spring.http.encoding.force=true
  20 +
  21 +spring.thymeleaf.mode=LEGACYHTML5
  22 +spring.thymeleaf.cache=false
  23 +#spring.thymeleaf.encoding=UTF-8
  24 +#spring.thymeleaf.content-type=text/html
  25 +#\u5F00\u53D1\u65F6\u5173\u95ED\u7F13\u5B58,\u4E0D\u7136\u6CA1\u6CD5\u770B\u5230\u5B9E\u65F6\u9875\u9762
  26 +
  27 +#\u6253\u5370\u8FD0\u884C\u65F6\u7684sql
  28 +#logging.level.com.cnlive.shenhe.mapper=debug
  29 +
  30 +mybatis.mapper-locations=classpath:mapper/*.xml
  31 +mybatis.type-aliases-package=com.cnlive.shenhe.entity
  32 +
  33 +#rabbitmq\u76F8\u5173\u914D\u7F6E
  34 +spring.rabbitmq.host=10.254.174.131
  35 +spring.rabbitmq.port=5672
  36 +spring.rabbitmq.username=test
  37 +spring.rabbitmq.password=p3~amKKt9
  38 +# \u5F00\u542F\u53D1\u9001\u786E\u8BA4
  39 +spring.rabbitmq.publisher-confirms=true
  40 +# \u5F00\u542F\u53D1\u9001\u5931\u8D25\u9000\u56DE
  41 +spring.rabbitmq.publisher-returns=true
  42 +# \u5F00\u542FACK
  43 +spring.rabbitmq.listener.direct.acknowledge-mode=manual
  44 +spring.rabbitmq.listener.simple.acknowledge-mode=manual
  45 +
  46 +#\u8BDD\u9898\u8BC4\u8BBA\u5206\u4EABh5
  47 +#topic_comment_shareH5=http://wjjh5test.cnlive.com/cnShareTopic.html?tid=
  48 +
  49 +#\u5173\u95EDspringboot\u63D0\u4F9B\u7684\u9ED8\u8BA4ico
  50 +spring.mvc.favicon.enabled = false
  51 +
  52 +#\u8BC4\u8BBA\u7981\u8A00\u548C\u89E3\u7981\u4F7F\u7528API
  53 +speak_comment=http://comment.cnlive.com/services/commentForTopic/muted
  54 +
  55 +#logback\u65E5\u5FD7\u4E2D\u4F7F\u7528
  56 +spring.application.name=cnlive_shenhe_test
  57 +spring.application.home=/usr/local/test_cnlive_shenhe/cnlive_shenhe/log
  58 +
  59 +sync_users_api=http://api.cnlive.com/open/api2/inner2/shenhe/getuser
  60 +sync_users_app_key=314a9dd4-a9b7-4c12-bbbe-1150a36491ae
  61 +
  62 +#\u7528\u6237\u4E91\u8BF7\u6C42\u67E5\u8BE2\u7528\u6237\u4FE1\u606F
  63 +queryUserByMobile=http://user.api.cnlive.com/CnliveM2/user/readUserByUserName.action?userName=
  64 +queryUserByUserId=http://user.api.cnlive.com/CnliveM2/user/readUserByUid.action?uid=
  65 +
  66 +#\u70B9\u64AD\u4E91\u9700\u8981\u7684\u5E38\u91CF
  67 +url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify
  68 +platformKey =AUDIT
  69 +platformValue=10011438
  70 +
  71 +#\u672C\u673A\u5730\u5740
  72 +spring.localhost.url=http://test.shen.cnlive.com
  73 +
  74 +#\u672C\u673A\u7684\u540D\u79F0
  75 +SERVER_NAME=http://test.shen.cnlive.com:80
  76 +
  77 +#\u767B\u5F55\u5165\u53E3
  78 +SERVICE_LOGIN=http://test.shen.cnlive.com:80/users/login
  79 +
  80 +#\u767B\u51FA
  81 +SERVICE_LOGINOUT=http://test.shen.cnlive.com:80/users/logout
  82 +
  83 +#\u62BD\u5E27\u5E38\u91CF
  84 +avsmple_appKey=1eac30dfbee311e7a2f0fa163e771cf9
  85 +avsmple_appSecret=28ce1e1fbee311e7a2f0fa163e771cf92ea58ebfbee311e7a2f0fa163e771cf9
  86 +avsmple_url=http://test.transcode.cnlive.com/api/request
  87 +avsmple_callback=http://test.shen.cnlive.com/api/avsample/callback
  88 +
  89 +#\u540C\u6B65\u76F4\u64AD\u4E91\u4FE1\u606F
  90 +live_url=http://test.bc.cnlive.com/bokong/activity/activityShenHe
  91 +
  92 +#\u90AE\u4EF6\u4F7F\u7528\u5E38\u91CF
  93 +email_app_id=769_jetja50p18
  94 +email_app_key=ad101b9152817a79b5c33c3617b96ff91385096ff3b4ba
  95 +email_send_URL=http://sms.cnlive.com/CnliveM3/email/sendMoreVarEmail.action
  96 +
  97 +#\u62BD\u5E27\u5B58\u653Ebucket\u548C\u57DF\u540D
  98 +qn_bucket=cnlivetest
  99 +qn_domain=http://test.qnvod.cnlive.com
  100 +ks_bucket=cnlive-test
  101 +ks_domain=http://test.wideo.cnlive.com
  102 +
  103 +#\u56FE\u7247\u5B58\u653E\u6839\u8DEF\u5F84
  104 +desdir=shen
  105 +yiDun_audio_callback=http://test.shen.cnlive.com/api/audio/
  106 +cms_getVideoAndLiveId=http://cmstest.cnlive.com:8768/contentApi/getBeanByIdcallbackAudio