public function actiontopgoods() { $ID = Yii::app()->request->getParam('id'); $IDs = explode(',', $ID); foreach ($IDs as $value) { if ($value) { $goodsold[$value] = DealergoodsService::newgoodsxinfo($value); } } $result = DealergoodsService::editsalegoods('1'); foreach ($IDs as $value) { if ($value) { $goodsnew[$value] = DealergoodsService::newgoodsxinfo($value); $edit = DealergoodsService::goodsversion($goodsnew[$value], $goodsold[$value]); DealergoodsService::editgoodslog($edit); } } //商品上架-生成版本 foreach ($IDs as $value) { if ($value) { DealergoodsService::addversiongoods($value); } } if ($result['bool']) { $result = array('success' => 0, 'name' => $result['name']); } else { $result = array('success' => 1); } echo json_encode($result); }