港口场景筛选

This commit is contained in:
2025-09-02 18:04:09 +08:00
parent a3d39feace
commit 152ce9a75f
7 changed files with 36 additions and 8 deletions
+3 -2
View File
@@ -147,10 +147,11 @@ class PresetController extends BaseController
}
}
public function port()
public function port(Request $request)
{
try {
$result = (new SysPortService)->getList();
$params = $request->all();
$result = (new SysPortService)->getList($params);
return $this->success($result, '获取港口列表');
} catch (\Throwable $e) {
return $this->error($e->getMessage());
+1 -1
View File
@@ -16,6 +16,6 @@ class SysCurrencyLogic
public function getList()
{
return SysCurrency::where('status', 1)->get(['id', 'currency_code', 'currency_name', 'currency_symbol', 'exchange_rate', 'float_percent_up', 'float_percent_down']);
return SysCurrency::where('status', 1)->get(['id', 'country_id', 'currency_code', 'currency_name', 'currency_symbol', 'exchange_rate', 'float_percent_up', 'float_percent_down']);
}
}
+2 -2
View File
@@ -14,9 +14,9 @@ class SysPortLogic
*/
protected string $modelClass = SysPort::class;
public function getList()
public function getList($where)
{
return SysPort::where('status', 1)->orderBy('sort','desc')->get(['id', 'port_code', 'port_name', 'country_id', 'description']);
return SysPort::where('status', 1)->where($where)->orderBy('sort','desc')->get(['id', 'port_code', 'port_name', 'country_id', 'description']);
}
}
+1 -1
View File
@@ -40,7 +40,7 @@ class SysCurrency extends Model
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'currency_code', 'currency_name', 'currency_symbol', 'exchange_rate', 'base_currency', 'float_percent_up', 'float_percent_down', 'status', 'last_updated', 'created_at', 'updated_at'];
protected $fillable = ['id', 'country_id', 'currency_code', 'currency_name', 'currency_symbol', 'exchange_rate', 'base_currency', 'float_percent_up', 'float_percent_down', 'status', 'last_updated', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
+10 -2
View File
@@ -21,8 +21,16 @@ class SysPortService
/**
* 获取系统list
*/
public function getList()
public function getList($params)
{
return $this->logic->getList();
$where = [];
if(isset($params['scene']) && $params['scene']) {
if($params['scene'] == 'domestic'){
$where['country_id'] = 45;
}else{
$where['country_id'] = ['<>', 45];
}
}
return $this->logic->getList($where);
}
}