cloud_goods_id; $form = new GoodsForm(); //找出商品未审核或者未更新的产品 $CloudGoodsUpdateLog = CloudGoodsUpdateLog::find()->where(['cloud_goods_id' => $cloud_goods_id])->asArray()->all(); foreach ($CloudGoodsUpdateLog as $value) { //直接通过审核(目前只有点击审核通过时才会调用此事件) $item = CloudGoodsUpdateLog::findOne($value['id']); $item->is_audit = 1; $item->updated_at = time(); $item->save(); //判断是否开启自动更新 $cloud_is_update = Option::get('cloud_is_update', $value['store_id'], 'store')['value']; if ((int)$cloud_is_update > 0) { //TODO 更新产品逻辑 if ($value['cloud_goods_id']) { $StoreCloud = StoreCloud::findOne(['store_id' => $value['store_id'], 'is_delete' => 0]); $form->id = $value['cloud_goods_id']; $form->store_id =$value['store_id']; $goodsInfo = $form->saveCloudGoods(); $merchantForm = new MerchantForm(); $merchantForm->token_stroe_cloud_id = $StoreCloud->id; $goodsInfo['cloudBindInfo']['store_id'] = $value['store_id']; $result = $merchantForm->mchGoodsImport($goodsInfo['cloudBindInfo'],$goodsInfo['goods_id']); if ((int)$result['code'] !== 0) { return $result; } } } } } catch (\Exception $e) { debug_log('创建云仓更新产品信息2'. json_encode($e->getFile() . $e->getMessage() . $e->getLine())); } } }