Wlogin.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. namespace app\mainapp\controller;
  3. use app\common\service\SmsService;
  4. use think\facade\Session;
  5. use app\mainapp\BaseController;
  6. use app\common\model\User as UserModel;
  7. use app\common\model\Worker as WorkerModel;
  8. class Wlogin extends BaseController
  9. {
  10. // public function getIdentity()
  11. // {
  12. // $userid = input('userid/d');
  13. // $user = UserModel::findOrEmpty($userid);
  14. // if ($user->isEmpty()){
  15. // page_result(1, "用户信息不存在");
  16. // }
  17. // $workerall = WorkerModel::where('userid','=',$user->id)->select();
  18. // $agentall = AgentModel::where('userid','=',$user->id)->select();
  19. // $brokerall = BrokerModel::where('userid','=',$user->id)->select();
  20. // page_result(0, "", array(
  21. // 'user' => $user,
  22. // 'workerall' => $workerall->isEmpty() ? null : $workerall,
  23. // 'agentall' => $agentall->isEmpty() ? null : $agentall,
  24. // 'brokerall' => $brokerall->isEmpty() ? null : $brokerall
  25. // ));
  26. // }
  27. public function regWorker()
  28. {
  29. $userid = input('userid/d', 0);
  30. $wtype = input('wtype/d', 1);
  31. $title = input('title/s', "");
  32. $realname = input('realname/s', "");
  33. $mobile = input('mobile/s', "");
  34. $province = input('province/s', "");
  35. $picone = input('picone/s', "");
  36. $card_no = input('card_no/s', "");
  37. $address = input('address/s', "");
  38. $idcardzpic = input('idcardzpic/s', "");
  39. $idcardfpic = input('idcardfpic/s', "");
  40. /*if (empty($card_no)) {
  41. $card_no_tips = $wtype == 1 ? '身份证号' : '公司证件号';
  42. page_result(1, $card_no_tips . "不能为空。");
  43. }*/
  44. if ($wtype == 1 && (empty($idcardfpic) || empty($idcardzpic))) {
  45. page_result(1, "请上传身份证正反面。");
  46. }
  47. if (empty($realname) || empty($mobile) || empty($province)) {
  48. page_result(1, "姓名,手机号,所属地区不能为空。");
  49. }
  50. if (empty($address)) {
  51. page_result(1, "详细地址不能为空。");
  52. }
  53. if ($wtype == 2) {
  54. if (empty($title)) {
  55. page_result(1, "公司名称不能为空。");
  56. }
  57. if (empty($picone)) {
  58. page_result(1, "相关证件不能为空。");
  59. }
  60. } elseif ($wtype == 1) {
  61. //个人注册,默认姓名为公司名
  62. $title = $realname;
  63. }
  64. $data = [
  65. 'userid' => $userid,
  66. 'wtype' => $wtype,
  67. 'title' => $title,
  68. 'ftitle' => input('ftitle/s', ""),
  69. 'realname' => $realname,
  70. 'mobile' => $mobile,
  71. 'weixin' => input('weixin/s', ""),
  72. 'latitude' => 0.000000,
  73. 'longitude' => 0.000000,
  74. 'province' => $province,
  75. 'city' => input('city/s', ""),
  76. 'district' => input('district/s', ""),
  77. 'address' => input('address/s', ""),
  78. 'picone' => $picone,
  79. 'pictwo' => input('pictwo/s', ""),
  80. 'picthr' => input('picthr/s', ""),
  81. 'idcardzpic' => $idcardzpic,
  82. 'idcardfpic' => $idcardfpic,
  83. 'details' => input('details/s', ""),
  84. 'priority' => 0,
  85. 'remark' => "",
  86. 'status' => 1,
  87. 'createtime' => time(),
  88. 'card_no' => $card_no,
  89. ];
  90. $worker = WorkerModel::create($data);
  91. //审核通知短信
  92. $sms = new SmsService();
  93. $sms->examineSend('worker_examine', [$worker['id']]);
  94. page_result(0, "", [
  95. 'worker' => $worker,
  96. ]);
  97. }
  98. }