LotteryEventsLog.class.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace Cas\Dao;
  3. use KIF\Dao\DBAgileDev;
  4. use KIF\Core\Request;
  5. /**
  6. *
  7. * 活动LOG表
  8. *
  9. * @author lihuanchun@qq.com
  10. *
  11. */
  12. class LotteryEventsLog extends DBAgileDev {
  13. protected $tableName = 'lottery_events_log';
  14. /**
  15. * 数据库里的真实字段
  16. * @var array
  17. */
  18. protected $other_field = array(
  19. 'events_id',
  20. 'type',
  21. 'uid',
  22. );
  23. /**
  24. * LOG_TYPE_PASS 访问
  25. * @var int
  26. */
  27. const LOG_TYPE_PASS = 1;
  28. /**
  29. * LOG_TYPE_PARTICIPATION 参与
  30. * @var int
  31. */
  32. const LOG_TYPE_PARTICIPATION = 2;
  33. /**
  34. * LOG_TYPE_RECEIVE 获得
  35. * @var int
  36. */
  37. const LOG_TYPE_RECEIVE = 3;
  38. /**
  39. * LOG_TYPE_PARTICIPATION_TRUE 参与成功
  40. * @var int
  41. */
  42. const LOG_TYPE_PARTICIPATION_TRUE = 4;
  43. public static $type= array(
  44. self::LOG_TYPE_PASS => array(
  45. 'desc' => '访问',
  46. 'kw' => 'LOG_TYPE_PASS',
  47. ),
  48. self::LOG_TYPE_PARTICIPATION => array(
  49. 'desc' => '参与',
  50. 'kw' => 'LOG_TYPE_PARTICIPATION',
  51. ),
  52. self::LOG_TYPE_RECEIVE => array(
  53. 'desc' => '获得',
  54. 'kw' => 'LOG_TYPE_RECEIVE',
  55. ),
  56. self::LOG_TYPE_PARTICIPATION_TRUE => array(
  57. 'desc' => '参与成功',
  58. 'kw' => 'LOG_TYPE_PARTICIPATION_TRUE',
  59. ),
  60. );
  61. /**
  62. * 获取TYPE 行为
  63. * @return array
  64. */
  65. public static function getType() {
  66. return self::$type;
  67. }
  68. /**
  69. * 添加记录
  70. */
  71. public function addOne($info){
  72. $info['ip'] = Request::ip();
  73. $info['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
  74. return $this->add($info);
  75. }
  76. }