Commit 91390ae0 by 朱继来

调整公司model

parent 8600c65d
Showing with 37 additions and 34 deletions
<?php <?php
namespace App\Model; namespace App\Model;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Request; use Request;
use Excel; use Excel;
use DB; use DB;
use App\Model\RegionModel; use App\Model\RegionModel;
class UserCompanyModel extends Model class UserCompanyModel extends Model
{ {
protected $connection = 'order'; protected $connection = 'order';
protected $table = 'lie_user_company'; protected $table = 'lie_user_company';
protected $primaryKey = 'com_id'; protected $primaryKey = 'com_id';
public $timestamps = false; public $timestamps = false;
// 获取公司信息 // 获取公司信息
public function getCompanyInfo($user_id) public function getCompanyInfo($user_id)
{ {
$info = $this->where('user_id', $user_id)->first(); $info = $this->where('user_id', $user_id)->first();
// 公司性质 if (!$info) return false;
$company_type = Config('params.company_type');
$info['type_id_val'] = $company_type[$info['type_id']]; // 公司性质
$company_type = Config('params.company_type');
// 省市区 $info['type_id_val'] = $company_type[$info['type_id']];
$RegionModel = new RegionModel;
$info['com_province'] = $RegionModel->getRegionName($info['com_province_id']); // 省市区
$info['com_city'] = $RegionModel->getRegionName($info['com_city_id']); $RegionModel = new RegionModel;
$info['com_area'] = $RegionModel->getRegionName($info['com_area_id']); $info['com_province'] = $RegionModel->getRegionName($info['com_province_id']);
$info['com_city'] = $RegionModel->getRegionName($info['com_city_id']);
return $info; $info['com_area'] = $RegionModel->getRegionName($info['com_area_id']);
}
return $info;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment