Identity.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace app\mainapp\controller;
  3. use think\facade\Session;
  4. use app\common\model\User as UserModel;
  5. use app\common\model\Worker as WorkerModel;
  6. class Identity extends BaseController
  7. {
  8. public function getIdentity()
  9. {
  10. $userid = input('userid/d');
  11. $user = UserModel::findOrEmpty($userid);
  12. if ($user->isEmpty()){
  13. page_result(1, "用户信息不存在");
  14. }
  15. $workerall = WorkerModel::where('userid','=',$user->id)->select();
  16. $agentall = AgentModel::where('userid','=',$user->id)->select();
  17. $brokerall = BrokerModel::where('userid','=',$user->id)->select();
  18. page_result(0, "", array(
  19. 'user' => $user,
  20. 'workerall' => $workerall->isEmpty() ? null : $workerall,
  21. 'agentall' => $agentall->isEmpty() ? null : $agentall,
  22. 'brokerall' => $brokerall->isEmpty() ? null : $brokerall
  23. ));
  24. }
  25. public function regWorker()
  26. {
  27. $userid = input('userid/d', 0);
  28. $title = input('title/s', "");
  29. $ftitle = input('ftitle/s', "");
  30. $realname = input('realname/s', "");
  31. $mobile = input('mobile/s', "");
  32. $position = input('position/s', "");
  33. $province = input('province/s', "");
  34. $address = input('address/s', "");
  35. if ( empty($title) || empty($ftitle) || empty($realname) || empty($mobile) || empty($position) || empty($province) || empty($address) ){
  36. page_result(1, "公司名称,微店名称,负责人姓名电话职位,地址信息不能为空。");
  37. }
  38. $data = [
  39. 'userid' => $userid,
  40. 'loginname' => $userid ."-". date("YmdHis"),
  41. 'password' => md5("123456789"),
  42. 'wtype' => input('wtype/d', 1),
  43. 'title' => input('title/s', ""),
  44. 'ftitle' => input('ftitle/s', ""),
  45. 'tilpic' => input('tilpic/s', ""),
  46. 'realname' => input('realname/s', ""),
  47. 'mobile' => input('mobile/s', ""),
  48. 'position' => input('position/s', ""),
  49. 'weixin' => input('weixin/s', ""),
  50. 'latitude' => input('latitude/f'),
  51. 'longitude' => input('longitude/f'),
  52. 'province' => input('province/s', ""),
  53. 'city' => input('city/s', ""),
  54. 'district' => input('district/s', ""),
  55. 'address' => input('address/s', ""),
  56. 'picone' => input('picone/s', ""),
  57. 'pictwo' => input('pictwo/s', ""),
  58. 'picthr' => input('picthr/s', ""),
  59. 'details' => input('details/s', ""),
  60. 'priority' => input('priority/d', 0),
  61. 'remark' => input('remark/s', ""),
  62. 'status' => input('status/d', 1),
  63. 'createtime' => time()
  64. ];
  65. $worker = WorkerModel::create($data);
  66. }
  67. }