Commit 0c38a8d3 authored by suntengda's avatar suntengda

add 批量获取供应商信息接口

parent 453da3a2
......@@ -45,4 +45,8 @@ class OtaValidate extends \Validate\BaseValidate
{
return $this->only(['ota_id']);
}
public function sceneListByIds()
{
return $this->only(['ota_id']);
}
}
\ No newline at end of file
......@@ -29,6 +29,20 @@ class OtaController extends Base
$this->success(['result' => $res]);
}
/**
* 根据id批量获取供应商信息
* @throws \App\Exception\custom\ParamException
*/
public function ota_list_by_idsAction()
{
(new OtaValidate())->scene('listByIds')->validate();
$otaIds = $this->params['ota_id'] ?? '';
$otaIds = explode(',',$otaIds);
$res = OtaService::getOtaListByIds($otaIds);
$this->success(['result' => $res]);
}
/**
* 添加供应商
* @throws \App\Exception\custom\ParamException
......
......@@ -44,6 +44,21 @@ class OtaService
return Ota::get(self::COLUMNS,['ota_id'=>$OtaId]);
}
/**
* 根据id批量获取供应商信息
* @param $otaIds
* @return \Api\PhpUtils\Mysql\MysqlBase|array
*/
public static function getOtaListByIds($otaIds)
{
if(empty($otaIds)) {
return [];
}
return Ota::select(self::COLUMNS,['ota_id'=>$otaIds]);
}
/**
* 添加供应商
* @param $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