Wlogin.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. /*if (empty($card_no)) {
  39. $card_no_tips = $wtype == 1 ? '身份证号' : '公司证件号';
  40. page_result(1, $card_no_tips . "不能为空。");
  41. }*/
  42. if (empty($realname) || empty($mobile) || empty($province)) {
  43. page_result(1, "姓名,手机号,所属地区不能为空。");
  44. }
  45. if (empty($address)) {
  46. page_result(1, "详细地址不能为空。");
  47. }
  48. if ($wtype == 2) {
  49. if (empty($title)) {
  50. page_result(1, "公司名称不能为空。");
  51. }
  52. if (empty($picone)) {
  53. page_result(1, "相关证件不能为空。");
  54. }
  55. } elseif ($wtype == 1) {
  56. //个人注册,默认姓名为公司名
  57. $title = $realname;
  58. }
  59. $data = [
  60. 'userid' => $userid,
  61. 'wtype' => $wtype,
  62. 'title' => $title,
  63. 'ftitle' => input('ftitle/s', ""),
  64. 'realname' => $realname,
  65. 'mobile' => $mobile,
  66. 'weixin' => input('weixin/s', ""),
  67. 'latitude' => 0.000000,
  68. 'longitude' => 0.000000,
  69. 'province' => $province,
  70. 'city' => input('city/s', ""),
  71. 'district' => input('district/s', ""),
  72. 'address' => input('address/s', ""),
  73. 'picone' => $picone,
  74. 'pictwo' => input('pictwo/s', ""),
  75. 'picthr' => input('picthr/s', ""),
  76. 'details' => input('details/s', ""),
  77. 'priority' => 0,
  78. 'remark' => "",
  79. 'status' => 1,
  80. 'createtime' => time(),
  81. 'card_no' => $card_no,
  82. ];
  83. $worker = WorkerModel::create($data);
  84. //审核通知短信
  85. $sms = new SmsService();
  86. $sms->examineSend('worker_examine', [$worker['id']]);
  87. page_result(0, "", [
  88. 'worker' => $worker,
  89. ]);
  90. }
  91. }