31 lines
884 B
PHP
31 lines
884 B
PHP
<?php
|
|
|
|
namespace app\api\controller;
|
|
|
|
use app\common\model\auth\Admin;
|
|
use app\common\model\contract\Contract;
|
|
|
|
/**
|
|
* 搜索
|
|
* Class ContractController
|
|
* @package app\api\controller
|
|
*/
|
|
class ContractController extends BaseApiController
|
|
{
|
|
|
|
public function index()
|
|
{
|
|
$page = $this->request->get('page', 1);
|
|
$limit = $this->request->get('limit', 15);
|
|
$admin = Admin::where('id', $this->userInfo['admin_id'])->find();
|
|
if (empty($admin)) {
|
|
return $this->success();
|
|
}
|
|
$where = empty($admin['company_id']) ? ['admin_id' => $admin['id']] : ['company_id' => $admin['company_id']];
|
|
$query = Contract::where($where);
|
|
$count = $query->count();
|
|
$contract = $query->page($page)->limit($limit)->select();
|
|
return $this->success('success', ['count' => $count, 'data' => $contract], 1, 1);
|
|
}
|
|
|
|
} |