Wlogin.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. $pictwo = input('pictwo/s', "");
  35. $picthr = input('picthr/s', "");
  36. if (empty($realname) || empty($mobile) || empty($province)) {
  37. page_result(1, "姓名,手机号,所属地区不能为空。");
  38. }
  39. if ($wtype == 2) {
  40. if (empty($title)) {
  41. page_result(1, "姓名,手机号,所属地区不能为空。");
  42. }
  43. if ((empty($pictwo) || empty($picthr)) || empty($picthr)) {
  44. page_result(1, "相关证件不能为空。");
  45. }
  46. }
  47. $data = [
  48. 'userid' => $userid,
  49. 'wtype' => $wtype,
  50. 'title' => input('title/s', ""),
  51. 'ftitle' => input('ftitle/s', ""),
  52. 'realname' => input('realname/s', ""),
  53. 'mobile' => input('mobile/s', ""),
  54. 'weixin' => input('weixin/s', ""),
  55. 'latitude' => 0.000000,
  56. 'longitude' => 0.000000,
  57. 'province' => input('province/s', ""),
  58. 'city' => input('city/s', ""),
  59. 'district' => input('district/s', ""),
  60. 'address' => input('address/s', ""),
  61. 'picone' => input('picone/s', ""),
  62. 'pictwo' => input('pictwo/s', ""),
  63. 'picthr' => input('picthr/s', ""),
  64. 'details' => input('details/s', ""),
  65. 'priority' => 0,
  66. 'remark' => "",
  67. 'status' => 1,
  68. 'createtime' => time(),
  69. ];
  70. $worker = WorkerModel::create($data);
  71. page_result(0, "", [
  72. 'worker' => $worker,
  73. ]);
  74. }
  75. }