Commit 32b7b330 authored by luhongguang's avatar luhongguang

update: temp

parent 2a75bfae
......@@ -17,40 +17,4 @@ class TakePlace extends MysqlBase
const STATUS_NORMAL = 0; // 正常
const STATUS_DELETE = 1; // 删除
/**
* 获取
* @param $params
* @return mixed
*/
public static function searchList($params)
{
$lifeAccountId = $params['life_account_id'] ?? 0;
$keywords = $params['keywords'] ?? '';
$offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20;
$takePlaceIds = $params['take_place_id'] ?? [];
if(!empty($takePlaceIds)) {
$where['take_place_id'] = $takePlaceIds;
}
if($lifeAccountId) {
$where['life_account_id'] = $lifeAccountId;
}
if($keywords) {
$where['OR'] = [
'take_place_name[~]' => $keywords,
'contact_name[~]' => $keywords,
];
}
$where['is_delete'] = TakePlace::STATUS_NORMAL;
$where['ORDER'] = ['take_place_id' => 'DESC'];
$where['LIMIT'] = [$offset, $limit];
$res['list'] = self::select('*', $where);
unset($where['ORDER'],$where['LIMIT']);
$res['total'] = self::count('*', $where);
return $res;
}
}
......@@ -20,7 +20,33 @@ class TakePlaceService
*/
public static function searchList($params)
{
return TakePlace::searchList($params);
$lifeAccountId = $params['life_account_id'] ?? 0;
$keywords = $params['keywords'] ?? '';
$takePlaceIds = $params['take_place_id'] ?? [];
$offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20;
if(!empty($takePlaceIds)) {
$where['take_place_id'] = $takePlaceIds;
}
if($lifeAccountId) {
$where['life_account_id'] = $lifeAccountId;
}
if($keywords) {
$where['OR'] = [
'take_place_name[~]' => $keywords,
'contact_name[~]' => $keywords,
];
}
$where['is_delete'] = TakePlace::STATUS_NORMAL;
$where['ORDER'] = ['take_place_id' => 'DESC'];
$where['LIMIT'] = [$offset, $limit];
$res['list'] = TakePlace::select('*', $where, []);
unset($where['ORDER'],$where['LIMIT']);
$res['total'] = TakePlace::count('*', $where);
return $res;
}
/**
......
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 to comment