MyController.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8. // +----------------------------------------------------------------------
  9. // | Author: 老猫 <thinkcmf@126.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\matchmaker\controller;
  12. use app\matchmaker\model\MatchmakerModel;
  13. use app\matchmaker\model\MatchmakerUserModel;
  14. class MyController extends MatchmakerBaseController
  15. {
  16. public function index()
  17. {
  18. $data['matchmaker'] = $this->matchmaker;
  19. $data['matchmaker']['avatar'] = cmf_get_image_url($data['matchmaker']['avatar']);
  20. return $this->fetch('', $data);
  21. }
  22. public function info()
  23. {
  24. $data['matchmaker'] = $this->matchmaker;
  25. $data['matchmaker']['avatar'] = cmf_get_image_url($data['matchmaker']['avatar']);
  26. return $this->fetch('', $data);
  27. }
  28. public function infoPost()
  29. {
  30. $data = $this->request->post();
  31. MatchmakerModel::update($data);
  32. $this->success();
  33. }
  34. public function statistics()
  35. {
  36. $data = [];
  37. $data['total'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  38. ->count();
  39. $data['sex_man'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  40. ->where('sex', 1)
  41. ->count();
  42. $data['sex_woman'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  43. ->where('sex', 2)
  44. ->count();
  45. $data['education_bkyx'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  46. ->where('education', '本科以下')
  47. ->count();
  48. $data['education_bk'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  49. ->where('education', '本科')
  50. ->count();
  51. $data['education_ss'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  52. ->where('education', '硕士')
  53. ->count();
  54. $data['education_bs'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  55. ->where('education', '博士')
  56. ->count();
  57. $data['marry_wh'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  58. ->where('marry', '未婚')
  59. ->count();
  60. $data['marry_lh'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  61. ->where('marry', '离婚')
  62. ->count();
  63. $data['marry_so'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  64. ->where('marry', '丧偶')
  65. ->count();
  66. $data['status_1'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  67. ->where('status', 1)
  68. ->count();
  69. $data['status_2'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  70. ->where('status', 2)
  71. ->count();
  72. $data['status_3'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  73. ->where('status', 3)
  74. ->count();
  75. $data['status_4'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  76. ->where('status', 4)
  77. ->count();
  78. $data['status_5'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
  79. ->where('status', 5)
  80. ->count();
  81. return view('',$data);
  82. }
  83. }