index_h5.action.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 index_h5Module extends baseModule{
  10. //H5版首页
  11. public function index(){
  12. $root = array();
  13. $sex = intval($_REQUEST['sex']);//性别 0:全部, 1-男,2-女
  14. $cate_id = intval($_REQUEST['cate_id']);//话题id
  15. $city = strim($_REQUEST['city']);//城市(空为:热门)
  16. if($city=='热门' || $city=='null'){
  17. $city = '';
  18. }
  19. if ($cate_id ==0){
  20. //首页 轮播
  21. $root['banner'] = load_auto_cache("banner_list");
  22. if($root['banner']==false){
  23. $root['banner'] = array();
  24. }
  25. }else{
  26. //主题相关内容
  27. $cate = load_auto_cache("cate_id",array('id'=>$cate_id));
  28. if ($cate['url'] != '' && $cate['image'] != ''){
  29. $root['banner'] = $cate['banner'];
  30. $root['cate'] = $cate;
  31. }
  32. }
  33. $root['sex'] = $sex;//
  34. $root['cate_id'] = $cate_id;//
  35. $root['city'] = $city;//
  36. $m_config = load_auto_cache("m_config");//初始化手机端配置
  37. $sdk_version_name = strim($_REQUEST['sdk_version_name']);
  38. $dev_type = strim($_REQUEST['sdk_type']);
  39. if($dev_type == 'ios' && $m_config['ios_check_version'] != '' && $m_config['ios_check_version'] == $sdk_version_name){
  40. $list = $this->check_video_list("select_video_check",array('sex_type'=>$sex,'area_type'=>$city,'cate_id'=>$cate_id));
  41. }else{
  42. $list = load_auto_cache("select_video",array('sex_type'=>$sex,'area_type'=>$city,'cate_id'=>$cate_id));
  43. }
  44. if (defined('SHOW_IS_GAMING') && SHOW_IS_GAMING) {
  45. fanwe_require(APP_ROOT_PATH . 'mapi/lib/redis/VideoRedisService.php');
  46. $video_redis = new VideoRedisService();
  47. foreach ($list as $key => $value) {
  48. $live_in = $video_redis->getOne_db(intval($value['room_id']), 'live_in') == 1;
  49. $list[$key]['is_gaming'] = intval($video_redis->getOne_db(intval($value['room_id']), 'game_log_id')) && $live_in ? 1 : 0;
  50. }
  51. }
  52. $root['list'] = $list;
  53. $root['status'] = 1;
  54. $root['has_next'] = 0;
  55. $root['page'] = 1;//
  56. $root['init_version'] = intval($m_config['init_version']);//手机端配置版本号
  57. api_ajax_return($root);
  58. }
  59. //获取主题
  60. public function theme(){
  61. $m_config = load_auto_cache("m_config");//初始化手机端配置
  62. $theme = intval($m_config['app_theme']);
  63. if($theme == 1){//1: green
  64. $root['layout'] = 'green';
  65. }else {//0或其他: default
  66. $root['layout'] = 'default';
  67. }
  68. ajax_return($root);
  69. }
  70. //审核版本读取的列表
  71. function check_video_list($type='',$date=array()){
  72. $list = '';
  73. if($type!=''){
  74. if($type=='new_video_check'){
  75. $list = load_auto_cache("new_video_check");
  76. }else{
  77. $list = load_auto_cache("select_video_check",$date);
  78. }
  79. }
  80. return $list;
  81. }
  82. }