Commit 454578fe authored by hujun's avatar hujun

删除收款和删除调整

parent 792223d7
......@@ -3403,19 +3403,18 @@ class Finance extends Basic
$where = [
'id' => $this->params['id'],
];
$pay_adjustment = $m_pay_adjustment->getAdjustmentList('new_paylog_id', $where);
if (empty($pay_adjustment[0]['new_paylog_id'])) {
$pay_adjustment = $m_pay_adjustment->getAdjustmentList('paylog_id,new_paylog_id', $where);
if (empty($pay_adjustment[0]['paylog_id'])) {
return $this->response($code, '无调整信息');
}
$where = [
'paylog_id' => $pay_adjustment[0]['new_paylog_id'],
['EXP', "new_paylog_id = {$pay_adjustment[0]['paylog_id']} OR paylog_id =".$pay_adjustment[0]['paylog_id']],
];
$pay_log_id = $m_pay_adjustment->getAdjustmentList('paylog_id', $where);
$pay_log_id = $m_pay_adjustment->getFieldColumn('paylog_id', $where);
if (count($pay_log_id) > 1) {
return $this->response($code, '存在调整,不能删除');
return $this->response($code, '存在调整,不能删除.');
}
$num = $m_pay_adjustment->updatePayLogAdjustment(['is_del'=>1, 'id'=>$this->params['id']]);
......@@ -3610,8 +3609,8 @@ class Finance extends Basic
}
$m_pay_adjustment = new OPayLogAdjustment();
$adjustment_num = $m_pay_adjustment->getAdjustmentList('id', ['paylog_id'=>$this->params['pay_id']]);
if (count($adjustment_num) > 1) {
$adjustment_id = $m_pay_adjustment->getFieldColumn('id', [['EXP',"paylog_id = {$this->params['pay_id']} OR new_paylog_id = ".$this->params['pay_id']]]);
if (count($adjustment_id) > 1) {
return $this->response($code, '存在调整,不能删除');
}
......@@ -3622,6 +3621,7 @@ class Finance extends Basic
}
$num = $m_pay->updatePayLog(['is_del'=>1, 'id'=>$this->params['pay_id']]);
if ($num > 0) {
$m_pay_adjustment->updatePayLogAdjustment(['id'=>['in', $adjustment_id], 'is_del'=>1]);
$code = 200;
} else {
$code = 101;
......
......@@ -162,7 +162,7 @@ class OPayLogAdjustment extends BaseModel{
unset($params["id"]);
Db::startTrans();
try {
$id = $this->db_->where([ "id" => $id ])->update($params);
$id = $this->db_->where([ "id" => ['in', $id] ])->update($params);
Db::commit();
return $id;
} catch (\Exception $e) {
......
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