diff --git a/migrations/mongodb-example-data/fecshop_test/article.bson b/migrations/mongodb-example-data/fecshop_test/article.bson new file mode 100644 index 000000000..574b0d87d Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/article.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/article.metadata.json b/migrations/mongodb-example-data/fecshop_test/article.metadata.json new file mode 100644 index 000000000..38952ca35 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/article.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.article"},{"v":1,"key":{"url_key":{"$numberLong":"-1"}},"name":"url_key_-1","ns":"fecshop_test.article","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/category.bson b/migrations/mongodb-example-data/fecshop_test/category.bson new file mode 100644 index 000000000..34e84e06f Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/category.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/category.metadata.json b/migrations/mongodb-example-data/fecshop_test/category.metadata.json new file mode 100644 index 000000000..c0541bbd5 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/category.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.category"}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/favorite.bson b/migrations/mongodb-example-data/fecshop_test/favorite.bson new file mode 100644 index 000000000..4e2d4ab2d Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/favorite.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/favorite.metadata.json b/migrations/mongodb-example-data/fecshop_test/favorite.metadata.json new file mode 100644 index 000000000..65a49dd66 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/favorite.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.favorite"},{"v":1,"key":{"user_id":{"$numberLong":"-1"}},"name":"user_id_-1","ns":"fecshop_test.favorite","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}},{"v":1,"key":{"product_id":{"$numberLong":"-1"}},"name":"product_id_-1","ns":"fecshop_test.favorite","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/log_product_view.bson b/migrations/mongodb-example-data/fecshop_test/log_product_view.bson new file mode 100644 index 000000000..e0981b3c9 Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/log_product_view.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/log_product_view.metadata.json b/migrations/mongodb-example-data/fecshop_test/log_product_view.metadata.json new file mode 100644 index 000000000..32ca22dee --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/log_product_view.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.log_product_view"}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/migration.bson b/migrations/mongodb-example-data/fecshop_test/migration.bson new file mode 100644 index 000000000..86bdcf068 Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/migration.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/migration.metadata.json b/migrations/mongodb-example-data/fecshop_test/migration.metadata.json new file mode 100644 index 000000000..2294bc171 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/migration.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.migration"}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/newsletter.bson b/migrations/mongodb-example-data/fecshop_test/newsletter.bson new file mode 100644 index 000000000..cd1e92218 Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/newsletter.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/newsletter.metadata.json b/migrations/mongodb-example-data/fecshop_test/newsletter.metadata.json new file mode 100644 index 000000000..39fc69b7e --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/newsletter.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.newsletter"},{"v":1,"key":{"email":{"$numberLong":"-1"}},"name":"email_-1","ns":"fecshop_test.newsletter","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/product_flat.bson b/migrations/mongodb-example-data/fecshop_test/product_flat.bson new file mode 100644 index 000000000..c3235e05b Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/product_flat.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/product_flat.metadata.json b/migrations/mongodb-example-data/fecshop_test/product_flat.metadata.json new file mode 100644 index 000000000..0f8774418 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/product_flat.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.product_flat"},{"v":1,"key":{"spu":{"$numberLong":"-1"}},"name":"spu_-1","ns":"fecshop_test.product_flat","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}},{"v":1,"key":{"sku":{"$numberLong":"-1"}},"name":"sku_-1","ns":"fecshop_test.product_flat","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}},{"v":1,"key":{"category":{"$numberLong":"-1"}},"name":"category_-1","ns":"fecshop_test.product_flat","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/review.bson b/migrations/mongodb-example-data/fecshop_test/review.bson new file mode 100644 index 000000000..303210e96 Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/review.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/review.metadata.json b/migrations/mongodb-example-data/fecshop_test/review.metadata.json new file mode 100644 index 000000000..5b0fd0818 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/review.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.review"},{"v":1,"key":{"product_spu":{"$numberLong":"-1"}},"name":"product_spu_-1","ns":"fecshop_test.review","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}},{"v":1,"key":{"product_sku":{"$numberLong":"-1"}},"name":"product_sku_-1","ns":"fecshop_test.review","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}},{"v":1,"key":{"product_id":{"$numberLong":"-1"}},"name":"product_id_-1","ns":"fecshop_test.review","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}},{"v":1,"key":{"user_id":{"$numberLong":"-1"}},"name":"user_id_-1","ns":"fecshop_test.review","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/static_block.bson b/migrations/mongodb-example-data/fecshop_test/static_block.bson new file mode 100644 index 000000000..458d2b1ab Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/static_block.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/static_block.metadata.json b/migrations/mongodb-example-data/fecshop_test/static_block.metadata.json new file mode 100644 index 000000000..6de783457 --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/static_block.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.static_block"},{"v":1,"key":{"identify":{"$numberLong":"-1"}},"name":"identify_-1","ns":"fecshop_test.static_block","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/migrations/mongodb-example-data/fecshop_test/url_rewrite.bson b/migrations/mongodb-example-data/fecshop_test/url_rewrite.bson new file mode 100644 index 000000000..f286f67ee Binary files /dev/null and b/migrations/mongodb-example-data/fecshop_test/url_rewrite.bson differ diff --git a/migrations/mongodb-example-data/fecshop_test/url_rewrite.metadata.json b/migrations/mongodb-example-data/fecshop_test/url_rewrite.metadata.json new file mode 100644 index 000000000..5a33958cf --- /dev/null +++ b/migrations/mongodb-example-data/fecshop_test/url_rewrite.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":1,"key":{"_id":1},"name":"_id_","ns":"fecshop_test.url_rewrite"},{"v":1,"key":{"custom_url_key":{"$numberLong":"-1"}},"name":"custom_url_key_-1","ns":"fecshop_test.url_rewrite","w":{"$numberLong":"1"},"background":true,"socketTimeoutMS":{"$numberLong":"300000"}}]} \ No newline at end of file diff --git a/services/product/ProductMongodb.php b/services/product/ProductMongodb.php index 494091ee5..8f46e2f07 100644 --- a/services/product/ProductMongodb.php +++ b/services/product/ProductMongodb.php @@ -156,6 +156,8 @@ public function save($one,$originUrlKey='catalog/product/index'){ Yii::$service->helper->errors->add('Product '.$this->getPrimaryKey().' is not exist'); return; } + echo new \MongoDB\BSON\ObjectId($primaryVal); + exit; #验证sku 是否重复 $product_one = Product::find()->asArray()->where([ '<>',$this->getPrimaryKey(),(new \MongoDB\BSON\ObjectId($primaryVal))