|
|
@ -7,6 +7,7 @@ use backend\modules\goods\models\ars\FilterAttr; |
|
|
|
use backend\modules\goods\models\ars\GoodsAttr; |
|
|
|
use backend\modules\shop\logic\ShopManager; |
|
|
|
use Exception; |
|
|
|
use Throwable; |
|
|
|
use Yii; |
|
|
|
use backend\modules\goods\models\ars\Goods; |
|
|
|
use backend\modules\goods\models\searchs\GoodsSearch; |
|
|
@ -16,6 +17,7 @@ use yii\filters\VerbFilter; |
|
|
|
use backend\modules\goods\logic\goods\GoodsManager; |
|
|
|
use backend\modules\file\models\ars\File; |
|
|
|
use backend\modules\goods\models\ars\Attribute; |
|
|
|
use iron\widget\Excel; |
|
|
|
|
|
|
|
/** |
|
|
|
* GoodsController implements the CRUD actions for Goods model. |
|
|
@ -196,7 +198,7 @@ class GoodsController extends Controller |
|
|
|
} else { |
|
|
|
$dataProvider = $searchModel->search($params); |
|
|
|
} |
|
|
|
\iron\widget\Excel::export([ |
|
|
|
Excel::export([ |
|
|
|
'models' => $dataProvider->getModels(), |
|
|
|
'format' => 'Xlsx', |
|
|
|
'asAttachment' => true, |
|
|
@ -216,6 +218,7 @@ class GoodsController extends Controller |
|
|
|
if ($data['status'] == true) { |
|
|
|
return FileManager::saveTemFile($fileName, $data); |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -255,7 +258,7 @@ class GoodsController extends Controller |
|
|
|
|
|
|
|
/** |
|
|
|
* @return array |
|
|
|
* @throws \Throwable |
|
|
|
* @throws Throwable |
|
|
|
* 添加sku |
|
|
|
*/ |
|
|
|
public function actionAddSku() |
|
|
@ -290,7 +293,7 @@ class GoodsController extends Controller |
|
|
|
$type = Yii::$app->request->get('type'); |
|
|
|
$id = Yii::$app->request->get('goodsId'); |
|
|
|
$data['sku'] = GoodsManager::getCreatedSku($id, $type); |
|
|
|
$data['attributes'] = GoodsManager::getAttrs($id, $type); |
|
|
|
$data['attributes'] = GoodsManager::getAttrs($id); |
|
|
|
return $data; |
|
|
|
} |
|
|
|
|
|
|
@ -301,8 +304,7 @@ class GoodsController extends Controller |
|
|
|
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(); |
|
|
|
$allAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR, 'is_delete' => Attribute::IS_DELETE_NO])->andWhere(['cat_id' => [0,$catId]])->asArray()->all(); |
|
|
|
return json_encode($allAttr); |
|
|
|
} |
|
|
|
} |