增加批量操作

This commit is contained in:
lccsw
2025-12-10 16:49:17 +08:00
parent b65cd6cccf
commit e7e299ee81
@@ -38,19 +38,27 @@ class Cmmssn extends BaseController
public function index_put()
{
$params = $this->input_param();
$row = $this->cmmssn_model->get(['id' => $params['id']]);
if (!$row) {
$ids = $this->input_param('ids');
if (!$ids) {
$this->return_json('参数错误');
}
if ($row['ifSend']) {
$this->return_json('已设置发放');
}
$ids = implode(',', $ids);
// $row = $this->cmmssn_model->get(['id' => $params['id']]);
// if (!$row) {
// $this->return_json('参数错误');
// }
// if ($row['ifSend']) {
// $this->return_json('已设置发放');
// }
$updateData = [
'ifSend' => Pingan_users_cmmssn_model::IF_SEND_YES,
'sendTime' => date('Y-m-d H:i:s')
];
$res = $this->cmmssn_model->update($updateData, ['id' => $row['id']]);
$where = [
"id in ({$ids})" => null,
"ifSend" => Pingan_users_cmmssn_model::IF_SEND_NO
];
$res = $this->cmmssn_model->update($updateData, $where);
if (!$res) {
$this->return_json('保存失败');
}
@@ -77,6 +85,10 @@ class Cmmssn extends BaseController
if (strlen($params['ifSend'])) {
$where["ifSend"] = intval($params['ifSend']);
}
if ($params['dateRange']) {
$where["createTime>="] = date('Y-m-d 00:00:00', strtotime($params['dateRange'][0]));
$where["createTime<="] = date('Y-m-d 23:59:59', strtotime($params['dateRange'][1]));
}
$count = $this->cmmssn_model->count($where);
if ($count) {
$rows = $this->cmmssn_model->select($where, 'id desc', $page, $limit);
@@ -109,7 +121,7 @@ class Cmmssn extends BaseController
'orgName' => $user['orgName'] ?: '',
'userName' => $user['username'] ?: '',
'userCode' => $user['userCode'] ?: '',
'unlockTime' => strtotime($customer['unlock_time']) > 0 ? $customer['unlock_time'] : '',
'unlockTime' => $item['createTime'],
'orderTime' => $order['order_time'] ?: '',
'money' => $item['money']
];
@@ -122,7 +134,7 @@ class Cmmssn extends BaseController
'userName' => $user['username'] ?: '',
'userCode' => $user['userCode'] ?: '',
'orgName' => $user['orgName'] ?: '',
'unlockTime' => strtotime($customer['unlock_time']) > 0 ? $customer['unlock_time'] : '',
'unlockTime' => $item['createTime'],
'orderTime' => $order['order_time'] ?: '',
'typeCn' => Pingan_users_cmmssn_model::CF_TYPE_CN[$item['cfType']] ?: '',
'money' => $item['money'],