Commit 454578fe authored by hujun's avatar hujun

删除收款和删除调整

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