LotteryData.class.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace Cas\Dao;
  3. use KIF\Dao\DBAgileDev;
  4. use KIF\Verify;
  5. use KIF\Dao\SqlHelper;
  6. /**
  7. *
  8. * 获奖数据表
  9. *
  10. * @author lihuanchun@qq.com
  11. *
  12. */
  13. class LotteryData extends DBAgileDev {
  14. protected $tableName = 'lottery_data';
  15. /**
  16. * 数据库里的真实字段
  17. * @var array
  18. */
  19. protected $other_field = array(
  20. 'events_id',
  21. 'prize_id',
  22. 'uid',
  23. 'scratch_receive',// 对刮挂卡领取奖品的特殊处理
  24. 'winning_time',
  25. 'winners_time',
  26. # 审核字段 1未审核 2审核通过 3审核不通过 默认为审核通过2
  27. 'audit',
  28. # 平台id 适用于多个平台下的领取记录
  29. 'platform_id',
  30. );
  31. /**
  32. * EVENT_SCRATCH_RECEIVE_TRUE 关于刮挂卡活动领取状态:用户已领取
  33. * @var int
  34. */
  35. const EVENT_SCRATCH_RECEIVE_TRUE = 1;
  36. /**
  37. * EVENT_SCRATCH_RECEIVE_FALSE 关于刮挂卡活动领取状态:用户未领取
  38. * @var int
  39. */
  40. const EVENT_SCRATCH_RECEIVE_FALSE = 2;
  41. public static $scratchReceive= array(
  42. self::EVENT_SCRATCH_RECEIVE_TRUE => array(
  43. 'desc' => '刮刮卡奖品:用户已领取',
  44. 'kw' => 'EVENT_SCRATCH_RECEIVE_TRUE',
  45. ),
  46. self::EVENT_SCRATCH_RECEIVE_FALSE => array(
  47. 'desc' => '刮刮卡奖品:用户未领取',
  48. 'kw' => 'EVENT_SCRATCH_RECEIVE_FALSE',
  49. ),
  50. );
  51. /**
  52. * 关于刮挂卡活动领取状态
  53. * @return array
  54. */
  55. public static function getScratchReceive() {
  56. return self::$scratchReceive;
  57. }
  58. public function getTodayHasWinTotal($prize_id){
  59. $total = 0;
  60. if (!Verify::unsignedInt($prize_id)) {
  61. return $total;
  62. }
  63. $condition = array(
  64. 'prize_id' => $prize_id,
  65. 'create_time' => SqlHelper::addCompareOperator('>=', mktime(0,0,0)),
  66. );
  67. $result = $this->findBy($condition, null, null, "count(*)");
  68. return array_pop(array_pop($result));
  69. }
  70. }