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, "相关证件不能为空。"); } } $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, ]); } }