调整手机端公司列表
This commit is contained in:
parent
43873bca84
commit
91b2e59e13
@ -30,18 +30,15 @@ class CompanyController extends BaseApiController
|
||||
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||
}
|
||||
|
||||
public function view($id)
|
||||
{
|
||||
$company = Company::findOrEmpty($id)->toArray();
|
||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||
$company['qualification'] = $company['qualification']!=null?json_decode($company['qualification'], true):'';
|
||||
return $this->success('', $company);
|
||||
}
|
||||
|
||||
public function mine()
|
||||
public function view()
|
||||
{
|
||||
$id = $this->request->param('id', 0);
|
||||
if (empty($id)) {
|
||||
$admin = Admin::findOrEmpty($this->userInfo['admin_id']);
|
||||
$company = Company::findOrEmpty($admin['company_id'])->toArray();
|
||||
} else {
|
||||
$company = Company::findOrEmpty($id)->toArray();
|
||||
}
|
||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||
$company['qualification'] = $company['qualification'] != null ? json_decode($company['qualification'], true) : '';
|
||||
$contract = Contract::find($company['contract_id']);
|
||||
|
@ -14,10 +14,8 @@
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
|
||||
|
||||
use app\common\model\dict\DictData;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* Company模型
|
||||
@ -29,6 +27,29 @@ class Company extends BaseModel
|
||||
|
||||
protected $name = 'company';
|
||||
|
||||
public function getCompanyTypeAttr($value)
|
||||
{
|
||||
return DictData::where('id', $value)->value('name');
|
||||
}
|
||||
|
||||
public function getProvinceAttr($value)
|
||||
{
|
||||
return Db::name('geo_province')->where(['province_code' => $value])->value('province_name');
|
||||
}
|
||||
|
||||
public function getCityAttr($value)
|
||||
{
|
||||
return Db::name('geo_city')->where(['city_code' => $value])->value('city_name');
|
||||
}
|
||||
|
||||
public function getAreaAttr($value)
|
||||
{
|
||||
return Db::name('geo_area')->where(['area_code' => $value])->value('area_name');
|
||||
}
|
||||
|
||||
public function getStreetAttr($value)
|
||||
{
|
||||
return Db::name('geo_street')->where(['street_code' => $value])->value('street_name');
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user