Commit b418a909 authored by hujun's avatar hujun

调整计算

parent 899fd130
...@@ -3506,13 +3506,13 @@ class Finance extends Basic ...@@ -3506,13 +3506,13 @@ class Finance extends Basic
* @return float|int|string * @return float|int|string
*/ */
private function sumPayLogPriceByType(int $type, int $is_adjustment = 0) { private function sumPayLogPriceByType(int $type, int $is_adjustment = 0) {
$m_pay = new OPayLogModel();
if ($is_adjustment) { if ($is_adjustment) {
$m_pay_adjustment = new OPayLogAdjustment();
$where['b.type'] = $type; $where['b.type'] = $type;
$where['source'] = 2; $where['source'] = 2;
$price = $m_pay->sumAdjustment('b.money', $where, $is_adjustment); $price = $m_pay_adjustment->sumMoney('a.money', $where, $is_adjustment);
} else { } else {
$m_pay = new OPayLogModel();
$where['type'] = $type; $where['type'] = $type;
$price = $m_pay->sumAdjustment('real_money', $where, $is_adjustment); $price = $m_pay->sumAdjustment('real_money', $where, $is_adjustment);
} }
......
...@@ -172,4 +172,16 @@ class OPayLogAdjustment extends BaseModel{ ...@@ -172,4 +172,16 @@ class OPayLogAdjustment extends BaseModel{
return 0; return 0;
} }
} }
/**
* @param $field
* @param $where
* @return float|int
*/
public function sumMoney($field, $where) {
return $this->db_->alias('a')
->join('o_paylog b','a.new_paylog_id=b.id')
->where($where)
->sum($field);
}
} }
\ No newline at end of file
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