|
|
@@ -6,6 +6,7 @@ use App\Model\Employee;
|
|
|
use App\Model\CustomerSupply;
|
|
|
use App\Model\CustomerSupplyDetails;
|
|
|
use App\Model\Organization;
|
|
|
+use App\Model\WxEmployeeOfficial;
|
|
|
use App\Service\Weixin\WxEmployeeService;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
@@ -300,8 +301,10 @@ class CustomerSupplyService extends Service
|
|
|
public function fillData($data, $user, $search){
|
|
|
if(empty($data['data'])) return $data;
|
|
|
|
|
|
+ $id = array_column($data['data'],'id');
|
|
|
$emp = (new EmployeeService())->getEmployeeMap(array_unique(array_column($data['data'],'crt_id')));
|
|
|
- $emp_2 = $this->getEmployeeMap(array_column($data['data'],'id'),'detail');
|
|
|
+ $emp_2 = $this->getEmployeeMap($id,'detail');
|
|
|
+ $wx_map = $this->getWxBind($id);
|
|
|
foreach ($data['data'] as $key => $value){
|
|
|
$data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';
|
|
|
$data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';
|
|
|
@@ -309,11 +312,23 @@ class CustomerSupplyService extends Service
|
|
|
$data['data'][$key]['status_title'] = CustomerSupply::$status_name[$value['status']] ?? '';
|
|
|
$e = $emp_2[$value['id']] ?? [];
|
|
|
$data['data'][$key]['organization_title'] = $e['organization_title'] ?? "";
|
|
|
+ $tmp = $wx_map[$value['id']] ?? 0;
|
|
|
+ $data['data'][$key]['is_wx_title'] = $tmp ? '是' : '否';
|
|
|
}
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
+ private function getWxBind($employee_id = []){
|
|
|
+ $appid = config("wx_msg.f_appid");
|
|
|
+
|
|
|
+ return WxEmployeeOfficial::whereIn('employee_id', $employee_id)
|
|
|
+ ->where('type', WxEmployeeOfficial::login_type_one)
|
|
|
+ ->where('appid', $appid)
|
|
|
+ ->pluck('id', 'employee_id')
|
|
|
+ ->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
public function getEmployeeMap($employee_ids, $type = ""){
|
|
|
if(empty($employee_ids)) return [];
|
|
|
if(! is_array($employee_ids)) $employee_ids = [$employee_ids];
|