homelogic.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2022-01-18 11:12:23
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2022-01-19 15:51:59
  7. */
  8. namespace app\admin\logic;
  9. use app\admin\model\companymodel;
  10. use app\admin\model\partymodel;
  11. use app\admin\model\partyrecordmodel;
  12. use app\admin\model\usermodel;
  13. class homelogic extends baselogic
  14. {
  15. /**
  16. * 设置请求数据规则
  17. * 20220107
  18. * wj
  19. */
  20. protected function setrules()
  21. {
  22. $list = [];
  23. return $list;
  24. }
  25. /**
  26. * 获取活动信息
  27. * 20220211
  28. * wj
  29. */
  30. public function getpartyinfo($arr)
  31. {
  32. $result = $this->checkparam(__FUNCTION__, $arr);
  33. if (1 != $result['status']) {
  34. return $result;
  35. }
  36. $m_p = new partymodel();
  37. //总数
  38. $count = $m_p->getList([], 'count');
  39. //当前活动
  40. $time = date('Y-m-d H:i:s');
  41. $where = [
  42. ['isactive', '=', 1],
  43. ['start_time', '<=', $time],
  44. ['end_time', '>=', $time],
  45. ];
  46. $info = $m_p->getInfo($where, ['name', 'id']);
  47. //报名企业数量
  48. $wherePr = [
  49. 'party_id' => $info['id'],
  50. ];
  51. $m_p = new partyrecordmodel();
  52. $prcount = $m_p->getListjoincompany($wherePr, 'count');
  53. $data = [
  54. 'count' => $count,
  55. 'info' => $info,
  56. 'prcount' => $prcount,
  57. ];
  58. return backarr(1, '查询成功', $data);
  59. }
  60. /**
  61. * 获取公司信息
  62. * 20220211
  63. * wj
  64. */
  65. public function getcompanyinfo($arr)
  66. {
  67. $result = $this->checkparam(__FUNCTION__, $arr);
  68. if (1 != $result['status']) {
  69. return $result;
  70. }
  71. $m_c = new companymodel();
  72. //总数
  73. $count = $m_c->getList([], 'count');
  74. //获取分组
  75. $where0 = ['ispass' => 0];
  76. $where1 = ['ispass' => 1];
  77. $where2 = ['ispass' => 2];
  78. $count0 = $m_c->getList($where0, 'count');
  79. $count1 = $m_c->getList($where1, 'count');
  80. $count2 = $m_c->getList($where2, 'count');
  81. $data = [
  82. 'count' => empty($count) ? 0 : $count,
  83. 'count0' => empty($count0) ? 0 : $count0,
  84. 'count1' => empty($count1) ? 0 : $count1,
  85. 'count2' => empty($count2) ? 0 : $count2,
  86. ];
  87. return backarr(1, '查询成功', $data);
  88. }
  89. /**
  90. * 获取用户信息
  91. * 20220211
  92. * wj
  93. */
  94. public function getuserinfo($arr)
  95. {
  96. $result = $this->checkparam(__FUNCTION__, $arr);
  97. if (1 != $result['status']) {
  98. return $result;
  99. }
  100. $m_u = new usermodel();
  101. //总数
  102. $count = $m_u->getList([], 'count');
  103. //获取分组
  104. $where1 = ['is_active' => 1];
  105. $where2 = ['company_id' => 1];
  106. $count1 = $m_u->getList($where1, 'count');
  107. $count2 = $m_u->getList($where2, 'count');
  108. $count1 = empty($count1) ? 0 : $count1;
  109. $count2 = empty($count2) ? 0 : $count2;
  110. $data = [
  111. 'count' => empty($count) ? 0 : $count,
  112. 'count_isactive_0' => $count - $count1,
  113. 'count_isactive_1' => $count1,
  114. /*'couunt_iscompany_0' => $count - $count2,
  115. 'couunt_iscompany_1' => $count2,*/
  116. ];
  117. return backarr(1, '查询成功', $data);
  118. }
  119. }