Wlogin.php 3.0 KB

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