优化:多提货点模式 - 只有一个提货点时 直接默认选中

This commit is contained in:
wuhui_zzw 2024-04-11 15:18:41 +08:00
parent 60f58e2e9c
commit 3e1eafbe90
1 changed files with 2 additions and 1 deletions

View File

@ -89,7 +89,8 @@ class PointRepository extends BaseRepository{
*/
public function getUseInfo(int $useId = 0):array{
$list = $this->getSearchModel([])->withoutField('create_time,update_time')->select()->toArray();
$config = $useId > 0 ? (array_column($list, null, 'id')[$useId] ?? []) : [];
if(count($list) == 1) $config = $list[0] ?? [];
else $config = $useId > 0 ? (array_column($list, null, 'id')[$useId] ?? []) : [];
return compact('list', 'config');
}