Commit 2fd46a8b authored by zhoujun's avatar zhoujun

预警接口

parent 12187a61
Pipeline #2075 passed with stage
in 0 seconds
......@@ -349,6 +349,7 @@ class WarnService implements IWarnService
$platformArr = config(env('ENVIRONMENT') . '.PLATFORM');
$channelArr = config(env('ENVIRONMENT') . '.CHANNEL');
$idArr = [];
foreach ($lists as $list) {
$tem['id'] = $list->id;
$tem['platform'] = $platformArr[$list->platform] ?? '';
......@@ -357,8 +358,8 @@ class WarnService implements IWarnService
$tem['oneWithdrawal'] = 0.00;
$tem['dayWithdrawal'] = 0.00;
$tem['userDayWithdrawal'] = 0.00;
$tem['configId'] =$list->config_id;
$tem['peopleId'] =$list->people_id;
$tem['configId'] = $list->config_id;
$tem['peopleId'] = $list->people_id;
$tem['status'] = $list->status;
$statusName = '已发送';
if($list->status == 0) $statusName = '未发送';
......@@ -366,7 +367,28 @@ class WarnService implements IWarnService
$tem['msg'] = $list->msg;
$tem['createdAt'] = $list->send_time;
$array['data'][] = $tem;
$idArr[$list->config_id] = $list->config_id;
}
if(!empty($idArr)){
$conArr = [];
$configs = WarnConfigModel::whereIn('id',$idArr)->select('id','one_withdrawal','day_withdrawal','people_day_withdrawal')->get();
foreach($configs as $con){
$ctem['oneWithdrawal'] = sprintf('%.2f',$con->one_withdrawal / 100);
$ctem['dayWithdrawal'] = sprintf('%.2f',$con->day_withdrawal / 100);
$ctem['userDayWithdrawal'] = sprintf('%.2f',$con->people_day_withdrawal / 100);
$conArr[$con->id] = $ctem;
}
if(!empty($conArr)){
foreach($array['data'] as &$val){
$val['oneWithdrawal'] = $conArr[$val['configId']]['oneWithdrawal'] ?? 0.00;
$val['dayWithdrawal'] = $conArr[$val['configId']]['dayWithdrawal'] ?? 0.00;
$val['userDayWithdrawal'] = $conArr[$val['configId']]['userDayWithdrawal'] ?? 0.00;
}
}
}
unset($lists, $list);
return $array;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment