|
@@ -2583,9 +2583,9 @@ class NewsService implements NewsServiceInterface
|
|
|
public function getJobCompany(array $data): array
|
|
|
{
|
|
|
$user = User::where('user.id', $data['user_id'])
|
|
|
- ->leftJoin('user_info', 'user_info.user_id', 'user.id')
|
|
|
- ->select('user.user_name', 'user.mobile', 'user.email', 'user.type_id', 'user_info.*')
|
|
|
- ->first();
|
|
|
+ ->leftJoin('user_info', 'user_info.user_id', 'user.id')
|
|
|
+ ->select('user.user_name','user.mobile','user.email','user.type_id','user_info.*')
|
|
|
+ ->first();
|
|
|
// return Result::success($user);
|
|
|
if (empty($user)) {
|
|
|
return Result::error("用户不存在", 0);
|
|
@@ -2600,12 +2600,12 @@ class NewsService implements NewsServiceInterface
|
|
|
'company_nature' => $user['company_nature'], // 公司性质
|
|
|
'company_size' => $user['company_size'], // 公司规模
|
|
|
'introduction' => $user['introduction'], // 公司简介
|
|
|
- 'real_name' => $user['real_name'], // 企业联系人
|
|
|
- 'mobile' => $user['mobile'], // 企业联系电话
|
|
|
+ // 'real_name' => $user['real_name'], // 企业联系人
|
|
|
+ // 'mobile' => $user['mobile'], // 企业联系电话
|
|
|
'company_url' => $user['company_url'], // 企业网址
|
|
|
'address_arr_id' => $user['address_arr_id'], // 企业网址
|
|
|
'address' => $user['address'], // 企业地址
|
|
|
- 'email' => $user['email'], // 企业邮箱
|
|
|
+ // 'email' => $user['email'], // 企业邮箱
|
|
|
];
|
|
|
} else {
|
|
|
return Result::error("用户类型错误", 0);
|
|
@@ -2622,11 +2622,10 @@ class NewsService implements NewsServiceInterface
|
|
|
{
|
|
|
// return Result::success($data);
|
|
|
$user = User::where('user.id', $data['user_id'])
|
|
|
- ->where('user.status', 1)
|
|
|
- ->leftJoin('user_info', 'user_info.user_id', 'user.id')
|
|
|
- ->select('user.user_name', 'user.type_id', 'user_info.*')
|
|
|
- ->first();
|
|
|
- if (empty($user)) {
|
|
|
+ ->where('user.status',1)
|
|
|
+ ->select('user.user_name','user.type_id')
|
|
|
+ ->first();
|
|
|
+ if(empty($user)){
|
|
|
return Result::error("用户不存在", 0);
|
|
|
}
|
|
|
$data['address_arr_id'] = isset($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : '';
|
|
@@ -2636,29 +2635,33 @@ class NewsService implements NewsServiceInterface
|
|
|
'company_nature' => $data['company_nature'], // 公司性质
|
|
|
'company_size' => $data['company_size'], // 公司规模
|
|
|
'introduction' => $data['introduction'], // 公司简介
|
|
|
- 'real_name' => $data['real_name'], // 企业联系人
|
|
|
+ // 'real_name' => $data['real_name'], // 企业联系人
|
|
|
'company_url' => $data['company_url'], // 企业网址
|
|
|
'address_arr_id' => $data['address_arr_id'], // 企业地址
|
|
|
'address' => $data['address'], // 企业详细地址
|
|
|
];
|
|
|
- if ($user['type_id'] == 3) {
|
|
|
- $result['user'] = User::where('user.id', $data['user_id'])->update([
|
|
|
- 'mobile' => $data['mobile'], // 企业联系电话
|
|
|
- 'email' => $data['email'], // 企业邮箱
|
|
|
- ]);
|
|
|
- $result['userinfo'] = UserInfo::where('user_id', $data['user_id'])->update([
|
|
|
- 'business_name' => $data['business_name'], // 企业名称
|
|
|
- 'company_hy_id' => $data['company_hy_id'], // 企业所属行业
|
|
|
- 'company_nature' => $data['company_nature'], // 公司性质
|
|
|
- 'company_size' => $data['company_size'], // 公司规模
|
|
|
- 'introduction' => $data['introduction'], // 公司简介
|
|
|
- 'real_name' => $data['real_name'], // 企业联系人
|
|
|
- 'company_url' => $data['company_url'], // 企业网址
|
|
|
- 'address_arr_id' => $data['address_arr_id'], // 企业地址
|
|
|
- 'address' => $data['address'], // 企业详细地址
|
|
|
- ]);
|
|
|
- $result = JobCompany::where('user_id', $data['user_id'])->update($company);
|
|
|
- } else {
|
|
|
+ if($user['type_id'] == 3){
|
|
|
+ Db::beginTransaction();
|
|
|
+ try {
|
|
|
+ $result['userinfo'] = UserInfo::where('user_id', $data['user_id'])->update([
|
|
|
+ 'business_name' => $data['business_name'], // 企业名称
|
|
|
+ 'company_hy_id' => $data['company_hy_id'], // 企业所属行业
|
|
|
+ 'company_nature' => $data['company_nature'], // 公司性质
|
|
|
+ 'company_size' => $data['company_size'], // 公司规模
|
|
|
+ 'introduction' => $data['introduction'], // 公司简介
|
|
|
+ // 'real_name' => $data['real_name'], // 企业联系人
|
|
|
+ 'company_url' => $data['company_url'], // 企业网址
|
|
|
+ 'address_arr_id' => $data['address_arr_id'], // 企业地址
|
|
|
+ 'address' => $data['address'], // 企业详细地址
|
|
|
+ ]);
|
|
|
+ $result['job_company'] = JobCompany::where('user_id', $data['user_id'])->update($company);
|
|
|
+ Db::commit();
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ Db::rollBack();
|
|
|
+ return Result::error($e->getMessage(), 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ }else{
|
|
|
return Result::error("用户类型错误", 0);
|
|
|
}
|
|
|
if (empty($result)) {
|