QuanController.class.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <?php
  2. /**
  3. * 播播资源
  4. *
  5. * ==========================================================================
  6. * @link https://www.ttbobo.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.ttbobo.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Controller;
  15. use Admin\Model\BlogModel;
  16. class QuanController extends CommonController{
  17. protected function _initialize(){
  18. parent::_initialize();
  19. $this->breadcrumb1='营销活动';
  20. $this->breadcrumb2='动态圈子';
  21. }
  22. public function del_post_comment(){
  23. $id = I('get.id', 0);
  24. $group_lzl_reply = M('group_lzl_reply')->where( array('id'=>$id) )->find();
  25. M('group_lzl_reply')->where( array('id'=>$id) )->delete();
  26. $res = M('group_post')->where( array('id' => $group_lzl_reply['post_id']) )->setDec('reply_count',1);
  27. $http_refer = $_SERVER['HTTP_REFER'];
  28. if($res) {
  29. $return = array(
  30. 'status'=>'success',
  31. 'message'=>'删除成功',
  32. 'jump'=>$http_refer
  33. );
  34. } else {
  35. $return = array(
  36. 'status'=>'fail',
  37. 'message'=>'删除失败',
  38. 'jump'=>$http_refer
  39. );
  40. }
  41. $this->osc_alert($return);
  42. }
  43. public function del_post()
  44. {
  45. $id = I('get.id', 0);
  46. $rs = M('group_post_fav')->where( array('post_id'=>$id) )->delete();
  47. M('group_lzl_reply')->where( array('post_id'=>$id) )->delete();
  48. $res = M('group_post')->where( array('id'=>$id) )->delete();
  49. $http_refer = $_SERVER['HTTP_REFER'];
  50. if($res) {
  51. $return = array(
  52. 'status'=>'success',
  53. 'message'=>'删除成功',
  54. 'jump'=>$http_refer
  55. );
  56. } else {
  57. $return = array(
  58. 'status'=>'fail',
  59. 'message'=>'删除失败',
  60. 'jump'=>$http_refer
  61. );
  62. }
  63. $this->osc_alert($return);
  64. }
  65. public function coments()
  66. {
  67. //post_id/10
  68. $post_id = I('get.post_id');
  69. $model=new BlogModel();
  70. $search = array('post_id' => $post_id);
  71. $data=$model->show_quan_lzy_page($search);
  72. $this->assign('empty',$data['empty']);// 赋值数据集
  73. $this->assign('list',$data['list']);// 赋值数据集
  74. $this->assign('page',$data['page']);// 赋值分页输出
  75. $this->display('comment');
  76. }
  77. public function index(){
  78. $model=new BlogModel();
  79. $group_info = M('group')->where( array('seller_id' => SELLERUID) )->find();
  80. $has_group = true;
  81. $data = array();
  82. if( empty($group_info) )
  83. {
  84. $search = array('group_id' => 0);
  85. $data=$model->show_quan_page($search);
  86. }else{
  87. $search = array('group_id' => $group_info['id']);
  88. $data=$model->show_quan_page($search);
  89. }
  90. $this->has_group = $has_group;
  91. $this->assign('empty',$data['empty']);// 赋值数据集
  92. $this->assign('list',$data['list']);// 赋值数据集
  93. $this->assign('page',$data['page']);// 赋值分页输出
  94. $this->type = -1;
  95. $this->display();
  96. }
  97. public function config()
  98. {
  99. if(IS_POST){
  100. $save_data = array();
  101. $save_data['title'] = I('post.title');
  102. $save_data['quan_logo'] = I('post.quan_logo');
  103. $save_data['quan_banner'] = I('post.quan_banner');
  104. $save_data['quan_share'] = I('post.quan_share');
  105. $save_data['quan_share_desc'] = I('post.quan_share_desc');
  106. $save_data['status'] = I('post.status');
  107. $save_data['member_ids'] = I('post.member_ids');
  108. $save_data['is_synchro'] = I('post.is_synchro');
  109. $save_data['limit_send_member'] = I('post.limit_send_member');
  110. M('group')->where( array('seller_id' => SELLERUID) )->save($save_data);
  111. $return = array(
  112. 'status'=>'success',
  113. 'message'=>'修改成功',
  114. 'jump'=>U('Quan/config')
  115. );
  116. $this->osc_alert($return);
  117. }
  118. $data = M('group')->where( array('seller_id' => SELLERUID) )->find();
  119. $member_data = array();
  120. if( empty($data) )
  121. {
  122. $this->_new_quanzi();
  123. $data = M('seller')->where( array('s_id' => SELLERUID) )->find();
  124. }else{
  125. $member_ids = $data['member_ids'];
  126. if( !empty($member_ids) )
  127. {
  128. $member_data = M('member')->field('member_id,uname')->where( array('member_id' => array('in', $member_ids) ) )->select();
  129. }
  130. }
  131. $this->member_data = $member_data;
  132. $this->type = 1;
  133. $this->data = $data;
  134. $this->display();
  135. }
  136. private function _new_quanzi()
  137. {
  138. $group_data = array();
  139. $group_data['seller_id'] = SELLERUID;
  140. $group_data['title'] = '';
  141. $group_data['post_count'] = 0;
  142. $group_data['status'] = 0;
  143. $group_data['member_count'] = 0;
  144. $group_data['quan_share'] = '';
  145. $group_data['quan_logo'] = '';
  146. $group_data['quan_banner'] = '';
  147. $group_data['quan_share_desc'] = '';
  148. $group_data['create_time'] = time();
  149. M('group')->add($group_data);
  150. }
  151. public function save_config()
  152. {
  153. $this->action=U('Seller/edit');
  154. }
  155. function showdetail(){
  156. $blog_id = I('get.blog_id',0,'intval');
  157. $blog_seller_order = M('blog_seller_order')->where( array('blog_id' =>$blog_id,'seller_id' =>SELLERUID) )->find();
  158. if( empty($blog_seller_order) )
  159. {
  160. $this->blog_not_count = $this->blog_not_count-1;
  161. M('blog_seller_order')->add(array('blog_id' =>$blog_id,'seller_id' =>SELLERUID,'addtime' =>time()));
  162. }
  163. $blog_info = M('blog')->where( array('blog_id' => $blog_id) )->find();
  164. $blog_content = M('blog_content')->where( array('blog_id' => $blog_id) )->find();
  165. $this->blog_info = $blog_info;
  166. $this->blog_content = $blog_content;
  167. $this->display();
  168. }
  169. }
  170. ?>