Commit d2853844 authored by zhz's avatar zhz

Merge branch 'ccw' of git.shenbd.com:qm-develop/shenbd into zhz

parents 75f395eb 1dc8d042
......@@ -70,6 +70,20 @@ class Common
}
return false;
}
/**
* @param $arr
* @param $key_name
* @return array
* 将数据库中查出的列表以指定的 id 作为数组的键名
*/
public static function convertArrKey($arr, $key_name)
{
$arr2 = array();
foreach ($arr as $key => $val) {
$arr2[$val[$key_name]] = $val;
}
return $arr2;
}
public static function isSerialized($data)
{
......
......@@ -1198,7 +1198,9 @@ class OrderServiceModel extends \Business\AbstractModel
public function updateGoodsStoregeByGoodsIds($storeId,$goodsid,$num=ApiConst::zero,$type=ApiConst::plus){
if(is_array($goodsid)){
$where['goods_id']=array('in',$goodsid);
$goodsids=array($goodsid);
$convertGoodsId=Common::convertArrKey($goodsid,'goodsId');
$where['goods_id']=array('in',$goodsids);
}else{
$where['goods_id']=$goodsid;
}
......@@ -1206,8 +1208,14 @@ class OrderServiceModel extends \Business\AbstractModel
$goodsDao = \DAO\GoodsModel::getInstance(DbNameConst::masterDBConnectName);
$goodses=$goodsDao->getList($where,$goodsDao->goodsDetailField);
if(!empty($goodses)){
foreach($goodses as &$goods){
if(is_array($goodsid)){
foreach($goodses as &$goods){
$goods['goodsNum']=$convertGoodsId[$goods['goodsId']]['num'];
}
}else{
foreach($goodses as &$goods){
$goods['goodsNum']=$num;
}
}
if($this->updateDateGoodsStoregeByOrderGoods($goodses,$type,false)){
return true;
......
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