于宏哲PHP 9 months ago
parent
commit
64ec89d0ae
  1. 1
      niucloud/app/adminapi/controller/customer_resources/CustomerResources.php
  2. 10
      niucloud/app/service/admin/customer_resources/CustomerResourcesService.php

1
niucloud/app/adminapi/controller/customer_resources/CustomerResources.php

@ -37,6 +37,7 @@ class CustomerResources extends BaseAdminController
["type", "khzy"], ["type", "khzy"],
["created_at", []], ["created_at", []],
["updated_at", []], ["updated_at", []],
["campus_name",""]
]); ]);
return success((new CustomerResourcesService())->getPage($data)); return success((new CustomerResourcesService())->getPage($data));
} }

10
niucloud/app/service/admin/customer_resources/CustomerResourcesService.php

@ -51,7 +51,7 @@ class CustomerResourcesService extends BaseAdminService
public function getPage(array $data = []) public function getPage(array $data = [])
{ {
// dump($data);die; // dump($data);die;
$field = 'a.*,b.id as shared_id'; $field = 'a.*,b.id as shared_id,c.campus_name';
$order = 'a.id desc'; $order = 'a.id desc';
$where = []; $where = [];
if ($data['phone_number']) { if ($data['phone_number']) {
@ -78,12 +78,18 @@ class CustomerResourcesService extends BaseAdminService
$where[] = ['a.member_label', 'like', "%" . $data['member_label'] . "%"]; $where[] = ['a.member_label', 'like', "%" . $data['member_label'] . "%"];
} }
if ($data['campus_name']) {
$where[] = ['c.campus_name', 'like', "%" . $data['campus_name'] . "%"];
}
$search_model = $this->model $search_model = $this->model
->alias("a") ->alias("a")
->join(['school_resource_sharing' => 'b'], 'a.id = b.resource_id', 'left') ->join(['school_resource_sharing' => 'b'], 'a.id = b.resource_id', 'left')
->join(['school_campus' => 'c'], 'a.campus = c.id', 'left')
->where($where) ->where($where)
->with(['personnel'])->field($field)->order($order); ->with(['personnel'])
->field($field)->order($order);
if (isset($data['created_at'][0]) && isset($data['created_at'][1])) { if (isset($data['created_at'][0]) && isset($data['created_at'][1])) {

Loading…
Cancel
Save