StatsController.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: xiaofeng
  5. * Date: 2018/4/19
  6. * Time: 下午2:52
  7. */
  8. namespace frontend\controllers;
  9. use frontend\base\CommonController;
  10. use common\models\Enroll;
  11. use backend\server\Houses;
  12. use backend\base\Help;
  13. use Yii;
  14. class StatsController extends CommonController
  15. {
  16. public $enableCsrfValidation = false;
  17. //格式 action 必须的 首字符大写,其余的都是小写。
  18. public function actionIndex(){
  19. if(!empty($_GET['value'])){
  20. switch ($_GET['value']) {
  21. case 'tCall':
  22. $t1 = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=3&t=count'),true);
  23. $t2 = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=4&t=count'),true);
  24. $t3 = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=5&t=count'),true);
  25. $merge = array($t1[0],$t2[0],$t3[0]);
  26. $num = 0;
  27. foreach($merge as $val){
  28. $num += $val['value'];
  29. }
  30. $result[]['value'] = $num;
  31. break;
  32. // 总来电(岛内)
  33. case 'CallCount':
  34. $pf = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=1&t=count'),true);
  35. $yf = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=2&t=count'),true);
  36. $t1 = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=3&t=count'),true);
  37. $t2 = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=4&t=count'),true);
  38. $t3 = json_decode(file_get_contents('http://pfg.office.kaipie.com/public/webclient.ashx?bm=5&t=count'),true);
  39. $merge = array($pf[0],$yf[0],$t1[0],$t2[0],$t3[0]);
  40. $num = 0;
  41. foreach($merge as $val){
  42. $num += $val['value'];
  43. }
  44. $result[]['value'] = $num;
  45. break;
  46. //品房网报名
  47. case 'bmcount':
  48. $time = date("Y-m-d",time());
  49. $Enroll = new Enroll();
  50. $Enrollcount = $Enroll->getList(['start_time'=>$time,'end_time'=>$time]);
  51. foreach($Enrollcount as &$val){
  52. $unique[$val['mobile']] = $val;
  53. }
  54. $result[]['value'] = count($unique);
  55. break;
  56. }
  57. echo json_encode($result);
  58. }
  59. }
  60. }