Candidate.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\mobile\controller;
  3. use app\common\model\Broker as BrokerModel;
  4. use app\common\model\OutResume as OutResumeModel;
  5. use app\mobile\MobileBaseController;
  6. use app\mobile\validate\CandidateValidate;
  7. use think\exception\ValidateException;
  8. class Candidate extends MobileBaseController
  9. {
  10. public function info()
  11. {
  12. $broker_id = input('get.broker_id');
  13. empty($broker_id) && jump('无法获取经纪人信息');
  14. $broker = BrokerModel::where('id', $broker_id)->find();
  15. empty($broker) && jump('无法获取经纪人信息');
  16. $broker['type'] != 3 && jump('无法获取经纪人信息');
  17. return view('candidate/info', ['broker' => $broker]);
  18. }
  19. public function infoPost()
  20. {
  21. $data = input('post.');
  22. try {
  23. validate(CandidateValidate::class)->check($data);
  24. } catch (ValidateException $e) {
  25. ajax_return(1, $e->getError());
  26. }
  27. $idcard_check = OutResumeModel::where('idcard', $data['idcard'])->find();
  28. $idcard_check && ajax_return(1, '该身份证号已被登记!');
  29. $mobile_check = OutResumeModel::where('mobile', $data['mobile'])->find();
  30. $mobile_check && ajax_return(1, '该手机号已被登记!');
  31. $data['updatetime'] = $data['createtime'] = time();
  32. OutResumeModel::create($data);
  33. ajax_return();
  34. }
  35. }