LotteryEvents.class.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693
  1. <?php
  2. namespace Cas\Dao;
  3. use KIF\Dao\DBAgileDev;
  4. /**
  5. *
  6. * 活动表
  7. *
  8. * @author lihuanchun@qq.com
  9. *
  10. */
  11. class LotteryEvents extends DBAgileDev {
  12. protected $tableName = 'lottery_events';
  13. /**
  14. * 数据库里的真实字段
  15. * @var array
  16. */
  17. protected $other_field = array(
  18. 'events_name',
  19. 'begin_time',
  20. 'end_time',
  21. 'share_button',
  22. 'platform_ids',
  23. 'operator_uid',
  24. 'list_display',
  25. 'focus_display',
  26. 'top_display',
  27. 'category_id',
  28. 'display', // 是否显示
  29. 'type',// 活动类型 转盘 ... ...
  30. 'del' // 是否被删除
  31. );
  32. /**
  33. * EVENT_DISPLAY_SHOW 发布
  34. * @var int
  35. */
  36. const EVENT_DISPLAY_SHOW = 1;
  37. /**
  38. * EVENT_DISPLAY_HIDE 停用
  39. * @var int
  40. */
  41. const EVENT_DISPLAY_HIDE = 0;
  42. /**
  43. * EVENT_DISPLAY_UNFINISHED 未设置完成
  44. * @var int
  45. */
  46. const EVENT_DISPLAY_UNFINISHED = 2;
  47. public static $display= array(
  48. self::EVENT_DISPLAY_SHOW => array(
  49. 'desc' => '发布',
  50. 'kw' => 'EVENT_DISPLAY_SHOW',
  51. ),
  52. self::EVENT_DISPLAY_HIDE => array(
  53. 'desc' => '停用',
  54. 'kw' => 'EVENT_DISPLAY_HIDE',
  55. ),
  56. self::EVENT_DISPLAY_UNFINISHED => array(
  57. 'desc' => '未设置完成',
  58. 'kw' => 'EVENT_DISPLAY_UNFINISHED',
  59. ),
  60. );
  61. /**
  62. * 活动发布状态
  63. * @return array
  64. */
  65. public static function getDisplay() {
  66. return self::$display;
  67. }
  68. /**
  69. * LIST_DISPLAY_HIDE 列表中隐藏
  70. * @var int
  71. */
  72. const LIST_DISPLAY_HIDE = 0;
  73. /**
  74. * LIST_DISPLAY_SHOW 列表中显示
  75. * @var int
  76. */
  77. const LIST_DISPLAY_SHOW = 1;
  78. public static $listDisplay= array(
  79. self::LIST_DISPLAY_HIDE => array(
  80. 'desc' => '不出现',
  81. 'kw' => 'LIST_DISPLAY_HIDE',
  82. ),
  83. self::LIST_DISPLAY_SHOW => array(
  84. 'desc' => '出现',
  85. 'kw' => 'LIST_DISPLAY_SHOW',
  86. )
  87. );
  88. /**
  89. * 活动列表中显示状态
  90. * @return array
  91. */
  92. public static function getListDisplay() {
  93. return self::$listDisplay;
  94. }
  95. /**
  96. * FOCUS_DISPLAY_HIDE 不推荐到焦点图
  97. * @var int
  98. */
  99. const FOCUS_DISPLAY_HIDE = 1;
  100. /**
  101. * FOCUS_DISPLAY_SHOW 推荐到焦点图
  102. * @var int
  103. */
  104. const FOCUS_DISPLAY_SHOW = 2;
  105. public static $focusDisplay= array(
  106. self::FOCUS_DISPLAY_HIDE => array(
  107. 'desc' => '不推荐',
  108. 'kw' => 'FOCUS_DISPLAY_HIDE',
  109. ),
  110. self::FOCUS_DISPLAY_SHOW => array(
  111. 'desc' => '推荐',
  112. 'kw' => 'FOCUS_DISPLAY_SHOW',
  113. )
  114. );
  115. /**
  116. * 推荐到焦点图
  117. * @return array
  118. */
  119. public static function getFocusDisplay() {
  120. return self::$focusDisplay;
  121. }
  122. /**
  123. * TOP_DISPLAY_HIDE 是否置顶
  124. * @var int
  125. */
  126. const TOP_DISPLAY_HIDE = 1;
  127. /**
  128. * TOP_DISPLAY_SHOW 是否置顶
  129. * @var int
  130. */
  131. const TOP_DISPLAY_SHOW = 2;
  132. public static $topDisplay= array(
  133. self::TOP_DISPLAY_HIDE => array(
  134. 'desc' => '不置顶',
  135. 'kw' => 'TOP_DISPLAY_HIDE',
  136. ),
  137. self::TOP_DISPLAY_SHOW => array(
  138. 'desc' => '置顶',
  139. 'kw' => 'TOP_DISPLAY_SHOW',
  140. )
  141. );
  142. /**
  143. * 是否置顶
  144. * @return array
  145. */
  146. public static function getTopDisplay() {
  147. return self::$topDisplay;
  148. }
  149. /**
  150. * NOT_DEL 未删除
  151. * @var int
  152. */
  153. const NOT_DEL = 1;
  154. /**
  155. * IS_NOT_DEL 已删除
  156. * @var int
  157. */
  158. const IS_DEL = 2;
  159. public static $del= array(
  160. self::NOT_DEL => array(
  161. 'desc' => '未删除',
  162. 'kw' => 'NOT_DEL',
  163. ),
  164. self::IS_DEL => array(
  165. 'desc' => '已删除',
  166. 'kw' => 'IS_DEL',
  167. )
  168. );
  169. /**
  170. * 获取活动是否被管理员删除状态
  171. * @return array
  172. */
  173. public static function getDel() {
  174. return self::$del;
  175. }
  176. /**
  177. * EVENT_AUTHORIZE_TRUE 需要登录
  178. * @var int
  179. */
  180. const EVENT_AUTHORIZE_TRUE = 1;
  181. /**
  182. * EVENT_AUTHORIZE_FALSE 不需要登录
  183. * @var int
  184. */
  185. const EVENT_AUTHORIZE_FALSE = 0;
  186. public static $authorize= array(
  187. self::EVENT_AUTHORIZE_TRUE => array(
  188. 'desc' => '需要登录',
  189. 'kw' => 'EVENT_AUTHORIZE_TRUE',
  190. ),
  191. self::EVENT_AUTHORIZE_FALSE => array(
  192. 'desc' => '不需要登录',
  193. 'kw' => 'EVENT_AUTHORIZE_FALSE',
  194. ),
  195. );
  196. /**
  197. * 是否需要登录
  198. * @return array
  199. */
  200. public static function getAuthorize() {
  201. return self::$authorize;
  202. }
  203. /**
  204. * MUSIC_POSITION_LEFT 左上角
  205. * @var int
  206. */
  207. const MUSIC_POSITION_LEFT = 0;
  208. /**
  209. * MUSIC_POSITION_RIGHT 右上角
  210. * @var int
  211. */
  212. const MUSIC_POSITION_RIGHT = 1;
  213. public static $musicPosition = array(
  214. self::MUSIC_POSITION_LEFT=> array(
  215. 'desc' => '左上角',
  216. 'kw' => 'MUSIC_POSITION_LEFT',
  217. ),
  218. self::MUSIC_POSITION_RIGHT=> array(
  219. 'desc' => '右上角',
  220. 'kw' => 'MUSIC_POSITION_RIGHT',
  221. ),
  222. );
  223. /**
  224. * 音乐图标位置
  225. * @return array
  226. */
  227. public static function getMusicPosition() {
  228. return self::$musicPosition;
  229. }
  230. /**
  231. * TYPE_EVENTS_NULL 未设置
  232. * @var int
  233. */
  234. const TYPE_EVENTS_NULL = 0;
  235. /**
  236. * TYPE_EVENTS_TURNTABLE 转盘
  237. * @var int
  238. */
  239. const TYPE_EVENTS_TURNTABLE = 1;
  240. /**
  241. * TYPE_EVENTS_SCRATCH 刮刮卡
  242. * @var int
  243. */
  244. const TYPE_EVENTS_SCRATCH = 2;
  245. /**
  246. * TYPE_EVENTS_LETTERS 收集字母
  247. * @var int
  248. */
  249. const TYPE_EVENTS_LETTERS = 3;
  250. /**
  251. * TYPE_EVENTS_TRY 试用
  252. * @var int
  253. */
  254. const TYPE_EVENTS_TRY = 4;
  255. /**
  256. * TYPE_EVENTS_VOTE 投票
  257. * @var int
  258. */
  259. const TYPE_EVENTS_VOTE = 5;
  260. /**
  261. * TYPE_EVENTS_INVITATION 邀请函
  262. * @var int
  263. */
  264. const TYPE_EVENTS_INVITATION = 6;
  265. /**
  266. * TYPE_EVENTS_CODE 领券
  267. * @var int
  268. */
  269. const TYPE_EVENTS_CODE = 7;
  270. /**
  271. * TYPE_EVENTS_OTHER 其他
  272. * @var int
  273. */
  274. const TYPE_EVENTS_OTHER = 8;
  275. /**
  276. * TYPE_EVENTS_ARTICLE 文章
  277. * @var int
  278. */
  279. const TYPE_EVENTS_ARTICLE = 9;
  280. /**
  281. * TYPE_EVENTS_CUT_SCREEN 切屏专题
  282. * @var int
  283. */
  284. const TYPE_EVENTS_CUT_SCREEN = 10;
  285. /**
  286. * TYPE_EVENTS_SURVEY 问卷调查
  287. * @var int
  288. */
  289. const TYPE_EVENTS_SURVEY = 11;
  290. public static $type = array(
  291. // self::TYPE_EVENTS_NULL => array(
  292. // 'desc' => '未设置',
  293. // 'kw' => 'TYPE_EVENTS_NULL',
  294. // ),
  295. self::TYPE_EVENTS_TURNTABLE => array(
  296. 'desc' => '抽奖',
  297. 'kw' => 'TYPE_EVENTS_TURNTABLE',
  298. 'lottery' => true,
  299. 'restrictions' => true,
  300. 'pageRoutine' => true,
  301. 'c' => 'EventsTurntable',
  302. ),
  303. // self::TYPE_EVENTS_SCRATCH => array(
  304. // 'desc' => '刮刮卡',
  305. // 'kw' => 'TYPE_EVENTS_SCRATCH',
  306. // 'lottery' => true,
  307. // 'restrictions' => true,
  308. // 'pageRoutine' => true,
  309. // 'c' => 'EventsScratch',
  310. // ),
  311. // self::TYPE_EVENTS_LETTERS => array(
  312. // 'desc' => '收集字母',
  313. // 'kw' => 'TYPE_EVENTS_LETTERS',
  314. // 'lottery' => true,
  315. // 'restrictions' => true,
  316. // 'pageRoutine' => true,
  317. // 'c' => 'EventsLetters',
  318. // ),
  319. self::TYPE_EVENTS_TRY => array(
  320. 'desc' => '试用',
  321. 'kw' => 'TYPE_EVENTS_TRY',
  322. 'form' => true,
  323. 'restrictions' => true,
  324. 'pageRoutine' => true,
  325. 'c' => 'EventsTry',
  326. ),
  327. self::TYPE_EVENTS_VOTE => array(
  328. 'desc' => '投票',
  329. 'kw' => 'TYPE_EVENTS_VOTE',
  330. 'vote' => true,
  331. 'restrictions' => true,
  332. 'pageRoutine' => true,
  333. 'c' => 'EventsVote',
  334. ),
  335. self::TYPE_EVENTS_INVITATION => array(
  336. 'desc' => '邀请函',
  337. 'kw' => 'TYPE_EVENTS_INVITATION',
  338. 'form' => true,
  339. 'restrictions' => true,
  340. 'pageRoutine' => true,
  341. 'c' => 'EventsInvitation',
  342. ),
  343. self::TYPE_EVENTS_CODE => array(
  344. 'desc' => '优惠券',
  345. 'kw' => 'TYPE_EVENTS_CODE',
  346. 'form' => true,
  347. 'code' => true,
  348. 'restrictions' => true,
  349. 'pageRoutine' => true,
  350. 'c' => 'EventsCode',
  351. ),
  352. self::TYPE_EVENTS_ARTICLE => array(
  353. 'desc' => '文章',
  354. 'kw' => 'TYPE_EVENTS_ARTICLE',
  355. 'article' =>true,
  356. 'c' => 'EventsArticle',
  357. ),
  358. self::TYPE_EVENTS_CUT_SCREEN => array(
  359. 'desc' => '切屏专题',
  360. 'kw' => 'TYPE_EVENTS_CUT_SCREEN',
  361. 'cut_screen' => true,
  362. 'c' => 'EventsCutScreen',
  363. ),
  364. self::TYPE_EVENTS_OTHER => array(
  365. 'desc' => '链接',
  366. 'kw' => 'TYPE_EVENTS_OTHER',
  367. 'jumpUrl' => true,
  368. 'c' => 'EventsOther',
  369. ),
  370. self::TYPE_EVENTS_SURVEY => array(
  371. 'desc' => '问卷调查',
  372. 'kw' => 'TYPE_EVENTS_SURVEY',
  373. 'form' => true,
  374. 'restrictions' => true,
  375. 'pageRoutine' => true,
  376. 'c' => 'EventsSurvey',
  377. ),
  378. );
  379. /**
  380. * 获取活动路由规则
  381. */
  382. static public function getEventRoute(){
  383. return array(
  384. 'a' => 'EventsTurntable',
  385. 'b' => 'EventsScratch',
  386. 'c' => 'EventsTry',
  387. 'd' => 'EventsVote',
  388. 'e' => 'EventsInvitation',
  389. 'f' => 'EventsCode',
  390. 'g' => 'EventsArticle',
  391. 'h' => 'EventsCutScreen',
  392. 'y' => 'EventsOther',
  393. 'z' => 'EventsSurvey'
  394. );
  395. }
  396. /**
  397. * 活动 大类型 配置
  398. *
  399. * @retrun array
  400. */
  401. public function getBigTypeConfig(){
  402. return array(
  403. 'H5' => array(
  404. self::TYPE_EVENTS_ARTICLE,
  405. ),
  406. 'Event' => array(
  407. self::TYPE_EVENTS_TURNTABLE,
  408. // self::TYPE_EVENTS_SCRATCH,
  409. self::TYPE_EVENTS_TRY,
  410. self::TYPE_EVENTS_SURVEY,
  411. self::TYPE_EVENTS_VOTE,
  412. self::TYPE_EVENTS_INVITATION,
  413. self::TYPE_EVENTS_CODE
  414. ),
  415. 'Article' => array(
  416. self::TYPE_EVENTS_CUT_SCREEN,
  417. )
  418. );
  419. }
  420. public function getBigType($type) {
  421. $bigTypes = self::getBigTypeConfig();
  422. if (!$bigTypes) {
  423. return false;
  424. }
  425. foreach ($bigTypes as $bigType => $tmpTypes) {
  426. if (!in_array($type, $tmpTypes)) {
  427. continue;
  428. }
  429. return $bigType;
  430. }
  431. return false;
  432. }
  433. /**
  434. * 获取活动类型
  435. * @return array
  436. */
  437. public static function getType() {
  438. return self::$type;
  439. }
  440. /**
  441. * [领券活动] 是否是二维码输出 [是]
  442. */
  443. const TWO_DIMENSIONAL_CODE_TRUE = 1;
  444. /**
  445. * [领券活动] 是否是二维码输出 [否]
  446. */
  447. const TWO_DIMENSIONAL_CODE_FALSE = 2;
  448. public static $twoDimensionalCodeType= array(
  449. self::TWO_DIMENSIONAL_CODE_TRUE => array(
  450. 'desc' => '是',
  451. 'kw' => 'TWO_DIMENSIONAL_CODE_TRUE',
  452. ),
  453. self::TWO_DIMENSIONAL_CODE_FALSE => array(
  454. 'desc' => '否',
  455. 'kw' => 'TWO_DIMENSIONAL_CODE_FALSE',
  456. ),
  457. );
  458. /**
  459. * 获取 [领券活动] 是否是二维码输出 类型
  460. * @return array
  461. */
  462. public static function getTwoDimensionalCodeType() {
  463. return self::$twoDimensionalCodeType;
  464. }
  465. /**
  466. * EVENT_VOTE_TEXT [投票活动] 文字类型
  467. * @var int
  468. */
  469. const EVENT_VOTE_TEXT = 1;
  470. /**
  471. * EVENT_VOTE_IMG [投票活动]图文类型
  472. * @var int
  473. */
  474. const EVENT_VOTE_IMG = 2;
  475. public static $voteType= array(
  476. self::EVENT_VOTE_TEXT => array(
  477. 'desc' => '文字类型',
  478. 'kw' => 'EVENT_VOTE_TEXT',
  479. ),
  480. self::EVENT_VOTE_IMG => array(
  481. 'desc' => '图文类型',
  482. 'kw' => 'EVENT_VOTE_IMG',
  483. ),
  484. );
  485. /**
  486. * 获取 [投票活动]类型
  487. * @return array
  488. */
  489. public static function getVoteType() {
  490. return self::$voteType;
  491. }
  492. /**
  493. * DELIVERY_FALSE [未发货]
  494. * @var int
  495. */
  496. const DELIVERY_FALSE = 1;
  497. /**
  498. * DELIVERY_TRUE [已经发货]
  499. * @var int
  500. */
  501. const DELIVERY_TRUE = 2;
  502. public static $deliveryType= array(
  503. self::DELIVERY_FALSE => array(
  504. 'desc' => '未发货',
  505. 'kw' => 'DELIVERY_FALSE',
  506. ),
  507. self::DELIVERY_TRUE => array(
  508. 'desc' => '已经发货',
  509. 'kw' => 'DELIVERY_TRUE',
  510. ),
  511. );
  512. /**
  513. * 获取 发货状态
  514. * @return array
  515. */
  516. public static function getDeliveryType() {
  517. return self::$deliveryType;
  518. }
  519. /**
  520. * SHARE_BUTTON_FALSE [不显示分享按钮]
  521. * @var int
  522. */
  523. const SHARE_BUTTON_FALSE = 1;
  524. /**
  525. * SHARE_BUTTON_TRUE [显示分享按钮]
  526. * @var int
  527. */
  528. const SHARE_BUTTON_TRUE = 2;
  529. public static $shareButton= array(
  530. self::SHARE_BUTTON_FALSE => array(
  531. 'desc' => '不显示',
  532. 'kw' => 'SHARE_BUTTON_FALSE',
  533. ),
  534. self::SHARE_BUTTON_TRUE => array(
  535. 'desc' => '显示',
  536. 'kw' => 'SHARE_BUTTON_TRUE',
  537. ),
  538. );
  539. /**
  540. * 获取 是否显示分享按钮
  541. * @return array
  542. */
  543. public static function getShareButton() {
  544. return self::$shareButton;
  545. }
  546. /**
  547. * TOP_DATA_FALSE [不显示顶部数据栏目]
  548. * @var int
  549. */
  550. const TOP_DATA_FALSE = 1;
  551. /**
  552. * TOP_DATA_TRUE [显示顶部数据栏目]
  553. * @var int
  554. */
  555. const TOP_DATA_TRUE = 2;
  556. public static $topData= array(
  557. self::TOP_DATA_FALSE => array(
  558. 'desc' => '不显示',
  559. 'kw' => 'TOP_DATA_FALSE',
  560. ),
  561. self::TOP_DATA_TRUE => array(
  562. 'desc' => '显示',
  563. 'kw' => 'TOP_DATA_TRUE',
  564. ),
  565. );
  566. /**
  567. * 获取 是否显示分享按钮
  568. * @return array
  569. */
  570. public static function getTopData() {
  571. return self::$topData;
  572. }
  573. /**
  574. * BUY_BUTTON_FALSE [是否显示导购按钮]
  575. * @var int
  576. */
  577. const BUY_BUTTON_FALSE = 1;
  578. /**
  579. * BUY_BUTTON_TRUE [是否显示导购按钮]
  580. * @var int
  581. */
  582. const BUY_BUTTON_TRUE = 2;
  583. public static $buyButton= array(
  584. self::BUY_BUTTON_FALSE => array(
  585. 'desc' => '不显示',
  586. 'kw' => 'BUY_BUTTON_FALSE',
  587. ),
  588. self::BUY_BUTTON_TRUE => array(
  589. 'desc' => '显示',
  590. 'kw' => 'BUY_BUTTON_TRUE',
  591. ),
  592. );
  593. /**
  594. * 获取 是否显示导购按钮
  595. * @return array
  596. */
  597. public static function getBuyButton() {
  598. return self::$buyButton;
  599. }
  600. }