You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ymww_backend/application/admin/model/shopro/dispatch/DispatchExpress.php

29 lines
889 B

1 year ago
<?php
namespace app\admin\model\shopro\dispatch;
use app\admin\model\shopro\Common;
use app\admin\model\shopro\data\Area;
class DispatchExpress extends Common
{
protected $name = 'shopro_dispatch_express';
protected $append = [
'district_text'
];
public function getDistrictTextAttr($value, $data)
{
$province_ids = $data['province_ids'] ? explode(',', $data['province_ids']) : [];
$city_ids = $data['city_ids'] ? explode(',', $data['city_ids']) : [];
$district_ids = $data['district_ids'] ? explode(',', $data['district_ids']) : [];
$ids = array_merge($province_ids, $city_ids, $district_ids);
$districtText = Area::where('id', 'in', $ids)->field('name')->select();
$districtText = collection($districtText)->column('name');
return implode(',', $districtText);
}
}