Эх сурвалжийг харах

Merge branch 'master' of http://git.bjzxtw.org.cn:3000/zxt/news_producer

LiuJ 3 өдөр өмнө
parent
commit
ef3d941341

+ 22 - 5
app/JsonRpc/NewsService.php

@@ -5034,6 +5034,7 @@ class NewsService implements NewsServiceInterface
       return Result::error("用户不存在", 0);
     }
     $data['address_arr_id'] = isset($data['address_arr_id']) ? json_encode(array_map('intval', $data['address_arr_id'])) : '';
+    $job_company = JobCompany::where('user_id', $data['user_id'])->first();
     $company = [
       'business_name' => $data['business_name'],       // 企业名称
       'company_hy_id' => $data['company_hy_id'],       // 企业所属行业
@@ -5044,6 +5045,7 @@ class NewsService implements NewsServiceInterface
       'company_url' => $data['company_url'],           // 企业网址
       'address_arr_id' => $data['address_arr_id'],     // 企业地址
       'address' => $data['address'],                   // 企业详细地址
+      // 'email' => $data['email'],                       // 企业邮箱
     ];
     if ($user['type_id'] == 3) {
       Db::beginTransaction();
@@ -5059,8 +5061,27 @@ class NewsService implements NewsServiceInterface
           'address_arr_id' => $data['address_arr_id'],     // 企业地址
           'address' => $data['address'],                   // 企业详细地址
         ]);
-        $result['job_company'] = JobCompany::where('user_id', $data['user_id'])->update($company);
+        if(empty($result['userinfo'])){
+          Db::rollBack();
+          return Result::error('修改企业会员信息失败!');
+        }
+        $result['user'] = User::where('id', $data['user_id'])->update([
+          'email' => $data['email'],                       // 企业邮箱
+        ]);
+        if(empty($result['user'])){
+          Db::rollBack();
+          return Result::error('修改个人中心信息失败!');
+        }
+        // 该企业会员若是未发布招聘信息则暂无该企业会员的企业信息
+        if(!empty($job_company)){
+          $result['job_company'] = JobCompany::where('user_id', $data['user_id'])->update($company);
+          if(empty($result['job_company'])){
+            Db::rollBack();
+            return Result::error('修改企业会员信息失败!');
+          }
+        }
         Db::commit();
+        return Result::success($result);
       } catch (\Exception $e) {
         Db::rollBack();
         return Result::error($e->getMessage(), 0);
@@ -5068,10 +5089,6 @@ class NewsService implements NewsServiceInterface
     } else {
       return Result::error("用户类型错误", 0);
     }
-    if (empty($result)) {
-      return Result::error("修改失败", 0);
-    }
-    return Result::success($result);
   }
   /*
     * 获取省-市