1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?php
- namespace Cas\Dao;
- use KIF\Dao\DBAgileDev;
- use KIF\Core\Request;
- use KIF\Cache\Memcached;
- /**
- *
- * 活动 投放渠道
- *
- * @author lihuanchun@qq.com
- *
- */
- class LotteryDeliveryChannels extends DBAgileDev {
- protected $tableName = 'lottery_delivery_channels';
-
- /**
- * 数据库里的真实字段
- * @var array
- */
- protected $other_field = array(
- 'str_name',
- 'events_id',
- 'platform_id',
- 'pv_num'
- );
-
- /**
- * 添加一个PV
- */
- public function addOnePV($id){
- $data = $this->get($id);
- $info = array(
- 'pv_num' => $data['pv_num'] + 1
- );
- return $this->modify($info,array('id' => $id));
- }
-
- /**
- * 添加默认渠道用cache 计数
- */
- public function addDefaultEventOnePV($schemeDomain,$events_id,$platform_id){
- $key = $schemeDomain.'_'.$events_id.'_'.$platform_id;
- $objMemcached = new Memcached();
- $num = $objMemcached->get($key);
- $time = time();
- if($num){
- if (strstr($num, '||')) {
- $temp = explode('||', $num);
- $num = $temp[0];
- $num = $num + 1;
- } else {
- $num = $num + 1;
- }
- $value = $num . '||' . $time;
- $objMemcached->set($key,$value);
- }else{
- $objMemcached->set($key,1 . '||' . $time);
- }
- }
-
- /**
- * 获取默认渠道用cache 计数
- */
- public function getDefaultEventOnePV($schemeDomain,$events_id,$platform_id){
- $key = $schemeDomain.'_'.$events_id.'_'.$platform_id;
- $objMemcached = new Memcached();
- return $objMemcached->get($key);
- }
-
- }
|