Commit c1c8f84c authored by hujun's avatar hujun

退款统计

parent ecdd7674
...@@ -265,14 +265,20 @@ class ORefundModel extends Model{ ...@@ -265,14 +265,20 @@ class ORefundModel extends Model{
* @return float|int * @return float|int
*/ */
public function getSumMoney($params) { public function getSumMoney($params) {
return $this->db_->alias('a') $refund_money = $this->db_->alias('a')
->field('a.refund_money')
->join('o_order b', 'a.order_id = b.id', 'left') ->join('o_order b', 'a.order_id = b.id', 'left')
->join('a_agents c', 'a.agent_id = c.id', 'left') ->join('a_agents c', 'a.agent_id = c.id', 'left')
->join('o_paylog d', 'a.pay_log_id = d.id', 'left') ->join('o_paylog d', 'a.pay_log_id = d.id', 'left')
->join('o_refund_log e', 'a.id = e.refund_id', 'left') ->join('o_refund_log e', 'a.id = e.refund_id', 'left')
->where($params) ->where($params)
->group('a.id') ->group('a.id')
->sum('a.refund_money'); ->select();
$price = 0;
foreach ($refund_money as $v) {
$price += $v['refund_money'];
}
return $price;
} }
/** /**
......
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