diff --git a/.gitignore b/.gitignore
index 82f923c..bf89285 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,4 +37,5 @@ phpunit.phar
vendor.zip
/vagrant
/backend/web/uploads
-dump.rdb
\ No newline at end of file
+dump.rdb
+/console/runtime
\ No newline at end of file
diff --git a/backend/config/main.php b/backend/config/main.php
index 272465d..352b926 100644
--- a/backend/config/main.php
+++ b/backend/config/main.php
@@ -9,7 +9,11 @@ return [
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
- 'modules' => [],
+ 'modules' => [
+ 'antgoods' => [
+ 'class' => 'antgoods\goods\Module',
+ ],
+ ],
'components' => [
'request' => [
'csrfParam' => '_csrf-backend',
@@ -30,6 +34,16 @@ return [
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
+ [
+ 'class' => 'yii\log\FileTarget',
+ 'levels' => ['info', 'error'],
+ 'categories' => ['imagetest'],
+ 'logFile' => '@app/runtime/logs/imagetest.log',
+ 'logVars' => [],
+ 'exportInterval' => 1,
+ 'prefix' => function ($message) {
+ }
+ ],
],
],
'errorHandler' => [
@@ -41,6 +55,8 @@ return [
'rules' => [
],
],
+ 'file' => ['class' => 'backend\logic\file\FileManager'],
+ 'goods' => ['class' => 'antgoods\goods\logic\goods\GoodsManager'],
],
'params' => $params,
];
diff --git a/backend/controllers/CategoryController.php b/backend/controllers/CategoryController.php
deleted file mode 100644
index 4be79f8..0000000
--- a/backend/controllers/CategoryController.php
+++ /dev/null
@@ -1,149 +0,0 @@
- [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'delete' => ['POST'],
- ],
- ],
- ];
- }
-
- /**
- * Lists all Category models.
- * @return mixed
- */
- public function actionIndex()
- {
- $searchModel = new CategorySearch();
- $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
-
- return $this->render('index', [
- 'searchModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- 'columns' => $searchModel->columns()
- ]);
- }
-
- /**
- * Displays a single Category model.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionView($id)
- {
- return $this->render('view', [
- 'model' => $this->findModel($id),
- ]);
- }
-
- /**
- * Creates a new Category model.
- * If creation is successful, the browser will be redirected to the 'view' page.
- * @return mixed
- */
- public function actionCreate()
- {
- $model = new Category();
-
- if ($model->load(Yii::$app->request->post()) && $model->save()) {
- return $this->redirect('index');
- }
-
- return $this->render('create', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Updates an existing Category model.
- * If update is successful, the browser will be redirected to the 'view' page.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionUpdate($id)
- {
- $model = $this->findModel($id);
-
- if ($model->load(Yii::$app->request->post()) && $model->save()) {
- return $this->redirect('index');
- }
-
- return $this->render('update', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Deletes an existing Category model.
- * If deletion is successful, the browser will be redirected to the 'index' page.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionDelete($id)
- {
- $this->findModel($id)->delete();
-
- return $this->redirect(['index']);
- }
-
- /**
- * Finds the Category model based on its primary key value.
- * If the model is not found, a 404 HTTP exception will be thrown.
- * @param integer $id
- * @return Category the loaded model
- * @throws NotFoundHttpException if the model cannot be found
- */
- protected function findModel($id)
- {
- if (($model = Category::findOne($id)) !== null) {
- return $model;
- }
-
- throw new NotFoundHttpException('The requested page does not exist.');
- }
- /**
- * @author iron
- * 文件导出
- */
- public function actionExport()
- {
- $searchModel = new CategorySearch();
- $params = Yii::$app->request->queryParams;
- if ($params['page-type'] == 'all') {
- $dataProvider = $searchModel->allData($params);
- } else {
- $dataProvider = $searchModel->search($params);
- }
- \iron\widget\Excel::export([
- 'models' => $dataProvider->getModels(),
- 'format' => 'Xlsx',
- 'asAttachment' => true,
- 'fileName' =>'Categories'. "-" .date('Y-m-d H/i/s', time()),
- 'columns' => $searchModel->columns()
- ]);
- }
-}
diff --git a/backend/controllers/ConfigController.php b/backend/controllers/ConfigController.php
old mode 100644
new mode 100755
diff --git a/backend/controllers/GoodsController.php b/backend/controllers/GoodsController.php
deleted file mode 100644
index c9024d1..0000000
--- a/backend/controllers/GoodsController.php
+++ /dev/null
@@ -1,149 +0,0 @@
- [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'delete' => ['POST'],
- ],
- ],
- ];
- }
-
- /**
- * Lists all Goods models.
- * @return mixed
- */
- public function actionIndex()
- {
- $searchModel = new GoodsSearch();
- $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
-
- return $this->render('index', [
- 'searchModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- 'columns' => $searchModel->columns()
- ]);
- }
-
- /**
- * Displays a single Goods model.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionView($id)
- {
- return $this->render('view', [
- 'model' => $this->findModel($id),
- ]);
- }
-
- /**
- * Creates a new Goods model.
- * If creation is successful, the browser will be redirected to the 'view' page.
- * @return mixed
- */
- public function actionCreate()
- {
- $model = new Goods();
-
- if ($model->load(Yii::$app->request->post()) && $model->save()) {
- return $this->redirect('index');
- }
-
- return $this->render('create', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Updates an existing Goods model.
- * If update is successful, the browser will be redirected to the 'view' page.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionUpdate($id)
- {
- $model = $this->findModel($id);
-
- if ($model->load(Yii::$app->request->post()) && $model->save()) {
- return $this->redirect('index');
- }
-
- return $this->render('update', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Deletes an existing Goods model.
- * If deletion is successful, the browser will be redirected to the 'index' page.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionDelete($id)
- {
- $this->findModel($id)->delete();
-
- return $this->redirect(['index']);
- }
-
- /**
- * Finds the Goods model based on its primary key value.
- * If the model is not found, a 404 HTTP exception will be thrown.
- * @param integer $id
- * @return Goods the loaded model
- * @throws NotFoundHttpException if the model cannot be found
- */
- protected function findModel($id)
- {
- if (($model = Goods::findOne($id)) !== null) {
- return $model;
- }
-
- throw new NotFoundHttpException('The requested page does not exist.');
- }
- /**
- * @author iron
- * 文件导出
- */
- public function actionExport()
- {
- $searchModel = new GoodsSearch();
- $params = Yii::$app->request->queryParams;
- if ($params['page-type'] == 'all') {
- $dataProvider = $searchModel->allData($params);
- } else {
- $dataProvider = $searchModel->search($params);
- }
- \iron\widget\Excel::export([
- 'models' => $dataProvider->getModels(),
- 'format' => 'Xlsx',
- 'asAttachment' => true,
- 'fileName' =>'Goods'. "-" .date('Y-m-d H/i/s', time()),
- 'columns' => $searchModel->columns()
- ]);
- }
-}
diff --git a/backend/controllers/OrderController.php b/backend/controllers/OrderController.php
old mode 100644
new mode 100755
diff --git a/backend/controllers/ShopCategoryController.php b/backend/controllers/ShopCategoryController.php
deleted file mode 100644
index ad4e43e..0000000
--- a/backend/controllers/ShopCategoryController.php
+++ /dev/null
@@ -1,149 +0,0 @@
- [
- 'class' => VerbFilter::className(),
- 'actions' => [
- 'delete' => ['POST'],
- ],
- ],
- ];
- }
-
- /**
- * Lists all ShopCategory models.
- * @return mixed
- */
- public function actionIndex()
- {
- $searchModel = new ShopCategorySearch();
- $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
-
- return $this->render('index', [
- 'searchModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- 'columns' => $searchModel->columns()
- ]);
- }
-
- /**
- * Displays a single ShopCategory model.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionView($id)
- {
- return $this->render('view', [
- 'model' => $this->findModel($id),
- ]);
- }
-
- /**
- * Creates a new ShopCategory model.
- * If creation is successful, the browser will be redirected to the 'view' page.
- * @return mixed
- */
- public function actionCreate()
- {
- $model = new ShopCategory();
-
- if ($model->load(Yii::$app->request->post()) && $model->save()) {
- return $this->redirect('index');
- }
-
- return $this->render('create', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Updates an existing ShopCategory model.
- * If update is successful, the browser will be redirected to the 'view' page.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionUpdate($id)
- {
- $model = $this->findModel($id);
-
- if ($model->load(Yii::$app->request->post()) && $model->save()) {
- return $this->redirect('index');
- }
-
- return $this->render('update', [
- 'model' => $model,
- ]);
- }
-
- /**
- * Deletes an existing ShopCategory model.
- * If deletion is successful, the browser will be redirected to the 'index' page.
- * @param integer $id
- * @return mixed
- * @throws NotFoundHttpException if the model cannot be found
- */
- public function actionDelete($id)
- {
- $this->findModel($id)->delete();
-
- return $this->redirect(['index']);
- }
-
- /**
- * Finds the ShopCategory model based on its primary key value.
- * If the model is not found, a 404 HTTP exception will be thrown.
- * @param integer $id
- * @return ShopCategory the loaded model
- * @throws NotFoundHttpException if the model cannot be found
- */
- protected function findModel($id)
- {
- if (($model = ShopCategory::findOne($id)) !== null) {
- return $model;
- }
-
- throw new NotFoundHttpException('The requested page does not exist.');
- }
- /**
- * @author iron
- * 文件导出
- */
- public function actionExport()
- {
- $searchModel = new ShopCategorySearch();
- $params = Yii::$app->request->queryParams;
- if ($params['page-type'] == 'all') {
- $dataProvider = $searchModel->allData($params);
- } else {
- $dataProvider = $searchModel->search($params);
- }
- \iron\widget\Excel::export([
- 'models' => $dataProvider->getModels(),
- 'format' => 'Xlsx',
- 'asAttachment' => true,
- 'fileName' =>'Shop Categories'. "-" .date('Y-m-d H/i/s', time()),
- 'columns' => $searchModel->columns()
- ]);
- }
-}
diff --git a/backend/controllers/SiteController.php b/backend/controllers/SiteController.php
old mode 100644
new mode 100755
diff --git a/backend/logic/file/FileManager.php b/backend/logic/file/FileManager.php
new file mode 100644
index 0000000..579096a
--- /dev/null
+++ b/backend/logic/file/FileManager.php
@@ -0,0 +1,122 @@
+ ['jpg', 'png', 'jpeg'],
+ self::TYPE_VIDEO => ['mp4'],
+ self::TYPE_EXCEL => [],
+ self::TYPE_WORD => ['docx'],
+ self::TYPE_TXT => ['txt'],
+ ];
+
+ /**
+ * @param $array
+ * @param $keyword
+ * @return bool|int|string
+ * 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false
+ */
+ public function searchType($array, $keyword)
+ {
+ foreach($array as $key => $value){
+ foreach ($value as $k => $v) {
+ if($v == $keyword){
+ return ['status' => true, 'info' => '操作成功', 'type' => $key];
+ }
+ }
+ }
+ return ['status' => false, 'info' => '操作失败'];
+ }
+
+ /**
+ * @param $imgIdStr
+ * @param $ownId
+ * @param $ownType
+ * @return array
+ * 根据临时文件id(字符串)将临时文件保存在文件中
+ */
+ public function saveTemFileToFile($temFIleIdArr, $ownId, $ownType)
+ {
+ if(!$temFIleIdArr || !$ownId) {
+ return ['status' => false, 'info' => '参数错误'];
+ }
+
+ $i = 1;
+ $first_file_id = 0;
+ foreach ($temFIleIdArr as $key => $value) {
+ $tem_file = TemFile::findOne($value);
+
+ if(!$tem_file) {
+ return ['status' => false, 'info' => '存在查找不到的文件'];
+ }
+
+ $res = self::saveNewFile($tem_file, $ownId, $ownType);
+ if(!$res['status']) {
+ return ['status' => false, 'info' => '存在文件保存失败'];
+ }
+ if($i == 1) {
+ $first_file_id = $res['file_id'];
+ }
+
+ $i++;
+ }
+
+ return ['status' => true, 'info' => '保存成功', 'first_file_id' => $first_file_id];
+ }
+
+ /**
+ * @param $temFile
+ * @param $ownId
+ * @param $ownType
+ * @return bool
+ * 创建新的文件
+ */
+ private function saveNewFile($temFile, $ownId, $ownType)
+ {
+ $new_file = new File();
+ $new_file->name = $temFile->name;
+ $new_file->type = $temFile->type;
+ $new_file->own_id = $ownId;
+ $new_file->own_type = $ownType;
+ $new_file->alias = $temFile->alias;
+ $new_file->path = $temFile->path;
+ if($new_file->save()) {
+ return ['status' => true, 'info' => '操作成功', 'file_id' => $new_file->id];
+ } else {
+ return ['status' => false, 'info' => '操作失败'];
+ }
+ }
+
+ /**
+ * @param $fileIdArr
+ * 删除file表中的文件
+ */
+ public function deleteFile($fileIdArr)
+ {
+ if($fileIdArr){
+ foreach ($fileIdArr as $key => $value) {
+ $file_model = File::findOne($value);
+ if($file_model){
+ $file_model->is_delete = File::IS_DELETE_YES;
+ if($file_model->save()){
+ return ['status' => false, 'info' => '操作失败'];
+ }
+ }
+ }
+ }
+ return ['status' => true, 'info' => '操作成功'];
+ }
+}
\ No newline at end of file
diff --git a/backend/views/brand/_search.php b/backend/views/brand/_search.php
deleted file mode 100644
index 14a96ae..0000000
--- a/backend/views/brand/_search.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
- ['index'],
- 'method' => 'get',
- 'validateOnType' => true,
- ]);
-?>
-
-
- = $form->field($model, 'id', [
- "template" => "{input}{error}",
- "inputOptions" => [
- "placeholder" => "检索ID",
- "class" => "form-control",
- ],
- "errorOptions" => [
- "class" => "error-tips"
- ]
- ])
- ?>
- = $form->field($model, "created_at_range", [
- "template" => "{input}{error}",
- "inputOptions" => [
- "placeholder" => "创建时间",
- ],
- "errorOptions" => [
- "class" => "error-tips"
- ]
- ])->widget(DateRangePicker::className());
- ?>
-
- = Html::submitButton('', ['class' => 'btn btn-default']) ?>
- = Html::resetButton('', ['class' => 'btn btn-default']) ?>
-
-
-
-
\ No newline at end of file
diff --git a/backend/views/category/_form.php b/backend/views/category/_form.php
deleted file mode 100644
index 1ce3540..0000000
--- a/backend/views/category/_form.php
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
diff --git a/backend/views/category/test.php b/backend/views/category/test.php
deleted file mode 100644
index a2ec90b..0000000
--- a/backend/views/category/test.php
+++ /dev/null
@@ -1,98 +0,0 @@
-
-
-
-
-
-
-
Upload
-
-
-
Drag & Drop Files
-
-
-
-
-
diff --git a/backend/views/config/index.php b/backend/views/config/index.php
old mode 100644
new mode 100755
diff --git a/backend/views/goods/_form.php b/backend/views/goods/_form.php
deleted file mode 100644
index 149e969..0000000
--- a/backend/views/goods/_form.php
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
diff --git a/backend/views/layouts/base.php b/backend/views/layouts/base.php
old mode 100644
new mode 100755
diff --git a/backend/views/layouts/breadcrumb.php b/backend/views/layouts/breadcrumb.php
old mode 100644
new mode 100755
diff --git a/backend/views/layouts/footer.php b/backend/views/layouts/footer.php
old mode 100644
new mode 100755
diff --git a/backend/views/layouts/header.php b/backend/views/layouts/header.php
old mode 100644
new mode 100755
diff --git a/backend/views/layouts/main.php b/backend/views/layouts/main.php
old mode 100644
new mode 100755
diff --git a/backend/views/layouts/sidebar.php b/backend/views/layouts/sidebar.php
old mode 100644
new mode 100755
index a975ac1..9eb71db
--- a/backend/views/layouts/sidebar.php
+++ b/backend/views/layouts/sidebar.php
@@ -20,14 +20,18 @@ use iron\widgets\Menu;
['label' => '基础配置', 'url' => ['config/index']],
]
],
- ['label' => '商品管理', 'url' => '#', 'icon' => 'fa-archive', 'items' => [
- ['label' => '商品分类', 'url' => ['/category']],
- ['label' => '商品列表', 'url' => ['/goods']],
- ['label' => '属性管理', 'url' => ['/attribute']],
+
+ ['label' => '商品管理', 'url' => '#', 'icon' => 'far fa-archive', 'items' => [
+ ['label' => '规格管理', 'url' => ['/antgoods/attribute/index']],
+ ['label' => '商品列表', 'url' => ['/antgoods/goods/index']],
+ ['label' => '后台商品分类', 'url' => ['/antgoods/category/index']],
+ ['label' => '前端商品分类', 'url' => ['/antgoods/shopcategory/index']],
+ ['label' => '品牌管理', 'url' => ['/antgoods/brand/index']],
+ ['label' => '供应商管理', 'url' => ['/antgoods/supplier/index']],
]
],
- ['label' => '订单管理', 'url' => '#', 'icon' => 'fa-list-alt', 'items' => [
- ['label' => '订单列表', 'url' => ['order/index']],
+ ['label' => '订单管理', 'url' => '#', 'icon' => 'far fa-list-alt', 'items' => [
+ ['label' => '订单列表', 'url' => ['/order/index', 'tag' => 'new']],
]
],
]
diff --git a/backend/views/order/_form.php b/backend/views/order/_form.php
old mode 100644
new mode 100755
diff --git a/backend/views/order/_search.php b/backend/views/order/_search.php
old mode 100644
new mode 100755
diff --git a/backend/views/order/create.php b/backend/views/order/create.php
old mode 100644
new mode 100755
diff --git a/backend/views/order/index.php b/backend/views/order/index.php
old mode 100644
new mode 100755
diff --git a/backend/views/order/update.php b/backend/views/order/update.php
old mode 100644
new mode 100755
diff --git a/backend/views/order/view.php b/backend/views/order/view.php
old mode 100644
new mode 100755
diff --git a/backend/views/shop-category/_form.php b/backend/views/shop-category/_form.php
deleted file mode 100644
index 5f0949f..0000000
--- a/backend/views/shop-category/_form.php
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
diff --git a/backend/views/site/error.php b/backend/views/site/error.php
old mode 100644
new mode 100755
diff --git a/backend/views/site/index.php b/backend/views/site/index.php
old mode 100644
new mode 100755
diff --git a/backend/views/site/login.php b/backend/views/site/login.php
old mode 100644
new mode 100755
diff --git a/backend/views/site/test.php b/backend/views/site/test.php
old mode 100644
new mode 100755
diff --git a/backend/views/supplier/_search.php b/backend/views/supplier/_search.php
deleted file mode 100644
index f014a90..0000000
--- a/backend/views/supplier/_search.php
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
- ['index'],
- 'method' => 'get',
- 'validateOnType' => true,
- ]);
-?>
-
-
- = $form->field($model, 'id', [
- "template" => "{input}{error}",
- "inputOptions" => [
- "placeholder" => "检索ID",
- "class" => "form-control",
- ],
- "errorOptions" => [
- "class" => "error-tips"
- ]
- ])
- ?>
- = $form->field($model, "created_at_range", [
- "template" => "{input}{error}",
- "inputOptions" => [
- "placeholder" => "创建时间",
- ],
- "errorOptions" => [
- "class" => "error-tips"
- ]
- ])->widget(DateRangePicker::className());
- ?>
-
- = Html::submitButton('', ['class' => 'btn btn-default']) ?>
- = Html::resetButton('', ['class' => 'btn btn-default']) ?>
-
-
-
-
\ No newline at end of file
diff --git a/backend/web/uploads/xls/15738696921690.jpg b/backend/web/uploads/xls/15738696921690.jpg
deleted file mode 100644
index ca03e9a..0000000
Binary files a/backend/web/uploads/xls/15738696921690.jpg and /dev/null differ
diff --git a/common/models/ars/Address.php b/common/models/ars/Address.php
index b7b9ad9..aec13fb 100644
--- a/common/models/ars/Address.php
+++ b/common/models/ars/Address.php
@@ -36,6 +36,7 @@ class Address extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['user_id', 'consignee', 'phone', 'address'], 'required'],
[['user_id', 'status'], 'integer'],
[['address'], 'string'],
[['consignee', 'phone'], 'string', 'max' => 20],
@@ -62,6 +63,7 @@ class Address extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/AfterSale.php b/common/models/ars/AfterSale.php
index 4f0cced..4cf35b1 100644
--- a/common/models/ars/AfterSale.php
+++ b/common/models/ars/AfterSale.php
@@ -42,6 +42,7 @@ class AfterSale extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['operator_id', 'user_id', 'amount'], 'required'],
[['operator_id', 'user_id', 'order_goods_id', 'count', 'amount', 'type', 'reason', 'applyed_at', 'dealed_at', 'finished_at'], 'integer'],
[['description', 'remarks'], 'string'],
[['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
@@ -74,5 +75,6 @@ class AfterSale extends \yii\db\ActiveRecord
'finished_at' => '完成时间',
];
}
+
}
diff --git a/common/models/ars/Area.php b/common/models/ars/Area.php
index e42ee4f..254681b 100644
--- a/common/models/ars/Area.php
+++ b/common/models/ars/Area.php
@@ -46,5 +46,6 @@ class Area extends \yii\db\ActiveRecord
'city_id' => 'city_id',
];
}
+
}
diff --git a/common/models/ars/Cart.php b/common/models/ars/Cart.php
index 3af30be..ef6477f 100644
--- a/common/models/ars/Cart.php
+++ b/common/models/ars/Cart.php
@@ -35,6 +35,7 @@ class Cart extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['user_id', 'goods_id', 'goods_name', 'sku_id'], 'required'],
[['user_id', 'goods_id', 'goods_img', 'goods_price', 'sku_id', 'goods_count'], 'integer'],
[['goods_name'], 'string', 'max' => 120],
];
@@ -58,6 +59,7 @@ class Cart extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/City.php b/common/models/ars/City.php
index 3b4096f..ae87412 100644
--- a/common/models/ars/City.php
+++ b/common/models/ars/City.php
@@ -46,5 +46,6 @@ class City extends \yii\db\ActiveRecord
'province_id' => 'province_id',
];
}
+
}
diff --git a/common/models/ars/Collection.php b/common/models/ars/Collection.php
index 69937f3..2a1a771 100644
--- a/common/models/ars/Collection.php
+++ b/common/models/ars/Collection.php
@@ -30,6 +30,7 @@ class Collection extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['user_id', 'goods_id'], 'required'],
[['user_id', 'goods_id'], 'integer'],
];
}
@@ -47,6 +48,7 @@ class Collection extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/Comment.php b/common/models/ars/Comment.php
index 2fe43aa..2701ecf 100644
--- a/common/models/ars/Comment.php
+++ b/common/models/ars/Comment.php
@@ -33,6 +33,7 @@ class Comment extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['user_id'], 'required'],
[['user_id', 'order_goods_id', 'star', 'status'], 'integer'],
[['content'], 'string'],
];
@@ -54,6 +55,7 @@ class Comment extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/Config.php b/common/models/ars/Config.php
old mode 100644
new mode 100755
diff --git a/common/models/ars/Delivery.php b/common/models/ars/Delivery.php
index e9760bd..85d1d0e 100644
--- a/common/models/ars/Delivery.php
+++ b/common/models/ars/Delivery.php
@@ -36,6 +36,7 @@ class Delivery extends \yii\db\ActiveRecord
{
return [
[['order_id', 'type', 'status'], 'integer'],
+ [['shipping_id'], 'required'],
[['goods', 'decription'], 'string'],
[['shipping_name'], 'string', 'max' => 50],
[['shipping_id'], 'string', 'max' => 10],
@@ -60,6 +61,7 @@ class Delivery extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php
index d91b966..e3e6b81 100644
--- a/common/models/ars/ExpressTemplate.php
+++ b/common/models/ars/ExpressTemplate.php
@@ -40,6 +40,7 @@ class ExpressTemplate extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['name'], 'required'],
[['province', 'city', 'area', 'taking_site'], 'string'],
[['billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking'], 'integer'],
[['name'], 'string', 'max' => 255],
@@ -69,6 +70,7 @@ class ExpressTemplate extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/File.php b/common/models/ars/File.php
index c58b34e..e75e597 100644
--- a/common/models/ars/File.php
+++ b/common/models/ars/File.php
@@ -22,6 +22,13 @@ use yii\behaviors\TimestampBehavior;
*/
class File extends \yii\db\ActiveRecord
{
+ //own_type
+ const OWN_TYPE_GOODS_INDEX = 1;//商品首页
+ const OWN_TYPE_GOODS_DETAILS = 2;//商品详情
+ const OWN_TYPE_CATEGORY_ICON = 3;//类目图标
+ //is_delete
+ const IS_DELETE_YES = 1;//已删除
+ const IS_DELETE_NO = 0;//未删除
/**
* {@inheritdoc}
*/
@@ -61,6 +68,7 @@ class File extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/Order.php b/common/models/ars/Order.php
index c74f2b0..6f03a52 100644
--- a/common/models/ars/Order.php
+++ b/common/models/ars/Order.php
@@ -51,6 +51,7 @@ class Order extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['user_id'], 'required'],
[['user_id', 'status', 'type', 'goods_count', 'goods_amount', 'shipping_amount', 'shipping_type', 'taking_site', 'pay_type', 'pay_at', 'payment_amount', 'receivables', 'discount_amount'], 'integer'],
[['discount_decription'], 'string'],
[['order_sn', 'invoice_id'], 'string', 'max' => 64],
@@ -95,6 +96,7 @@ class Order extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/OrderGoods.php b/common/models/ars/OrderGoods.php
index f98ceea..fa4d65d 100644
--- a/common/models/ars/OrderGoods.php
+++ b/common/models/ars/OrderGoods.php
@@ -36,6 +36,7 @@ class OrderGoods extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['order_id', 'goods_id'], 'required'],
[['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price'], 'integer'],
[['goods_name', 'sku_value'], 'string', 'max' => 120],
];
@@ -60,6 +61,7 @@ class OrderGoods extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/PaymentLog.php b/common/models/ars/PaymentLog.php
index ad85810..9055f33 100644
--- a/common/models/ars/PaymentLog.php
+++ b/common/models/ars/PaymentLog.php
@@ -60,6 +60,7 @@ class PaymentLog extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/Province.php b/common/models/ars/Province.php
index 26506c4..b03ffe6 100644
--- a/common/models/ars/Province.php
+++ b/common/models/ars/Province.php
@@ -44,5 +44,6 @@ class Province extends \yii\db\ActiveRecord
'province_id' => 'province_id',
];
}
+
}
diff --git a/common/models/ars/RefundLog.php b/common/models/ars/RefundLog.php
index 9f281b8..33ed965 100644
--- a/common/models/ars/RefundLog.php
+++ b/common/models/ars/RefundLog.php
@@ -66,5 +66,6 @@ class RefundLog extends \yii\db\ActiveRecord
'finished_at' => '完成时间',
];
}
+
}
diff --git a/common/models/ars/SearchHistory.php b/common/models/ars/SearchHistory.php
index 6be7b5f..17fc86c 100644
--- a/common/models/ars/SearchHistory.php
+++ b/common/models/ars/SearchHistory.php
@@ -33,6 +33,7 @@ class SearchHistory extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['user_id'], 'required'],
[['user_id', 'count', 'status', 'type'], 'integer'],
[['keyword'], 'string', 'max' => 255],
];
@@ -54,6 +55,7 @@ class SearchHistory extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php
index f147e62..cbd36bd 100644
--- a/common/models/ars/TakingSite.php
+++ b/common/models/ars/TakingSite.php
@@ -34,6 +34,7 @@ class TakingSite extends \yii\db\ActiveRecord
public function rules()
{
return [
+ [['name'], 'required'],
[['address'], 'string'],
[['is_default'], 'integer'],
[['name'], 'string', 'max' => 120],
@@ -58,6 +59,7 @@ class TakingSite extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/TemFile.php b/common/models/ars/TemFile.php
index df9bab0..450f34c 100644
--- a/common/models/ars/TemFile.php
+++ b/common/models/ars/TemFile.php
@@ -19,6 +19,7 @@ use yii\behaviors\TimestampBehavior;
*/
class TemFile extends \yii\db\ActiveRecord
{
+
/**
* {@inheritdoc}
*/
@@ -55,6 +56,7 @@ class TemFile extends \yii\db\ActiveRecord
'created_at' => '创建时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/searchs/OrderSearch.php b/common/models/searchs/OrderSearch.php
old mode 100644
new mode 100755
diff --git a/composer.json b/composer.json
index 83a43bb..8a68eb5 100755
--- a/composer.json
+++ b/composer.json
@@ -35,5 +35,10 @@
"yiisoft/yii2-debug": "^2.0@dev",
"kint-php/kint": "dev-master",
"yiisoft/yii2-gii": "^2.0@dev"
+ },
+ "autoload": {
+ "psr-4": {
+ "antgoods\\goods\\": "vendor/antgoods/goods/src"
+ }
}
}
diff --git a/console/controllers/InitController.php b/console/controllers/InitController.php
index d0ee181..bb51368 100644
--- a/console/controllers/InitController.php
+++ b/console/controllers/InitController.php
@@ -63,7 +63,7 @@ class InitController extends Controller {
* TODO没有完善
* 清空数据库
*/
- public function clearDb() {
+ public function actionClearDb() {
Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute();
$dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1];
$sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';";
diff --git a/console/migrations/m130524_201442_init.php b/console/migrations/m130524_201442_init.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m140506_102106_rbac_init.php b/console/migrations/m140506_102106_rbac_init.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php b/console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php b/console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php b/console/migrations/m190124_110200_add_verification_token_column_to_user_table.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m190802_072830_add_category.php b/console/migrations/m190802_072830_add_category.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191111_101658_create_table_area.php b/console/migrations/m191111_101658_create_table_area.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191111_102644_create_table_province.php b/console/migrations/m191111_102644_create_table_province.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191111_102730_create_table_city.php b/console/migrations/m191111_102730_create_table_city.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191111_102925_create_table_cart.php b/console/migrations/m191111_102925_create_table_cart.php
old mode 100644
new mode 100755
index 5c81c47..bea2e27
--- a/console/migrations/m191111_102925_create_table_cart.php
+++ b/console/migrations/m191111_102925_create_table_cart.php
@@ -15,12 +15,12 @@ class m191111_102925_create_table_cart extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="购物车表"';
$this->createTable('ats_cart', [
'id' => $this->primaryKey(),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
- 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
- 'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
+ 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
+ 'goods_name'=>$this->string(120)->notNull()->comment('商品名称'),
'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'),
'goods_price'=>$this->integer(20)->defaultValue(null)->comment('商品售价'),
- 'sku_id'=>$this->integer(11)->defaultValue(null)->comment('商品sku的id'),
+ 'sku_id'=>$this->integer(11)->notNull()->comment('商品sku的id'),
'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
diff --git a/console/migrations/m191111_112559_create_table_address.php b/console/migrations/m191111_112559_create_table_address.php
old mode 100644
new mode 100755
index 2882b5c..ab94279
--- a/console/migrations/m191111_112559_create_table_address.php
+++ b/console/migrations/m191111_112559_create_table_address.php
@@ -15,13 +15,13 @@ class m191111_112559_create_table_address extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="地址表"';
$this->createTable('ats_address', [
'id' => $this->primaryKey(),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
- 'consignee'=>$this->string(20)->defaultValue(null)->comment('收件人'),
- 'phone'=>$this->string(20)->defaultValue(null)->comment('电话'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
+ 'consignee'=>$this->string(20)->notNull()->comment('收件人'),
+ 'phone'=>$this->string(20)->notNull()->comment('电话'),
'province'=>$this->string(10)->defaultValue(null)->comment('省份'),
'city'=>$this->string(10)->defaultValue(null)->comment('城市'),
'area'=>$this->string(10)->defaultValue(null)->comment('区域'),
- 'address'=>$this->text()->comment('详细地址'),
+ 'address'=>$this->text()->notNull()->comment('详细地址'),
'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态,0-默认值 1-默认地址'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
diff --git a/console/migrations/m191111_113455_create_table_after_sale.php b/console/migrations/m191111_113455_create_table_after_sale.php
old mode 100644
new mode 100755
index fde56b1..56a71ae
--- a/console/migrations/m191111_113455_create_table_after_sale.php
+++ b/console/migrations/m191111_113455_create_table_after_sale.php
@@ -15,13 +15,13 @@ class m191111_113455_create_table_after_sale extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="售后表"';
$this->createTable('ats_after_sale', [
'id' => $this->primaryKey(),
- 'operator_id'=>$this->integer(11)->defaultValue(null)->comment('操作者'),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
+ 'operator_id'=>$this->integer(11)->notNull()->comment('操作者'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'wx_refund_id'=>$this->string(64)->defaultValue(null)->comment('微信退款单号'),
'after_sale_sn'=>$this->string(64)->defaultValue(null)->comment('售后单号'),
'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单商品id'),
'count'=>$this->integer(11)->defaultValue(null)->comment('退换货的商品数量'),
- 'amount'=>$this->integer(20)->defaultValue(null)->comment('退货时实际退的金额'),
+ 'amount'=>$this->integer(20)->notNull()->comment('退货时实际退的金额'),
'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
'reason'=>$this->smallInteger(2)->defaultValue(0)->comment('退换货理由'),
'description'=>$this->text()->comment('描述'),
diff --git a/console/migrations/m191112_005106_create_table_search_history.php b/console/migrations/m191112_005106_create_table_search_history.php
old mode 100644
new mode 100755
index e54e8ba..54736ec
--- a/console/migrations/m191112_005106_create_table_search_history.php
+++ b/console/migrations/m191112_005106_create_table_search_history.php
@@ -15,7 +15,7 @@ class m191112_005106_create_table_search_history extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="搜索记录表"';
$this->createTable('ats_search_history', [
'id' => $this->primaryKey(),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'keyword'=>$this->string(255)->defaultValue(null)->comment('关键字'),
'count'=>$this->integer(10)->defaultValue(null)->comment('次数'),
'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'),
diff --git a/console/migrations/m191112_005545_create_table_collection.php b/console/migrations/m191112_005545_create_table_collection.php
old mode 100644
new mode 100755
index 13492eb..e4fb1e7
--- a/console/migrations/m191112_005545_create_table_collection.php
+++ b/console/migrations/m191112_005545_create_table_collection.php
@@ -15,8 +15,8 @@ class m191112_005545_create_table_collection extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="收藏表"';
$this->createTable('ats_collection', [
'id' => $this->primaryKey(),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
- 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
+ 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
],$tableOptions);
diff --git a/console/migrations/m191112_005702_create_table_comment.php b/console/migrations/m191112_005702_create_table_comment.php
old mode 100644
new mode 100755
index f3a1ddd..1fa7e2b
--- a/console/migrations/m191112_005702_create_table_comment.php
+++ b/console/migrations/m191112_005702_create_table_comment.php
@@ -15,7 +15,7 @@ class m191112_005702_create_table_comment extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="评论记录表"';
$this->createTable('ats_comment', [
'id' => $this->primaryKey(),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单详情商品id'),
'star'=>$this->integer(11)->defaultValue(null)->comment('星级'),
'content'=>$this->text()->comment('评论内容'),
diff --git a/console/migrations/m191112_010421_create_table_order.php b/console/migrations/m191112_010421_create_table_order.php
old mode 100644
new mode 100755
index dfd6a01..6bcfb06
--- a/console/migrations/m191112_010421_create_table_order.php
+++ b/console/migrations/m191112_010421_create_table_order.php
@@ -15,7 +15,7 @@ class m191112_010421_create_table_order extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单表"';
$this->createTable('ats_order', [
'id' => $this->primaryKey(),
- 'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
+ 'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'order_sn'=>$this->string(64)->defaultValue(null)->comment('订单号'),
'invoice_id'=>$this->string(64)->defaultValue(null)->comment('发票单号'),
'status'=>$this->tinyInteger(2)->defaultValue(0)->comment('状态'),
diff --git a/console/migrations/m191112_011517_create_table_order_goods.php b/console/migrations/m191112_011517_create_table_order_goods.php
old mode 100644
new mode 100755
index 52974d1..3340d25
--- a/console/migrations/m191112_011517_create_table_order_goods.php
+++ b/console/migrations/m191112_011517_create_table_order_goods.php
@@ -15,8 +15,8 @@ class m191112_011517_create_table_order_goods extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单商品表"';
$this->createTable('ats_order_goods', [
'id' => $this->primaryKey(),
- 'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'),
- 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
+ 'order_id'=>$this->integer(11)->notNull()->comment('订单id'),
+ 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'),
'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'),
'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
diff --git a/console/migrations/m191112_012449_create_table_taking_site.php b/console/migrations/m191112_012449_create_table_taking_site.php
old mode 100644
new mode 100755
index a9bc8e8..a03c9a6
--- a/console/migrations/m191112_012449_create_table_taking_site.php
+++ b/console/migrations/m191112_012449_create_table_taking_site.php
@@ -15,7 +15,7 @@ class m191112_012449_create_table_taking_site extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="自提地点表"';
$this->createTable('ats_taking_site', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(120)->defaultValue(null)->comment('名称'),
+ 'name'=>$this->string(120)->notNull()->comment('名称'),
'province'=>$this->string(10)->defaultValue(null)->comment('省份'),
'city'=>$this->string(10)->defaultValue(null)->comment('城市'),
'area'=>$this->string(10)->defaultValue(null)->comment('区域'),
diff --git a/console/migrations/m191112_014508_create_table_express_template.php b/console/migrations/m191112_014508_create_table_express_template.php
old mode 100644
new mode 100755
index 83a1165..4b788a5
--- a/console/migrations/m191112_014508_create_table_express_template.php
+++ b/console/migrations/m191112_014508_create_table_express_template.php
@@ -15,7 +15,7 @@ class m191112_014508_create_table_express_template extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="配送情况设置表"';
$this->createTable('ats_express_template', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(255)->defaultValue(null)->comment('名称'),
+ 'name'=>$this->string(255)->notNull()->comment('名称'),
'province'=>$this->text()->comment('省份'),
'city'=>$this->text()->comment('城市'),
'area'=>$this->text()->comment('区域'),
diff --git a/console/migrations/m191112_015939_create_table_delivery.php b/console/migrations/m191112_015939_create_table_delivery.php
old mode 100644
new mode 100755
index 92cd994..c90f0a1
--- a/console/migrations/m191112_015939_create_table_delivery.php
+++ b/console/migrations/m191112_015939_create_table_delivery.php
@@ -17,7 +17,7 @@ class m191112_015939_create_table_delivery extends Migration
'id' => $this->primaryKey(),
'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'),
'shipping_name'=>$this->string(50)->defaultValue(null)->comment('货流名称'),
- 'shipping_id'=>$this->string(10)->defaultValue(null)->comment('运货单位'),
+ 'shipping_id'=>$this->string(10)->notNull()->comment('运货单位'),
'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
'goods'=>$this->text()->comment('商品'),
'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'),
diff --git a/console/migrations/m191112_020830_create_table_payment_log.php b/console/migrations/m191112_020830_create_table_payment_log.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191112_021528_create_table_refund_log.php b/console/migrations/m191112_021528_create_table_refund_log.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191112_022131_create_table_file.php b/console/migrations/m191112_022131_create_table_file.php
old mode 100644
new mode 100755
diff --git a/console/migrations/m191112_022532_create_table_tem_file.php b/console/migrations/m191112_022532_create_table_tem_file.php
old mode 100644
new mode 100755
diff --git a/console/migrations/schema-mysql.sql b/console/migrations/schema-mysql.sql
old mode 100644
new mode 100755
diff --git a/console/migrations/sql/add_category.sql b/console/migrations/sql/add_category.sql
old mode 100644
new mode 100755
diff --git a/console/migrations/sql/area.sql b/console/migrations/sql/area.sql
old mode 100644
new mode 100755
diff --git a/console/migrations/sql/city.sql b/console/migrations/sql/city.sql
old mode 100644
new mode 100755
diff --git a/console/migrations/sql/province.sql b/console/migrations/sql/province.sql
old mode 100644
new mode 100755
diff --git a/environments/skeleton/backend/config/main-local.php b/environments/skeleton/backend/config/main-local.php
old mode 100644
new mode 100755
index ddff7d3..51a12b2
--- a/environments/skeleton/backend/config/main-local.php
+++ b/environments/skeleton/backend/config/main-local.php
@@ -22,16 +22,16 @@ if (!YII_ENV_TEST) {
'allowedIPs' => ['127.0.0.1'],
'generators' => [
'crud' => [
- 'class' => 'blobt\generators\crud\Generator',
+ 'class' => 'iron\generators\crud\Generator',
'templates' => [
'blobtCrud' => '@blobt/generators/crud/default',
- 'linyaoCrud' => '@linyao/generators/crud/default',
+ 'ironCrud' => '@iron/generators/crud/default',
]
],
'model' => [
- 'class' => 'linyao\generators\model\Generator',
+ 'class' => 'iron\generators\model\Generator',
'templates' => [
- 'linyaoModel' => '@linyao/generators/model/default',
+ 'ironModel' => '@iron/generators/model/default',
]
]
],
diff --git a/environments/skeleton/backend/config/params-local.php b/environments/skeleton/backend/config/params-local.php
old mode 100644
new mode 100755
diff --git a/vendor/antgoods/goods/AutoloadExample.php b/vendor/antgoods/goods/AutoloadExample.php
new file mode 100644
index 0000000..1f3b005
--- /dev/null
+++ b/vendor/antgoods/goods/AutoloadExample.php
@@ -0,0 +1,14 @@
+```
\ No newline at end of file
diff --git a/vendor/antgoods/goods/composer.json b/vendor/antgoods/goods/composer.json
new file mode 100644
index 0000000..3b16d84
--- /dev/null
+++ b/vendor/antgoods/goods/composer.json
@@ -0,0 +1,21 @@
+{
+ "name": "antgoods/goods",
+ "description": "ant基础模块之一",
+ "type": "yii2-extension",
+ "keywords": ["goods"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "linyao",
+ "email": "linyaostalker@gmail.com"
+ }
+ ],
+ "require": {
+ "yiisoft/yii2": "~2.0.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "antgoods\\goods\\": ""
+ }
+ }
+}
diff --git a/vendor/antgoods/goods/src/Module.php b/vendor/antgoods/goods/src/Module.php
new file mode 100755
index 0000000..5c2b482
--- /dev/null
+++ b/vendor/antgoods/goods/src/Module.php
@@ -0,0 +1,28 @@
+ $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
- ]);
+ ]);
}
/**
@@ -126,25 +125,24 @@ class AttributeController extends Controller
throw new NotFoundHttpException('The requested page does not exist.');
}
-
/**
- * @author iron
- * 文件导出
- */
+ * @author iron
+ * 文件导出
+ */
public function actionExport()
{
- $searchModel = new attributeSearch();
+ $searchModel = new AttributeSearch();
$params = Yii::$app->request->queryParams;
if ($params['page-type'] == 'all') {
- $dataProvider = $searchModel->allData($params);
+ $dataProvider = $searchModel->allData($params);
} else {
$dataProvider = $searchModel->search($params);
}
- \iron\widget\Excel::export([
+ \iron\widget\Excel::export([
'models' => $dataProvider->getModels(),
'format' => 'Xlsx',
'asAttachment' => true,
- 'fileName' => 'Attributes' . "-" . date('Y-m-d H/i/s', time()),
+ 'fileName' =>'Attributes'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
diff --git a/backend/controllers/BrandController.php b/vendor/antgoods/goods/src/controllers/BrandController.php
similarity index 96%
rename from backend/controllers/BrandController.php
rename to vendor/antgoods/goods/src/controllers/BrandController.php
index 0dd6523..35e5f83 100644
--- a/backend/controllers/BrandController.php
+++ b/vendor/antgoods/goods/src/controllers/BrandController.php
@@ -1,10 +1,10 @@
[
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ public function actions()
+ {
+ return [
+ 'upload' => [
+ 'class' => 'iron\actions\UploadAction',
+ 'path' => 'xls/',
+ 'maxSize' => 20480,
+ ]
+ ];
+ }
+
+ /**
+ * Lists all Category models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new CategorySearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ 'columns' => $searchModel->columns()
+ ]);
+ }
+
+ /**
+ * Displays a single Category model.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Category model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Category();
+
+ if ($model->load(Yii::$app->request->post())) {
+
+ //类目图片上传保存处理
+ $icon_image_id_str = $model->iconImageId;
+ $model->save();
+ $goods_manager = new GoodsManager();
+ $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model, [], File::OWN_TYPE_CATEGORY_ICON);
+ if($save_icon_image_res['status']){
+ $model->icon = $save_icon_image_res['first_file_id'];
+ $model->save();
+ }
+
+ return $this->redirect('index');
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing Category model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+ $model->iconImageId = $model->icon;
+ //记录已保存的类目图片id,用于修改
+ $icon_image_old_id_arr = $model->icon;
+
+ if ($model->load(Yii::$app->request->post())) {
+
+ //类目图片上传保存处理
+ $icon_image_id_str = $model->iconImageId;
+ $model->save();
+ $goods_manager = new GoodsManager();
+ $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model, explode(',', $icon_image_old_id_arr), File::OWN_TYPE_CATEGORY_ICON);
+ if($save_icon_image_res['status'] && $save_icon_image_res['first_file_id'] !== 0){
+ $model->icon = $save_icon_image_res['first_file_id'];
+ $model->save();
+ }
+
+ return $this->redirect('index');
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing Category model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $model = $this->findModel($id);
+
+ $model->is_delete = Category::IS_DELETE_YES;
+ $model->save();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Category model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Category the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Category::findOne($id)) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ /**
+ * @author iron
+ * 文件导出
+ */
+ public function actionExport()
+ {
+ $searchModel = new CategorySearch();
+ $params = Yii::$app->request->queryParams;
+ if ($params['page-type'] == 'all') {
+ $dataProvider = $searchModel->allData($params);
+ } else {
+ $dataProvider = $searchModel->search($params);
+ }
+ \iron\widget\Excel::export([
+ 'models' => $dataProvider->getModels(),
+ 'format' => 'Xlsx',
+ 'asAttachment' => true,
+ 'fileName' =>'Categories'. "-" .date('Y-m-d H/i/s', time()),
+ 'columns' => $searchModel->columns()
+ ]);
+ }
+
+ /**
+ * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id
+ */
+ public function actionSaveFile()
+ {
+ if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){
+ return '';
+ }
+
+ $data = Yii::$app->request->get('data');
+ $file_name = Yii::$app->request->get('fileName')[0];
+
+ if ($data['status'] == true) {
+ $model = new \common\models\ars\TemFile();
+ $model->user_id = Yii::$app->user->identity->id;
+ $model->name = $file_name;
+ $file_manager = new \backend\logic\file\FileManager();
+ $type_res = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']);
+ if ($type_res['status']) {
+ $model->type = $type_res['type'];
+ }
+ $model->alias = $data['alias'];
+ $model->path = $data['path'];
+ $model->save();
+ return $model->id;
+ }
+ }
+
+ /**
+ * @return string
+ * 点击删除按钮时同时删除字符串中的id
+ */
+ public function actionImgIdDel()
+ {
+ //判断该类是否存在
+ if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){
+ return '';
+ }
+
+ $img_id = Yii::$app->request->get('imgid');
+ $img_id_arr = explode(',', $img_id);
+ if(isset(Yii::$app->request->get('data')['alias'])) {
+ $alias = Yii::$app->request->get('data')['alias'];
+ $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]);
+ if ($tem_file) {
+ $img_id_arr = array_diff($img_id_arr, [$tem_file->id]);
+ }
+ }else{
+ foreach (Yii::$app->request->get() as $key => $value) {
+ $tem_file = \common\models\ars\File::findOne(['alias' => $value]);
+ if ($tem_file) {
+ $img_id_arr = array_diff($img_id_arr, [$tem_file->id]);
+ }
+ }
+ }
+ $img_id_str = implode(',', $img_id_arr);
+ return $img_id_str;
+ }
+
+ /**
+ * @return bool|false|string
+ * 加载已有的文件
+ */
+ public function actionImageFile()
+ {
+ //判断该类是否存在
+ if(!class_exists('\common\models\ars\File')){
+ return false;
+ }
+
+ $file_id_str = Yii::$app->request->get('fileidstr');
+ $file_id_arr = explode(',', $file_id_str);
+ $data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all();
+ $res = array();
+ if($data) {
+ $i = 0;
+ foreach ($data as $key => $value) {
+ $res[$i]['name'] = $value->alias;
+ $res[$i]['path'] = Yii::$app->request->hostInfo . '/' . $value->path;
+ $res[$i]['size'] = filesize($value->path);
+ $i++;
+ }
+ }
+ return json_encode($res);
+ }
+}
diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php
new file mode 100644
index 0000000..eaca006
--- /dev/null
+++ b/vendor/antgoods/goods/src/controllers/GoodsController.php
@@ -0,0 +1,282 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ public function actions()
+ {
+ return [
+ 'upload' => [
+ 'class' => 'iron\actions\UploadAction',
+ 'path' => 'xls/',
+ 'maxSize' => 20480,
+ ]
+ ];
+ }
+
+ /**
+ * Lists all Goods models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new GoodsSearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ 'columns' => $searchModel->columns()
+ ]);
+ }
+
+ /**
+ * Displays a single Goods model.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new Goods model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Goods();
+
+ if ($model->load(Yii::$app->request->post())) {
+
+ //商品封面图和商品详情图上传保存处理
+ $cover_image_id_str = $model->coverImageId;
+ $detail_image_id_str = $model->detailImageId;
+ $model->save();
+ $goods_manager = new GoodsManager();
+ $save_cover_image_res = $goods_manager->saveFile(explode(',', $cover_image_id_str), $model);
+ $save_detail_image_res = $goods_manager->saveFile(explode(',', $detail_image_id_str), $model, [], File::OWN_TYPE_GOODS_DETAILS);
+ if($save_cover_image_res['status'] && $save_detail_image_res['status']){
+ $model->image = $save_cover_image_res['first_file_id'];
+ $model->save();
+ }
+
+ return $this->redirect('index');
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing Goods model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+ $model->coverImageId = $model->image;
+ $model->detailImageId = implode(',', File::find()->select('id')->where(['is_delete' => File::IS_DELETE_NO, 'own_id' => $model->id, 'own_type' => File::OWN_TYPE_GOODS_DETAILS])->column());
+
+ //记录已保存的商品图片id,用于修改
+ $cover_image_old_id_arr = $model->image;
+ $detail_image_old_id_arr = $model->detailImageId;
+
+ if ($model->load(Yii::$app->request->post())) {
+
+ //商品封面图和商品详情图上传保存处理
+ $cover_image_id_str = $model->coverImageId;
+ $detail_image_id_str = $model->detailImageId;
+ $model->save();
+ $goods_manager = new GoodsManager();
+ $save_cover_image_res = $goods_manager->saveFile(explode(',', $cover_image_id_str), $model, explode(',', $cover_image_old_id_arr));
+ $save_detail_image_res = $goods_manager->saveFile(explode(',', $detail_image_id_str), $model, explode(',', $detail_image_old_id_arr), File::OWN_TYPE_GOODS_DETAILS);
+ if($save_cover_image_res['status'] && $save_detail_image_res['status'] && $save_cover_image_res['first_file_id'] !== 0){
+ $model->image = $save_cover_image_res['first_file_id'];
+ $model->save();
+ }
+
+ return $this->redirect('index');
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing Goods model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the Goods model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Goods the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Goods::findOne($id)) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ /**
+ * @author iron
+ * 文件导出
+ */
+ public function actionExport()
+ {
+ $searchModel = new GoodsSearch();
+ $params = Yii::$app->request->queryParams;
+ if ($params['page-type'] == 'all') {
+ $dataProvider = $searchModel->allData($params);
+ } else {
+ $dataProvider = $searchModel->search($params);
+ }
+ \iron\widget\Excel::export([
+ 'models' => $dataProvider->getModels(),
+ 'format' => 'Xlsx',
+ 'asAttachment' => true,
+ 'fileName' =>'Goods'. "-" .date('Y-m-d H/i/s', time()),
+ 'columns' => $searchModel->columns()
+ ]);
+ }
+
+ /**
+ * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id
+ */
+ public function actionSaveFile()
+ {
+ if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){
+ return '';
+ }
+
+ $data = Yii::$app->request->get('data');
+ $file_name = Yii::$app->request->get('fileName')[0];
+
+ if ($data['status'] == true) {
+ $model = new \common\models\ars\TemFile();
+ $model->user_id = Yii::$app->user->identity->id;
+ $model->name = $file_name;
+ $file_manager = new \backend\logic\file\FileManager();
+ $type_res = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']);
+ if ($type_res['status']) {
+ $model->type = $type_res['type'];
+ }
+ $model->alias = $data['alias'];
+ $model->path = $data['path'];
+ $model->save();
+ return $model->id;
+ }
+ }
+
+ /**
+ * @return string
+ * 点击删除按钮时同时删除字符串中的id
+ */
+ public function actionImgIdDel()
+ {
+ //判断该类是否存在
+ if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){
+ return '';
+ }
+
+ $img_id = Yii::$app->request->get('imgid');
+ $img_id_arr = explode(',', $img_id);
+ if(isset(Yii::$app->request->get('data')['alias'])) {
+ $alias = Yii::$app->request->get('data')['alias'];
+ $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]);
+ if ($tem_file) {
+ $img_id_arr = array_diff($img_id_arr, [$tem_file->id]);
+ }
+ }else{
+ foreach (Yii::$app->request->get() as $key => $value) {
+ $tem_file = \common\models\ars\File::findOne(['alias' => $value]);
+ if ($tem_file) {
+ $img_id_arr = array_diff($img_id_arr, [$tem_file->id]);
+ }
+ }
+ }
+ $img_id_str = implode(',', $img_id_arr);
+ return $img_id_str;
+ }
+
+ /**
+ * @return bool|false|string
+ * 加载已有的文件
+ */
+ public function actionImageFile()
+ {
+ //判断该类是否存在
+ if(!class_exists('\common\models\ars\File')){
+ return false;
+ }
+
+ $file_id_str = Yii::$app->request->get('fileidstr');
+ $file_id_arr = explode(',', $file_id_str);
+ $data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all();
+ $res = array();
+ if($data) {
+ $i = 0;
+ foreach ($data as $key => $value) {
+ $res[$i]['name'] = $value->alias;
+ $res[$i]['path'] = Yii::$app->request->hostInfo . '/' . $value->path;
+ $res[$i]['size'] = filesize($value->path);
+ $i++;
+ }
+ }
+ return json_encode($res);
+ }
+}
diff --git a/vendor/antgoods/goods/src/controllers/ShopcategoryController.php b/vendor/antgoods/goods/src/controllers/ShopcategoryController.php
new file mode 100644
index 0000000..64c758a
--- /dev/null
+++ b/vendor/antgoods/goods/src/controllers/ShopcategoryController.php
@@ -0,0 +1,273 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ public function actions()
+ {
+ return [
+ 'upload' => [
+ 'class' => 'iron\actions\UploadAction',
+ 'path' => 'xls/',
+ 'maxSize' => 20480,
+ ]
+ ];
+ }
+
+ /**
+ * Lists all ShopCategory models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new ShopCategorySearch();
+ $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ 'columns' => $searchModel->columns()
+ ]);
+ }
+
+ /**
+ * Displays a single ShopCategory model.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionView($id)
+ {
+ return $this->render('view', [
+ 'model' => $this->findModel($id),
+ ]);
+ }
+
+ /**
+ * Creates a new ShopCategory model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new ShopCategory();
+
+ if ($model->load(Yii::$app->request->post())) {
+
+ //类目图片上传保存处理
+ $icon_image_id_str = $model->iconImageId;
+ $model->save();
+ $goods_manager = new GoodsManager();
+ $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model, [], File::OWN_TYPE_CATEGORY_ICON);
+ if($save_icon_image_res['status']){
+ $model->icon = $save_icon_image_res['first_file_id'];
+ $model->save();
+ }
+
+ return $this->redirect('index');
+ }
+
+ return $this->render('create', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Updates an existing ShopCategory model.
+ * If update is successful, the browser will be redirected to the 'view' page.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionUpdate($id)
+ {
+ $model = $this->findModel($id);
+ $model->iconImageId = $model->icon;
+ //记录已保存的类目图片id,用于修改
+ $icon_image_old_id_arr = $model->icon;
+
+ if ($model->load(Yii::$app->request->post())) {
+
+ //类目图片上传保存处理
+ $icon_image_id_str = $model->iconImageId;
+ $model->save();
+ $goods_manager = new GoodsManager();
+ $save_icon_image_res = $goods_manager->saveFile(explode(',', $icon_image_id_str), $model, explode(',', $icon_image_old_id_arr), File::OWN_TYPE_CATEGORY_ICON);
+ if($save_icon_image_res['status'] && $save_icon_image_res['first_file_id'] !== 0){
+ $model->icon = $save_icon_image_res['first_file_id'];
+ $model->save();
+ }
+
+ return $this->redirect('index');
+ }
+
+ return $this->render('update', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Deletes an existing ShopCategory model.
+ * If deletion is successful, the browser will be redirected to the 'index' page.
+ * @param integer $id
+ * @return mixed
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ public function actionDelete($id)
+ {
+ $this->findModel($id)->delete();
+
+ return $this->redirect(['index']);
+ }
+
+ /**
+ * Finds the ShopCategory model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return ShopCategory the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = ShopCategory::findOne($id)) !== null) {
+ return $model;
+ }
+
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ /**
+ * @author iron
+ * 文件导出
+ */
+ public function actionExport()
+ {
+ $searchModel = new ShopCategorySearch();
+ $params = Yii::$app->request->queryParams;
+ if ($params['page-type'] == 'all') {
+ $dataProvider = $searchModel->allData($params);
+ } else {
+ $dataProvider = $searchModel->search($params);
+ }
+ \iron\widget\Excel::export([
+ 'models' => $dataProvider->getModels(),
+ 'format' => 'Xlsx',
+ 'asAttachment' => true,
+ 'fileName' =>'Shop Categories'. "-" .date('Y-m-d H/i/s', time()),
+ 'columns' => $searchModel->columns()
+ ]);
+ }
+
+ /**
+ * 处理文件上传成功后回调保存到临时文件表中,并返回临时文件id
+ */
+ public function actionSaveFile()
+ {
+ if(!class_exists('\common\models\ars\TemFile') || !class_exists('\backend\logic\file\FileManager')){
+ return '';
+ }
+
+ $data = Yii::$app->request->get('data');
+ $file_name = Yii::$app->request->get('fileName')[0];
+
+ if ($data['status'] == true) {
+ $model = new \common\models\ars\TemFile();
+ $model->user_id = Yii::$app->user->identity->id;
+ $model->name = $file_name;
+ $file_manager = new \backend\logic\file\FileManager();
+ $type_res = $file_manager->searchType(\backend\logic\file\FileManager::$extension, pathinfo($data['path'])['extension']);
+ if ($type_res['status']) {
+ $model->type = $type_res['type'];
+ }
+ $model->alias = $data['alias'];
+ $model->path = $data['path'];
+ $model->save();
+ return $model->id;
+ }
+ }
+
+ /**
+ * @return string
+ * 点击删除按钮时同时删除字符串中的id
+ */
+ public function actionImgIdDel()
+ {
+ //判断该类是否存在
+ if(!class_exists('\common\models\ars\TemFile') || !class_exists('\common\models\ars\File')){
+ return '';
+ }
+
+ $img_id = Yii::$app->request->get('imgid');
+ $img_id_arr = explode(',', $img_id);
+ if(isset(Yii::$app->request->get('data')['alias'])) {
+ $alias = Yii::$app->request->get('data')['alias'];
+ $tem_file = \common\models\ars\TemFile::findOne(['alias' => $alias]);
+ if ($tem_file) {
+ $img_id_arr = array_diff($img_id_arr, [$tem_file->id]);
+ }
+ }else{
+ foreach (Yii::$app->request->get() as $key => $value) {
+ $tem_file = \common\models\ars\File::findOne(['alias' => $value]);
+ if ($tem_file) {
+ $img_id_arr = array_diff($img_id_arr, [$tem_file->id]);
+ }
+ }
+ }
+ $img_id_str = implode(',', $img_id_arr);
+ return $img_id_str;
+ }
+
+ /**
+ * @return bool|false|string
+ * 加载已有的文件
+ */
+ public function actionImageFile()
+ {
+ //判断该类是否存在
+ if(!class_exists('\common\models\ars\File')){
+ return false;
+ }
+
+ $file_id_str = Yii::$app->request->get('fileidstr');
+ $file_id_arr = explode(',', $file_id_str);
+ $data = \common\models\ars\File::find()->where(['id' => $file_id_arr])->all();
+ $res = array();
+ if($data) {
+ $i = 0;
+ foreach ($data as $key => $value) {
+ $res[$i]['name'] = $value->alias;
+ $res[$i]['path'] = Yii::$app->request->hostInfo . '/' . $value->path;
+ $res[$i]['size'] = filesize($value->path);
+ $i++;
+ }
+ }
+ return json_encode($res);
+ }
+}
diff --git a/backend/controllers/SupplierController.php b/vendor/antgoods/goods/src/controllers/SupplierController.php
similarity index 96%
rename from backend/controllers/SupplierController.php
rename to vendor/antgoods/goods/src/controllers/SupplierController.php
index b538566..cdc6a80 100644
--- a/backend/controllers/SupplierController.php
+++ b/vendor/antgoods/goods/src/controllers/SupplierController.php
@@ -1,10 +1,10 @@
false, 'info' => '操作失败'];
+ }
+
+ //需要新建的文件id
+ $create_file_id_arr = array_diff($newFileIdArr, $oldFileIdArr);
+
+ //创建文件
+ $class = new \backend\logic\file\FileManager();
+ $create_file_res = $class->saveTemFileToFile($create_file_id_arr, $goodsModel->id, $filetype);
+
+ //需要删除的文件id
+ $del_file_id_arr = array_diff($oldFileIdArr, $newFileIdArr);
+
+ //删除文件
+ $class->deleteFile($del_file_id_arr);
+
+ //记录第一张图片id
+ $first_file_id = 0;
+
+ //查看修改数组是否为空
+ if (!$newFileIdArr[0]) {
+ $first_file_id = null;
+ }else {
+ if ($create_file_res['status']) {
+ $first_file_id = $create_file_res['first_file_id'];
+ }
+ }
+
+ return ['status' => true, 'info' => '操作成功', 'first_file_id' => $first_file_id];
+ }
+}
\ No newline at end of file
diff --git a/console/migrations/m191111_080318_create_table_shop_category.php b/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php
similarity index 72%
rename from console/migrations/m191111_080318_create_table_shop_category.php
rename to vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php
index da2a1a3..35f536e 100644
--- a/console/migrations/m191111_080318_create_table_shop_category.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_080318_create_table_shop_category
+ * Class m191119_021851_create_table_shop_category
*/
-class m191111_080318_create_table_shop_category extends Migration
+class m191119_021851_create_table_shop_category extends Migration
{
/**
* {@inheritdoc}
@@ -13,14 +13,14 @@ class m191111_080318_create_table_shop_category extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="前端商品类别表"';
- $this->createTable('ats_shop_category', [
+ $this->createTable('antgoods_shop_category', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'),
+ 'name'=>$this->string(60)->notNull()->comment('类别名称'),
'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'),
- 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
+ 'goods_count'=>$this->integer(11)->defaultValue(0)->comment('商品数量'),
'keywords'=>$this->string(100)->defaultValue(null)->comment('关键字'),
'desc'=>$this->string(255)->defaultValue(null)->comment('描述'),
- 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'),
+ 'sort_order'=>$this->smallInteger(3)->defaultValue(0)->comment('排序'),
'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'),
'icon'=>$this->string(64)->defaultValue(null)->comment('图标'),
'filter_attr'=>$this->text()->comment('筛选属性'),
@@ -36,7 +36,7 @@ class m191111_080318_create_table_shop_category extends Migration
*/
public function down()
{
- $this->dropTable('kcs_tags_relation_goods');
+ $this->dropTable('antgoods_shop_category');
return true;
}
}
diff --git a/console/migrations/m191111_081842_create_table_category.php b/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php
similarity index 55%
rename from console/migrations/m191111_081842_create_table_category.php
rename to vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php
index e7598bd..60dd21e 100644
--- a/console/migrations/m191111_081842_create_table_category.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_081842_create_table_category
+ * Class m191119_022641_create_table_category
*/
-class m191111_081842_create_table_category extends Migration
+class m191119_022641_create_table_category extends Migration
{
/**
* {@inheritdoc}
@@ -13,16 +13,16 @@ class m191111_081842_create_table_category extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="后台商品类别表"';
- $this->createTable('ats_category', [
+ $this->createTable('antgoods_category', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(60)->defaultValue(null)->comment('类别名称'),
+ 'name'=>$this->string(60)->notNull()->comment('类别名称'),
'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'),
- 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
- 'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'),
+ 'goods_count'=>$this->integer(11)->defaultValue(0)->comment('商品数量'),
+ 'sort_order'=>$this->smallInteger(3)->defaultValue(0)->comment('排序'),
'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'),
'icon'=>$this->string(64)->defaultValue(null)->comment('图标'),
- 'is_show'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否显示,1为不显示'),
- 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'),
+ 'is_show'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否显示,1为不显示'),
+ 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
],$tableOptions);
@@ -33,7 +33,7 @@ class m191111_081842_create_table_category extends Migration
*/
public function down()
{
- $this->dropTable('ats_category');
+ $this->dropTable('antgoods_category');
return true;
}
}
diff --git a/console/migrations/m191111_082739_create_table_attribute.php b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php
similarity index 61%
rename from console/migrations/m191111_082739_create_table_attribute.php
rename to vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php
index d640a25..8f77f8f 100644
--- a/console/migrations/m191111_082739_create_table_attribute.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_082739_create_table_attribute
+ * Class m191119_022939_create_table_attribute
*/
-class m191111_082739_create_table_attribute extends Migration
+class m191119_022939_create_table_attribute extends Migration
{
/**
* {@inheritdoc}
@@ -13,13 +13,13 @@ class m191111_082739_create_table_attribute extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="属性表"';
- $this->createTable('ats_attribute', [
+ $this->createTable('antgoods_attribute', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(50)->defaultValue(null)->comment('属性名'),
- 'value'=>$this->text()->comment('属性值'),
+ 'name'=>$this->string(50)->notNull()->comment('属性名'),
+ 'value'=>$this->text()->notNull()->comment('属性值'),
'type'=>$this->smallInteger(2)->defaultValue(null)->comment('类型'),
'sort_order'=>$this->smallInteger(3)->defaultValue(null)->comment('排序'),
- 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'),
+ 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
],$tableOptions);
@@ -30,7 +30,7 @@ class m191111_082739_create_table_attribute extends Migration
*/
public function down()
{
- $this->dropTable('ats_attribute');
+ $this->dropTable('antgoods_attribute');
return true;
}
}
diff --git a/console/migrations/m191111_083808_create_table_goods_attr.php b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php
similarity index 50%
rename from console/migrations/m191111_083808_create_table_goods_attr.php
rename to vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php
index 573252f..19a263c 100644
--- a/console/migrations/m191111_083808_create_table_goods_attr.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_083808_create_table_goods_attr
+ * Class m191119_023115_create_table_goods_attr
*/
-class m191111_083808_create_table_goods_attr extends Migration
+class m191119_023115_create_table_goods_attr extends Migration
{
/**
* {@inheritdoc}
@@ -13,12 +13,12 @@ class m191111_083808_create_table_goods_attr extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="商品属性表"';
- $this->createTable('ats_goods_attr', [
+ $this->createTable('antgoods_goods_attr', [
'id' => $this->primaryKey(),
- 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
- 'attr_id'=>$this->integer(11)->defaultValue(null)->comment('属性id'),
- 'attr_value'=>$this->string(50)->defaultValue(null)->comment('属性名'),
- 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'),
+ 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
+ 'attr_id'=>$this->integer(11)->notNull()->comment('属性id'),
+ 'attr_value'=>$this->string(50)->notNull()->comment('属性名'),
+ 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
],$tableOptions);
@@ -29,7 +29,7 @@ class m191111_083808_create_table_goods_attr extends Migration
*/
public function down()
{
- $this->dropTable('ats_goods_attr');
+ $this->dropTable('antgoods_goods_attr');
return true;
}
}
diff --git a/console/migrations/m191111_084452_create_table_brand.php b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php
similarity index 60%
rename from console/migrations/m191111_084452_create_table_brand.php
rename to vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php
index 6658ff7..48984d4 100644
--- a/console/migrations/m191111_084452_create_table_brand.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_084452_create_table_brand
+ * Class m191119_024029_create_table_brand
*/
-class m191111_084452_create_table_brand extends Migration
+class m191119_024029_create_table_brand extends Migration
{
/**
* {@inheritdoc}
@@ -13,10 +13,10 @@ class m191111_084452_create_table_brand extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="品牌表"';
- $this->createTable('ats_brand', [
+ $this->createTable('antgoods_brand', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(50)->defaultValue(null)->comment('品牌名'),
- 'is_delete'=>$this->tinyInteger(1)->defaultValue(null)->comment('是否删除,1为已删除'),
+ 'name'=>$this->string(50)->notNull()->comment('品牌名'),
+ 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
],$tableOptions);
@@ -27,7 +27,7 @@ class m191111_084452_create_table_brand extends Migration
*/
public function down()
{
- $this->dropTable('ats_brand');
+ $this->dropTable('antgoods_brand');
return true;
}
}
diff --git a/console/migrations/m191111_095158_create_table_goods.php b/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php
similarity index 67%
rename from console/migrations/m191111_095158_create_table_goods.php
rename to vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php
index 5644e70..d16c1e5 100644
--- a/console/migrations/m191111_095158_create_table_goods.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_095158_create_table_goods
+ * Class m191119_024205_create_table_goods
*/
-class m191111_095158_create_table_goods extends Migration
+class m191119_024205_create_table_goods extends Migration
{
/**
* {@inheritdoc}
@@ -21,7 +21,7 @@ class m191111_095158_create_table_goods extends Migration
*/
public function down()
{
- $this->dropTable("ats_goods");
+ $this->dropTable("antgoods_goods");
return true;
}
}
diff --git a/console/migrations/m191111_100540_create_table_goods_sku.php b/vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php
similarity index 66%
rename from console/migrations/m191111_100540_create_table_goods_sku.php
rename to vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php
index ac7ec13..227b38b 100644
--- a/console/migrations/m191111_100540_create_table_goods_sku.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_100540_create_table_goods_sku
+ * Class m191119_024345_create_table_goods_sku
*/
-class m191111_100540_create_table_goods_sku extends Migration
+class m191119_024345_create_table_goods_sku extends Migration
{
/**
* {@inheritdoc}
@@ -21,7 +21,7 @@ class m191111_100540_create_table_goods_sku extends Migration
*/
public function down()
{
- $this->dropTable("ats_goods_sku");
+ $this->dropTable("antgoods_goods_sku");
return true;
}
}
diff --git a/console/migrations/m191111_100639_create_table_supplier.php b/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php
similarity index 55%
rename from console/migrations/m191111_100639_create_table_supplier.php
rename to vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php
index e13f46a..c7d8f6c 100644
--- a/console/migrations/m191111_100639_create_table_supplier.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_100639_create_table_supplier
+ * Class m191119_025607_create_table_supplier
*/
-class m191111_100639_create_table_supplier extends Migration
+class m191119_025607_create_table_supplier extends Migration
{
/**
* {@inheritdoc}
@@ -13,12 +13,12 @@ class m191111_100639_create_table_supplier extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="供应商表"';
- $this->createTable('ats_supplier', [
+ $this->createTable('antgoods_supplier', [
'id' => $this->primaryKey(),
- 'name'=>$this->string(50)->defaultValue(null)->comment('供应商名称'),
- 'full_name'=>$this->string(50)->defaultValue(null)->comment('供应商全称'),
- 'phone'=>$this->string(20)->defaultValue(null)->comment('手机号码'),
- 'address'=>$this->string(50)->defaultValue(null)->comment('地址'),
+ 'name'=>$this->string(50)->notNull()->comment('供应商名称'),
+ 'full_name'=>$this->string(50)->notNull()->comment('供应商全称'),
+ 'phone'=>$this->string(20)->notNull()->comment('手机号码'),
+ 'address'=>$this->string(50)->notNull()->comment('地址'),
'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
@@ -30,7 +30,7 @@ class m191111_100639_create_table_supplier extends Migration
*/
public function down()
{
- $this->dropTable('ats_supplier');
+ $this->dropTable('antgoods_supplier');
return true;
}
}
diff --git a/console/migrations/m191111_100958_create_table_filter_attr.php b/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php
similarity index 59%
rename from console/migrations/m191111_100958_create_table_filter_attr.php
rename to vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php
index 357f4dd..0409292 100644
--- a/console/migrations/m191111_100958_create_table_filter_attr.php
+++ b/vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php
@@ -3,9 +3,9 @@
use yii\db\Migration;
/**
- * Class m191111_100958_create_table_filter_attr
+ * Class m191119_025843_create_table_filter_attr
*/
-class m191111_100958_create_table_filter_attr extends Migration
+class m191119_025843_create_table_filter_attr extends Migration
{
/**
* {@inheritdoc}
@@ -13,11 +13,11 @@ class m191111_100958_create_table_filter_attr extends Migration
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="筛选属性表"';
- $this->createTable('ats_filter_attr', [
+ $this->createTable('antgoods_filter_attr', [
'id' => $this->primaryKey(),
- 'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
- 'attr_id'=>$this->integer(11)->defaultValue(null)->comment('属性id'),
- 'attr_value'=>$this->string(50)->defaultValue(null)->comment('属性值'),
+ 'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
+ 'attr_id'=>$this->integer(11)->notNull()->comment('属性id'),
+ 'attr_value'=>$this->string(50)->notNull()->comment('属性值'),
'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
@@ -29,7 +29,7 @@ class m191111_100958_create_table_filter_attr extends Migration
*/
public function down()
{
- $this->dropTable('ats_filter_attr');
+ $this->dropTable('antgoods_filter_attr');
return true;
}
}
diff --git a/vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php b/vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php
new file mode 100644
index 0000000..00fb52e
--- /dev/null
+++ b/vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php
@@ -0,0 +1,22 @@
+dropColumn('antgoods_category', 'icon_type');
+ $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(1)->comment('图标类型'));
+ }
+
+ public function down()
+ {
+ $this->dropColumn('antgoods_category', 'icon_type');
+ $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型'));
+ return true;
+ }
+}
diff --git a/vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php b/vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php
new file mode 100644
index 0000000..04c6a2b
--- /dev/null
+++ b/vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php
@@ -0,0 +1,20 @@
+dropColumn('antgoods_category', 'icon_type');
+ }
+
+ public function down()
+ {
+ $this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型'));
+ return true;
+ }
+}
diff --git a/vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php b/vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php
new file mode 100644
index 0000000..055e84c
--- /dev/null
+++ b/vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php
@@ -0,0 +1,26 @@
+dropColumn('antgoods_category', 'icon');
+ $this->addColumn('antgoods_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标'));
+ $this->dropColumn('antgoods_category', 'pid');
+ $this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id'));
+ }
+
+ public function down()
+ {
+ $this->dropColumn('antgoods_category', 'icon');
+ $this->addColumn('antgoods_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标'));
+ $this->dropColumn('antgoods_category', 'pid');
+ $this->addColumn('antgoods_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id'));
+ return true;
+ }
+}
diff --git a/vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php b/vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php
new file mode 100644
index 0000000..2f182eb
--- /dev/null
+++ b/vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php
@@ -0,0 +1,20 @@
+dropColumn('antgoods_shop_category', 'icon_type');
+ }
+
+ public function down()
+ {
+ $this->addColumn('antgoods_shop_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型'));
+ return true;
+ }
+}
diff --git a/vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php b/vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php
new file mode 100644
index 0000000..b1536ac
--- /dev/null
+++ b/vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php
@@ -0,0 +1,26 @@
+dropColumn('antgoods_shop_category', 'icon');
+ $this->addColumn('antgoods_shop_category', 'icon', $this->integer(11)->defaultValue(null)->comment('图标'));
+ $this->dropColumn('antgoods_shop_category', 'pid');
+ $this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(0)->comment('父级id'));
+ }
+
+ public function down()
+ {
+ $this->dropColumn('antgoods_shop_category', 'icon');
+ $this->addColumn('antgoods_shop_category', 'icon', $this->string(64)->defaultValue(null)->comment('图标'));
+ $this->dropColumn('antgoods_shop_category', 'pid');
+ $this->addColumn('antgoods_shop_category', 'pid', $this->integer(11)->defaultValue(null)->comment('父级id'));
+ return true;
+ }
+}
diff --git a/console/migrations/sql/goods.sql b/vendor/antgoods/goods/src/migrations/sql/goods.sql
old mode 100644
new mode 100755
similarity index 82%
rename from console/migrations/sql/goods.sql
rename to vendor/antgoods/goods/src/migrations/sql/goods.sql
index 186d046..fe9d9e2
--- a/console/migrations/sql/goods.sql
+++ b/vendor/antgoods/goods/src/migrations/sql/goods.sql
@@ -1,11 +1,11 @@
-DROP TABLE IF EXISTS `ats_goods`;
-CREATE TABLE `ats_goods` (
+DROP TABLE IF EXISTS `antgoods_goods`;
+CREATE TABLE `antgoods_goods` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pid` int(11) DEFAULT NULL COMMENT '父级id',
- `cat_id` int(11) DEFAULT NULL COMMENT '后台商品类别id',
- `brand_id` int(11) DEFAULT NULL COMMENT '品牌id',
- `shop_cat_id` int(11) DEFAULT NULL COMMENT '前端商品类别id',
- `name` varchar(120) DEFAULT NULL COMMENT '商品名称',
+ `cat_id` int(11) NOT NULL COMMENT '后台商品类别id',
+ `brand_id` int(11) NOT NULL COMMENT '品牌id',
+ `shop_cat_id` int(11) NOT NULL COMMENT '前端商品类别id',
+ `name` varchar(120) NOT NULL COMMENT '商品名称',
`sn` varchar(60) DEFAULT NULL COMMENT '商品唯一货号',
`code` varchar(50) DEFAULT NULL COMMENT '商品货码',
`supplier_id` int(11) DEFAULT NULL COMMENT '供应商id',
diff --git a/console/migrations/sql/goods_sku.sql b/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql
old mode 100644
new mode 100755
similarity index 76%
rename from console/migrations/sql/goods_sku.sql
rename to vendor/antgoods/goods/src/migrations/sql/goods_sku.sql
index 0a5ec6c..a599a39
--- a/console/migrations/sql/goods_sku.sql
+++ b/vendor/antgoods/goods/src/migrations/sql/goods_sku.sql
@@ -1,9 +1,9 @@
-DROP TABLE IF EXISTS `ats_goods_sku`;
-CREATE TABLE `ats_goods_sku` (
+DROP TABLE IF EXISTS `antgoods_goods_sku`;
+CREATE TABLE `antgoods_goods_sku` (
`id` int(11) NOT NULL AUTO_INCREMENT,
- `goods_id` int(11) DEFAULT NULL COMMENT '商品id',
+ `goods_id` int(11) NOT NULL COMMENT '商品id',
`goods_code` varchar(50) DEFAULT NULL COMMENT '商品条码',
- `goods_sn` varchar(60) DEFAULT NULL COMMENT '商品唯一货号',
+ `goods_sn` varchar(60) NOT NULL COMMENT '商品唯一货号',
`goods_attr` varchar(60) DEFAULT NULL COMMENT '属性匹配',
`weight` mediumint(8) DEFAULT NULL COMMENT '重量',
`length` mediumint(8) DEFAULT NULL COMMENT '长度',
@@ -16,7 +16,7 @@ CREATE TABLE `ats_goods_sku` (
`price` int(20) DEFAULT NULL COMMENT '销售价',
`model_id` int(11) DEFAULT NULL COMMENT '模型id',
`is_sale` tinyint(1) DEFAULT '0' COMMENT '该商品是否开放销售,1为是,0为否',
- `sort_order` smallint(3) DEFAULT NULL COMMENT '排序',
+ `sort_order` smallint(3) DEFAULT '0' COMMENT '排序',
`is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除',
`created_at` int(10) DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) DEFAULT '0' COMMENT '更新时间',
diff --git a/common/models/ars/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php
similarity index 78%
rename from common/models/ars/Attribute.php
rename to vendor/antgoods/goods/src/models/ars/Attribute.php
index 664fb60..d621446 100644
--- a/common/models/ars/Attribute.php
+++ b/vendor/antgoods/goods/src/models/ars/Attribute.php
@@ -1,12 +1,12 @@
50],
@@ -46,8 +52,8 @@ class Attribute extends \yii\db\ActiveRecord
{
return [
'id' => 'id',
- 'name' => '属性名',
- 'value' => '属性值',
+ 'name' => '规格名称',
+ 'value' => '规格内容(每项以逗号隔开)',
'type' => '类型',
'sort_order' => '排序',
'is_delete' => '是否删除,1为已删除',
@@ -55,6 +61,7 @@ class Attribute extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php
similarity index 75%
rename from common/models/ars/Brand.php
rename to vendor/antgoods/goods/src/models/ars/Brand.php
index cbe1618..e577b1d 100644
--- a/common/models/ars/Brand.php
+++ b/vendor/antgoods/goods/src/models/ars/Brand.php
@@ -1,12 +1,12 @@
50],
];
@@ -48,6 +52,7 @@ class Brand extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
@@ -69,4 +74,9 @@ class Brand extends \yii\db\ActiveRecord
],
];
}
+
+ public static function modelColumn()
+ {
+ return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
+ }
}
diff --git a/common/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php
similarity index 63%
rename from common/models/ars/Category.php
rename to vendor/antgoods/goods/src/models/ars/Category.php
index 3e67792..6a50d3a 100644
--- a/common/models/ars/Category.php
+++ b/vendor/antgoods/goods/src/models/ars/Category.php
@@ -1,20 +1,19 @@
'显示',
+ self::IS_SHOW_HIDE => '隐藏'
+ ];
+
/**
* {@inheritdoc}
*/
public static function tableName()
{
- return 'ats_category';
+ return 'antgoods_category';
}
/**
@@ -36,9 +49,10 @@ class Category extends \yii\db\ActiveRecord
public function rules()
{
return [
- [['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'],
+ [['name'], 'required'],
+ [['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'],
[['name'], 'string', 'max' => 60],
- [['icon'], 'string', 'max' => 64],
+ [['iconImageId'], 'string'],
];
}
@@ -55,12 +69,13 @@ class Category extends \yii\db\ActiveRecord
'sort_order' => '排序',
'icon_type' => '图标类型',
'icon' => '图标',
- 'is_show' => '是否显示,1为不显示',
+ 'is_show' => '是否显示',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
@@ -82,4 +97,13 @@ class Category extends \yii\db\ActiveRecord
],
];
}
+
+ /**
+ * @return array
+ * 数据键值对
+ */
+ public static function modelColumn()
+ {
+ return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
+ }
}
diff --git a/common/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php
similarity index 88%
rename from common/models/ars/FilterAttr.php
rename to vendor/antgoods/goods/src/models/ars/FilterAttr.php
index 95d6513..2036d55 100644
--- a/common/models/ars/FilterAttr.php
+++ b/vendor/antgoods/goods/src/models/ars/FilterAttr.php
@@ -1,12 +1,12 @@
50],
];
@@ -52,6 +53,7 @@ class FilterAttr extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php
similarity index 70%
rename from common/models/ars/Goods.php
rename to vendor/antgoods/goods/src/models/ars/Goods.php
index 8b7aa93..d446283 100644
--- a/common/models/ars/Goods.php
+++ b/vendor/antgoods/goods/src/models/ars/Goods.php
@@ -1,12 +1,12 @@
'否',
+ self::IS_SALE_YES => '是'
+ ];
/**
* {@inheritdoc}
*/
public static function tableName()
{
- return 'ats_goods';
+ return 'antgoods_goods';
}
/**
@@ -59,7 +75,9 @@ class Goods extends \yii\db\ActiveRecord
{
return [
[['pid', 'cat_id', 'brand_id', 'shop_cat_id', 'supplier_id', 'weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'limit_count', 'stock', 'stock_warn', 'market_price', 'price', 'image', 'model_id', 'is_sale', 'sort_order', 'bouns_points', 'experience_points', 'is_delete', 'express_template'], 'integer'],
- [['description'], 'string'],
+ [['cat_id', 'brand_id', 'shop_cat_id', 'name'], 'required'],
+ [['sn'], 'checkExist'],
+ [['description', 'coverImageId', 'detailImageId'], 'string'],
[['name'], 'string', 'max' => 120],
[['sn'], 'string', 'max' => 60],
[['code'], 'string', 'max' => 50],
@@ -68,6 +86,25 @@ class Goods extends \yii\db\ActiveRecord
];
}
+ /**
+ * @param $attribute
+ * @param $params
+ * 验证商品编号唯一
+ */
+ public function checkExist($attribute, $params)
+ {
+ $goods = self::find()->where([$attribute => $this->$attribute, 'is_delete' => 0])->one();
+ if ($this->isNewRecord) {
+ if ($goods) {
+ $this->addError($attribute, "该商品编号已经存在");
+ }
+ } else {
+ if ($goods && $goods->id != $this->id) {
+ $this->addError($attribute, "该商品编号已经存在");
+ }
+ }
+ }
+
/**
* {@inheritdoc}
*/
@@ -99,7 +136,7 @@ class Goods extends \yii\db\ActiveRecord
'description' => '详细介绍',
'image' => '图片id',
'model_id' => '模型id',
- 'is_sale' => '该商品是否开放销售,1为是,0为否',
+ 'is_sale' => '该商品是否开放销售',
'sort_order' => '排序',
'bouns_points' => '奖励积分',
'experience_points' => '经验值',
@@ -109,6 +146,7 @@ class Goods extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
@@ -130,4 +168,17 @@ class Goods extends \yii\db\ActiveRecord
],
];
}
+
+ /**
+ * @param bool $insert
+ * @return bool
+ * 自动填入参数
+ */
+ public function beforeSave($insert)
+ {
+ if (!$this->sn) {
+ $this->sn = time() . rand(1111, 9999);
+ }
+ return parent::beforeSave($insert); // TODO: Change the autogenerated stub
+ }
}
diff --git a/common/models/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php
similarity index 88%
rename from common/models/ars/GoodsAttr.php
rename to vendor/antgoods/goods/src/models/ars/GoodsAttr.php
index 1a96b10..b888e46 100644
--- a/common/models/ars/GoodsAttr.php
+++ b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php
@@ -1,12 +1,12 @@
50],
];
@@ -52,6 +53,7 @@ class GoodsAttr extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php
similarity index 93%
rename from common/models/ars/GoodsSku.php
rename to vendor/antgoods/goods/src/models/ars/GoodsSku.php
index 8d523fc..7e4644a 100644
--- a/common/models/ars/GoodsSku.php
+++ b/vendor/antgoods/goods/src/models/ars/GoodsSku.php
@@ -1,12 +1,12 @@
50],
[['goods_sn', 'goods_attr'], 'string', 'max' => 60],
@@ -79,6 +80,7 @@ class GoodsSku extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
diff --git a/common/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php
similarity index 68%
rename from common/models/ars/ShopCategory.php
rename to vendor/antgoods/goods/src/models/ars/ShopCategory.php
index 5df7d3d..d6dc798 100644
--- a/common/models/ars/ShopCategory.php
+++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php
@@ -1,12 +1,12 @@
'显示',
+ self::IS_SHOW_HIDE => '隐藏'
+ ];
+
/**
* {@inheritdoc}
*/
public static function tableName()
{
- return 'ats_shop_category';
+ return 'antgoods_shop_category';
}
/**
@@ -39,12 +53,12 @@ class ShopCategory extends \yii\db\ActiveRecord
public function rules()
{
return [
- [['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'],
+ [['name'], 'required'],
+ [['pid', 'goods_count', 'sort_order', 'icon', 'is_show', 'is_delete', 'iconImageId'], 'integer'],
[['filter_attr'], 'string'],
[['name'], 'string', 'max' => 60],
[['keywords'], 'string', 'max' => 100],
[['desc'], 'string', 'max' => 255],
- [['icon'], 'string', 'max' => 64],
];
}
@@ -64,12 +78,13 @@ class ShopCategory extends \yii\db\ActiveRecord
'icon_type' => '图标类型',
'icon' => '图标',
'filter_attr' => '筛选属性',
- 'is_show' => '是否显示,1为不显示',
- 'is_delete' => '是否删除,1为已删除',
+ 'is_show' => '是否显示',
+ 'is_delete' => '是否删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
@@ -91,4 +106,13 @@ class ShopCategory extends \yii\db\ActiveRecord
],
];
}
+
+ /**
+ * @return array
+ * 数据键值对
+ */
+ public static function modelColumn()
+ {
+ return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
+ }
}
diff --git a/common/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php
similarity index 68%
rename from common/models/ars/Supplier.php
rename to vendor/antgoods/goods/src/models/ars/Supplier.php
index 6733a35..a19f7dd 100644
--- a/common/models/ars/Supplier.php
+++ b/vendor/antgoods/goods/src/models/ars/Supplier.php
@@ -1,12 +1,12 @@
50],
[['phone'], 'string', 'max' => 20],
+ ['phone', 'filter', 'filter' => 'trim'],
+ ['phone','match','pattern'=>'/^[1][34578][0-9]{9}$/'],
+ ['phone', 'unique', 'targetClass' => '\antgoods\goods\models\ars\Supplier', 'message' => '手机号已被使用'],
];
}
@@ -55,6 +62,7 @@ class Supplier extends \yii\db\ActiveRecord
'updated_at' => '更新时间',
];
}
+
/**
* @author linyao
@@ -76,4 +84,13 @@ class Supplier extends \yii\db\ActiveRecord
],
];
}
+
+ /**
+ * @return array
+ * 数据键值对
+ */
+ public static function modelColumn()
+ {
+ return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
+ }
}
diff --git a/common/models/searchs/AttributeSearch.php b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php
similarity index 92%
rename from common/models/searchs/AttributeSearch.php
rename to vendor/antgoods/goods/src/models/searchs/AttributeSearch.php
index bb725fe..b06e242 100644
--- a/common/models/searchs/AttributeSearch.php
+++ b/vendor/antgoods/goods/src/models/searchs/AttributeSearch.php
@@ -1,16 +1,16 @@
andFilterWhere(['is_delete' => Attribute::IS_DELETE_NO]);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
diff --git a/common/models/searchs/BrandSearch.php b/vendor/antgoods/goods/src/models/searchs/BrandSearch.php
similarity index 91%
rename from common/models/searchs/BrandSearch.php
rename to vendor/antgoods/goods/src/models/searchs/BrandSearch.php
index c75e607..e484b56 100644
--- a/common/models/searchs/BrandSearch.php
+++ b/vendor/antgoods/goods/src/models/searchs/BrandSearch.php
@@ -1,14 +1,14 @@
'iron\grid\ActionColumn',
'align' => 'center',
@@ -115,6 +114,7 @@ class BrandSearch extends Brand
* 条件筛选
*/
private function filter($query, $dataProvider){
+ $query->andFilterWhere(['is_delete' => Brand::IS_DELETE_NO]);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
diff --git a/common/models/searchs/CategorySearch.php b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php
similarity index 88%
rename from common/models/searchs/CategorySearch.php
rename to vendor/antgoods/goods/src/models/searchs/CategorySearch.php
index 2693c7f..868afe6 100644
--- a/common/models/searchs/CategorySearch.php
+++ b/vendor/antgoods/goods/src/models/searchs/CategorySearch.php
@@ -1,14 +1,14 @@
andFilterWhere(['is_delete' => Category::IS_DELETE_NO]);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
@@ -133,15 +133,14 @@ class CategorySearch extends Category
'pid' => $this->pid,
'goods_count' => $this->goods_count,
'sort_order' => $this->sort_order,
- 'icon_type' => $this->icon_type,
'is_show' => $this->is_show,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
+ 'icon' => $this->icon,
]);
- $query->andFilterWhere(['like', 'name', $this->name])
- ->andFilterWhere(['like', 'icon', $this->icon]);
+ $query->andFilterWhere(['like', 'name', $this->name]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
diff --git a/common/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php
similarity index 96%
rename from common/models/searchs/GoodsSearch.php
rename to vendor/antgoods/goods/src/models/searchs/GoodsSearch.php
index 2e7cfcf..618b320 100644
--- a/common/models/searchs/GoodsSearch.php
+++ b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php
@@ -1,14 +1,14 @@
andFilterWhere(['is_delete' => Goods::IS_DELETE_NO]);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
diff --git a/common/models/searchs/ShopCategorySearch.php b/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php
similarity index 90%
rename from common/models/searchs/ShopCategorySearch.php
rename to vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php
index 8704080..2e5dcfc 100644
--- a/common/models/searchs/ShopCategorySearch.php
+++ b/vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php
@@ -1,14 +1,14 @@
$this->pid,
'goods_count' => $this->goods_count,
'sort_order' => $this->sort_order,
- 'icon_type' => $this->icon_type,
+ 'icon' => $this->icon,
'is_show' => $this->is_show,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
@@ -146,7 +146,6 @@ class ShopCategorySearch extends ShopCategory
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'keywords', $this->keywords])
->andFilterWhere(['like', 'desc', $this->desc])
- ->andFilterWhere(['like', 'icon', $this->icon])
->andFilterWhere(['like', 'filter_attr', $this->filter_attr]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
diff --git a/common/models/searchs/SupplierSearch.php b/vendor/antgoods/goods/src/models/searchs/SupplierSearch.php
similarity index 95%
rename from common/models/searchs/SupplierSearch.php
rename to vendor/antgoods/goods/src/models/searchs/SupplierSearch.php
index ca170c5..916acb7 100644
--- a/common/models/searchs/SupplierSearch.php
+++ b/vendor/antgoods/goods/src/models/searchs/SupplierSearch.php
@@ -1,14 +1,14 @@
andFilterWhere(['is_delete' => Supplier::IS_DELETE_NO]);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
diff --git a/backend/views/attribute/_form.php b/vendor/antgoods/goods/src/views/attribute/_form.php
similarity index 76%
rename from backend/views/attribute/_form.php
rename to vendor/antgoods/goods/src/views/attribute/_form.php
index de4e895..b0e98f7 100644
--- a/backend/views/attribute/_form.php
+++ b/vendor/antgoods/goods/src/views/attribute/_form.php
@@ -1,10 +1,10 @@
@@ -16,12 +16,8 @@ use yii\widgets\ActiveForm;
= $form->field($model, 'value')->textarea(['rows' => 6]) ?>
- = $form->field($model, 'type')->textInput() ?>
-
= $form->field($model, 'sort_order')->textInput() ?>
- = $form->field($model, 'is_delete')->textInput() ?>
-