Commit fc350e10 authored by suntengda's avatar suntengda

update 获取自提点列表支持按生活号id筛选

parent 2c62d0d1
......@@ -20,26 +20,26 @@ class TakePlace extends MysqlBase
/**
* 获取
* @param $keywords
* @param int $offset
* @param int $limit
* @param $params
* @return mixed
*/
public static function searchList($keywords,$offset=0,$limit=20)
public static function searchList($params)
{
$lifeAccountId = $params['life_account_id'] ?? 0;
$keywords = $params['keywords'] ?? '';
$offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20;
if($lifeAccountId) {
$where['life_account_id'] = $lifeAccountId;
}
if($keywords) {
$where = [
'AND' => [
'OR' => [
'take_place_name[~]' => $keywords,
'contact_name[~]' => $keywords,
],
'is_delete' => TakePlace::STATUS_NORMAL,
],
$where['OR'] = [
'take_place_name[~]' => $keywords,
'contact_name[~]' => $keywords,
];
}else {
$where = ['is_delete' => TakePlace::STATUS_NORMAL];
}
$where['is_delete'] = TakePlace::STATUS_NORMAL;
$where['ORDER'] = ['take_place_id' => 'DESC'];
$where['LIMIT'] = [$offset, $limit];
......
......@@ -20,10 +20,7 @@ class TakeplaceController extends Base
{
(new TakePlaceValidate())->scene('list')->validate();
$keywords = $this->params['keywords'] ?? '';
$offset = $this->params['offset'] ?? 0;
$limit = $this->params['limit'] ?? 20;
$res = TakePlaceService::searchList($keywords,$offset,$limit);
$res = TakePlaceService::searchList($this->params);
$this->success(['result'=>$res]);
}
......
......@@ -14,14 +14,12 @@ class TakePlaceService
* 获取自提点列表(op 后台)
*
* 支持关键词(自提点名称/联系人)搜索
* @param string $keywords
* @param int $offset
* @param int $limit
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public static function searchList($keywords='',$offset=0,$limit=20)
public static function searchList($params)
{
return TakePlace::searchList($keywords, $offset, $limit);
return TakePlace::searchList($params);
}
/**
......
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