12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- namespace app\mainapp\controller;
- use think\facade\Session;
- use app\mainapp\BaseController;
- use app\common\model\User as UserModel;
- use app\common\model\Worker as WorkerModel;
- class Wlogin extends BaseController
- {
- // public function getIdentity()
- // {
- // $userid = input('userid/d');
- // $user = UserModel::findOrEmpty($userid);
- // if ($user->isEmpty()){
- // page_result(1, "用户信息不存在");
- // }
- // $workerall = WorkerModel::where('userid','=',$user->id)->select();
- // $agentall = AgentModel::where('userid','=',$user->id)->select();
- // $brokerall = BrokerModel::where('userid','=',$user->id)->select();
- // page_result(0, "", array(
- // 'user' => $user,
- // 'workerall' => $workerall->isEmpty() ? null : $workerall,
- // 'agentall' => $agentall->isEmpty() ? null : $agentall,
- // 'brokerall' => $brokerall->isEmpty() ? null : $brokerall
- // ));
- // }
- public function regWorker()
- {
- $userid = input('userid/d', 0);
- $wtype = input('wtype/d', 1);
- $title = input('title/s', "");
- $realname = input('realname/s', "");
- $mobile = input('mobile/s', "");
- $province = input('province/s', "");
- $picone = input('picone/s', "");
- $card_no = input('card_no/s', "");
- /*if (empty($card_no)) {
- $card_no_tips = $wtype == 1 ? '身份证号' : '公司证件号';
- page_result(1, $card_no_tips . "不能为空。");
- }*/
- if (empty($realname) || empty($mobile) || empty($province)) {
- page_result(1, "姓名,手机号,所属地区不能为空。");
- }
- if ($wtype == 2) {
- if (empty($title)) {
- page_result(1, "公司名称不能为空。");
- }
- if (empty($picone)) {
- page_result(1, "相关证件不能为空。");
- }
- } elseif ($wtype == 1) {
- //个人注册,默认姓名为公司名
- $title = $realname;
- }
- $data = [
- 'userid' => $userid,
- 'wtype' => $wtype,
- 'title' => $title,
- 'ftitle' => input('ftitle/s', ""),
- 'realname' => $realname,
- 'mobile' => $mobile,
- 'weixin' => input('weixin/s', ""),
- 'latitude' => 0.000000,
- 'longitude' => 0.000000,
- 'province' => $province,
- 'city' => input('city/s', ""),
- 'district' => input('district/s', ""),
- 'address' => input('address/s', ""),
- 'picone' => $picone,
- 'pictwo' => input('pictwo/s', ""),
- 'picthr' => input('picthr/s', ""),
- 'details' => input('details/s', ""),
- 'priority' => 0,
- 'remark' => "",
- 'status' => 1,
- 'createtime' => time(),
- 'card_no' => $card_no,
- ];
- $worker = WorkerModel::create($data);
- page_result(0, "", [
- 'worker' => $worker,
- ]);
- }
- }
|