index.action.php 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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 indexCModule extends baseCModule
  10. {
  11. //首页-美女列表
  12. public function index()
  13. {
  14. $page = intval($_REQUEST['page'])?intval($_REQUEST['page']):1;
  15. $m_config = load_auto_cache("m_config");//初始化手机端配置
  16. if($m_config['weibo_list_label']){
  17. $weibo_list_label = explode(',',$m_config['weibo_list_label']);
  18. }else{
  19. $weibo_list_label = array();
  20. }
  21. $root = array(
  22. 'first_label'=>$m_config['weibo_first_label'],
  23. 'list_label'=>$weibo_list_label,
  24. 'has_next'=>1,
  25. 'page'=>$page,
  26. 'status'=>1,
  27. 'error'=>''
  28. );
  29. $root['invite_info'] = $this->get_invite_info($m_config['distribution_rate'],$m_config['weibo_distribution_img'],$m_config['program_title']);
  30. $page_size =20;
  31. if($page>1){
  32. $list = load_auto_cache("select_user_index",array('page'=>$page,'page_size'=>$page_size));
  33. $root['list'] = $list;
  34. unset($root['first']);
  35. }else{
  36. $list = load_auto_cache("select_user_index",array('page'=>1,'page_size'=>$page_size));
  37. if(count($list)>6){
  38. $root['first'] = array_slice($list,0,6,true);
  39. $root['list'] = array_slice($list,6);
  40. }else{
  41. $root['first'] = $list;
  42. $root['list'] = array();
  43. }
  44. $root['banner'] = load_auto_cache("banner_list_xr",array('type'=>10));
  45. if($root['banner']==false){
  46. $root['banner'] = array();
  47. }
  48. }
  49. if(count($list)==$page_size){
  50. $root['has_next'] = 1;
  51. }else{
  52. $root['has_next'] = 0;
  53. }
  54. api_ajax_return($root);
  55. }
  56. public function get_invite_info($distribution_rate,$invite_image,$app_name = ''){
  57. if($GLOBALS['user_info'])
  58. {
  59. // $invite_url = url('live#show', array('user_id' => $GLOBALS['user_info']['id'],'itype'=>'xr'));
  60. $invite_url = SITE_DOMAIN.'/wap/xr/index.html#/activeIndex?user_id='.$GLOBALS['user_info']['id'];
  61. //$invite_url = SITE_DOMAIN.'/wap/index.php?ctl=distribution&act=init_register&user_id='.$GLOBALS['user_info']['id'];
  62. $invite_info = array(
  63. 'invite_url'=>$invite_url, //用户推荐链接
  64. 'invite_image'=>$invite_image, //推荐图片
  65. 'sharing_info' =>'他(她)的每一笔消费,您都分成'.intval($distribution_rate) .'%',
  66. );
  67. }else{
  68. $invite_info = array(
  69. 'invite_url'=>'', //用户推荐链接
  70. 'invite_image'=>$invite_image, //推荐图片
  71. 'sharing_info' => intval($distribution_rate) .'%',
  72. );
  73. }
  74. $invite_info['title'] = '【推荐】《'.$app_name.'》';
  75. $invite_info['content'] = $GLOBALS['user_info']['nick_name'].' 请您加入 '.$app_name."APP,让您毫不费力地发照片挣红包,还有美女帅哥排队等您铃!";
  76. $invite_info['imageUrl'] = $invite_image;
  77. $invite_info['clickUrl'] = $invite_url;
  78. return $invite_info;
  79. }
  80. //首页-写真列表
  81. public function select_photo(){
  82. if(!$GLOBALS['user_info']){
  83. $root['error'] = "用户未登陆,请先登陆.";
  84. $root['status'] = 2;
  85. api_ajax_return($root);
  86. }
  87. $page = intval($_REQUEST['page'])?intval($_REQUEST['page']):1;
  88. $m_config = load_auto_cache("m_config");//初始化手机端配置
  89. if($m_config['weibo_list_label']){
  90. $weibo_list_label = explode(',',$m_config['weibo_list_label']);
  91. }else{
  92. $weibo_list_label = array();
  93. }
  94. $root = array(
  95. 'first_label'=>$m_config['weibo_first_label'],
  96. 'list_label'=>$weibo_list_label,
  97. 'has_next'=>1,
  98. 'page'=>$page,
  99. 'status'=>1,
  100. 'error'=>''
  101. );
  102. // if(!$GLOBALS['user_info']){
  103. // $root['user_login_status'] = 0;
  104. // }else{
  105. // $root['user_login_status'] = 1;
  106. // }
  107. $root['invite_info'] = $this->get_invite_info($m_config['distribution_rate'],$m_config['weibo_distribution_img']);
  108. $page_size =20;
  109. $list = load_auto_cache("select_weibo_index",array('page'=>$page,'page_size'=>$page_size,'type'=>'photo'));
  110. if($page>1){
  111. $root['list'] = $list;
  112. unset($root['first']);
  113. }else{
  114. if(count($list)>6){
  115. $root['first'] = array_slice($list,0,6,true);
  116. $root['list'] = array_slice($list,6);
  117. }else{
  118. $root['first'] = $list;
  119. $root['list'] = array();
  120. }
  121. $root['banner'] = load_auto_cache("banner_list_xr",array('type'=>11));
  122. if($root['banner']==false){
  123. $root['banner'] = array();
  124. }
  125. }
  126. if(count($list)==$page_size){
  127. $root['has_next'] = 1;
  128. }else{
  129. $root['has_next'] = 0;
  130. }
  131. api_ajax_return($root);
  132. }
  133. //首页-视频列表
  134. public function select_video(){
  135. $page = intval($_REQUEST['page'])?intval($_REQUEST['page']):1;
  136. $m_config = load_auto_cache("m_config");//初始化手机端配置
  137. if($m_config['weibo_list_label']){
  138. $weibo_list_label = explode(',',$m_config['weibo_list_label']);
  139. }else{
  140. $weibo_list_label = array();
  141. }
  142. $root = array(
  143. 'first_label'=>$m_config['weibo_first_label'],
  144. 'list_label'=>$weibo_list_label,
  145. 'has_next'=>1,
  146. 'page'=>$page,
  147. 'status'=>1,
  148. 'error'=>''
  149. );
  150. $page_size =20;
  151. $list = load_auto_cache("select_weibo_index",array('page'=>$page,'page_size'=>$page_size,'type'=>'video'));
  152. $root['list'] = $list;
  153. if(count($list)==$page_size){
  154. $root['has_next'] = 1;
  155. }else{
  156. $root['has_next'] = 0;
  157. }
  158. api_ajax_return($root);
  159. }
  160. //获取美女列表
  161. public function get_user_list(){
  162. $root['list'] = load_auto_cache("select_user_index",array('page'=>1));
  163. echo json_encode($root);
  164. }
  165. //获取写真列表
  166. public function get_photo_list(){
  167. $root['banner'] = load_auto_cache("banner_list_xr",array('type'=>11));
  168. var_dump($root);
  169. }
  170. //获取视频列表
  171. public function get_video_list(){
  172. echo $this->time_tran('2017-03-15 20:17:00');
  173. }
  174. //热门搜索
  175. public function hot_search(){
  176. $m_config = load_auto_cache("m_config");//初始化手机端配置
  177. if($m_config['weibo_list_label']){
  178. $weibo_list_label = explode(',',$m_config['weibo_list_label']);
  179. }else{
  180. $weibo_list_label = array(
  181. '鲜肉','客服妹妹','松果儿','赵雅依'
  182. );
  183. }
  184. $root = array(
  185. 'first_label'=>$m_config['weibo_first_label'],
  186. 'list_label'=>$weibo_list_label,
  187. 'status'=>1,
  188. 'error'=>''
  189. );
  190. api_ajax_return($root);
  191. }
  192. public function time_tran($the_time)
  193. {
  194. $now_time = to_date(NOW_TIME,"Y-m-d H:i:s");
  195. $now_time = to_timespan($now_time);
  196. $show_time = to_timespan($the_time);
  197. $dur = $now_time - $show_time;
  198. if ($dur < 0) {
  199. return $the_time;
  200. } else {
  201. if ($dur < 60) {
  202. return $dur . '秒前';
  203. } else {
  204. if ($dur < 3600) {
  205. return floor($dur / 60) . '分钟前';
  206. } else {
  207. if ($dur < 86400) {
  208. return floor($dur / 3600) . '小时前';
  209. } else {
  210. if ($dur < 2592000) {//30天内
  211. return floor($dur / 86400) . '天前';
  212. } else {
  213. return to_date($show_time,"Y-m-d");;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. ?>