LotteryDeliveryChannels.class.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace Cas\Dao;
  3. use KIF\Dao\DBAgileDev;
  4. use KIF\Core\Request;
  5. use KIF\Cache\Memcached;
  6. /**
  7. *
  8. * 活动 投放渠道
  9. *
  10. * @author lihuanchun@qq.com
  11. *
  12. */
  13. class LotteryDeliveryChannels extends DBAgileDev {
  14. protected $tableName = 'lottery_delivery_channels';
  15. /**
  16. * 数据库里的真实字段
  17. * @var array
  18. */
  19. protected $other_field = array(
  20. 'str_name',
  21. 'events_id',
  22. 'platform_id',
  23. 'pv_num'
  24. );
  25. /**
  26. * 添加一个PV
  27. */
  28. public function addOnePV($id){
  29. $data = $this->get($id);
  30. $info = array(
  31. 'pv_num' => $data['pv_num'] + 1
  32. );
  33. return $this->modify($info,array('id' => $id));
  34. }
  35. /**
  36. * 添加默认渠道用cache 计数
  37. */
  38. public function addDefaultEventOnePV($schemeDomain,$events_id,$platform_id){
  39. $key = $schemeDomain.'_'.$events_id.'_'.$platform_id;
  40. $objMemcached = new Memcached();
  41. $num = $objMemcached->get($key);
  42. if($num){
  43. $objMemcached->set($key,$num+1);
  44. }else{
  45. $objMemcached->set($key,1);
  46. }
  47. }
  48. /**
  49. * 获取默认渠道用cache 计数
  50. */
  51. public function getDefaultEventOnePV($schemeDomain,$events_id,$platform_id){
  52. $key = $schemeDomain.'_'.$events_id.'_'.$platform_id;
  53. $objMemcached = new Memcached();
  54. return $objMemcached->get($key);
  55. }
  56. }