private function calPaymentTrans($distance = false) { $data_obj = new \HaiQuan\Backend\Models\CtgData(); $payment_obj = new \HaiQuan\Backend\Models\Payment(); $trans = 0; if (!empty($distance)) { $key = $distance . "_PAY_TRANS"; if ($distance == 7) { $trans = $payment_obj->distancePaymentTransaction($this->_7_day, $this->_yesterday)->toArray(); } else { $trans = $payment_obj->distancePaymentTransaction($this->_30_day, $this->_yesterday)->toArray(); } $trans = $this->calAvarage($trans); } else { $key = "D_PAY_TRANS"; $trans = $payment_obj->datePaymentTransaction($this->_yesterday)->toArray(); $trans = $trans["value"]; } $data_obj->replaceKey($this->_yesterday, $key, $trans); return $trans; }