private function _getDangAchieve() { $endTime = time(); $beginTime = $endTime - 30 * 24 * 60 * 60; $this->orderRelation->setBeginTime($beginTime); $this->orderRelation->setEndTime($endTime); $res = $this->orderRelation->getPayedOrder(); //添加系数信息 $rebate = new RebateModel(); $key = 'totalGoodsFee'; $keyRes = '_totalGoodsFee_rebate'; $res = $rebate->getRatioByMoney($res, $key, $keyRes); $key = 'lineTotalGoodsFee'; $keyRes = '_lineTotalGoodsFee_rebate'; $res = $rebate->getRatioByMoney($res, $key, $keyRes); $achieve = $res[$this->id]; return $achieve; }
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; }
private function _getCurrentCustomerCurrentAchievement() { /* 取用户基本信息**** */ $openid = (string) $this->postObj->FromUserName; //获取当前周期的开始结束日期 $config = new ConfigModel(); $times = $config->getBeginTimeAndEndTime(); $beginTime = $times['endTime']; $endTime = time(); //取当期业绩信息中直销业绩 $relationForm = new OrderRelationModel(); $currentAchievement['direct'] = $relationForm->getAchievementByOpenid($openid, $beginTime, $endTime); //取出上线为自已的所有用户的业绩 $customer = new CustomerModel(); $openids = $customer->getLineOpenids($openid); $currentAchievement['line'] = $relationForm->getAchievementByOpenid($openids, $beginTime, $endTime); //添加直销,线销系数 $rebate = new RebateModel(); //取直销系数 $dataArr[0] = $currentAchievement['direct']; $key = '_totalGoodsFee'; $keyReturn = '_direct_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_direct_radio'] = $dataArr[0][$keyReturn]; //取线销系数 $dataArr[0] = $currentAchievement['line']; $keyReturn = '_line_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_line_radio'] = $dataArr[0][$keyReturn]; return $currentAchievement; }
public function indexAction() { /* 取用户基本信息**** */ $customerInfo = $this->customerInfo; //设置用户状态,用以显示“修改个人信息还是请完善个人信息” if (trim($customerInfo['phone_number']) == '' || trim($customerInfo['account']) == '') { $customerInfo['flag'] = 1; } else { $customerInfo['flag'] = 0; } $this->assign('customer', $customerInfo); $openid = get_openid(); //取订单数量 $orderForm = new OrderFormModel(); $noPayOrderCount = $orderForm->getNopayOrderCountByOpenid($openid); $payedOrderCount = $orderForm->getPayedOrderCountByOpenid($openid); //传订单数量数据 $this->assign('noPayOrderCount', $noPayOrderCount); $this->assign('payedOrderCount', $payedOrderCount); //获取当前周期的开始结束日期 $config = new ConfigModel(); $times = $config->getBeginTimeAndEndTime(); $beginTime = $times['endTime']; $endTime = time(); //取当期业绩信息中直销业绩 $relationForm = new OrderRelationModel(); $currentAchievement['direct'] = $relationForm->getAchievementByOpenid($openid, $beginTime, $endTime); //取出上线为自已的所有用户的业绩 $customer = new CustomerModel(); $openids = $customer->getLineOpenids($openid); $currentAchievement['line'] = $relationForm->getAchievementByOpenid($openids, $beginTime, $endTime); //添加直销,线销系数 $rebate = new RebateModel(); //取直销系数 $dataArr[0] = $currentAchievement['direct']; $key = '_totalGoodsFee'; $keyReturn = '_direct_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_direct_radio'] = $dataArr[0][$keyReturn]; //取线销系数 $dataArr[0] = $currentAchievement['line']; $keyReturn = '_line_radio'; $dataArr = $rebate->getRatioByMoney($dataArr, $key, $keyReturn); $currentAchievement['_line_radio'] = $dataArr[0][$keyReturn]; $this->assign('achievement', $currentAchievement); $changeUrl = U('ChangePhone/index'); $this->assign('changeUrl', $changeUrl); $account = U('Account/index'); $couponUrl = U('User/Coupon/index'); $this->assign('couponUrl', $couponUrl); $this->assign('wangqiurl', U('User/Achievement/pastData')); $finishedOrderUrl = U('UserCenter/OrderManage/finishedOrder'); $payedOrderUrl = U('UserCenter/OrderManage/payedOrder'); $unpayOrderUrl = U('UserCenter/OrderManage/unpayedOrder'); $allOrderUrl = U('UserCenter/OrderManage/allOrder'); $this->assign('finishedOrderUrl', $finishedOrderUrl); $this->assign('payedOrderUrl', $payedOrderUrl); $this->assign('unpayOrderUrl', $unpayOrderUrl); $this->assign('allOrderUrl', $allOrderUrl); $this->assign('count', $count); $css = $this->fetch('indexCss'); $this->assign('indexCss', $css); $this->assign("YZBody", $this->fetch()); $this->display(YZ_TEMPLATE); }