|
@@ -704,6 +704,38 @@ class WebsiteController extends AbstractController
|
|
return Result::error($result['message']);
|
|
return Result::error($result['message']);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ private function processMonthlyData(array $data, string $dateKey = 'date', string $typeKey = 'type_id')
|
|
|
|
+ {
|
|
|
|
+ $dates = [];
|
|
|
|
+ $startDate = (new DateTime())->modify('-29 day');
|
|
|
|
+ for ($i = 0; $i < 30; $i++) {
|
|
|
|
+ $dates[] = $startDate->format('Y-m-d');
|
|
|
|
+ $startDate->modify('+1 day');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $list = PublicData::arrayColumnAsKey($data, $dateKey);
|
|
|
|
+ $result = [];
|
|
|
|
+
|
|
|
|
+ foreach ([1, 2, 3, 4, 10000] as $type) {
|
|
|
|
+ $result[$type] = [];
|
|
|
|
+ foreach ($dates as $key => $val) {
|
|
|
|
+ $default = ['date' => $val, 'count' => 0];
|
|
|
|
+ if (isset($list[$val]) && $list[$val][$typeKey] == $type) {
|
|
|
|
+ $result[$type][$key] = ['date' => $val, 'count' => $list[$val]['count'] ?? 0];
|
|
|
|
+ } else {
|
|
|
|
+ $result[$type][$key] = $default;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return array_map(function ($typeId) use ($result) {
|
|
|
|
+ return [
|
|
|
|
+ 'usertype' => $typeId,
|
|
|
|
+ 'data' => $result[$typeId]
|
|
|
|
+ ];
|
|
|
|
+ }, [10000, 1, 2, 3, 4]);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 管理后台首页统计
|
|
* 管理后台首页统计
|
|
* @return array
|
|
* @return array
|
|
@@ -718,22 +750,24 @@ class WebsiteController extends AbstractController
|
|
var_dump("用户类型:", $typeId);
|
|
var_dump("用户类型:", $typeId);
|
|
switch ($typeId) {
|
|
switch ($typeId) {
|
|
case 1:
|
|
case 1:
|
|
|
|
+ case 2:
|
|
|
|
+ case 3:
|
|
$user_id = Context::get("UserId");
|
|
$user_id = Context::get("UserId");
|
|
$result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId, 'user_id' => $user_id]);
|
|
$result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId, 'user_id' => $user_id]);
|
|
return $result['code'] == 200 ? Result::success($result['data']) : Result::error($result['message']);
|
|
return $result['code'] == 200 ? Result::success($result['data']) : Result::error($result['message']);
|
|
case 4:
|
|
case 4:
|
|
$dates = [];
|
|
$dates = [];
|
|
|
|
+ $user_id = Context::get("UserId");
|
|
$startDate = (new DateTime())->modify('-29 day'); // 从 29 天前开始(因为我们要 30 天,包括今天的前一天)
|
|
$startDate = (new DateTime())->modify('-29 day'); // 从 29 天前开始(因为我们要 30 天,包括今天的前一天)
|
|
for ($i = 0; $i < 30; $i++) {
|
|
for ($i = 0; $i < 30; $i++) {
|
|
$dates[] = $startDate->format('Y-m-d');
|
|
$dates[] = $startDate->format('Y-m-d');
|
|
$startDate->modify('+1 day'); // 每天递增一天
|
|
$startDate->modify('+1 day'); // 每天递增一天
|
|
}
|
|
}
|
|
- $result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId]);
|
|
|
|
|
|
+ $result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId, 'user_id' => $user_id]);
|
|
|
|
+ $runturn = $result['data'];
|
|
$list = [];
|
|
$list = [];
|
|
- if ($result['data']) {
|
|
|
|
-
|
|
|
|
- $list = PublicData::arrayColumnAsKey($result['data'], 'date');
|
|
|
|
- var_dump($list);
|
|
|
|
|
|
+ if ($result['data']['letterOfComplaintList']) {
|
|
|
|
+ $list = PublicData::arrayColumnAsKey($result['data']['letterOfComplaintList'], 'date');
|
|
}
|
|
}
|
|
$newResult = [];
|
|
$newResult = [];
|
|
if ($dates) {
|
|
if ($dates) {
|
|
@@ -744,136 +778,518 @@ class WebsiteController extends AbstractController
|
|
}
|
|
}
|
|
//投诉举报列表
|
|
//投诉举报列表
|
|
$res['letterOfComplaintList'] = $newResult;
|
|
$res['letterOfComplaintList'] = $newResult;
|
|
|
|
+ $res = array_merge($runturn, $res);
|
|
return $result['code'] == 200 ? Result::success($res) : Result::error($result['message']);
|
|
return $result['code'] == 200 ? Result::success($res) : Result::error($result['message']);
|
|
- break;
|
|
|
|
case 10000:
|
|
case 10000:
|
|
-
|
|
|
|
$result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId]);
|
|
$result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId]);
|
|
- if ($result) {
|
|
|
|
- $dates = [];
|
|
|
|
- $startDate = (new DateTime())->modify('-29 day'); // 从 29 天前开始(因为我们要 30 天,包括今天的前一天)
|
|
|
|
- for ($i = 0; $i < 30; $i++) {
|
|
|
|
- $dates[] = $startDate->format('Y-m-d');
|
|
|
|
- $startDate->modify('+1 day'); // 每天递增一天
|
|
|
|
- }
|
|
|
|
- $list = [];
|
|
|
|
- if ($result['data']['monthArticle']) {
|
|
|
|
- $list = PublicData::arrayColumnAsKey($result['data']['monthArticle'], 'date');
|
|
|
|
- }
|
|
|
|
- $newResult[1] = [];
|
|
|
|
- $newResult[2] = [];
|
|
|
|
- $newResult[3] = [];
|
|
|
|
- $newResult[4] = [];
|
|
|
|
- $newResult[10000] = [];
|
|
|
|
- if ($dates) {
|
|
|
|
- foreach ($dates as $key => $val) {
|
|
|
|
- // 初始化默认值
|
|
|
|
- $defaultData = [
|
|
|
|
- 'date' => $val,
|
|
|
|
- 'count' => 0
|
|
|
|
- ];
|
|
|
|
- // 检查 $list[$val] 是否存在且 type_id 为 1
|
|
|
|
- if (isset($list[$val]) && $list[$val]['type_id'] == 1) {
|
|
|
|
- $newResult[1][$key] = [
|
|
|
|
- 'date' => $val,
|
|
|
|
- 'count' => $list[$val]['count'] ?? 0
|
|
|
|
- ];
|
|
|
|
- } else {
|
|
|
|
- // 若不存在,使用默认值
|
|
|
|
- $newResult[1][$key] = $defaultData;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (isset($list[$val]) && $list[$val]['type_id'] == 10000) {
|
|
|
|
- $newResult[10000][$key] = [
|
|
|
|
- 'date' => $val,
|
|
|
|
- 'count' => $list[$val]['count'] ?? 0
|
|
|
|
- ];
|
|
|
|
- } else {
|
|
|
|
- // 若不存在,使用默认值
|
|
|
|
- $newResult[10000][$key] = $defaultData;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (isset($list[$val]) && $list[$val]['type_id'] == 2) {
|
|
|
|
- $newResult[2][$key] = [
|
|
|
|
- 'date' => $val,
|
|
|
|
- 'count' => $list[$val]['count'] ?? 0
|
|
|
|
- ];
|
|
|
|
- } else {
|
|
|
|
- // 若不存在,使用默认值
|
|
|
|
- $newResult[2][$key] = $defaultData;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (isset($list[$val]) && $list[$val]['type_id'] == 3) {
|
|
|
|
- $newResult[3][$key] = [
|
|
|
|
- 'date' => $val,
|
|
|
|
- 'count' => $list[$val]['count'] ?? 0
|
|
|
|
- ];
|
|
|
|
- } else {
|
|
|
|
- // 若不存在,使用默认值
|
|
|
|
- $newResult[3][$key] = $defaultData;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (isset($list[$val]) && $list[$val]['type_id'] == 4) {
|
|
|
|
- $newResult[4][$key] = [
|
|
|
|
- 'date' => $val,
|
|
|
|
- 'count' => $list[$val]['count'] ?? 0
|
|
|
|
- ];
|
|
|
|
- } else {
|
|
|
|
- // 若不存在,使用默认值
|
|
|
|
- $newResult[4][$key] = $defaultData;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- $newResult_new = [
|
|
|
|
- [
|
|
|
|
- 'usertype' => 10000,
|
|
|
|
- 'data' => $newResult[10000],
|
|
|
|
- ],
|
|
|
|
- [
|
|
|
|
- 'usertype' => 1,
|
|
|
|
- 'data' => $newResult[1],
|
|
|
|
- ],
|
|
|
|
- [
|
|
|
|
- 'usertype' => 2,
|
|
|
|
- 'data' => $newResult[2],
|
|
|
|
- ],
|
|
|
|
- [
|
|
|
|
- 'usertype' => 3,
|
|
|
|
- 'data' => $newResult[3],
|
|
|
|
- ],
|
|
|
|
- [
|
|
|
|
- 'usertype' => 4,
|
|
|
|
- 'data' => $newResult[4],
|
|
|
|
- ],
|
|
|
|
-
|
|
|
|
- ];
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //1:个人会员 2:政务会员 3:企业会员 4:调研员 10000:管理员
|
|
|
|
- $userType = [
|
|
|
|
- '1' => '个人会员',
|
|
|
|
- '2' => '政务会员',
|
|
|
|
- '3' => '企业会员',
|
|
|
|
- '4' => '调研员',
|
|
|
|
- '10000' => '管理员',
|
|
|
|
- '20000' => '游客',
|
|
|
|
- ];
|
|
|
|
- if ($result['data']['userType']) {
|
|
|
|
- foreach ($result['data']['userType'] as $k => $v) {
|
|
|
|
- $result['data']['userType'][$k]['typeName'] = $userType[$v['type_id']];
|
|
|
|
- }
|
|
|
|
|
|
+ if (!$result || $result['code'] != 200) {
|
|
|
|
+ return Result::error($result['message'] ?? '获取数据失败');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $data = $result['data'];
|
|
|
|
+
|
|
|
|
+ $userTypeMapping = [
|
|
|
|
+ 1 => '个人会员',
|
|
|
|
+ 2 => '政务会员',
|
|
|
|
+ 3 => '企业会员',
|
|
|
|
+ 4 => '调研员',
|
|
|
|
+ 10000 => '管理员',
|
|
|
|
+ 20000 => '游客',
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ // 处理各个统计项
|
|
|
|
+ $processed = [
|
|
|
|
+ 'monthArticle' => $this->processMonthlyData($data['monthArticle']),
|
|
|
|
+ 'monthGood' => $this->processMonthlyData($data['monthGood']),
|
|
|
|
+ 'monthBook' => $this->processMonthlyData($data['monthBook']),
|
|
|
|
+ 'monthJobHunting' => $this->processMonthlyData($data['monthJobHunting']),
|
|
|
|
+ 'monthJobRecruiting' => $this->processMonthlyData($data['monthJobRecruiting']),
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ // 用户类型映射
|
|
|
|
+ if (!empty($data['userType'])) {
|
|
|
|
+ foreach ($data['userType'] as &$item) {
|
|
|
|
+ $item['typeName'] = $userTypeMapping[$item['type_id']] ?? '未知';
|
|
}
|
|
}
|
|
- $result['data']['monthArticle'] = $newResult_new;
|
|
|
|
- $result['data']['list'] = $list;
|
|
|
|
- return Result::success($result['data']);
|
|
|
|
- } else {
|
|
|
|
- return Result::error($result['message']);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return Result::success($result);
|
|
|
|
- break;
|
|
|
|
|
|
+ // 合并结果
|
|
|
|
+ $finalData = array_merge($data, $processed);
|
|
|
|
+
|
|
|
|
+ return Result::success($finalData);
|
|
|
|
+ // $result = $this->websiteServiceClient->getAdminIndex(['type_id' => $typeId]);
|
|
|
|
+ // if ($result) {
|
|
|
|
+ // $dates = [];
|
|
|
|
+ // $startDate = (new DateTime())->modify('-29 day'); // 从 29 天前开始(因为我们要 30 天,包括今天的前一天)
|
|
|
|
+ // for ($i = 0; $i < 30; $i++) {
|
|
|
|
+ // $dates[] = $startDate->format('Y-m-d');
|
|
|
|
+ // $startDate->modify('+1 day'); // 每天递增一天
|
|
|
|
+ // }
|
|
|
|
+ // $list = [];
|
|
|
|
+ // if ($result['data']['monthArticle']) {
|
|
|
|
+ // $list = PublicData::arrayColumnAsKey($result['data']['monthArticle'], 'date');
|
|
|
|
+ // }
|
|
|
|
+ // if ($result['data']['monthGood']) {
|
|
|
|
+ // $listGood = PublicData::arrayColumnAsKey($result['data']['monthGood'], 'date');
|
|
|
|
+ // }
|
|
|
|
+ // if ($result['data']['monthBook']) {
|
|
|
|
+ // $listBook = PublicData::arrayColumnAsKey($result['data']['monthBook'], 'date');
|
|
|
|
+ // }
|
|
|
|
+ // if ($result['data']['monthJobHunting']) {
|
|
|
|
+ // $listJobHunting = PublicData::arrayColumnAsKey($result['data']['monthJobHunting'], 'date');
|
|
|
|
+ // }
|
|
|
|
+ // if ($result['data']['monthJobRecruiting']) {
|
|
|
|
+ // $listJobRecruiting = PublicData::arrayColumnAsKey($result['data']['monthJobRecruiting'], 'date');
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // $newResult[1] = [];
|
|
|
|
+ // $newResult[2] = [];
|
|
|
|
+ // $newResult[3] = [];
|
|
|
|
+ // $newResult[4] = [];
|
|
|
|
+ // $newResult[10000] = [];
|
|
|
|
+
|
|
|
|
+ // $newResultGood[1] = [];
|
|
|
|
+ // $newResultGood[2] = [];
|
|
|
|
+ // $newResultGood[3] = [];
|
|
|
|
+ // $newResultGood[4] = [];
|
|
|
|
+ // $newResultGood[10000] = [];
|
|
|
|
+
|
|
|
|
+ // $newResultBook[1] = [];
|
|
|
|
+ // $newResultBook[2] = [];
|
|
|
|
+ // $newResultBook[3] = [];
|
|
|
|
+ // $newResultBook[4] = [];
|
|
|
|
+ // $newResultBook[10000] = [];
|
|
|
|
+
|
|
|
|
+ // $newResultJobHunting[1] = [];
|
|
|
|
+ // $newResultJobHunting[2] = [];
|
|
|
|
+ // $newResultJobHunting[3] = [];
|
|
|
|
+ // $newResultJobHunting[4] = [];
|
|
|
|
+ // $newResultJobHunting[10000] = [];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // $newResultJobRecruiting[1] = [];
|
|
|
|
+ // $newResultJobRecruiting[2] = [];
|
|
|
|
+ // $newResultJobRecruiting[3] = [];
|
|
|
|
+ // $newResultJobRecruiting[4] = [];
|
|
|
|
+ // $newResultJobRecruiting[10000] = [];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if ($dates) {
|
|
|
|
+ // foreach ($dates as $key => $val) {
|
|
|
|
+ // // 初始化默认值
|
|
|
|
+ // $defaultData = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => 0
|
|
|
|
+ // ];
|
|
|
|
+ // // 检查 $list[$val] 是否存在且 type_id 为 1
|
|
|
|
+ // if (isset($list[$val]) && $list[$val]['type_id'] == 1) {
|
|
|
|
+ // $newResult[1][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $list[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResult[1][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($list[$val]) && $list[$val]['type_id'] == 10000) {
|
|
|
|
+ // $newResult[10000][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $list[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResult[10000][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($list[$val]) && $list[$val]['type_id'] == 2) {
|
|
|
|
+ // $newResult[2][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $list[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResult[2][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($list[$val]) && $list[$val]['type_id'] == 3) {
|
|
|
|
+ // $newResult[3][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $list[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResult[3][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($list[$val]) && $list[$val]['type_id'] == 4) {
|
|
|
|
+ // $newResult[4][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $list[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResult[4][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // //good-----------------------------------------------------------------
|
|
|
|
+ // if (isset($listGood[$val]) && $listGood[$val]['type_id'] == 1) {
|
|
|
|
+ // $newResultGood[1][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listGood[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultGood[1][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listGood[$val]) && $listGood[$val]['type_id'] == 10000) {
|
|
|
|
+ // $newResultGood[10000][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listGood[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultGood[10000][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listGood[$val]) && $listGood[$val]['type_id'] == 2) {
|
|
|
|
+ // $newResultGood[2][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listGood[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultGood[2][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listGood[$val]) && $listGood[$val]['type_id'] == 3) {
|
|
|
|
+ // $newResultGood[3][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listGood[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultGood[3][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listGood[$val]) && $listGood[$val]['type_id'] == 4) {
|
|
|
|
+ // $newResultGood[4][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listGood[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultGood[4][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // //book-----------------------------------------------------------------
|
|
|
|
+ // if (isset($listBook[$val]) && $listBook[$val]['type_id'] == 1) {
|
|
|
|
+ // $newResultBook[1][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listBook[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultBook[1][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listBook[$val]) && $listBook[$val]['type_id'] == 10000) {
|
|
|
|
+ // $newResultBook[10000][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listBook[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultBook[10000][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listBook[$val]) && $listBook[$val]['type_id'] == 2) {
|
|
|
|
+ // $newResultBook[2][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listBook[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultBook[2][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listBook[$val]) && $listBook[$val]['type_id'] == 3) {
|
|
|
|
+ // $newResultBook[3][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listBook[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultBook[3][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listBook[$val]) && $listBook[$val]['type_id'] == 4) {
|
|
|
|
+ // $newResultBook[4][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listBook[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultBook[4][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+ // //JobHunting-----------------------------------------------------------------
|
|
|
|
+ // if (isset($listJobHunting[$val]) && $listJobHunting[$val]['type_id'] == 1) {
|
|
|
|
+ // $newResultJobHunting[1][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobHunting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobHunting[1][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobHunting[$val]) && $listJobHunting[$val]['type_id'] == 10000) {
|
|
|
|
+ // $newResultJobHunting[10000][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobHunting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobHunting[10000][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobHunting[$val]) && $listJobHunting[$val]['type_id'] == 2) {
|
|
|
|
+ // $newResultJobHunting[2][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobHunting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobHunting[2][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobHunting[$val]) && $listJobHunting[$val]['type_id'] == 3) {
|
|
|
|
+ // $newResultJobHunting[3][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobHunting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobHunting[3][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobHunting[$val]) && $listJobHunting[$val]['type_id'] == 4) {
|
|
|
|
+ // $newResultJobHunting[4][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobHunting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobHunting[4][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+ // //JobRecruiting-----------------------------------------------------------------
|
|
|
|
+ // if (isset($listJobRecruiting[$val]) && $listJobRecruiting[$val]['type_id'] == 1) {
|
|
|
|
+ // $newResultJobRecruiting[1][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobRecruiting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobRecruiting[1][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobRecruiting[$val]) && $listJobRecruiting[$val]['type_id'] == 10000) {
|
|
|
|
+ // $newResultJobRecruiting[10000][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobRecruiting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobRecruiting[10000][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobRecruiting[$val]) && $listJobRecruiting[$val]['type_id'] == 2) {
|
|
|
|
+ // $newResultJobRecruiting[2][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobRecruiting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobRecruiting[2][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobRecruiting[$val]) && $listJobRecruiting[$val]['type_id'] == 3) {
|
|
|
|
+ // $newResultJobRecruiting[3][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobRecruiting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobRecruiting[3][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // if (isset($listJobRecruiting[$val]) && $listJobRecruiting[$val]['type_id'] == 4) {
|
|
|
|
+ // $newResultJobRecruiting[4][$key] = [
|
|
|
|
+ // 'date' => $val,
|
|
|
|
+ // 'count' => $listJobRecruiting[$val]['count'] ?? 0
|
|
|
|
+ // ];
|
|
|
|
+ // } else {
|
|
|
|
+ // // 若不存在,使用默认值
|
|
|
|
+ // $newResultJobRecruiting[4][$key] = $defaultData;
|
|
|
|
+ // }
|
|
|
|
+ // //-----------------------------------------------------
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // $newResult_new = [
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 10000,
|
|
|
|
+ // 'data' => $newResult[10000],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 1,
|
|
|
|
+ // 'data' => $newResult[1],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 2,
|
|
|
|
+ // 'data' => $newResult[2],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 3,
|
|
|
|
+ // 'data' => $newResult[3],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 4,
|
|
|
|
+ // 'data' => $newResult[4],
|
|
|
|
+ // ],
|
|
|
|
+ // ];
|
|
|
|
+
|
|
|
|
+ // $newResult_Good = [
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 10000,
|
|
|
|
+ // 'data' => $newResultGood[10000],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 1,
|
|
|
|
+ // 'data' => $newResultGood[1],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 2,
|
|
|
|
+ // 'data' => $newResultGood[2],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 3,
|
|
|
|
+ // 'data' => $newResultGood[3],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 4,
|
|
|
|
+ // 'data' => $newResultGood[4],
|
|
|
|
+ // ],
|
|
|
|
+ // ];
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // $newResult_Book = [
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 10000,
|
|
|
|
+ // 'data' => $newResultBook[10000],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 1,
|
|
|
|
+ // 'data' => $newResultBook[1],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 2,
|
|
|
|
+ // 'data' => $newResultBook[2],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 3,
|
|
|
|
+ // 'data' => $newResultBook[3],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 4,
|
|
|
|
+ // 'data' => $newResultBook[4],
|
|
|
|
+ // ],
|
|
|
|
+ // ];
|
|
|
|
+
|
|
|
|
+ // $newResult_JobHunting = [
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 10000,
|
|
|
|
+ // 'data' => $newResultJobHunting[10000],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 1,
|
|
|
|
+ // 'data' => $newResultJobHunting[1],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 2,
|
|
|
|
+ // 'data' => $newResultJobHunting[2],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 3,
|
|
|
|
+ // 'data' => $newResultJobHunting[3],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 4,
|
|
|
|
+ // 'data' => $newResultJobHunting[4],
|
|
|
|
+ // ],
|
|
|
|
+ // ];
|
|
|
|
+
|
|
|
|
+ // $newResult_JobRecruiting = [
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 10000,
|
|
|
|
+ // 'data' => $newResultJobRecruiting[10000],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 1,
|
|
|
|
+ // 'data' => $newResultJobRecruiting[1],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 2,
|
|
|
|
+ // 'data' => $newResultJobRecruiting[2],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 3,
|
|
|
|
+ // 'data' => $newResultJobRecruiting[3],
|
|
|
|
+ // ],
|
|
|
|
+ // [
|
|
|
|
+ // 'usertype' => 4,
|
|
|
|
+ // 'data' => $newResultJobRecruiting[4],
|
|
|
|
+ // ],
|
|
|
|
+ // ];
|
|
|
|
+
|
|
|
|
+ // //1:个人会员 2:政务会员 3:企业会员 4:调研员 10000:管理员
|
|
|
|
+ // $userType = [
|
|
|
|
+ // '1' => '个人会员',
|
|
|
|
+ // '2' => '政务会员',
|
|
|
|
+ // '3' => '企业会员',
|
|
|
|
+ // '4' => '调研员',
|
|
|
|
+ // '10000' => '管理员',
|
|
|
|
+ // '20000' => '游客',
|
|
|
|
+ // ];
|
|
|
|
+ // if ($result['data']['userType']) {
|
|
|
|
+ // foreach ($result['data']['userType'] as $k => $v) {
|
|
|
|
+ // $result['data']['userType'][$k]['typeName'] = $userType[$v['type_id']];
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // $result['data']['monthArticle'] = $newResult_new;
|
|
|
|
+ // $result['data']['monthGood'] = $newResult_Good;
|
|
|
|
+ // $result['data']['monthBook'] = $newResult_Book;
|
|
|
|
+ // $result['data']['monthJobHunting'] = $newResult_JobHunting;
|
|
|
|
+ // $result['data']['monthJobRecruiting'] = $newResult_JobRecruiting;
|
|
|
|
+ // $result['data']['list'] = $list;
|
|
|
|
+ // return Result::success($result['data']);
|
|
|
|
+ // } else {
|
|
|
|
+ // return Result::error($result['message']);
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ // return Result::success($result);
|
|
|
|
+ // break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|