Commit fc72a893 authored by liuyuzhen's avatar liuyuzhen

配送公式

parent 31b45f87
......@@ -109,6 +109,10 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
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
......@@ -142,11 +146,23 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}
}
$formula = array();
$formula['half'] = max(array_column($distanceFormulaList,'half'));
$formula['one'] = max(array_column($distanceFormulaList,'one'));
$formula['two'] = max(array_column($distanceFormulaList,'two'));
$formula['oneday'] = max(array_column($distanceFormulaList,'oneday'));
$formula['other'] = max(array_column($distanceFormulaList,'other'));
$halfList = array();
$oneList = array();
$twoList = array();
$dayList = array();
$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;
$time = date('Y-m-d',$currentTime);
......@@ -226,7 +242,7 @@ class DeliveryFormulaModel extends \DAO\AbstractModel {
}else if($interval<=\Our\ApiConst::halfHour*4){
$temp['price'] = $formulaPrice['two'];
}else{
$temp['price'] = $formulaPrice['oneday'];
$temp['price'] = $formulaPrice['day'];
}
if($deliveryFreeFlag){
$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