Advclick.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /*
  3. * 广告统计
  4. */
  5. namespace app\home\controller;
  6. /**
  7. * ============================================================================
  8. *
  9. * ============================================================================
  10. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  11. * 网站地址: https://www.valimart.net/
  12. * ----------------------------------------------------------------------------
  13. *
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Advclick extends BaseMall {
  18. /**
  19. * 广告点击率统计
  20. */
  21. public function advclick() {
  22. /**
  23. * 取广告的相关信息
  24. */
  25. $adv_model = model('adv');
  26. $adv_id = intval(input('param.adv_id'));
  27. if($adv_id<=0){
  28. $this->error(lang('param_error'));
  29. }
  30. $adv_info = $adv_model->getOneAdv(array(array('adv_id','=',$adv_id)));
  31. if(empty($adv_info['adv_link'])){
  32. $adv_info['adv_link'] = HOME_SITE_URL;
  33. }
  34. $url = str_replace(array('&amp;'), array('&'), $adv_info['adv_link']);
  35. /**
  36. * 写入点击率表
  37. */
  38. $adv_param['adv_clicknum'] = $adv_info['adv_clicknum'] + 1;
  39. $adv_model->editAdv($adv_id,$adv_param);
  40. /**
  41. * 广告链接跳转
  42. */
  43. $this->redirect($url);
  44. }
  45. }
  46. ?>