master #1
@ -301,4 +301,58 @@ class AdditionAndSubtractionRecords extends Api
|
|||||||
return $this->error('审核失败');
|
return $this->error('审核失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function plexamine()
|
||||||
|
{
|
||||||
|
// 接收原始参数
|
||||||
|
$idsParam = $this->request->post('ids');
|
||||||
|
$status = $this->request->post('status');
|
||||||
|
|
||||||
|
// 权限验证
|
||||||
|
$level = Db::name('auth_group')
|
||||||
|
->where('id', $this->auth_group)
|
||||||
|
->value('level');
|
||||||
|
if ($level == 2) {
|
||||||
|
return $this->error('您没有审核权限');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数预处理
|
||||||
|
$ids = [];
|
||||||
|
if (!empty($idsParam)) {
|
||||||
|
// 将字符串转换为数组并过滤无效ID
|
||||||
|
$ids = array_filter(explode(',', $idsParam), function($id) {
|
||||||
|
return is_numeric($id) && $id > 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 参数校验
|
||||||
|
if (empty($ids) || !$status) {
|
||||||
|
return $this->error('缺少必要参数或包含无效ID');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构造批量更新条件
|
||||||
|
$where = [
|
||||||
|
'id' => ['in', $ids]
|
||||||
|
];
|
||||||
|
|
||||||
|
$update = [
|
||||||
|
'status' => $status,
|
||||||
|
// 'updatetime' => time()
|
||||||
|
];
|
||||||
|
|
||||||
|
// 执行批量更新
|
||||||
|
$affectedRows = Db::name('addition_and_subtraction_records')
|
||||||
|
->where($where)
|
||||||
|
->update($update);
|
||||||
|
|
||||||
|
// 结果处理
|
||||||
|
if ($affectedRows !== false) {
|
||||||
|
if ($affectedRows > 0) {
|
||||||
|
return $this->success("成功更新{$affectedRows}条记录");
|
||||||
|
}
|
||||||
|
return $this->error('未找到可更新的记录');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->error('审核操作失败');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user