Advclick.php 1.1 KB

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