提交 8b457e32 编写于 作者: T Terry

appserver product favorite

上级 80e71b52
......@@ -67,18 +67,20 @@ class ProductfavoriteController extends AppserverTokenController
{
$product_ids = [];
$favorites = [];
$favoritePrimaryKey = Yii::$service->product->favorite->getPrimaryKey();
foreach ($coll as $one) {
$p_id = (string)$one['product_id'];
$product_ids[] = $one['product_id'];
$favorites[$p_id] = [
'updated_at' => $one['updated_at'],
'favorite_id' => (string) $one['_id'],
'favorite_id' => (string) $one[$favoritePrimaryKey],
];
}
$productPrimaryKey = Yii::$service->product->getPrimaryKey();
// 得到产品的信息
$product_filter = [
'where' => [
['in', '_id', $product_ids],
['in', $productPrimaryKey, $product_ids],
],
'select' => [
'name', 'image',
......@@ -92,7 +94,8 @@ class ProductfavoriteController extends AppserverTokenController
$product_arr = [];
if (is_array($data['coll']) && !empty($data['coll'])) {
foreach ($data['coll'] as $one) {
$p_id = (string) $one['_id'];
//$p_id = (string) $one['_id'];
$p_id = (string) $one[$productPrimaryKey];
$one['updated_at'] = $favorites[$p_id]['updated_at'];
$one['favorite_id'] = $favorites[$p_id]['favorite_id'];
$main_img = isset($one['image']['main']['image']) ? $one['image']['main']['image'] : '';
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册