EnrollStudents.php 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <?php
  2. namespace app\parent\controller\enroll;
  3. use app\admin\extend\enroll\EnrollHandle;
  4. use app\common\model\ArrangeConfig\JdfArrangeConfig;
  5. use app\common\model\base\org\Org;
  6. use app\common\model\base\org\OrgType;
  7. use app\common\model\guardian\JdfGuardian;
  8. use app\common\model\periodConfig\JdfPeriodConfig;
  9. use app\parent\ParentBase;
  10. use app\common\model\enroll\EnrollStudents as EnrollStudentsModel;
  11. use daorui\platform\platformAuth;
  12. class EnrollStudents extends ParentBase
  13. {
  14. protected $noNeedLogin = [];
  15. protected $model = null;
  16. public function initialize()
  17. {
  18. parent::initialize(); // TODO: Change the autogenerated stub
  19. $this->model = new EnrollStudentsModel;
  20. }
  21. /**
  22. * Desc :获取学校等级分类列表
  23. * User : zwq
  24. * Date : 2024-12-12 16:37
  25. */
  26. public function getSchoolCode()
  27. {
  28. $data = $this->request->param();
  29. $res = EnrollHandle::getSchoolCode($data);
  30. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  31. return res(1, "保存成功", $res['data'] ?? '');
  32. }
  33. /**
  34. * Desc :获取分类年级
  35. * User : zwq
  36. * Date : 2025-01-13 16:17
  37. * @return \think\response\Json
  38. */
  39. public function getGrade()
  40. {
  41. $data = $this->request->param();
  42. $res = (new platformAuth())->interfaceRequest('getGrade', $data);
  43. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  44. return res(1, "保存成功", $res['data'] ?? '');
  45. }
  46. /**
  47. * Desc :获取报名学校
  48. * User : zwq
  49. * Date : 2025-01-13 16:59
  50. * @return \think\response\Json
  51. */
  52. public function getClassSchool()
  53. {
  54. $data = $this->request->param();
  55. $res = EnrollHandle::getClassSchool($data);
  56. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  57. return res(1, "保存成功", $res['data'] ?? '');
  58. }
  59. /**
  60. * Desc :获取根据类型查学校
  61. * User : zwq
  62. * Date : 2024-12-12 17:23
  63. */
  64. public function getSchoolList()
  65. {
  66. $data = $this->request->param();
  67. $res = (new platformAuth())->interfaceRequest('getSchool', $data);
  68. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  69. return pageRes(1, '获取成功', $res['extend'], $res['data']);
  70. }
  71. /**
  72. * Desc :创建报名
  73. * User : zwq
  74. * Date : 2024-12-17 10:57
  75. */
  76. public function createOrder()
  77. {
  78. $data = $this->request->param();
  79. if (empty($data['enroll_id'])) {
  80. $res = EnrollHandle::createEnroll($this->userinfo, $data);
  81. WLog('createOrder', $data);
  82. if (!$res['code']) return res(2, $res['msg'] ?? '创建失败', $res['data'] ?? '');
  83. return res(1, "报名信息提交成功!", $res['data'] ?? '');
  84. } else {
  85. $res = EnrollHandle::updateEnroll($this->userinfo, $data);
  86. WLog('updateOrder', $data);
  87. if (!$res['code']) return res(2, $res['msg'] ?? '编辑失败', $res['data'] ?? '');
  88. return res(1, "报名信息编辑成功!", $res['data'] ?? '');
  89. }
  90. }
  91. /**
  92. * Desc :删除报名信息
  93. * User : zwq
  94. * Date : 2025-02-07 17:59
  95. */
  96. public function deleteEnroll()
  97. {
  98. $data = $this->request->param();
  99. $res = EnrollHandle::deleteEnroll($this->userinfo, $data);
  100. WLog('delOrder', $data);
  101. if (!$res['code']) return res(2, $res['msg'] ?? '删除失败', $res['data'] ?? '');
  102. return res(1, "报名信息删除成功!", $res['data'] ?? '');
  103. }
  104. /**
  105. * Desc :家长查询学生报名列表
  106. * User : zwq
  107. * Date : 2024-12-24 08:50
  108. */
  109. public function getOrderList()
  110. {
  111. $guardian_id = $this->userinfo->guardian_id;
  112. $data = $this->request->param();
  113. $where = [];
  114. $where[] = ['apply_uid', '=', $guardian_id];
  115. if (!empty($data['kw'])) {
  116. $where[] = ['name|idcard', 'LIKE', "%{$data['kw']}%"];
  117. }
  118. $res = EnrollStudentsModel::where($where)->select();
  119. return res(1, "获取成功", $res);
  120. }
  121. /**
  122. * Desc :查询报名详情
  123. * User : zwq
  124. * Date : 2024-12-24 09:30
  125. */
  126. public function getOrderInfo()
  127. {
  128. $enroll_id = input("enroll_id/d", 0);
  129. if (empty($enroll_id)) return res(2, "enroll_id不能为空");
  130. $res = EnrollStudentsModel::alias('a')
  131. ->with(["volunteer"])
  132. ->where('enroll_id', $enroll_id)->find();
  133. if (!empty($res)) {
  134. $guardian = JdfGuardian::alias('a')
  135. ->join('jdf_guardian_relation b', 'a.guardian_id=b.guardian_id')
  136. ->where('b.enroll_id', $res['enroll_id'])
  137. ->where('a.guardian_id', 'IN', $res['guardian_ids'])
  138. ->select();
  139. $res['guardian'] = $guardian;
  140. } else {
  141. return res(401, "报名信息不存在");
  142. }
  143. return res(1, "获取成功", $res);
  144. }
  145. /**
  146. * Desc :获取全部省市县区列表
  147. * User : zwq
  148. * Date : 2025-01-09 16:18
  149. */
  150. public function getAreaList()
  151. {
  152. $data = $this->request->param();
  153. $res = (new platformAuth())->interfaceRequest('getArea', $data);
  154. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  155. return res(1, "保存成功", $res['data'] ?? '');
  156. }
  157. /**
  158. * Desc :获取以前就读学校
  159. * User : zwq
  160. * Date : 2025-01-09 16:18
  161. */
  162. public function getFormerSchool()
  163. {
  164. $data = $this->request->param();
  165. $res = (new platformAuth())->interfaceRequest('getPreviousSchool', $data);
  166. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  167. return res(1, "获取成功", $res['data']);
  168. }
  169. /**
  170. * Desc :获取监护人关系列表
  171. * User : zwq
  172. * Date : 2025-01-13 09:07
  173. * @return \think\response\Json
  174. */
  175. public function getRelationList()
  176. {
  177. $data = $this->request->param();
  178. $res = (new platformAuth())->interfaceRequest('getDicPage', $data);
  179. if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
  180. return res(1, "获取成功", $res['data']);
  181. }
  182. /**
  183. * Desc :获取上一单信息
  184. * User : zwq
  185. * Date : 2025-01-22 10:40
  186. */
  187. public function getPreviousOrder()
  188. {
  189. $guardian_id = $this->userinfo->guardian_id??0;
  190. if(!empty($guardian_id)) {
  191. $res = $this->model->where('apply_uid', $guardian_id)->order('enroll_id desc')->find();
  192. }
  193. return res(1, "获取成功", $res ?? "");
  194. }
  195. /**
  196. * Desc :检测该学段是否已截至报名
  197. * User : zwq
  198. * Date : 2025-02-06 09:33
  199. */
  200. public function checkExpire()
  201. {
  202. $code = input("code/s", "");
  203. if (empty($code)) return res(2, "学段不能为空");
  204. $info = JdfPeriodConfig::where('code', $code)->find();
  205. if (empty($info)) return res(2, "学段不存在");
  206. // 获取当前时间
  207. $current_time = date('Y-m-d H:i:s');
  208. // 将时间字符串转换为时间戳
  209. $start_timestamp = strtotime($info['start_time']);
  210. $end_timestamp = strtotime($info['end_time']);
  211. $current_timestamp = strtotime($current_time);
  212. // 判断当前时间是否在 start_time 和 end_time 之间
  213. if ($current_timestamp >= $start_timestamp && $current_timestamp <= $end_timestamp && $info['is_open'] == 1) {
  214. return res(1, "获取成功", true);
  215. } else {
  216. return res(1, "获取成功", false);
  217. }
  218. }
  219. }