public function currentAction() { //取出起始时间 $beginTime = $this->dateArr['endTime']; $endTime = time(); //取出当前时间段的数据 $orderRelation = new OrderRelationModel(); $orderRelation->setBeginTime($beginTime); $orderRelation->setEndTime($endTime); $currentSettles = $orderRelation->getPayedOrder(); //添加用户信息 $key = '_customer_id'; $currentSettles = get_customer_info_by_id($currentSettles, $key); //添加系数信息 $rebate = new RebateModel(); $key = 'totalGoodsFee'; $keyRes = '_totalGoodsFee_rebate'; $currentSettles = $rebate->getRatioByMoney($currentSettles, $key, $keyRes); $key = 'lineTotalGoodsFee'; $keyRes = '_lineTotalGoodsFee_rebate'; $currentSettles = $rebate->getRatioByMoney($currentSettles, $key, $keyRes); //计算佣金 foreach ($currentSettles as $key => $value) { $currentSettles[$key]['commission'] = floor($value['totalDirectFee'] * $value['_totalGoodsFee_rebate']['direct_ratio'] + $value['lineTotalLineFee'] * $value['_lineTotalGoodsFee_rebate']['line_ratio']); } //数据分页 $currentPage = I('get.p', 1); $this->page->setCounts(count($currentSettles)); $this->page->setCurrentpage($currentPage); $this->page->setPageStyle(2); $pageSize = $this->page->getPageSize(); //截取本页内容 $currentSettles = array_slice($currentSettles, ($currentPage - 1) * $pageSize, $pageSize); $this->assign('beginTime', $beginTime); $this->assign('endTime', $endTime); $pageStr = $this->page->fetch(); $this->assign('page', $pageStr); $this->assign('data', $currentSettles); $this->assign('YZRight', $this->fetch()); $this->display(YZ_TEMPLATE); }
private function _getInfoBetweenTime($beginTime, $endTime) { //取出当前时间段的数据 $orderRelation = new OrderRelationModel(); $orderRelation->setBeginTime($beginTime); $orderRelation->setEndTime($endTime); $currentSettles = $orderRelation->getPayedOrder(); //添加用户信息 $key = '_customer_id'; $currentSettles = get_customer_info_by_id($currentSettles, $key); //添加系数信息 $rebate = new RebateModel(); $key = 'totalGoodsFee'; $keyRes = '_totalGoodsFee_rebate'; $currentSettles = $rebate->getRatioByMoney($currentSettles, $key, $keyRes); $key = 'lineTotalGoodsFee'; $keyRes = '_lineTotalGoodsFee_rebate'; $currentSettles = $rebate->getRatioByMoney($currentSettles, $key, $keyRes); //计算佣金 foreach ($currentSettles as $key => $value) { $currentSettles[$key]['commission'] = floor($value['totalDirectFee'] * $value['_totalGoodsFee_rebate']['direct_ratio'] + $value['lineTotalLineFee'] * $value['_lineTotalGoodsFee_rebate']['line_ratio']); } $key1 = '_customer_id'; $key2 = 'openid'; $currentSettles = change_key_by_key1_key2($currentSettles, $key1, $key2); return $currentSettles; }