Commit fc72a893 authored by liuyuzhen's avatar liuyuzhen

配送公式

parent 31b45f87
...@@ -109,6 +109,10 @@ class DeliveryFormulaModel extends \DAO\AbstractModel { ...@@ -109,6 +109,10 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
return $return; return $return;
} }
public function delDeliverFormulaByStoreId($storeId){
return \Our\RedisHelper::delCachedFunction(\Redis\Db6\DeliveryFormulaRedisModel::getInstance(),array(&$this, 'getOne'),array(),\Our\ApiConst::sevenDaySecond,array($storeId));
}
/** /**
* 新的配送公式 * 新的配送公式
* @param $store * @param $store
...@@ -142,11 +146,23 @@ class DeliveryFormulaModel extends \DAO\AbstractModel { ...@@ -142,11 +146,23 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
} }
} }
$formula = array(); $formula = array();
$formula['half'] = max(array_column($distanceFormulaList,'half')); $halfList = array();
$formula['one'] = max(array_column($distanceFormulaList,'one')); $oneList = array();
$formula['two'] = max(array_column($distanceFormulaList,'two')); $twoList = array();
$formula['oneday'] = max(array_column($distanceFormulaList,'oneday')); $dayList = array();
$formula['other'] = max(array_column($distanceFormulaList,'other')); $otherList = array();
foreach($distanceFormulaList as $tempFormuala){
$halfList[] = $tempFormuala['half']?$tempFormuala['half']:$tempFormuala['other'];
$oneList[] = $tempFormuala['one']?$tempFormuala['one']:$tempFormuala['other'];
$twoList[] = $tempFormuala['one']?$tempFormuala['two']:$tempFormuala['other'];
$dayList[] = $tempFormuala['day']?$tempFormuala['day']:$tempFormuala['other'];
$otherList[] = $tempFormuala['other'];
}
$formula['half'] = max($distanceFormulaList);
$formula['one'] = max($oneList);
$formula['two'] = max($twoList);
$formula['day'] = max($dayList);
$formula['other'] = max($otherList);
$currentTime =TIMESTAMP; $currentTime =TIMESTAMP;
$time = date('Y-m-d',$currentTime); $time = date('Y-m-d',$currentTime);
...@@ -226,7 +242,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel { ...@@ -226,7 +242,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}else if($interval<=\Our\ApiConst::halfHour*4){ }else if($interval<=\Our\ApiConst::halfHour*4){
$temp['price'] = $formulaPrice['two']; $temp['price'] = $formulaPrice['two'];
}else{ }else{
$temp['price'] = $formulaPrice['oneday']; $temp['price'] = $formulaPrice['day'];
} }
if($deliveryFreeFlag){ if($deliveryFreeFlag){
$temp['price'] = \Our\ApiConst::zero; $temp['price'] = \Our\ApiConst::zero;
......
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