WeiboConfAction.class.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维直播系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class WeiboConfAction extends CommonAction{
  10. //检查模块开关是否开启
  11. public function check_Module(){
  12. $m_config = load_auto_cache("m_config");
  13. if($m_config['has_dirty_words']==0){
  14. $this->redirect('APP_ROOT+'.get_manage_url_name().'?m=Conf&a=mobile&');
  15. }
  16. }
  17. public function mobile()
  18. {
  19. $config = M("MConfig")->order("sort asc")->findAll();
  20. $unset_group_id = array(
  21. 'PC端设置','付费直播配置','方维云','应用设置','排序权重'
  22. );
  23. $unset_code_array = array(
  24. 'profit_ratio','login_send_score','upgrade_level','share_ticket','open_share_ticket','ticket_exchange_rate',
  25. 'authent_alipay','alipay_partner','alipay_key','open_vip','open_room_hide',
  26. 'society_public_rate','society_user_rate','coin_exchange_rate','full_group_id','on_line_group_id','live_pay_max','live_pay_min',
  27. 'live_pay_scene_max','live_pay_scene_min','beauty_close','mic_max_num','video_type','register_gift','register_gift_diamonds',
  28. 'register_gift_coins','iap_recharge','diamonds_rate','exchange_rate','short_name','ticket_name','must_cate','must_authentication',
  29. 'rank_day','rank_month','rank_all','rank_day_user','is_limit_time','is_limit_time_start','is_limit_time_end','join_room_remind_limit',
  30. 'join_room_limit','has_private_chat','tim_sdkappid','tim_identifier','tim_identifier','vodset_app_id','qcloud_bizid','video_resolution_type',
  31. 'has_save_video',
  32. );
  33. foreach($config as $k=>$v){
  34. if(in_array($v['group_id'],$unset_group_id)){
  35. unset($config[$k]);
  36. continue;
  37. }
  38. if(in_array($v['code'],$unset_code_array)){
  39. unset($config[$k]);
  40. continue;
  41. }
  42. if($v['type']==2){
  43. $v['val'] =get_spec_image($v['val']);
  44. }
  45. if($v['type']==4){
  46. $v['value_scope']=explode(',',$v['value_scope']);
  47. $v['title_scope']=explode(',',$v['title_scope']);
  48. }else{
  49. $v['value_scope']='';
  50. }
  51. $conf[$v['group_id']][] = $v;
  52. }
  53. $is_limit_time_h = array("01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24");
  54. $this->assign("is_limit_time_h",$is_limit_time_h);
  55. $this->assign("conf",$conf);
  56. $this->assign("domain_url",get_domain());
  57. $this->display();
  58. }
  59. public function savemobile()
  60. {
  61. foreach($_POST as $k=>$v)
  62. {
  63. if($k=='rank_day'||$k=='rank_month'||$k=='rank_all'||$k=='rank_day_user'){
  64. $result = $this->check_rank_time(array('name'=>$k,'value'=>strim($v)));
  65. if($result['status']==0){
  66. $this->error($result['error']);
  67. }
  68. }
  69. if((defined('OPEN_LIVE_PAY')&&OPEN_LIVE_PAY==1)&&($k=='live_pay_num'||$k=='live_pay_rule'||$k=='live_pay_fee'||$k=='live_count_down'||$k=='ticket_to_rate'||$k=='uesddiamonds_to_score')){
  70. if(floor($v)!=$v){
  71. $this->error("付费直播的参数必须为整数");
  72. }
  73. }
  74. if((defined('OPEN_LIVE_PAY')&&OPEN_LIVE_PAY==1)&&($k=='live_pay_max'||$k=='live_pay_min'||$k=='live_pay_scene_max'||$k=='live_pay_scene_min')){
  75. if(floor($v)!=$v){
  76. $this->error("付费直播的收费参数必须为整数");
  77. }
  78. }
  79. if(defined('OPEN_LIVE_PAY')&&OPEN_LIVE_PAY==1){
  80. if((!defined('LIVE_PAY_TIME')||LIVE_PAY_TIME!=1)){
  81. if(intval($_POST['live_pay_min'])<1){
  82. $this->error("按时收费最低收费参数不能小于1");
  83. }
  84. if(intval($_POST['live_pay_max'])<intval($_POST['live_pay_min'])){
  85. $this->error("按时收费最低收费参数必须小于按时收费最高收费参数");
  86. }
  87. }
  88. if(defined('LIVE_PAY_SCENE')&&LIVE_PAY_SCENE==1){
  89. if(intval($_POST['live_pay_scene_min'])<1){
  90. $this->error("按场收费最低收费参数不能小于1");
  91. }
  92. if(intval($_POST['live_pay_scene_max'])<intval($_POST['live_pay_scene_min'])){
  93. $this->error("按场收费最低收费参数必须小于按场收费最高收费参数");
  94. }
  95. }
  96. }
  97. M("MConfig")->where("code='".$k."'")->setField("val",trim($v));
  98. }
  99. clear_auto_cache("m_config");
  100. $log_info = "手机端配置";
  101. save_log($log_info.L("UPDATE_SUCCESS"),1);
  102. $this->success("保存成功");
  103. }
  104. //脏字库
  105. public function dirty_words(){
  106. $this->check_Module();
  107. //调用tim
  108. require_once(APP_ROOT_PATH.'system/tim/TimApi.php');
  109. $api = createTimAPI();
  110. $ret = $api->openim_dirty_words_get();
  111. $vo = array();
  112. $vo['title'] = '脏字库';
  113. $vo['content'] = implode(',',$ret['DirtyWordsList']);
  114. $this->assign ( 'vo', $vo );
  115. $this->display ();
  116. }
  117. //检查排行榜缓存时间
  118. function check_rank_time($data){
  119. $result = array('status'=>1,'error'=>'');
  120. //日榜
  121. if($data['name']=='rank_day'&&$data['value'] <1){
  122. $result['status'] = 0;
  123. $result['error'] = '总排行日榜缓存时间,不得低1800秒';
  124. }
  125. //总排行月榜
  126. if($data['name']=='rank_month'&&$data['value'] <28800){
  127. $result['status'] = 0;
  128. $result['error'] = '总排行月榜缓存时间,不得低28800秒';
  129. }
  130. //总排行总榜
  131. if($data['name']=='rank_all'&&$data['value'] <86400){
  132. $result['status'] = 0;
  133. $result['error'] = '总排行总榜缓存时间,不得低86400秒';
  134. }
  135. //主播日排行榜
  136. if($data['name']=='rank_day_user'&&$data['value'] <300){
  137. $result['status'] = 0;
  138. $result['error'] = '主播日排行榜缓存时间,不得低300秒';
  139. }
  140. return $result;
  141. }
  142. }
  143. ?>