123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238 |
- <?php
- namespace app\parent\controller\enroll;
- use app\admin\extend\enroll\EnrollHandle;
- use app\common\model\ArrangeConfig\JdfArrangeConfig;
- use app\common\model\base\org\Org;
- use app\common\model\base\org\OrgType;
- use app\common\model\guardian\JdfGuardian;
- use app\common\model\periodConfig\JdfPeriodConfig;
- use app\parent\ParentBase;
- use app\common\model\enroll\EnrollStudents as EnrollStudentsModel;
- use daorui\platform\platformAuth;
- class EnrollStudents extends ParentBase
- {
- protected $noNeedLogin = [];
- protected $model = null;
- public function initialize()
- {
- parent::initialize(); // TODO: Change the autogenerated stub
- $this->model = new EnrollStudentsModel;
- }
- /**
- * Desc :获取学校等级分类列表
- * User : zwq
- * Date : 2024-12-12 16:37
- */
- public function getSchoolCode()
- {
- $data = $this->request->param();
- $res = EnrollHandle::getSchoolCode($data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return res(1, "保存成功", $res['data'] ?? '');
- }
- /**
- * Desc :获取分类年级
- * User : zwq
- * Date : 2025-01-13 16:17
- * @return \think\response\Json
- */
- public function getGrade()
- {
- $data = $this->request->param();
- $res = (new platformAuth())->interfaceRequest('getGrade', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return res(1, "保存成功", $res['data'] ?? '');
- }
- /**
- * Desc :获取报名学校
- * User : zwq
- * Date : 2025-01-13 16:59
- * @return \think\response\Json
- */
- public function getClassSchool()
- {
- $data = $this->request->param();
- $res = EnrollHandle::getClassSchool($data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return res(1, "保存成功", $res['data'] ?? '');
- }
- /**
- * Desc :获取根据类型查学校
- * User : zwq
- * Date : 2024-12-12 17:23
- */
- public function getSchoolList()
- {
- $data = $this->request->param();
- $res = (new platformAuth())->interfaceRequest('getSchool', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return pageRes(1, '获取成功', $res['extend'], $res['data']);
- }
- /**
- * Desc :创建报名
- * User : zwq
- * Date : 2024-12-17 10:57
- */
- public function createOrder()
- {
- $data = $this->request->param();
- if (empty($data['enroll_id'])) {
- $res = EnrollHandle::createEnroll($this->userinfo, $data);
- WLog('createOrder', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '创建失败', $res['data'] ?? '');
- return res(1, "报名信息提交成功!", $res['data'] ?? '');
- } else {
- $res = EnrollHandle::updateEnroll($this->userinfo, $data);
- WLog('updateOrder', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '编辑失败', $res['data'] ?? '');
- return res(1, "报名信息编辑成功!", $res['data'] ?? '');
- }
- }
- /**
- * Desc :删除报名信息
- * User : zwq
- * Date : 2025-02-07 17:59
- */
- public function deleteEnroll()
- {
- $data = $this->request->param();
- $res = EnrollHandle::deleteEnroll($this->userinfo, $data);
- WLog('delOrder', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '删除失败', $res['data'] ?? '');
- return res(1, "报名信息删除成功!", $res['data'] ?? '');
- }
- /**
- * Desc :家长查询学生报名列表
- * User : zwq
- * Date : 2024-12-24 08:50
- */
- public function getOrderList()
- {
- $guardian_id = $this->userinfo->guardian_id;
- $data = $this->request->param();
- $where = [];
- $where[] = ['apply_uid', '=', $guardian_id];
- if (!empty($data['kw'])) {
- $where[] = ['name|idcard', 'LIKE', "%{$data['kw']}%"];
- }
- $res = EnrollStudentsModel::where($where)->select();
- return res(1, "获取成功", $res);
- }
- /**
- * Desc :查询报名详情
- * User : zwq
- * Date : 2024-12-24 09:30
- */
- public function getOrderInfo()
- {
- $enroll_id = input("enroll_id/d", 0);
- if (empty($enroll_id)) return res(2, "enroll_id不能为空");
- $res = EnrollStudentsModel::alias('a')
- ->with(["volunteer"])
- ->where('enroll_id', $enroll_id)->find();
- if (!empty($res)) {
- $guardian = JdfGuardian::alias('a')
- ->join('jdf_guardian_relation b', 'a.guardian_id=b.guardian_id')
- ->where('b.enroll_id', $res['enroll_id'])
- ->where('a.guardian_id', 'IN', $res['guardian_ids'])
- ->select();
- $res['guardian'] = $guardian;
- } else {
- return res(401, "报名信息不存在");
- }
- return res(1, "获取成功", $res);
- }
- /**
- * Desc :获取全部省市县区列表
- * User : zwq
- * Date : 2025-01-09 16:18
- */
- public function getAreaList()
- {
- $data = $this->request->param();
- $res = (new platformAuth())->interfaceRequest('getArea', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return res(1, "保存成功", $res['data'] ?? '');
- }
- /**
- * Desc :获取以前就读学校
- * User : zwq
- * Date : 2025-01-09 16:18
- */
- public function getFormerSchool()
- {
- $data = $this->request->param();
- $res = (new platformAuth())->interfaceRequest('getPreviousSchool', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return res(1, "获取成功", $res['data']);
- }
- /**
- * Desc :获取监护人关系列表
- * User : zwq
- * Date : 2025-01-13 09:07
- * @return \think\response\Json
- */
- public function getRelationList()
- {
- $data = $this->request->param();
- $res = (new platformAuth())->interfaceRequest('getDicPage', $data);
- if (!$res['code']) return res(2, $res['msg'] ?? '获取失败', $res['data'] ?? '');
- return res(1, "获取成功", $res['data']);
- }
- /**
- * Desc :获取上一单信息
- * User : zwq
- * Date : 2025-01-22 10:40
- */
- public function getPreviousOrder()
- {
- $guardian_id = $this->userinfo->guardian_id??0;
- if(!empty($guardian_id)) {
- $res = $this->model->where('apply_uid', $guardian_id)->order('enroll_id desc')->find();
- }
- return res(1, "获取成功", $res ?? "");
- }
- /**
- * Desc :检测该学段是否已截至报名
- * User : zwq
- * Date : 2025-02-06 09:33
- */
- public function checkExpire()
- {
- $code = input("code/s", "");
- if (empty($code)) return res(2, "学段不能为空");
- $info = JdfPeriodConfig::where('code', $code)->find();
- if (empty($info)) return res(2, "学段不存在");
- // 获取当前时间
- $current_time = date('Y-m-d H:i:s');
- // 将时间字符串转换为时间戳
- $start_timestamp = strtotime($info['start_time']);
- $end_timestamp = strtotime($info['end_time']);
- $current_timestamp = strtotime($current_time);
- // 判断当前时间是否在 start_time 和 end_time 之间
- if ($current_timestamp >= $start_timestamp && $current_timestamp <= $end_timestamp && $info['is_open'] == 1) {
- return res(1, "获取成功", true);
- } else {
- return res(1, "获取成功", false);
- }
- }
- }
|