添加手机端公司查询
This commit is contained in:
parent
c2d6a069a2
commit
f39dbca235
@ -15,14 +15,18 @@ class CompanyController extends BaseApiController
|
||||
|
||||
public function index()
|
||||
{
|
||||
$page = $this->request->get('page', 1);
|
||||
$limit = $this->request->get('limit', 15);
|
||||
$admin = Admin::findOrEmpty($this->userInfo['admin_id']);
|
||||
$myCompany = Company::findOrEmpty($admin['company_id'])->toArray();
|
||||
$companyIds = Contract::where('party_a', $myCompany['id'])->column('party_b');
|
||||
$companies = Company::whereIn('id', $companyIds)->select()->each(function ($company) {
|
||||
$query = Company::whereIn('id', $companyIds);
|
||||
$count = $query->count();
|
||||
$companies = $query->page($page)->limit($limit)->select()->each(function ($company) {
|
||||
$company['other_contacts'] = json_decode($company['other_contacts'], true);
|
||||
$company['qualification'] = $company['qualification']!=null?json_decode($company['qualification'], true):'';
|
||||
})->toArray();
|
||||
return $this->success('', $companies);
|
||||
return $this->success('', ['count' => $count, 'data' => $companies]);
|
||||
}
|
||||
|
||||
public function view($id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user