Advertisement
Guest User

Untitled

a guest
Sep 19th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. set_time_limit(0);
  2. ob_start();
  3.  
  4. -/*
  5. -// Fill report_money_earned_by_callcenter table (slow)
  6. -$db->query("INSERT report_money_earned_by_callcenter select log_ad_click.action_dt 'Date', cc.id CallCenter, count(*) Clicks, sum(cost_per_lead*(100-shared_revenue_pct)/100) 'Amount'
  7. -from log_ad_click
  8. -join ad_available aa on ad_id=aa.id
  9. -join log_ad_page_served ps on ps.id=log_ad_page_id
  10. -join call_center cc on cc.id=ps.call_center_id
  11. -where 1=1
  12. -#and log_ad_click.action_dt> now() - INTERVAL 3 MONTH
  13. -group by log_ad_click.action_dt, cc.id");
  14. -*/
  15. -
  16. -// Fill data for today into report_money_earned_by_callcenter
  17. -$db->query("REPLACE report_money_earned_by_callcenter select log_ad_click.action_dt 'Date', cc.id CallCenter, count(*) Clicks, sum(cost_per_lead*(100-shared_revenue_pct)/100) 'Amount'
  18. -from log_ad_click
  19. -join ad_available aa on ad_id=aa.id
  20. -join log_ad_page_served ps on ps.id=log_ad_page_id
  21. -join call_center cc on cc.id=ps.call_center_id
  22. -where 1=1
  23. -and log_ad_click.action_dt = DATE(now())
  24. -group by log_ad_click.action_dt, cc.id");
  25. -
  26. -
  27. -// Fill data for today into report_money_earned_by_callcenter
  28. -$db->query("REPLACE report_messages_sent_by_callcenter SELECT action_dt 'Date', cc.id CallCenter, count(*) Served
  29. -, sum((select count(*) from log_ad_view where ps.id=log_ad_page_id )) Seen
  30. -from log_ad_page_served ps
  31. -join call_center cc on cc.id=ps.call_center_id
  32. -where 1=1
  33. -and action_dt = DATE(now())
  34. -group by action_dt, cc.id;");
  35. -
  36. -
  37. // Cache Ad Pages stats data
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement