|
@ -4,8 +4,8 @@ namespace antgoods\controllers; |
|
|
|
|
|
|
|
|
use antgoods\models\ars\GoodsAttr; |
|
|
use antgoods\models\ars\GoodsAttr; |
|
|
use antgoods\models\ars\GoodsSku; |
|
|
use antgoods\models\ars\GoodsSku; |
|
|
use common\models\ars\OrderGoods; |
|
|
|
|
|
use common\models\ars\TemFile; |
|
|
|
|
|
|
|
|
use backend\models\ars\OrderGoods; |
|
|
|
|
|
use backend\models\ars\TemFile; |
|
|
use MongoDB\Driver\Manager; |
|
|
use MongoDB\Driver\Manager; |
|
|
use Yii; |
|
|
use Yii; |
|
|
use antgoods\models\ars\Goods; |
|
|
use antgoods\models\ars\Goods; |
|
@ -14,7 +14,7 @@ use yii\web\Controller; |
|
|
use yii\web\NotFoundHttpException; |
|
|
use yii\web\NotFoundHttpException; |
|
|
use yii\filters\VerbFilter; |
|
|
use yii\filters\VerbFilter; |
|
|
use antgoods\logic\goods\GoodsManager; |
|
|
use antgoods\logic\goods\GoodsManager; |
|
|
use common\models\ars\File; |
|
|
|
|
|
|
|
|
use backend\models\ars\File; |
|
|
use yii\web\Response; |
|
|
use yii\web\Response; |
|
|
use antgoods\models\ars\Attribute; |
|
|
use antgoods\models\ars\Attribute; |
|
|
|
|
|
|
|
@ -203,7 +203,7 @@ class GoodsController extends Controller |
|
|
*/ |
|
|
*/ |
|
|
public function actionSaveFile() |
|
|
public function actionSaveFile() |
|
|
{ |
|
|
{ |
|
|
if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){ |
|
|
|
|
|
|
|
|
if(!class_exists('\backend\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){ |
|
|
return ''; |
|
|
return ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -211,7 +211,7 @@ class GoodsController extends Controller |
|
|
$file_name = Yii::$app->request->get('fileName')[0]; |
|
|
$file_name = Yii::$app->request->get('fileName')[0]; |
|
|
|
|
|
|
|
|
if ($data['status'] == true) { |
|
|
if ($data['status'] == true) { |
|
|
$model = new \common\models\ars\TemFile(); |
|
|
|
|
|
|
|
|
$model = new \backend\models\ars\TemFile(); |
|
|
$model->user_id = Yii::$app->user->identity->id; |
|
|
$model->user_id = Yii::$app->user->identity->id; |
|
|
$model->name = $file_name; |
|
|
$model->name = $file_name; |
|
|
$file_manager = new \backend\logic\file\FileManager(); |
|
|
$file_manager = new \backend\logic\file\FileManager(); |
|
@ -233,7 +233,7 @@ class GoodsController extends Controller |
|
|
public function actionImgIdDel() |
|
|
public function actionImgIdDel() |
|
|
{ |
|
|
{ |
|
|
//判断该类是否存在
|
|
|
//判断该类是否存在
|
|
|
if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){ |
|
|
|
|
|
|
|
|
if(!class_exists('\backend\models\ars\TemFile') || !class_exists('\backend\models\ars\File')){ |
|
|
return ''; |
|
|
return ''; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -241,13 +241,13 @@ class GoodsController extends Controller |
|
|
$img_id_arr = explode(',', $img_id); |
|
|
$img_id_arr = explode(',', $img_id); |
|
|
if(isset(Yii::$app->request->get('data')['alias'])) { |
|
|
if(isset(Yii::$app->request->get('data')['alias'])) { |
|
|
$alias = Yii::$app->request->get('data')['alias']; |
|
|
$alias = Yii::$app->request->get('data')['alias']; |
|
|
$tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]); |
|
|
|
|
|
|
|
|
$tem_file = \backend\models\ars\TemFile::findOne(['alias' => $alias]); |
|
|
if ($tem_file) { |
|
|
if ($tem_file) { |
|
|
$img_id_arr = array_diff($img_id_arr, [$tem_file->id]); |
|
|
$img_id_arr = array_diff($img_id_arr, [$tem_file->id]); |
|
|
} |
|
|
} |
|
|
}else{ |
|
|
}else{ |
|
|
foreach (Yii::$app->request->get() as $key => $value) { |
|
|
foreach (Yii::$app->request->get() as $key => $value) { |
|
|
$tem_file = \common\models\ars\File::findOne(['alias' => $value]); |
|
|
|
|
|
|
|
|
$tem_file = \backend\models\ars\File::findOne(['alias' => $value]); |
|
|
if ($tem_file) { |
|
|
if ($tem_file) { |
|
|
$img_id_arr = array_diff($img_id_arr, [$tem_file->id]); |
|
|
$img_id_arr = array_diff($img_id_arr, [$tem_file->id]); |
|
|
} |
|
|
} |
|
@ -264,7 +264,7 @@ class GoodsController extends Controller |
|
|
public function actionImageFile() |
|
|
public function actionImageFile() |
|
|
{ |
|
|
{ |
|
|
//判断该类是否存在
|
|
|
//判断该类是否存在
|
|
|
if(!class_exists('\common\models\ars\File')){ |
|
|
|
|
|
|
|
|
if(!class_exists('\backend\models\ars\File')){ |
|
|
return false; |
|
|
return false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -272,9 +272,9 @@ class GoodsController extends Controller |
|
|
$file_id_str = Yii::$app->request->get('fileidstr'); |
|
|
$file_id_str = Yii::$app->request->get('fileidstr'); |
|
|
$file_id_arr = explode(',', $file_id_str); |
|
|
$file_id_arr = explode(',', $file_id_str); |
|
|
if ($rule_verify == 1) { |
|
|
if ($rule_verify == 1) { |
|
|
$data = \common\models\ars\TemFile::find()->where(['id' => $file_id_arr])->all(); |
|
|
|
|
|
|
|
|
$data = \backend\models\ars\TemFile::find()->where(['id' => $file_id_arr])->all(); |
|
|
} else { |
|
|
} else { |
|
|
$data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all(); |
|
|
|
|
|
|
|
|
$data = \backend\models\ars\File::find()->where(['id' => $file_id_arr])->all(); |
|
|
} |
|
|
} |
|
|
$res = array(); |
|
|
$res = array(); |
|
|
if($data) { |
|
|
if($data) { |
|
|