Commit c7cb00c9 authored by hujun's avatar hujun

调整

parent be3c7da5
......@@ -323,18 +323,36 @@ class PayLogService
return false;
}
$pay_id = $this->payLogModel->getFieldValue('id', ['bargain_id'=>$bargain_id]);
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id'=>$bargain_id]);
if (empty($pay_id)) {
return false;
}
$money = $this->payLogModel->getSum('money', ['id'=>$pay_id]);
$money = $this->payLogModel->getSum('money', ['id'=> ['in', $pay_id]]);
if ($money > 0) {
$refund_money = $this->oRefundModel->getRefundSum('refund_money', ['pay_log_id'=>$pay_id]);
$refund_money = $this->oRefundModel->getRefundSum('refund_money', ['pay_log_id'=>['in', $pay_id]]);
$result = $money - $refund_money;
} else {
$result = 0;
}
return $result;
}
/**
* @param $bargain_id
* @return bool
*/
public function checkPayLogAdjustment($bargain_id) {
if (empty($bargain_id)) {
return false;
}
$result = false;
$pay_id = $this->payLogModel->getFieldColumn('id', ['bargain_id'=>$bargain_id]);
$id = $this->payLogAdjustmentModel->getFieldValue('id', ['paylog_id'=> ['in', $pay_id]]);
if ($id > 0) {
$result = true;
}
return $result;
}
}
\ No newline at end of file
......@@ -2288,6 +2288,11 @@ class Finance extends Basic
return $this->response(101, '存在收款或退款,不能撤销!');
}
$is_adjustment = $service_pay->checkPayLogAdjustment($this->params['bargain_id']);
if ($is_adjustment) {
return $this->response(101, '收款存在调整,不能撤销!');
}
$check = $this->updatePerformanceAll($this->params['bargain_id']);
if ($check['status'] == 'fail') {
return $this->response(101, '更新个人业绩失败,请重试!');
......
......@@ -563,9 +563,28 @@ class OPayLogModel extends Model
}
public function getCount($where) {
if (!isset($params['is_del'])) {
$params['is_del'] = 0;
}
return $this->db_->where($where)->count('id');
}
/**
* @param $where
* @return array
*/
public function getFieldColumn($field, $where) {
if (!isset($params['is_del'])) {
$params['is_del'] = 0;
}
return $this->db_->where($where)->column($field);
}
/**
* @param $field
* @param $where
* @return mixed
*/
public function getFieldValue($field, $where) {
if (!isset($params['is_del'])) {
$params['is_del'] = 0;
......
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