weibo.action.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <?php
  2. //动态详情页
  3. class weiboCModule extends baseCModule
  4. {
  5. //动态详情
  6. public function index()
  7. {
  8. fanwe_require(APP_ROOT_PATH.'mapi/xr/core/common.php');
  9. $weibo_id = intval($_REQUEST['weibo_id']);
  10. $is_paid = intval($_REQUEST['is_paid']);
  11. $page = intval($_REQUEST['page'])?intval($_REQUEST['page']):1;
  12. $page_size =20;
  13. if($GLOBALS['user_info']){
  14. $user_id = $GLOBALS['user_info']['id'];
  15. }else{
  16. $user_id = 0;
  17. }
  18. if (defined('OPEN_SVIDEO_MODULE') && OPEN_SVIDEO_MODULE == 1) {
  19. $root = load_auto_cache("svideo_select_weibo_info",
  20. array('page' => $page, 'weibo_id' => $weibo_id, 'is_paid' => $is_paid));
  21. $sql = "select count(*) from " . DB_PREFIX . "weibo_comment where weibo_id = " . $weibo_id . " and type = 3 and user_id = " . $user_id;
  22. $root['info']['has_unlike'] = $GLOBALS['db']->getOne($sql) ? 1 : 0; //是否踩过
  23. $sql = "select count(*) from " . DB_PREFIX . "qk_svideo_favor f where user_id = {$user_id} and weibo_id = {$weibo_id}";
  24. $root['info']['has_favor'] = $GLOBALS['db']->getOne($sql) ? 1 : 0; //是否踩过
  25. } else {
  26. $root = load_auto_cache("select_weibo_info",
  27. array('page' => $page, 'weibo_id' => $weibo_id, 'is_paid' => $is_paid));
  28. }
  29. for($i=0;$i<count($root['comment_list']);$i++)
  30. {
  31. $id = $root['comment_list'][$i]['user_id'];
  32. $root['comment_list'][$i]['v_icon'] = $GLOBALS['db']->getOne("select v_icon from " . DB_PREFIX . "user where id = " .$id);
  33. $root['comment_list'][$i]['nick_name'] = emoji_decode($root['comment_list'][$i]['nick_name']);
  34. $root['comment_list'][$i]['to_nick_name'] = emoji_decode($root['comment_list'][$i]['to_nick_name']);
  35. $root['comment_list'][$i]['content'] = emoji_decode($root['comment_list'][$i]['content']);
  36. }
  37. $root['info']['nick_name'] = emoji_decode($root['info']['nick_name']);
  38. //获取认证图标
  39. $sql = "select v_icon from " . DB_PREFIX . "user where id = " . $root['info']['user_id'];
  40. $root['info']['v_icon'] = $GLOBALS['db']->getOne($sql);
  41. $info = $root['info'];
  42. $root['page'] = $page;
  43. $root['is_admin'] = 0; //是否可以管理评论
  44. $root['is_reply_but'] = 0;//是否可以评论动态
  45. $root['is_reply_comment_but'] = 0; //是否可以回复评论
  46. $root['is_show_weibo_report'] = 0; //是否显示举报动态
  47. $root['is_show_user_report'] = 0; //是否显示举报动态
  48. $root['is_show_user_black'] = 0; // 是否显示拉黑用户
  49. $root['is_show_top'] = 0; // 是否显示置顶
  50. $root['is_show_deal_weibo'] = 0; // 是否显示删除动态
  51. //$root['is_show_deal_comment'] = 0; // 是否显示删除评论
  52. $root['info']['has_digg'] =0; //是否点赞过
  53. if($info['price']){
  54. $is_pay =0;
  55. }
  56. if($user_id){
  57. //判断是否为本人
  58. $to_user_id = $info['user_id'];
  59. if($user_id==$to_user_id){
  60. $root['is_admin'] = 1;
  61. $root['is_show_deal_weibo'] = 1;
  62. $root['is_show_top'] = 1;
  63. $is_pay = 1;
  64. }else{
  65. $root['is_show_weibo_report'] = 1;
  66. $root['is_show_user_report'] = 1;
  67. $root['is_show_user_black'] = 1;
  68. $is_pay = 1;
  69. if($info['price']){
  70. if(count($info['images'])>0){
  71. $payed = $GLOBALS['db']->getOne("select id from ".DB_PREFIX."payment_notice where user_id = ".$user_id." and type in (11,13,14) and is_paid = 1 and order_id = ".$info['weibo_id']);
  72. if($payed>0){
  73. $is_pay =1;
  74. }else{
  75. $is_pay =0;
  76. }
  77. }
  78. }
  79. }
  80. $root['is_reply_but'] = 1;
  81. $root['is_reply_comment_but'] = 1;
  82. //判断是否点赞过
  83. if(in_array($user_id,$root['digg_user_list'])){
  84. $root['info']['has_digg'] =1;
  85. }
  86. }
  87. //获取图片
  88. if(count($info['images'])>0){
  89. $images = $info['images'];
  90. foreach($images as $k1=>$v1){
  91. if(is_object($v1)){
  92. $v1 = (array)$v1;
  93. }
  94. if($v1['url']){
  95. $is_model = $v1['is_model'];
  96. $images[$k1]['orginal_url'] = '';
  97. $info_type = $info['type'].'_info';
  98. if($info['price']&&in_array($info['type'],$this->image_pay_type)){
  99. if($is_model){
  100. if($is_pay){
  101. $images[$k1]['url'] = deal_weio_image($v1['url'],$info_type);
  102. $images[$k1]['is_model'] = 0;
  103. $images[$k1]['orginal_url'] = get_spec_image($v1['url']);
  104. }else{
  105. $images[$k1]['url'] = deal_weio_image($v1['url'],$info_type,1);
  106. }
  107. }else{
  108. $images[$k1]['url'] = deal_weio_image($v1['url'],$info_type);
  109. $images[$k1]['orginal_url'] = get_spec_image($v1['url']);
  110. }
  111. }else{
  112. $images[$k1]['url'] = deal_weio_image($v1['url'],$info_type);
  113. $images[$k1]['is_model'] = 0;
  114. $images[$k1]['orginal_url'] = get_spec_image($v1['url']);
  115. }
  116. }
  117. }
  118. $root['info']['images'] = $images;
  119. }
  120. $root['user_id'] = $user_id;
  121. $root['invite_info'] = $this->get_invite_info();
  122. //整理传递分享链接参数
  123. $root['invite_info']['imageUrl'] = $root['info']['photo_image'];
  124. $root['invite_info']['headImage'] = $root['info']['head_image'];
  125. $root['invite_info']['videoUrl'] = $root['info']['video_url'];
  126. if(count($root['comment_list'])==$page_size){
  127. $root['has_next'] = 1;
  128. }else{
  129. $root['has_next'] = 0;
  130. }
  131. $root['status'] = 1;
  132. $root['error'] = '';
  133. $root['app_down_url'] = SITE_DOMAIN_DOWNLOAD."/appdown.php";
  134. unset($root['info']['data']);
  135. unset($root['digg_user_list']);
  136. if($is_paid){
  137. $root['info']['status'] = 1;
  138. $pay_list = $root['info'];
  139. api_ajax_return($pay_list);
  140. }else{
  141. api_ajax_return($root);
  142. }
  143. }
  144. public function get_invite_info($distribution_rate,$invite_image,$app_name = ''){
  145. $m_config = load_auto_cache("m_config");//初始化手机端配置
  146. $invite_url = SITE_DOMAIN.'/wap/xr/index.html#/activeIndex?user_id='.$GLOBALS['user_info']['id'];
  147. $invite_image = $m_config['weibo_distribution_img'];
  148. $invite_info['title'] = '【推荐】《'.$m_config['program_title'].'》';
  149. $nick_name = emoji_decode($GLOBALS['user_info']['nick_name']);
  150. $invite_info['content'] = $nick_name.' 请您加入 '.$app_name."APP,让您毫不费力地发照片挣红包,还有美女帅哥排队等您领!";
  151. $invite_info['imageUrl'] = empty($invite_image) ? $m_config['app_logo'] : $invite_image;
  152. $invite_info['clickUrl'] = $invite_url;
  153. return $invite_info;
  154. }
  155. //点赞列表
  156. public function digg_list(){
  157. $weibo_id = intval($_REQUEST['weibo_id']);
  158. $page = intval($_REQUEST['page'])?intval($_REQUEST['page']):1;
  159. $page_size =20;
  160. $list = load_auto_cache("select_weibo_digg",array('page'=>$page,'page_size'=>$page_size,'weibo_id'=>$weibo_id));
  161. if(count($list)==$page_size){
  162. $root['has_next'] = 1;
  163. }else{
  164. $root['has_next'] = 0;
  165. }
  166. $root['page'] = $page;
  167. $root['status'] = 1;
  168. $root['error'] = '';
  169. $root['list'] = $list;
  170. api_ajax_return($root);
  171. }
  172. //商品详情
  173. public function goods_info(){
  174. $weibo_id = intval($_REQUEST['weibo_id']);
  175. $goods_info = $GLOBALS['db']->getRow("select id as weibo_id,price,data as images,photo_image,red_count,content,create_time from ".DB_PREFIX."weibo where id = ".$weibo_id." and type = 'goods'");
  176. if(!$goods_info){
  177. $root['error'] = "商品不存在!";
  178. $root['status'] = 0;
  179. api_ajax_return($root);
  180. }
  181. $root = array(
  182. 'status'=>1,
  183. 'error'=>''
  184. );
  185. if($goods_info['photo_image']){
  186. $goods_info['photo_image'] = deal_weio_image($goods_info['photo_image'],'goods_info');
  187. }
  188. if(!$goods_info['images']){
  189. $root['error'] = "商品图片不存在!";
  190. $root['status'] = 0;
  191. api_ajax_return($root);
  192. }
  193. $goods_info['images'] = unserialize($goods_info['images']);
  194. foreach($goods_info['images'] as $k=>$v){
  195. if($v){
  196. $goods_info['images'][$k]['url'] = get_spec_image($v['url']);
  197. }
  198. }
  199. $root['goods'] = $goods_info;
  200. api_ajax_return($root);
  201. }
  202. public function add_video_count(){
  203. if(!$GLOBALS['user_info']){
  204. $root['error'] = "用户未登陆,请先登陆.";
  205. $root['status'] = 0;
  206. api_ajax_return($root);
  207. }
  208. $weibo_id = intval($_REQUEST['weibo_id']);
  209. $weibo = $GLOBALS['db']->getRow("select id,video_count from ".DB_PREFIX."weibo where id = $weibo_id and type ='video'");
  210. if(!$weibo){
  211. $root['error'] = "该动态不存在!.";
  212. $root['status'] = 0;
  213. api_ajax_return($root);
  214. }
  215. $re = $GLOBALS['db']->query("update ".DB_PREFIX."weibo set video_count=video_count+1 where id = $weibo_id");
  216. $root['error'] = "";
  217. $root['status'] = 1;
  218. $video_count = $GLOBALS['db']->getOne("select video_count from ".DB_PREFIX."weibo where id = $weibo_id ");
  219. $root['video_count'] = intval($video_count);
  220. api_ajax_return($root);
  221. }
  222. }
  223. ?>