'', ]; $data['site_info'] = (new SiteService())->getInfo($this->site_id); $site_create_time = strtotime($data['site_info']['create_time']); $site_expire_time = strtotime($data['site_info']['expire_time']); $data['site_info']['mix'] = (number_format((time() - $site_create_time) / ($site_expire_time - $site_create_time), 2) * 100).'%'; $data['site_info']['over_date'] = $site_expire_time - time() > 0 ? number_format(($site_expire_time - time())/ 86400, 2) : 0; return $data; } /** * 订单金额 * @param $start_time * @param $end_time * @return float */ public function orderMoney($start_time, $end_time) { $where[] = [ ['site_id', '=', $this->site_id], ['order_status', '>', 0], ['create_time', 'between', [$start_time, $end_time]] ]; return (new RechargeOrder())->where($where)->sum('order_money'); } /** * 订单数量 * @param $start_time * @param $end_time * @return int * @throws DbException */ public function orderCount($start_time, $end_time) { $where[] = [ ['site_id', '=', $this->site_id], ['order_status', '>', 0], ['create_time', 'between', [$start_time, $end_time]] ]; return (new RechargeOrder())->where($where)->count('order_id'); } }