|
|
@@ -73,6 +73,7 @@ class User extends BaseController
|
|
|
$data['work_type_id'] = $request->user['work_type_id'];//用户职称类型
|
|
|
$data['work_type_title'] = $request->user['work_type_title'];//用户职称类型名称
|
|
|
$data['card_look_count'] = $request->user['card_look_count'];//用户名片浏览次数
|
|
|
+ $data['bookmark_count'] = $request->user['bookmark_count'];//收藏数量
|
|
|
|
|
|
$data['info_audit_status'] = empty($infoAuditData) ? -2 : $infoAuditData["status"];
|
|
|
$data['user_audit_status'] = empty($userAuditData) ? -2 : $userAuditData["status"];
|
|
|
@@ -210,7 +211,7 @@ class User extends BaseController
|
|
|
}
|
|
|
// if(!empty($post["mobile"])){
|
|
|
// if(is_mobile($post["mobile"])){
|
|
|
-// return app("json")->fail("请输入正确的手机号码");
|
|
|
+// return app("json")->fail("请输入正确的手机号码");
|
|
|
// }
|
|
|
// $save["mobile"] = $post["mobile"];
|
|
|
// }
|
|
|
@@ -320,12 +321,17 @@ class User extends BaseController
|
|
|
['service_intro_imgs', []],
|
|
|
['service_audit_imgs', []],//此处为我的证书
|
|
|
['service_imgs', []],//我的服务照片
|
|
|
+ ['model_imgs', []],//我的服务照片
|
|
|
['service_count', 0],
|
|
|
['work_year', ''],
|
|
|
['ancestral_place', ''],
|
|
|
['education', ''],
|
|
|
+ ['weight', 0],
|
|
|
+ ['height', 0],
|
|
|
['minority', ''],
|
|
|
['is_china', 1],
|
|
|
+ ['is_global', 0],
|
|
|
+ ['modelType', 0],
|
|
|
|
|
|
['user_work_type_id', '0'],//服务职称
|
|
|
['service_label', []],//服务标签
|
|
|
@@ -340,6 +346,8 @@ class User extends BaseController
|
|
|
$save["name"] = empty($post["name"]) ? "" : $post["name"];
|
|
|
$save["mobile"] = empty($post["mobile"]) ? "" : $post["mobile"];
|
|
|
$save["idcard"] = empty($post["idcard"]) ? "" : $post["idcard"];
|
|
|
+ $save["weight"] = empty($post["weight"]) ? 0 : $post["weight"];
|
|
|
+ $save["height"] = empty($post["height"]) ? 0 : $post["height"];
|
|
|
$save["service_count"] = $post['service_count'];
|
|
|
|
|
|
// $save["birthday"] = empty($post["birthday"])? 0 : strtotime($post["birthday"]);
|
|
|
@@ -435,7 +443,7 @@ class User extends BaseController
|
|
|
$save["service_intro_imgs"] = empty($post["service_intro_imgs"]) ? "" : implode(",", $post["service_intro_imgs"]);
|
|
|
$save["service_audit_imgs"] = empty($post["service_audit_imgs"]) ? "" : implode(",", $post["service_audit_imgs"]);
|
|
|
$save["service_imgs"] = empty($post["service_imgs"]) ? "" : implode(",", $post["service_imgs"]);//我的服务展示
|
|
|
-
|
|
|
+ $save["model_imgs"] = empty($post["model_imgs"]) ? "" : implode(",", $post["model_imgs"]);//我的服务展示
|
|
|
|
|
|
$save['work_year'] = empty($post["work_year"]) ? "" : $post["work_year"];
|
|
|
$save['ancestral_place'] = empty($post["ancestral_place"]) ? "" : $post["ancestral_place"];
|
|
|
@@ -447,6 +455,8 @@ class User extends BaseController
|
|
|
$save["time"] = time();
|
|
|
$save["uid"] = $request->user["uid"];
|
|
|
$save['is_china'] = $post["is_china"];
|
|
|
+ $save['is_global'] = $post["is_global"];
|
|
|
+ $save['modelType'] = $post["modelType"];
|
|
|
|
|
|
//服务职称
|
|
|
$save["user_work_type_id"] = empty($post["user_work_type_id"]) ? 0 : (int)$post["user_work_type_id"];
|
|
|
@@ -469,6 +479,11 @@ class User extends BaseController
|
|
|
}
|
|
|
(new InfoAudit)->where("id", $r)->update(["no" => $no]);
|
|
|
(new InfoAudit)->where("id", $r)->update(["status" => 1]);
|
|
|
+ (new UserModel)->where("uid", $save["uid"])->update(["work_type_id" => $save["user_work_type_id"]]);
|
|
|
+ //绑定初始化模板
|
|
|
+ (new UserShowTemplate)->userBindTempInit($save["uid"]);
|
|
|
+ //删除以前的资料
|
|
|
+ (new InfoAudit)->where('uid', $save['uid'])->where("id", "<>", $r)->delete();
|
|
|
return app('json')->success("提交成功,数据已通过审核");
|
|
|
}
|
|
|
|
|
|
@@ -796,332 +811,6 @@ class User extends BaseController
|
|
|
(new UserModel)->where("uid", $request->user["uid"])->update(["invite_img" => $res["url"]]);
|
|
|
return app('json')->success(["qrcode" => $res["url"], "bgimg" => $bgimg]);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-// public function getWxmpInviteQrcode2(Request $request){
|
|
|
-//
|
|
|
-// //获取小程序码
|
|
|
-// $weixinA = new weixina();
|
|
|
-// $data = $weixinA->getUnlimitedQRCode("pages/index/index","scene=".$request->user["uid"]);
|
|
|
-// if(empty($data)){
|
|
|
-// return app('json')->fail("小程序码获取失败".$weixinA->error);
|
|
|
-// }
|
|
|
-// $base64 = 'data:'.$data['contentType'].';base64,'.base64_encode($data['buffer']);
|
|
|
-// $code = "temp";
|
|
|
-// $sysData = (new SysModel())->where("id",1)->find();
|
|
|
-// $uploadConfig = config('filesystem');
|
|
|
-// //验证base64格式
|
|
|
-// preg_match('/^(data:\s*image\/(\w+);base64,)/',$base64, $result);
|
|
|
-// if(!$result){
|
|
|
-// return ["code"=>-1,"msg"=>"base64格式格式错误"];
|
|
|
-// }
|
|
|
-// //验证图片后缀
|
|
|
-// if (!in_array($result[2], $uploadConfig['image']['ext'], true)) {
|
|
|
-// return ["code"=>-1,"msg"=>"不支持的图片格式"];
|
|
|
-// }
|
|
|
-// $rootPath = config('filesystem.disks.resource.root');
|
|
|
-// $hashName = $code.DIRECTORY_SEPARATOR.date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true)).".".$result[2];
|
|
|
-// $filePath = $rootPath. DIRECTORY_SEPARATOR .$hashName;
|
|
|
-// $path = dirname($filePath);
|
|
|
-// // 检测目录
|
|
|
-// if (!is_dir($path)) {
|
|
|
-// if (!mkdir($path, 0777, true)) {
|
|
|
-// return ["code"=>-1,"msg"=>"生成目录失败"];
|
|
|
-// }
|
|
|
-// return ["code"=>-1,"msg"=>"上传目录不存在"];
|
|
|
-// }
|
|
|
-// //重名文件验证
|
|
|
-// if (is_file($filePath)) {
|
|
|
-// return ["code"=>-1,"msg"=>"文件已存在"];
|
|
|
-// }
|
|
|
-// if(!file_put_contents($filePath, base64_decode(str_replace($result[1], '', $base64)))){
|
|
|
-// return ["code"=>-1,"msg"=>"文件报错失败"];
|
|
|
-// }
|
|
|
-//
|
|
|
-// //获取海报背景
|
|
|
-// $inviteData = (new SysModel)->getDataInfo("invite");
|
|
|
-// if(empty($inviteData["img"])){
|
|
|
-// return ["code"=>-1,"msg"=>"海报背景不存在"];
|
|
|
-// }
|
|
|
-// $bgimg =explode("resource", $inviteData["img"])[1];
|
|
|
-// if(empty($bgimg)){
|
|
|
-// return ["code"=>-1,"msg"=>"海报背景不存在"];
|
|
|
-// }
|
|
|
-//
|
|
|
-// $savePath = $rootPath. DIRECTORY_SEPARATOR .$code.DIRECTORY_SEPARATOR.date('Ymd') . DIRECTORY_SEPARATOR . md5((string) microtime(true))."b".".jpg";
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-// $bg = $rootPath.$bgimg;
|
|
|
-// $bgSize = getimagesize($bg);
|
|
|
-// $qrcodeSize = getimagesize($filePath);
|
|
|
-// $handle = Image::open($bg);
|
|
|
-// $handle->water($filePath,[($bgSize[0]-$qrcodeSize[0])/2,($bgSize[1]-$qrcodeSize[1])/2]);
|
|
|
-// $handle->save($savePath,"jpg",80);
|
|
|
-// $qiniu = new Qiniu;
|
|
|
-// $img_url = $qiniu->updateFile('img', $savePath, $savePath);
|
|
|
-// if (empty($img_url['url'])) {
|
|
|
-// return ["code"=>-1,"msg"=>"文件报错失败:".$qiniu->getError()];
|
|
|
-// }
|
|
|
-// @unlink($filePath);
|
|
|
-// @unlink($savePath);
|
|
|
-// return ["code"=>1,"url"=>str_replace("\\", "/", $img_url['url'])];
|
|
|
-// }
|
|
|
-//
|
|
|
-// public function checkImgPath(){
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
- /**
|
|
|
- * 图片合成
|
|
|
- * @param type $bg
|
|
|
- * @param type $qrcode
|
|
|
- * @param type $savePath
|
|
|
- */
|
|
|
- public function createPosterImg($bg, $qrcode, $savePath)
|
|
|
- {
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取小程序码
|
|
|
- * @param Request $request
|
|
|
- */
|
|
|
- public function getWxmpQrcode(Request $request)
|
|
|
- {
|
|
|
- $weixinA = new weixina();
|
|
|
- $data = $weixinA->getUnlimitedQRCode("pages/index/index", "a=1");
|
|
|
- if (empty($data)) {
|
|
|
- return app('json')->fail("小程序码获取失败" . $weixinA->error);
|
|
|
- }
|
|
|
- $base64 = 'data:' . $data['contentType'] . ';base64,' . base64_encode($data['buffer']);
|
|
|
- $res = $this->uploadImageBase64("wximg", $base64);
|
|
|
- if ($res["code"] != 1) {
|
|
|
- return app('json')->fail($res["msg"]);
|
|
|
- }
|
|
|
- return app('json')->success(["img" => $res["data"]]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param Request $request
|
|
|
- */
|
|
|
- public function uploadBase64(Request $request)
|
|
|
- {
|
|
|
- [$img, $code] = UtilService::getMore([
|
|
|
- ['img', '', 'empty', "请上传图片"],
|
|
|
- ['code', 'image'],
|
|
|
- ], $request, true);
|
|
|
-// $imgAr = explode("base64,",$img);
|
|
|
-// if(empty($imgAr)){
|
|
|
-// return app("json")->fail("请上传base64图片");
|
|
|
-// }
|
|
|
-// $imgBase64 = count($imgAr)==1?$imgAr[0]:$imgAr[1];
|
|
|
-// //判断字符串是否经过编码方法
|
|
|
-// if($imgBase64!=base64_encode(base64_decode($imgBase64))){
|
|
|
-// return app("json")->fail("请上传base64图片");
|
|
|
-// }
|
|
|
-// $base64 = "data:application/octet-stream;base64,".$imgBase64;//七牛
|
|
|
- $res = $this->uploadImageBase64($code, $img);
|
|
|
- if ($res["code"] != 1) {
|
|
|
- return app('json')->fail($res["msg"]);
|
|
|
- }
|
|
|
- return app('json')->success(["img" => $res["data"]]);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 图片上传
|
|
|
- * @param Request $request
|
|
|
- * @return type
|
|
|
- */
|
|
|
- public function upload(Request $request)
|
|
|
- {
|
|
|
- $uploadConfig = config('filesystem');
|
|
|
- $sysData = (new SysModel())->where("id", 1)->find();
|
|
|
- $file = $request->file('file');
|
|
|
- $code = $request->post("code", "image");
|
|
|
- if (empty($file)) {
|
|
|
- return app('json')->fail("未上传文件");
|
|
|
- }
|
|
|
- $size = $file->getSize();
|
|
|
- if (!empty($size) && $size > $uploadConfig["image"]["size"] * 1024 * 1024) {
|
|
|
- return app('json')->fail("图片不能超过{$uploadConfig["image"]["size"]}M");
|
|
|
- }
|
|
|
-
|
|
|
- if (!in_array($code, $uploadConfig['image']['path'])) {
|
|
|
- return app('json')->fail("上传路径错误");
|
|
|
- }
|
|
|
- $ext = $file->extension();
|
|
|
- if (!in_array($ext, $uploadConfig['image']['ext'])) {
|
|
|
- return app('json')->fail("图片类型错误");
|
|
|
- }
|
|
|
- $upPath = \think\facade\Filesystem::disk('resource')->putFile($code, $file);
|
|
|
- if (!$upPath) {
|
|
|
- return app('json')->fail("上传失败01");
|
|
|
- }
|
|
|
- $savePath = $sysData['system_url'] . '/resource/' . $upPath;
|
|
|
- $imgUrl = str_replace("\\", "/", $savePath);
|
|
|
- return app('json')->success(['img' => $imgUrl, 'size' => $size]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 视频上传
|
|
|
- * @param Request $request
|
|
|
- * @return type
|
|
|
- */
|
|
|
- public function uploadVideo(Request $request)
|
|
|
- {
|
|
|
- $uploadConfig = config('filesystem');
|
|
|
- $sysData = (new SysModel())->where("id", 1)->find();
|
|
|
- $file = $request->file('file');
|
|
|
- $code = $request->post("code", "video");
|
|
|
- if (empty($file)) {
|
|
|
- return app('json')->fail("未上传文件");
|
|
|
- }
|
|
|
- if (!in_array($code, $uploadConfig['video']['path'])) {
|
|
|
- return app('json')->fail("上传路径错误");
|
|
|
- }
|
|
|
- $ext = $file->extension();
|
|
|
- if (!in_array($ext, $uploadConfig['video']['ext'])) {
|
|
|
- return app('json')->fail("视频类型错误");
|
|
|
- }
|
|
|
- $upPath = \think\facade\Filesystem::disk('resource')->putFile($code, $file);
|
|
|
- if (!$upPath) {
|
|
|
- return app('json')->fail("上传失败01");
|
|
|
- }
|
|
|
- $savePath = $sysData['system_url'] . '/resource/' . $upPath;
|
|
|
- $imgUrl = str_replace("\\", "/", $savePath);
|
|
|
- return app('json')->success(['video' => $imgUrl]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * base64文件上传
|
|
|
- * @param type $code
|
|
|
- * @param type $base64
|
|
|
- */
|
|
|
- public function uploadImageBase64($code, $base64, $isQiniu = 0)
|
|
|
- {
|
|
|
- $sysData = (new SysModel())->where("id", 1)->find();
|
|
|
- $uploadConfig = config('filesystem');
|
|
|
- //验证base64格式
|
|
|
- preg_match('/^(data:\s*image\/(\w+);base64,)/', $base64, $result);
|
|
|
- if (!$result) {
|
|
|
- return ["code" => -1, "msg" => "base64格式格式错误"];
|
|
|
- }
|
|
|
- //验证图片后缀
|
|
|
- if (!in_array($result[2], $uploadConfig['image']['ext'], true)) {
|
|
|
- return ["code" => -1, "msg" => "不支持的图片格式"];
|
|
|
- }
|
|
|
- $rootPath = config('filesystem.disks.resource.root');
|
|
|
- $hashName = $code . DIRECTORY_SEPARATOR . date('Ymd') . DIRECTORY_SEPARATOR . md5((string)microtime(true)) . "." . $result[2];
|
|
|
- $filePath = $rootPath . DIRECTORY_SEPARATOR . $hashName;
|
|
|
- $path = dirname($filePath);
|
|
|
- // 检测目录
|
|
|
- if (!is_dir($path)) {
|
|
|
- if (!mkdir($path, 0777, true)) {
|
|
|
- return ["code" => -1, "msg" => "生成目录失败"];
|
|
|
- }
|
|
|
- return ["code" => -1, "msg" => "上传目录不存在"];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- //重名文件验证
|
|
|
- if (is_file($filePath)) {
|
|
|
- return ["code" => -1, "msg" => "文件已存在"];
|
|
|
- }
|
|
|
- if (!file_put_contents($filePath, base64_decode(str_replace($result[1], '', $base64)))) {
|
|
|
- return ["code" => -1, "msg" => "文件报错失败"];
|
|
|
- }
|
|
|
- //七牛上传
|
|
|
- if ($isQiniu == 1) {
|
|
|
- $qiniu = new Qiniu;
|
|
|
- $img_url = $qiniu->updateFile('img', $filePath, $filePath);
|
|
|
- if (empty($img_url['url'])) {
|
|
|
- return ["code" => -1, "msg" => "文件报错失败:" . $qiniu->getError()];
|
|
|
- }
|
|
|
- @unlink($filePath);
|
|
|
- return ["code" => 1, "url" => str_replace("\\", "/", $img_url['url'])];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- $savePath = $sysData['system_url'] . config('filesystem.disks.resource.url') . DIRECTORY_SEPARATOR . $hashName;
|
|
|
- return ["code" => 1, "url" => str_replace("\\", "/", $savePath)];
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 七牛上传图片
|
|
|
- * @param Request $request
|
|
|
- */
|
|
|
- public function qiniuUpload(Request $request)
|
|
|
- {
|
|
|
- $file = $request->file('file');
|
|
|
- if (empty($file)) {
|
|
|
- return app('json')->fail("未上传文件");
|
|
|
- }
|
|
|
- $rootTmp = config('filesystem.disks.local.root') . '/' . \think\facade\Filesystem::putFile('tmp', $file);
|
|
|
- $image_size = @getimagesize($rootTmp);
|
|
|
- if ($image_size[0] > 1000) {
|
|
|
- $imgS = Image::open($rootTmp);
|
|
|
- $imgS->thumb(1000, $image_size[1]);
|
|
|
- $imgS->save($rootTmp);
|
|
|
- } else {
|
|
|
- if ($image_size[1] > 1000) {
|
|
|
- $imgS = Image::open($rootTmp);
|
|
|
- $imgS->thumb($image_size[0], 1000);
|
|
|
- $imgS->save($rootTmp);
|
|
|
- }
|
|
|
- }
|
|
|
- $qiniu = new Qiniu;
|
|
|
- $img_url = $qiniu->updateFile('img', $rootTmp, $rootTmp);
|
|
|
- if (empty($img_url['url'])) {
|
|
|
- return app('json')->fail($qiniu->getError());
|
|
|
- }
|
|
|
- @unlink($rootTmp);
|
|
|
- return app('json')->success(['img' => $img_url['url']]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 七牛上传token
|
|
|
- * @param Request $request
|
|
|
- */
|
|
|
- public function qiniuUploadToken(Request $request)
|
|
|
- {
|
|
|
- [$bucket] = UtilService::getMore([
|
|
|
- ['bucket', ''],
|
|
|
- ], $request, true);
|
|
|
- $qiniu = new Qiniu;
|
|
|
- $token = $qiniu->createUploadToken($bucket);
|
|
|
- return app('json')->success(['token' => $token]);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取用户模板信息
|
|
|
- * @param int $uid 用户ID
|
|
|
- * @return array
|
|
|
- */
|
|
|
- private function getUserInfo($uid)
|
|
|
- {
|
|
|
- $userInfo = (new UserModel)->where('uid', $uid)->find();
|
|
|
- $auth = (new InfoAudit)->where('uid', $uid)->find();
|
|
|
- $user_work_type_title = (new UserWorkType)->where('id', $auth['user_work_type_id'])->find();
|
|
|
- if ($auth) {
|
|
|
- $auth_info = $auth->toArray();
|
|
|
- } else {
|
|
|
- $auth_info = null;
|
|
|
- }
|
|
|
- return [
|
|
|
- 'is_type_audit' => $auth && $auth['status'] == 1 ? 1 : 0,
|
|
|
- 'ancestral_place' => $auth ? $auth['ancestral_place'] : '',
|
|
|
- 'auth_info' => $auth_info,
|
|
|
- 'user_work_type_id' => $user_work_type_title['title'],
|
|
|
- ];
|
|
|
- }
|
|
|
/**
|
|
|
* 获取邀请海报小程序码
|
|
|
* @param Request $request
|
|
|
@@ -1515,6 +1204,7 @@ class User extends BaseController
|
|
|
['contract_id', '0'], //合约id
|
|
|
['longitude', ''], //经度
|
|
|
['latitude', ''], //纬度
|
|
|
+ ['content', ''], //工作内容
|
|
|
// ['uid',0]
|
|
|
], $request);
|
|
|
$uid = UtilService::getMore([
|
|
|
@@ -1541,6 +1231,7 @@ class User extends BaseController
|
|
|
'longitude' => $post['longitude'],
|
|
|
'latitude' => $post['latitude'],
|
|
|
'contract_id' => $post['contract_id'],
|
|
|
+ 'content' => $post['content'],
|
|
|
'create_time' => time()
|
|
|
]);
|
|
|
return app('json')->success("数据保存成功");
|