StatisticsController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace App\Http\Controllers\Wechat\Statistic;
  3. use App\Http\Requests;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Response;
  6. use EasyWeChat\Foundation\Application;
  7. use EasyWeChat\Message\News;
  8. /**
  9. * 公众号统计信息
  10. * @author zhoulingjie
  11. *
  12. */
  13. class StatisticsController
  14. {
  15. public function __construct($_param)
  16. {
  17. $this->param = $_param;
  18. $this->app = $_param['app'];
  19. }
  20. /**
  21. * 得到公众号统计信息
  22. * @param Request $request
  23. */
  24. public function get_gzh_statistics($from_date,$to_date,$gzh_app_id)
  25. {
  26. $result = array('code'=>1,'msg'=>'','data'=>array());
  27. try{
  28. $result['data']['user_cumulate'] = $this->app->stats->userCumulate($from_date, $to_date);//获取累计用户数据, 最大时间跨度:7;
  29. $result['data']['user_summary'] = $this->app->stats->userSummary($from_date, $to_date);//获取用户增减数据, 最大时间跨度:7;
  30. v($result);
  31. }
  32. // 加上\ 全局抓取
  33. catch(\Exception $e){
  34. $result['code'] = 0;
  35. $result['msg'] = $e->getMessage();
  36. v('get_gzh_statistics_ept:'.$gzh_app_id.' info:'.$e->getMessage());
  37. }
  38. return $result;
  39. }
  40. }