|
@@ -29,7 +29,7 @@ class Couple extends AdminBaseController
|
|
|
}
|
|
|
|
|
|
//初始化数据
|
|
|
- $data = ['id', 'name','company','level','street','mobile','people'];
|
|
|
+ $data = ['id', 'name', 'company', 'level', 'street', 'mobile', 'people'];
|
|
|
$old_list = import_exl($old_file, $data, 1);
|
|
|
$new_list = import_exl($new_file, $data, 1);
|
|
|
if (empty($old_list)) {
|
|
@@ -44,33 +44,36 @@ class Couple extends AdminBaseController
|
|
|
$new_idcard = array_column($new_list, 'mobile');
|
|
|
$delete = array_diff($old_idcard, $new_idcard);
|
|
|
$add = array_diff($new_idcard, $old_idcard);
|
|
|
- $list = array_intersect($new_idcard,$old_idcard);
|
|
|
+ $list = array_intersect($new_idcard, $old_idcard);
|
|
|
|
|
|
//旧名单重整
|
|
|
- $old_people_by_mobile = [];
|
|
|
+ $old_people_by_mobile = [];
|
|
|
+ $old_people_by_company = [];
|
|
|
foreach ($old_list as $v) {
|
|
|
- $old_people_by_mobile[$v['mobile']] = $v['people'];
|
|
|
+ $old_people_by_mobile[$v['mobile']] = $v['people'];
|
|
|
+ $old_people_by_company[$v['company']] = $v['people'];
|
|
|
}
|
|
|
|
|
|
//匹配名单
|
|
|
$res = [];
|
|
|
foreach ($delete as $k => $v) {
|
|
|
- $item = $old_list[$k];
|
|
|
+ $item = $old_list[$k];
|
|
|
$item['status'] = '过期';
|
|
|
- $res[] = $item;
|
|
|
+ $res[] = $item;
|
|
|
}
|
|
|
|
|
|
foreach ($add as $k => $v) {
|
|
|
- $item = $new_list[$k];
|
|
|
+ $item = $new_list[$k];
|
|
|
$item['status'] = '新增';
|
|
|
- $res[] = $item;
|
|
|
+ $item['people'] = $old_people_by_company[$v['company']] ?? '';
|
|
|
+ $res[] = $item;
|
|
|
}
|
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
- $item = $new_list[$k];
|
|
|
+ $item = $new_list[$k];
|
|
|
$item['status'] = '续期';
|
|
|
$item['people'] = $old_people_by_mobile[$v];
|
|
|
- $res[] = $item;
|
|
|
+ $res[] = $item;
|
|
|
}
|
|
|
|
|
|
$xlsCell = [
|