ActivityList.class.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <?php
  2. namespace Cas\Controller\Admin\Activity;
  3. use Cas\Module\Lottery;
  4. use Cas\Dao\PlatformBulletin;
  5. use KIF\Core\Request;
  6. use Cas\Dao\LotteryEvents;
  7. use Cas\Controller\Admin\Controller;
  8. use Cas\Dao\Platform;
  9. use Cas\Dao\LotteryDeliveryChannels;
  10. use KIF\Core\Config;
  11. use Cas\Dao\LotteryPvUvLog;
  12. use KIF\Dao\SqlHelper;
  13. use KIF\Dao\AbstractDao;
  14. use KIF\Page\Page;
  15. /**
  16. * "活动相关" - "活动列表"
  17. *
  18. * @author lihuanchun 
  19. *  
  20. */
  21. class ActivityList extends Controller {
  22. private $objLottery; // 活动后端
  23. private $peratorData;
  24. /**
  25. *  初始化
  26. */
  27. public function __construct() {
  28. header ( "Content-Type: text/html; charset=utf-8" );
  29. $this->objLottery = new Lottery ();
  30. $this->operatorData = $this->getUser ();
  31. }
  32. public function doDefault() {
  33. }
  34. /**
  35. * 页面:活动列表
  36. * 地址:http://cas.lishuy.com/?c=Admin_Activity_ActivityList&a=PageList
  37. */
  38. public function doPageList(){
  39. $objDLotteryEvents = new LotteryEvents ();
  40. $eventsType = $objDLotteryEvents->getType ();
  41. $eventsDisplayStatus = $objDLotteryEvents->getDisplay ();
  42. // 取数据
  43. $page = Request::varGetInt ( 'page', 1 );
  44. $size = 24;
  45. $offset = ($page - 1) * $size;
  46. $limit = "{$offset},{$size}";
  47. $condition = array();
  48. $allLotteryEventsIds = $objDLotteryEvents->findIdsBy ( $condition, $limit, 'id desc' );
  49. $eventsData = $objDLotteryEvents->gets ( $allLotteryEventsIds );
  50. $total_num = $this->objLottery->getLotteryEventsListNum ( $condition );
  51. $url_tpl = Request::schemeDomain () . "c=Admin_Activity_ActivityList&a=PageList";
  52. $url_tpl .= "&page={page}";
  53. // 分页
  54. $objPage = new Page ( $total_num, $url_tpl, $page, $size );
  55. $page_html = $objPage->html ();
  56. $this->setOutput ( 'page_html', $page_html );
  57. $this->setOutput ( 'allEventsData', $eventsData );
  58. $this->setOutput ( 'thisPageTitle', '所有发布' );
  59. $this->tpl = 'admin/activity/activity_list';
  60. $title = '活动列表';
  61. $this->setOutput('title', $title);
  62. $this->setOutput('menu_active', array('name' => 'activitylist', 'item' => '')); //激活菜单
  63. $this->addNavMenu('活动列表');
  64. $this->setOutput('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据
  65. }
  66. /**
  67. * 页面:我的活动列表
  68. * 地址:http://cas.lishuy.com/?c=Admin_Activity_ActivityList&a=PageMyList
  69. */
  70. public function doPageMyList(){
  71. $objDLotteryEvents = new LotteryEvents ();
  72. $eventsType = $objDLotteryEvents->getType ();
  73. $eventsDisplayStatus = $objDLotteryEvents->getDisplay ();
  74. // 取数据
  75. $page = Request::varGetInt ( 'page', 1 );
  76. $size = 24;
  77. $offset = ($page - 1) * $size;
  78. $limit = "{$offset},{$size}";
  79. $condition = array(
  80. 'operator_uid' => $this->operatorData['uid'],
  81. 'del' => LotteryEvents::NOT_DEL
  82. );
  83. if($this->isSuperadmin()){
  84. $condition = array(
  85. 'del' => LotteryEvents::NOT_DEL
  86. );
  87. }
  88. $allLotteryEventsIds = $objDLotteryEvents->findIdsBy ( $condition, $limit, 'id desc' );
  89. $eventsData = $objDLotteryEvents->gets ( $allLotteryEventsIds );
  90. $total_num = $this->objLottery->getLotteryEventsListNum ( $condition );
  91. $url_tpl = Request::schemeDomain () . "?c=Admin_Activity_ActivityList&a=PageMyList";
  92. $url_tpl .= "&page={page}";
  93. // 分页
  94. $objPage = new Page ( $total_num, $url_tpl, $page, $size );
  95. $page_html = $objPage->html ();
  96. $allTypeData = $objDLotteryEvents ->getType();
  97. $this->setOutput('allTypeData', $allTypeData);
  98. $this->setOutput ( 'page_html', $page_html );
  99. $this->setOutput ( 'allEventsData', $eventsData );
  100. $this->setOutput ( 'thisPageTitle', '我的发布' );
  101. $this->tpl = 'admin/activity/activity_list';
  102. $title = '我的发布';
  103. $this->setOutput('title', $title);
  104. $this->setOutput('menu_active', array('name' => 'mypublish', 'item' => '')); //激活菜单
  105. $this->addNavMenu('我的发布');
  106. $this->setOutput('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据
  107. }
  108. /**
  109. * 删除操作
  110. * 地址:http://cas.lishuy.com/?c=Admin_Activity_ActivityList&a=ReqDel
  111. */
  112. public function doReqDel(){
  113. $id = Request::p('id');
  114. $objDLotteryEvents = new LotteryEvents ();
  115. $tableInfo = array(
  116. 'del' => LotteryEvents::IS_DEL,
  117. 'display' => LotteryEvents::LIST_DISPLAY_HIDE,
  118. );
  119. $condition = array(
  120. 'id' => $id
  121. );
  122. $objDLotteryEvents -> update($tableInfo, $condition);
  123. $this->ajax_success_exit($id);
  124. }
  125. /**
  126. * 回复删除操作
  127. * 地址:http://cas.lishuy.com/?c=Admin_Activity_ActivityList&a=ReqReductionDel
  128. */
  129. public function doReqReductionDel(){
  130. $id = Request::p('id');
  131. $objDLotteryEvents = new LotteryEvents ();
  132. $tableInfo = array(
  133. 'del' => LotteryEvents::NOT_DEL,
  134. 'display' => LotteryEvents::LIST_DISPLAY_HIDE,
  135. );
  136. $condition = array(
  137. 'id' => $id
  138. );
  139. $objDLotteryEvents -> update($tableInfo, $condition);
  140. $this->ajax_success_exit($id);
  141. }
  142. /**
  143. * 页面:我的已删除活动列表
  144. * 地址:http://cas.lishuy.com/?c=Admin_Activity_ActivityList&a=PageDelMyList
  145. */
  146. public function doPageDelMyList(){
  147. $objDLotteryEvents = new LotteryEvents ();
  148. $eventsType = $objDLotteryEvents->getType ();
  149. $eventsDisplayStatus = $objDLotteryEvents->getDisplay ();
  150. // 取数据
  151. $page = Request::varGetInt ( 'page', 1 );
  152. $size = 24;
  153. $offset = ($page - 1) * $size;
  154. $limit = "{$offset},{$size}";
  155. $condition = array(
  156. 'operator_uid' => $this->operatorData['uid'],
  157. 'del' => LotteryEvents::IS_DEL
  158. );
  159. if($this->isSuperadmin()){
  160. $condition = array(
  161. 'del' => LotteryEvents::IS_DEL
  162. );
  163. }
  164. $allLotteryEventsIds = $objDLotteryEvents->findIdsBy ( $condition, $limit, 'id desc' );
  165. $eventsData = $objDLotteryEvents->gets ( $allLotteryEventsIds );
  166. $total_num = $this->objLottery->getLotteryEventsListNum ( $condition );
  167. $url_tpl = Request::schemeDomain () . "?c=Admin_Activity_ActivityList&a=PageDelMyList";
  168. $url_tpl .= "&page={page}";
  169. // 分页
  170. $objPage = new Page ( $total_num, $url_tpl, $page, $size );
  171. $page_html = $objPage->html ();
  172. $allTypeData = $objDLotteryEvents ->getType();
  173. $this->setOutput('allTypeData', $allTypeData);
  174. $this->setOutput ( 'page_html', $page_html );
  175. $this->setOutput ( 'allEventsData', $eventsData );
  176. $this->setOutput ( 'thisPageTitle', '删除的活动' );
  177. $this->tpl = 'admin/activity/activity_del_list'; // 写到这了.
  178. $title = '删除的活动';
  179. $this->setOutput('title', $title);
  180. $this->setOutput('menu_active', array('name' => 'mypublishdel', 'item' => '')); //激活菜单
  181. $this->addNavMenu('我的发布');
  182. $this->setOutput('pagePublicData', $this->getPagePublicData()); // 后台管理相关数据
  183. }
  184. public function display() {
  185. return $this->render ();
  186. }
  187. }