|
@ -4,6 +4,7 @@ namespace antgoods\goods\controllers; |
|
|
|
|
|
|
|
|
use antgoods\goods\models\ars\GoodsAttr; |
|
|
use antgoods\goods\models\ars\GoodsAttr; |
|
|
use antgoods\goods\models\ars\GoodsSku; |
|
|
use antgoods\goods\models\ars\GoodsSku; |
|
|
|
|
|
use common\models\ars\OrderGoods; |
|
|
use common\models\ars\TemFile; |
|
|
use common\models\ars\TemFile; |
|
|
use MongoDB\Driver\Manager; |
|
|
use MongoDB\Driver\Manager; |
|
|
use Yii; |
|
|
use Yii; |
|
@ -15,6 +16,7 @@ use yii\filters\VerbFilter; |
|
|
use antgoods\goods\logic\goods\GoodsManager; |
|
|
use antgoods\goods\logic\goods\GoodsManager; |
|
|
use common\models\ars\File; |
|
|
use common\models\ars\File; |
|
|
use yii\web\Response; |
|
|
use yii\web\Response; |
|
|
|
|
|
use antgoods\goods\models\ars\Attribute; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* GoodsController implements the CRUD actions for Goods model. |
|
|
* GoodsController implements the CRUD actions for Goods model. |
|
@ -331,4 +333,16 @@ class GoodsController extends Controller |
|
|
$data['attributes'] = GoodsManager::getAttrs($id, $type); |
|
|
$data['attributes'] = GoodsManager::getAttrs($id, $type); |
|
|
return $data; |
|
|
return $data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @return false|string |
|
|
|
|
|
* 根据商品分类获取商品属性 |
|
|
|
|
|
*/ |
|
|
|
|
|
public function actionFilterAttribute() |
|
|
|
|
|
{ |
|
|
|
|
|
$catId = Yii::$app->request->get('catId')??0; |
|
|
|
|
|
$goodsId = Yii::$app->request->get('goodsId')??0; |
|
|
|
|
|
$allAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR])->andWhere(['cat_id' => [0,$catId]])->asArray()->all(); |
|
|
|
|
|
return json_encode($allAttr); |
|
|
|
|
|
} |
|
|
} |
|
|
} |