|
@@ -2,10 +2,9 @@
|
|
|
|
|
|
namespace App\Service;
|
|
|
|
|
|
-use App\Model\Employee;
|
|
|
+use App\Model\BasicType;
|
|
|
+use App\Model\Customer;
|
|
|
use App\Model\FollowUpRecord;
|
|
|
-use Illuminate\Support\Facades\DB;
|
|
|
-use Illuminate\Support\Facades\Hash;
|
|
|
|
|
|
class FollowUpRecordService extends Service
|
|
|
{
|
|
@@ -61,8 +60,6 @@ class FollowUpRecordService extends Service
|
|
|
if(! empty($data['crt_id'])) $model->where('crt_id',$data['crt_id']);
|
|
|
|
|
|
$list = $this->limit($model,'',$data);
|
|
|
-
|
|
|
- //组织数据
|
|
|
$list = $this->organizationData($list);
|
|
|
|
|
|
return [true, $list];
|
|
@@ -71,8 +68,17 @@ class FollowUpRecordService extends Service
|
|
|
public function organizationData($data) {
|
|
|
if (empty($data['data'])) return $data;
|
|
|
|
|
|
- foreach ($data['data'] as $key => $value){
|
|
|
+ $customer = Customer::whereIn('id',array_unique(array_column($data['data'],'customer_id')))
|
|
|
+ ->pluck('title','id')
|
|
|
+ ->toArray();
|
|
|
|
|
|
+ $basic_type = BasicType::whereIn('id',array_unique(array_column($data['data'],'basic_type_id')))
|
|
|
+ ->pluck('title','id')
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ foreach ($data['data'] as $key => $value){
|
|
|
+ $data['data'][$key]['customer_name'] = $customer[$value['customer_id']] ?? '';
|
|
|
+ $data['data'][$key]['basic_type_name'] = $basic_type[$value['basic_type_id']] ?? '';
|
|
|
}
|
|
|
return $data;
|
|
|
}
|