Advclick.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /*
  3. * 广告统计
  4. */
  5. namespace app\home\controller;
  6. /**
  7. * ============================================================================
  8. *
  9. * ============================================================================
  10. *
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Advclick extends BaseMall {
  17. /**
  18. * 广告点击率统计
  19. */
  20. public function advclick() {
  21. /**
  22. * 取广告的相关信息
  23. */
  24. $adv_model = model('adv');
  25. $adv_id = intval(input('param.adv_id'));
  26. if($adv_id<=0){
  27. $this->error(lang('param_error'));
  28. }
  29. $adv_info = $adv_model->getOneAdv(array(array('adv_id','=',$adv_id)));
  30. if(empty($adv_info['adv_link'])){
  31. $adv_info['adv_link'] = HOME_SITE_URL;
  32. }
  33. $url = str_replace(array('&amp;'), array('&'), $adv_info['adv_link']);
  34. /**
  35. * 写入点击率表
  36. */
  37. $adv_param['adv_clicknum'] = $adv_info['adv_clicknum'] + 1;
  38. $adv_model->editAdv($adv_id,$adv_param);
  39. /**
  40. * 广告链接跳转
  41. */
  42. $this->redirect($url);
  43. }
  44. }