Beispiel #1
0
 /**
  * 获取公司详情
  *
  */
 public function show()
 {
     $id = $this->request->get('id');
     $company = $this->company->find($id);
     //判断公司是否存在
     if (!$company) {
         return return_rest('0', '', '该公司不存在');
     }
     $company = $company->toArray();
     //获取项目介绍
     $company['introduce'] = CompanyIntroduce::select('company_introduce.id', 'company_introduce.content', 'company_introduce_config.name')->where('company_id', $company['id'])->leftJoin('company_introduce_config', 'company_introduce.config_id', '=', 'company_introduce_config.id')->orderBy('company_introduce.config_id', 'asc')->get()->toArray();
     return return_rest('1', compact('company'), '获取公司详情');
 }
 /**
  * 我的项目
  */
 public function mine()
 {
     $user = $this->user();
     //获取用户类型 是否为投资人
     if ($user->type == '2') {
         //该用户为投资人 获取用户投资列表
         $invest_project = InvestProject::select('project_id')->where('customer_id', $user->id)->get()->toArray();
         if (empty($invest_project)) {
             return return_rest('1', array('project' => array()), '暂无投资项目');
         }
         $project_id = array_pluck($invest_project, 'project_id');
         $project = CompanyProject::select('id', 'name', 'brief', 'logo')->whereIn('id', $project_id)->with('field')->get()->toArray();
         $i = 0;
         foreach ($project as $item) {
             //获取项目投资轮次
             $project_finance = DB::table('company_project_finance')->where('project_id', $item['id'])->orderBy('created_at', 'desc')->first();
             $project[$i]['project_finance'] = '天使轮';
             if ($project_finance) {
                 $project[$i]['project_finance'] = $this->financeName($project_finance->finance_id);
             }
             $i++;
         }
         return return_rest('1', compact('project'), '项目列表');
     }
     if ($user->company_id == 0) {
         $project['is_company'] = '0';
         $project['is_project'] = '0';
         return return_rest('1', compact('project'), '项目详情');
     }
     //获取项目信息
     $project = $this->project->select('id', 'name', 'logo', 'brief', 'finance_progress', 'company_id', 'target_amount', 'start_amount', 'get_out', 'subscribe', 'subscribe_amount', 'currency', 'city', 'view', 'share')->where('company_id', $user->company_id)->with('field')->first();
     if (is_null($project)) {
         return return_rest('1', array('is_company' => '1', 'is_project' => '0'), '该用户没有项目');
     }
     $project = $project->toArray();
     //项目介绍
     $project_introduce = DB::table('company_project_detail')->where('company_project_id', $project['id'])->first();
     if (!$project_introduce) {
         return return_rest('0', '', '项目介绍未添加,请联系harry');
     }
     $project['project_introduce'] = $project_introduce->project_introduce;
     //获取公司介绍
     $project['companyIntroduce'] = CompanyIntroduce::select('company_introduce.id', 'company_introduce.content', 'company_introduce_config.name')->where('company_id', $project['company_id'])->leftJoin('company_introduce_config', 'company_introduce.config_id', '=', 'company_introduce_config.id')->orderBy('company_introduce.config_id', 'asc')->get()->toArray();
     //获取企业网站
     $project['website'] = Company::where('id', $user->company_id)->first()->website;
     //获取项目优势
     $project['teamAdvantage'] = "";
     $company_extend = CompanyExtend::select('story')->where('company_id', $user->company_id)->first();
     if ($company_extend) {
         $project['teamAdvantage'] = $company_extend->story;
     }
     $project['is_company'] = '1';
     $project['is_project'] = '1';
     //获取项目投资轮次
     $project_finance = DB::table('company_project_finance')->where('project_id', $project['id'])->orderBy('created_at', 'desc')->first();
     $project['project_finance'] = '天使轮';
     if ($project_finance) {
         $project['project_finance'] = $this->financeName($project_finance->finance_id);
     }
     return return_rest('1', compact('project'), '项目详情');
 }