Browse Source

删除vendor下面的antgoods模块

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
00aa1f17fc
  1. 14
      vendor/antgoods/goods/AutoloadExample.php
  2. 31
      vendor/antgoods/goods/README.md
  3. 21
      vendor/antgoods/goods/composer.json
  4. 28
      vendor/antgoods/goods/src/Module.php
  5. 58
      vendor/antgoods/goods/src/assets/custom/sku.49a56a9198d9c3ec233c.js
  6. 58
      vendor/antgoods/goods/src/assets/custom/sku.52802ed907a316501cd7.js
  7. 58
      vendor/antgoods/goods/src/assets/custom/sku.9a46222d01b3d601e5ad.js
  8. 64
      vendor/antgoods/goods/src/assets/custom/sku_item.6649e882bedbeb22ea3d.js
  9. 9210
      vendor/antgoods/goods/src/assets/js/jquery.js
  10. 170
      vendor/antgoods/goods/src/controllers/AttributeController.php
  11. 151
      vendor/antgoods/goods/src/controllers/BrandController.php
  12. 276
      vendor/antgoods/goods/src/controllers/CategoryController.php
  13. 359
      vendor/antgoods/goods/src/controllers/GoodsController.php
  14. 287
      vendor/antgoods/goods/src/controllers/ShopCategoryController.php
  15. 151
      vendor/antgoods/goods/src/controllers/SupplierController.php
  16. 578
      vendor/antgoods/goods/src/logic/goods/GoodsManager.php
  17. 42
      vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php
  18. 39
      vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php
  19. 36
      vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php
  20. 35
      vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php
  21. 33
      vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php
  22. 27
      vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php
  23. 27
      vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php
  24. 36
      vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php
  25. 35
      vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php
  26. 22
      vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php
  27. 20
      vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php
  28. 26
      vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php
  29. 20
      vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php
  30. 26
      vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php
  31. 20
      vendor/antgoods/goods/src/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php
  32. 20
      vendor/antgoods/goods/src/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php
  33. 26
      vendor/antgoods/goods/src/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php
  34. 20
      vendor/antgoods/goods/src/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php
  35. 27
      vendor/antgoods/goods/src/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php
  36. 37
      vendor/antgoods/goods/src/migrations/sql/goods.sql
  37. 24
      vendor/antgoods/goods/src/migrations/sql/goods_sku.sql
  38. 111
      vendor/antgoods/goods/src/models/ars/Attribute.php
  39. 82
      vendor/antgoods/goods/src/models/ars/Brand.php
  40. 114
      vendor/antgoods/goods/src/models/ars/Category.php
  41. 81
      vendor/antgoods/goods/src/models/ars/FilterAttr.php
  42. 232
      vendor/antgoods/goods/src/models/ars/Goods.php
  43. 81
      vendor/antgoods/goods/src/models/ars/GoodsAttr.php
  44. 102
      vendor/antgoods/goods/src/models/ars/GoodsSku.php
  45. 122
      vendor/antgoods/goods/src/models/ars/ShopCategory.php
  46. 96
      vendor/antgoods/goods/src/models/ars/Supplier.php
  47. 162
      vendor/antgoods/goods/src/models/searchs/AttributeSearch.php
  48. 152
      vendor/antgoods/goods/src/models/searchs/BrandSearch.php
  49. 172
      vendor/antgoods/goods/src/models/searchs/CategorySearch.php
  50. 241
      vendor/antgoods/goods/src/models/searchs/GoodsSearch.php
  51. 162
      vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php
  52. 161
      vendor/antgoods/goods/src/models/searchs/SupplierSearch.php
  53. 32
      vendor/antgoods/goods/src/views/attribute/_form.php
  54. 49
      vendor/antgoods/goods/src/views/attribute/_search.php
  55. 18
      vendor/antgoods/goods/src/views/attribute/create.php
  56. 28
      vendor/antgoods/goods/src/views/attribute/index.php
  57. 19
      vendor/antgoods/goods/src/views/attribute/update.php
  58. 33
      vendor/antgoods/goods/src/views/attribute/view.php
  59. 24
      vendor/antgoods/goods/src/views/brand/_form.php
  60. 49
      vendor/antgoods/goods/src/views/brand/_search.php
  61. 18
      vendor/antgoods/goods/src/views/brand/create.php
  62. 28
      vendor/antgoods/goods/src/views/brand/index.php
  63. 19
      vendor/antgoods/goods/src/views/brand/update.php
  64. 30
      vendor/antgoods/goods/src/views/brand/view.php
  65. 47
      vendor/antgoods/goods/src/views/category/_form.php
  66. 49
      vendor/antgoods/goods/src/views/category/_search.php
  67. 18
      vendor/antgoods/goods/src/views/category/create.php
  68. 28
      vendor/antgoods/goods/src/views/category/index.php
  69. 19
      vendor/antgoods/goods/src/views/category/update.php
  70. 41
      vendor/antgoods/goods/src/views/category/view.php
  71. 107
      vendor/antgoods/goods/src/views/goods/_form.php
  72. 49
      vendor/antgoods/goods/src/views/goods/_search.php
  73. 22
      vendor/antgoods/goods/src/views/goods/attribute.php
  74. 72
      vendor/antgoods/goods/src/views/goods/create.php
  75. 22
      vendor/antgoods/goods/src/views/goods/filter_attribute.php
  76. 63
      vendor/antgoods/goods/src/views/goods/goods.php
  77. 28
      vendor/antgoods/goods/src/views/goods/index.php
  78. 31
      vendor/antgoods/goods/src/views/goods/new_editor.php
  79. 37
      vendor/antgoods/goods/src/views/goods/picture.php
  80. 15
      vendor/antgoods/goods/src/views/goods/sku_edit.php
  81. 74
      vendor/antgoods/goods/src/views/goods/update.php
  82. 113
      vendor/antgoods/goods/src/views/goods/view.php
  83. 55
      vendor/antgoods/goods/src/views/shop-category/_form.php
  84. 49
      vendor/antgoods/goods/src/views/shop-category/_search.php
  85. 18
      vendor/antgoods/goods/src/views/shop-category/create.php
  86. 28
      vendor/antgoods/goods/src/views/shop-category/index.php
  87. 19
      vendor/antgoods/goods/src/views/shop-category/update.php
  88. 64
      vendor/antgoods/goods/src/views/shop-category/view.php
  89. 30
      vendor/antgoods/goods/src/views/supplier/_form.php
  90. 49
      vendor/antgoods/goods/src/views/supplier/_search.php
  91. 18
      vendor/antgoods/goods/src/views/supplier/create.php
  92. 28
      vendor/antgoods/goods/src/views/supplier/index.php
  93. 19
      vendor/antgoods/goods/src/views/supplier/update.php
  94. 33
      vendor/antgoods/goods/src/views/supplier/view.php
  95. 22
      vendor/antgoods/goods/src/web/GoodsAttributeAsset.php
  96. 21
      vendor/antgoods/goods/src/web/GoodsFilterAttributeAsset.php
  97. 21
      vendor/antgoods/goods/src/web/GoodsSkuEditAsset.php

14
vendor/antgoods/goods/AutoloadExample.php

@ -1,14 +0,0 @@
<?php
namespace antgoods\goods;
/**
* This is just an example.
*/
class AutoloadExample extends \yii\base\Widget
{
public function run()
{
return "Hello!";
}
}

31
vendor/antgoods/goods/README.md

@ -1,31 +0,0 @@
商品模块
====
ant基础模块之一
Installation
------------
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require --prefer-dist antgoods/goods "*"
```
or add
```
"antgoods/goods": "*"
```
to the require section of your `composer.json` file.
Usage
-----
Once the extension is installed, simply use it in your code by :
```php
<?= \antgoods\goods\AutoloadExample::widget(); ?>```

21
vendor/antgoods/goods/composer.json

@ -1,21 +0,0 @@
{
"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\\": ""
}
}
}

28
vendor/antgoods/goods/src/Module.php

@ -1,28 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2018/9/13
* Time: 11:47
*/
namespace antgoods\goods;
class Module extends \yii\base\Module
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'antgoods\goods\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
}

58
vendor/antgoods/goods/src/assets/custom/sku.49a56a9198d9c3ec233c.js
File diff suppressed because it is too large
View File

58
vendor/antgoods/goods/src/assets/custom/sku.52802ed907a316501cd7.js
File diff suppressed because it is too large
View File

58
vendor/antgoods/goods/src/assets/custom/sku.9a46222d01b3d601e5ad.js
File diff suppressed because it is too large
View File

64
vendor/antgoods/goods/src/assets/custom/sku_item.6649e882bedbeb22ea3d.js
File diff suppressed because it is too large
View File

9210
vendor/antgoods/goods/src/assets/js/jquery.js
File diff suppressed because it is too large
View File

170
vendor/antgoods/goods/src/controllers/AttributeController.php

@ -1,170 +0,0 @@
<?php
namespace antgoods\goods\controllers;
use Yii;
use antgoods\goods\models\ars\Attribute;
use antgoods\goods\models\searchs\AttributeSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* AttributeController implements the CRUD actions for Attribute model.
*/
class AttributeController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Attribute models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new AttributeSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
]);
}
/**
* Displays a single Attribute 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 Attribute model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Attribute();
$model->sort_order = 0;
$model->cat_id = 0;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$model->value = str_replace(',', ',', $model->value);
$array = explode(',', $model->value);
if (count($array) != count(array_unique($array))) {
\Yii::$app->getSession()->setFlash('error', '不能有相同的属性值');
return $this->render('create', ['model' => $model]);
}
if ($model->save()) {
return $this->redirect(['index']);
}
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Attribute 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->validate()) {
$model->value = str_replace(',', ',', $model->value);
$array = explode(',', $model->value);
if (count($array) != count(array_unique($array))) {
\Yii::$app->getSession()->setFlash('error', '不能有相同的属性值');
return $this->render('create', ['model' => $model]);
}
if ($model->save()) {
return $this->redirect(['index']);
}
return $this->redirect('index');
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Attribute 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 = Attribute::IS_DELETE_YES;
$model->save();
return $this->redirect(['index']);
}
/**
* Finds the Attribute model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Attribute the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Attribute::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @author iron
* 文件导出
*/
public function actionExport()
{
$searchModel = new AttributeSearch();
$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' =>'Attributes'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
}

151
vendor/antgoods/goods/src/controllers/BrandController.php

@ -1,151 +0,0 @@
<?php
namespace antgoods\goods\controllers;
use Yii;
use antgoods\goods\models\ars\Brand;
use antgoods\goods\models\searchs\BrandSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* BrandController implements the CRUD actions for Brand model.
*/
class BrandController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Brand models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new BrandSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
]);
}
/**
* Displays a single Brand 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 Brand model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Brand();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Brand 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 Brand 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 = Brand::IS_DELETE_YES;
$model->save();
return $this->redirect(['index']);
}
/**
* Finds the Brand model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Brand the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Brand::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @author iron
* 文件导出
*/
public function actionExport()
{
$searchModel = new BrandSearch();
$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' =>'Brands'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
}

276
vendor/antgoods/goods/src/controllers/CategoryController.php

@ -1,276 +0,0 @@
<?php
namespace antgoods\goods\controllers;
use antgoods\goods\logic\goods\GoodsManager;
use common\models\ars\File;
use Yii;
use antgoods\goods\models\ars\Category;
use antgoods\goods\models\searchs\CategorySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* CategoryController implements the CRUD actions for Category model.
*/
class CategoryController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'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();
$model->is_show = Category::IS_SHOW_DISPLAY;
$model->sort_order = 0;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
//类目图片上传保存处理
$icon_image_id_str = $model->iconImageId;
$model->save();
$save_icon_image_res = GoodsManager::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()) && $model->validate()) {
//类目图片上传保存处理
$icon_image_id_str = $model->iconImageId;
$model->save();
$save_icon_image_res = GoodsManager::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);
}
}

359
vendor/antgoods/goods/src/controllers/GoodsController.php

@ -1,359 +0,0 @@
<?php
namespace antgoods\goods\controllers;
use antgoods\goods\models\ars\GoodsAttr;
use antgoods\goods\models\ars\GoodsSku;
use common\models\ars\OrderGoods;
use common\models\ars\TemFile;
use MongoDB\Driver\Manager;
use Yii;
use antgoods\goods\models\ars\Goods;
use antgoods\goods\models\searchs\GoodsSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use antgoods\goods\logic\goods\GoodsManager;
use common\models\ars\File;
use yii\web\Response;
use antgoods\goods\models\ars\Attribute;
/**
* GoodsController implements the CRUD actions for Goods model.
*/
class GoodsController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
public function actions()
{
return [
'upload' => [
'class' => 'iron\actions\UploadAction',
'path' => 'xls/',
'maxSize' => 20480,
],
'ueditor' => [
'class' => 'common\widgets\ueditor\UeditorAction',
'config' => [
//上传图片配置
'imageUrlPrefix' => "", /* 图片访问路径前缀 */
'imagePathFormat' => "/uploads/origin/introduce/" . md5(time() . rand(000, 999)), /* 上传保存路径,可以自定义保存路径和文件名格式 */
]
],
];
}
/**
* 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();
$model->is_sale = Goods::IS_SALE_YES;
$model->stock = -1;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
//商品封面图和商品详情图上传保存处理
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model);
if ($res['status']) {
return $this->redirect('index');
}
} else {
$model->ruleVerify = 1;
}
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_str = $model->image;
$detail_image_old_id_str = $model->detailImageId;
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
//商品封面图和商品详情图上传保存处理
$res = GoodsManager::updateGoods(Yii::$app->request->post(), $model, $cover_image_old_id_str, $detail_image_old_id_str);
if ($res['status']) {
return $this->redirect('index');
}
}
$attributeModel = GoodsManager::getAttribute($id);
$checkAttr = GoodsManager::getSkuInfo($id);
$filterAttributeModel = GoodsManager::getFilterAttribute($id);
$judgeGoodsCategory = GoodsManager::judgeGoodsCategory($model);
return $this->render('update', [
'model' => $model,
'attributeModel' => $attributeModel,
'attrValue' => $checkAttr,
'filterAttributeModel' => $filterAttributeModel,
'judgeGoodsCategory' => $judgeGoodsCategory,
]);
}
/**
* 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)
{
$model = $this->findModel($id);
$model->is_delete = Goods::IS_DELETE_YES;
$model->save();
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;
}
$rule_verify = Yii::$app->request->get('ruleverify');
$file_id_str = Yii::$app->request->get('fileidstr');
$file_id_arr = explode(',', $file_id_str);
if ($rule_verify == 1) {
$data = \common\models\ars\TemFile::find()->where(['id' => $file_id_arr])->all();
} else {
$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);
}
/**
* @param $id
* @return string
* 商品编辑sku
*/
public function actionEditSku($id)
{
$sku = GoodsManager::getCreatedSku($id);
$attributes = GoodsManager::getAttrs($id);
return $this->render('sku_edit', [
'attributes' => $attributes,
'sku' => $sku,]);
}
/**
* @return array
* @throws \Throwable
* 添加sku
*/
public function actionAddSku()
{
$data = [];
Yii::$app->response->format = 'json';
$res = Yii::$app->request->post('sku');
$goodsId = Yii::$app->request->post('goodsId');
$tra = Yii::$app->db->beginTransaction();
try {
$data['originalIds'] = GoodsManager::getOriginalIds($res['type'], $goodsId);
$data['acceptIds'] = [];
foreach ($res['data'] as $sku) {
GoodsManager::AddOrUpdateData($sku, $res['type'], $goodsId);
if ($sku['id'] > 0) {
$data['acceptIds'][] = $sku['id'];
}
}
GoodsManager::deleteSku($res['type'], $data, $goodsId);
$tra->commit();
return ['status' => true];
} catch (\Exception $e) {
$tra->rollBack();
return ['status' => false, 'info' => $e->getMessage()];
}
}
public function actionSwitch()
{
Yii::$app->response->format = 'json';
$data = [];
$type = Yii::$app->request->get('type');
$id = Yii::$app->request->get('goodsId');
$data['sku'] = GoodsManager::getCreatedSku($id, $type);
$data['attributes'] = GoodsManager::getAttrs($id, $type);
return $data;
}
/**
* @return false|string
* 根据商品分类获取商品属性
*/
public function actionFilterAttribute()
{
$catId = Yii::$app->request->get('catId')??0;
$goodsId = Yii::$app->request->get('goodsId')??0;
$allAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR])->andWhere(['cat_id' => [0,$catId]])->asArray()->all();
return json_encode($allAttr);
}
}

287
vendor/antgoods/goods/src/controllers/ShopCategoryController.php

@ -1,287 +0,0 @@
<?php
namespace antgoods\goods\controllers;
use antgoods\goods\logic\goods\GoodsManager;
use common\models\ars\File;
use Yii;
use antgoods\goods\models\ars\ShopCategory;
use antgoods\goods\models\searchs\ShopCategorySearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* ShopcategoryController implements the CRUD actions for ShopCategory model.
*/
class ShopCategoryController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'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();
$model->is_show = ShopCategory::IS_SHOW_HIDE;
$model->sort_order = 0;
if ($model->load(Yii::$app->request->post())) {
if ($model->filter_attr != null && is_array($model->filter_attr)) {
$model->filter_attr = implode(',', $model->filter_attr);
} else {
$model->filter_attr = '';
}
//类目图片上传保存处理
$icon_image_id_str = $model->iconImageId;
$model->save();
$save_icon_image_res = GoodsManager::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);
if ($model->filter_attr != null) {
$model->filter_attr = explode(',', $model->filter_attr);
}
$model->iconImageId = $model->icon;
$icon_image_old_id_arr = $model->icon;//记录已保存的类目图片id,用于修改
if ($model->load(Yii::$app->request->post())) {
if ($model->filter_attr != null && is_array($model->filter_attr)) {
$model->filter_attr = implode(',', $model->filter_attr);
} else {
$model->filter_attr = '';
}
//类目图片上传保存处理
$icon_image_id_str = $model->iconImageId;
$model->save();
$save_icon_image_res = GoodsManager::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)
{
$model = $this->findModel($id);
$model->is_delete = ShopCategory::IS_DELETE_YES;
$model->save();
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);
}
}

151
vendor/antgoods/goods/src/controllers/SupplierController.php

@ -1,151 +0,0 @@
<?php
namespace antgoods\goods\controllers;
use Yii;
use antgoods\goods\models\ars\Supplier;
use antgoods\goods\models\searchs\SupplierSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* SupplierController implements the CRUD actions for Supplier model.
*/
class SupplierController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Supplier models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new SupplierSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
]);
}
/**
* Displays a single Supplier 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 Supplier model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Supplier();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Supplier 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 Supplier 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 = Supplier::IS_DELETE_YES;
$model->save();
return $this->redirect(['index']);
}
/**
* Finds the Supplier model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Supplier the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Supplier::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @author iron
* 文件导出
*/
public function actionExport()
{
$searchModel = new SupplierSearch();
$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' =>'Suppliers'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
}

578
vendor/antgoods/goods/src/logic/goods/GoodsManager.php

@ -1,578 +0,0 @@
<?php
namespace antgoods\goods\logic\goods;
use common\models\ars\File;
use Yii;
use yii\base\Exception;
use antgoods\goods\models\ars\GoodsAttr;
use antgoods\goods\models\ars\Attribute;
use antgoods\goods\models\ars\GoodsSku;
use antgoods\goods\models\ars\Goods;
use antgoods\goods\models\ars\FilterAttr;
use antgoods\goods\models\ars\Category;
class GoodsManager
{
/**
* @param $newFileIdArr
* @param $goodsModel
* @param array $oldFileIdArr
* @param int $fileType
* @return array
* 保存新文件,删除不需要的文件操作
*/
public static function saveFile($newFileIdArr, $goodsModel, $oldFileIdArr = [], $fileType = 1)
{
//判断类名是否存在
if(!class_exists('\backend\logic\file\FileManager') || !class_exists('\common\models\ars\File')) {
return ['status' => false, 'info' => '操作失败'];
}
//需要新建的文件id
$createFileIdArr = array_diff($newFileIdArr, $oldFileIdArr);
//创建文件
$class = new \backend\logic\file\FileManager();
$createFileRes = $class->saveTemFileToFile($createFileIdArr, $goodsModel->id, $fileType);
//需要删除的文件id
$delFileIdArr = array_diff($oldFileIdArr, $newFileIdArr);
//删除文件
$class->deleteFile($delFileIdArr);
//记录第一张图片id
$firstFileId = 0;
//查看修改数组是否为空
if (!$newFileIdArr[0]) {
$firstFileId = null;
}else {
if ($createFileRes['status']) {
$firstFileId = $createFileRes['first_file_id'];
}
}
return ['status' => true, 'info' => '操作成功', 'first_file_id' => $firstFileId];
}
/**
* @param $data
* @param $model
* @param null $coverImageOldIdStr
* @param null $detailImageOldIdStr
* @return array
* @throws \Throwable
* 创建修改商品操作
*/
public static function updateGoods($data, $model, $coverImageOldIdStr = null, $detailImageOldIdStr = null)
{
$attribute = $data['attribute'];
$filterAttribute = $data['filterattribute'];
$tra = Yii::$app->db->beginTransaction();
try {
if (!$model->save()) {
throw new Exception('');
}
$saveCoverImageRes = self::saveFile(explode(',', $model->coverImageId), $model, explode(',', $coverImageOldIdStr));
$saveDetailImageRes = self::saveFile(explode(',', $model->detailImageId), $model, explode(',', $detailImageOldIdStr), File::OWN_TYPE_GOODS_DETAILS);
if ($saveCoverImageRes['status'] && $saveDetailImageRes['status']) {
if($saveCoverImageRes['first_file_id'] !== 0) {
$model->image = $saveCoverImageRes['first_file_id'];
if (!$model->save()) {
throw new Exception('图片保存失败');
}
}
} else {
throw new Exception('图片保存失败');
}
self::addAttributeOperating(['id' => $model->id, 'attribute' => $attribute]);
self::addFilterAttributeOperating(['id' => $model->id, 'filterAttribute' => $filterAttribute]);
$tra->commit();
return ['status' => true];
} catch (\yii\base\Exception $e) {
$tra->rollBack();
return ['status' => false, 'info' => $e->getMessage()];
}
}
/**
* @param $data
* @return bool
* @throws Exception
* 创建修改商品属性操作
*/
public static function addAttributeOperating($data)
{
if (!$data['attribute']) {
return true;
}
$data['attribute'] = json_decode($data['attribute'], true);
$oldAttr = [];
$goodsAttr = GoodsAttr::find()->where(['goods_id' => $data['id'], 'is_delete' => GoodsAttr::IS_DELETE_NO])->all();
if ($goodsAttr) { //如果商品有旧的属性
if(count($data['attribute']) == 0 && is_array($data['attribute'])) { //如果传上来的是空数组,删除该商品下的全部属性
self::delAttribute($goodsAttr);
return true;
}
foreach ($goodsAttr as $key => $value) { //把旧的商品属性保存到一个数组
$oldAttr[$value->id] = $value->attr_value;
}
}
$newAttr = self::addAttribute($data['attribute'], $data['id']); //添加新的商品属性
$delAttr = array_diff(array_keys($oldAttr), array_keys($newAttr)); //找出需要删除的goodsAttrId
if (!$delAttr) {
return true;
}
foreach ($delAttr as $value) {
$model = GoodsAttr::find()->where(['id' => $value, 'is_delete' => GoodsAttr::IS_DELETE_NO])->One();
if ($model) {
$model->is_delete = GoodsAttr::IS_DELETE_YES;
if (!$model->save()) {
throw new Exception('goodsAttribute delete false');
}
}
}
}
/**
* @param $goodsAttr
* @throws Exception
* 删除商品属性
*/
public static function delAttribute($goodsAttr)
{
foreach ($goodsAttr as $key => $value) {
$value->is_delete = GoodsAttr::IS_DELETE_YES;
if (!$value->save()) {
throw new Exception('goods attribute delete false');
}
}
}
/**
* @param $attribute
* @param $goodsId
* @return array
* @throws Exception
* 保存商品属性
*/
public static function addAttribute($attribute, $goodsId)
{
$newAttr = [];
if (!$attribute) {
return [];
}
foreach ($attribute as $value) {
foreach ($value['value'] as $k => $v) {
$goodsAttrModel = new GoodsAttr();
$goodsAttrModel->attr_id = $value['id'];
$attr = GoodsAttr::find()->where(['goods_id' => $goodsId, 'attr_id' => $value['id'], 'attr_value' => $v, 'is_delete' => GoodsAttr::IS_DELETE_NO])->one();
if ($attr) {
$newAttr[$attr->id] = $attr->attr_value; //原有的数据
} else {
$goodsAttrModel->goods_id = $goodsId;
$goodsAttrModel->attr_value = $v;
if (!$goodsAttrModel->save()) {
throw new Exception('goodsAttribute save false');
}
$newAttr[$goodsAttrModel->id] = $goodsAttrModel->attr_value; //新增的数据
}
}
}
return $newAttr;
}
/**
* @param $id
* @return Attribute|array|null
* 获取属性信息
*/
public static function getAttribute($id)
{
$goodsAttributes = GoodsAttr::find()->where(['goods_id' => $id, 'is_delete' => GoodsAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->all();
$filter = [];
$goodsAttributeModel = [];
if (!$goodsAttributes) {
return $goodsAttributeModel;
}
foreach ($goodsAttributes as $key => $value) {
$attribute = Attribute::findOne($value->attr_id);
if (!in_array($attribute->name, $filter)) {
$filter[] = $attribute->name;
$attribute = ['name' => $attribute->name, 'id' => $attribute->id, 'value' => [$value->attr_value]];
$goodsAttributeModel[] = $attribute;
} else {
foreach ($goodsAttributeModel as $k => $v) {
if ($v['name'] == $attribute->name) {
$goodsAttributeModel[$k]['value'][] = $value->attr_value;
}
}
}
}
return $goodsAttributeModel;
}
/**
* @param $id
* @return array
* 获取sku信息
*/
public static function getSkuInfo($id)
{
$skus = GoodsSku::find()->where(['goods_id' => $id, 'is_delete' => GoodsSku::IS_DELETE_NO])->all();
$attrId = [];
foreach ($skus as $sku) {
$attrId = array_merge(explode(',', $sku->goods_attr), $attrId);
}
$attrs = GoodsAttr::find()->where(['id' => $attrId, 'is_delete' => GoodsAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->all();
$checkAttr = [];
$filterAttr = [];
foreach ($attrs as $value) {
$attr = Attribute::findOne(['id' => $value->attr_id, 'is_delete' => Attribute::IS_DELETE_NO]);
if (!in_array($attr->name, $filterAttr)) {
$filterAttr[] = $attr->name;
$newAttr = ['id' => $attr->id, 'name' => $attr->name, 'value' => [$value->attr_value]];
$checkAttr[] = $newAttr;
} else {
foreach ($checkAttr as $key => $item) {
if ($item['name'] == $attr->name) { //如果attr_id与$filter的attr_id相符,入栈
$checkAttr[$key]['value'][] = $value->attr_value;
}
}
}
}
return $checkAttr;
}
/**
* @param $id
* @return mixed
* 已创建sku信息
*/
public static function getCreatedSku($id, $type = 0)
{
$goods = Goods::findOne($id);
$data['type'] = $type ?: $goods->sku_mode;
$data['data'] = [];
if ($data['type'] == Goods::SKU_MODE_ATTR) {
$sku = GoodsSku::find()
->where(['goods_id' => $id, 'is_manaul' => 0])
->all();
} else {
$sku = GoodsSku::find()
->where(['goods_id' => $id, 'is_manaul' => 1])
->all();
}
foreach ($sku as $value) {
$data['data'][] = self::getAttrInfo($data['type'], $value);
}
return $data;
}
/**
* @param $type
* @param $sku
* @return array
* 获取商品详情
*/
public static function getAttrInfo($type, $sku)
{
$data = [];
if ($type == Goods::SKU_MODE_ATTR) {
$data['value'] = array_filter(explode(',', $sku->goods_attr));
} else {
$attr = explode(',', $sku->goods_attr);
$goodsAttr = GoodsAttr::findOne($attr[0]);
$data['value'] = $goodsAttr->attr_value;
}
$data['id'] = $sku->id;
$data['price'] = $sku->price;
$data['stock'] = $sku->stock;
$data['weight'] = $sku->weight;
return $data;
}
/**
* @param $id
* @return array
* 获取商品属性
*/
public static function getAttrs($id)
{
$attrId = GoodsAttr::find()->where(['goods_id' => $id, 'is_delete' => GoodsAttr::IS_DELETE_NO])
->andWhere(['>', 'attr_id', 0])
->select('attr_id')
->distinct()
->all();
$attributes = [];
foreach ($attrId as $v) {
$attribute = Attribute::findOne($v);
if ($attribute && $attribute->type == Attribute::TYPE_ATTR) {
$ret['name'] = $attribute->name;
$ret['id'] = $attribute->id;
$ret['attrValue'] = self::getAttrValue($attribute->id, $id);
$attributes[] = $ret;
}
}
return $attributes;
}
/**
* @param $attrId
* @param $goodsId
* @return GoodsAttr[]|GoodsSku[]|array|File[]|\common\models\ars\TemFile[]|\yii\db\ActiveRecord[]
* 获取属性值
*/
public static function getAttrValue($attrId, $goodsId)
{
return GoodsAttr::find()
->select(['id', 'attr_value'])
->where(['goods_id' => $goodsId])
->andWhere(['attr_id' => $attrId])
->asArray()
->all();
}
/**
* @param $type
* @param $goodsId
* @return array
* 获取已存储的商品sku的id
*/
public static function getOriginalIds($type, $goodsId)
{
$ids = [];
if ($type == Goods::SKU_MODE_MANUAL) {
$query = GoodsSku::find()
->where(['is_manaul' => 1]);
} else {
$query = GoodsSku::find()
->where(['is_manaul' => 0]);
}
$sku = $query
->andWhere(['goods_id' => $goodsId])
->all();
foreach ($sku as $value) {
$ids[] = $value->id;
}
return $ids;
}
/**
* @param $sku
* @throws \yii\db\Exception
* 添加或更新sku数据
*/
public static function AddOrUpdateData($sku, $type, $goodsId)
{
$goodsModel = Goods::findOne($goodsId);
if ($sku['id'] > 0) {
$goodsSku = GoodsSku::findOne($sku['id']);
$attrId = array_filter(explode(',', $goodsSku->goods_attr));
$attr = GoodsAttr::findOne($attrId[0]);
} else {
$goodsSku = new GoodsSku();
$attr = new GoodsAttr();
}
if (!$attr || !$goodsSku || !$goodsModel) {
throw new \yii\db\Exception('系统异常');
}
if ($type == Goods::SKU_MODE_MANUAL) {
$attr->attr_value = $sku['value'];
if (!$attr->save()) {
throw new \yii\db\Exception('手动属性修改失败');
}
$goodsSku->goods_attr = (string)$attr->id;
$goodsSku->is_manaul = 1;
} else {
$goodsSku->goods_attr = implode(',', array_filter($sku['value']));
}
$goodsSku->goods_id = $goodsId;
$goodsSku->price = $sku['price'];
$goodsSku->stock = $sku['stock'];
$goodsSku->weight = $sku['weight'];
$goodsSku->goods_sn = $goodsModel->sn;
if (!$goodsSku->save()) {
throw new \yii\db\Exception('保存失败,请检查是否有重复规格');
}
$goods = Goods::findOne($goodsId);
$goods->sku_mode = $type;
if (!$goods->save()) {
throw new \yii\db\Exception('商品sku类型修改失败');
}
}
/**
* @param $type
* @param $data
* @param $goodsId
* @return bool
* @throws \Throwable
* @throws \yii\db\StaleObjectException
* 删除sku
*/
public static function deleteSku($type, $data, $goodsId)
{
if (!$data['originalIds']) {
return true;
}
if ($type == Goods::SKU_MODE_MANUAL) {
$query = GoodsSku::find()
->where(['is_manaul' => 1]);
} else {
$query = GoodsSku::find()
->where(['is_manaul' => 0]);
}
$sku = $query
->andWhere(['goods_id' => $goodsId])
->andWhere(['in', 'id', $data['originalIds']])
->andWhere(['not in', 'id', $data['acceptIds']])
->all();
foreach ($sku as $value) {
$value->delete();
}
}
/**
* @param $data
* @return bool
* @throws Exception
* 创建修改商品筛选属性操作
*/
public static function addFilterAttributeOperating($data)
{
if (!$data['filterAttribute']) {
return true;
}
$data['filterAttribute'] = json_decode($data['filterAttribute'], true);
$oldFilterAttr = [];
$goodsFilterAttr = FilterAttr::find()->where(['goods_id' => $data['id'], 'is_delete' => FilterAttr::IS_DELETE_NO])->all();
if ($goodsFilterAttr) { //如果商品有旧的属性
if(count($data['filterAttribute']) == 0 && is_array($data['filterAttribute'])) { //如果传上来的是空数组,删除该商品下的全部属性
self::delFilterAttribute($goodsFilterAttr);
return true;
}
foreach ($goodsFilterAttr as $key => $value) { //把旧的商品属性保存到一个数组
$oldFilterAttr[$value->id] = $value->attr_value;
}
}
$newAttr = self::addFilterAttribute($data['filterAttribute'], $data['id']); //添加新的商品属性
$delAttr = array_diff(array_keys($oldFilterAttr), array_keys($newAttr)); //找出需要删除的goodsAttrId
if (!$delAttr) {
return true;
}
foreach ($delAttr as $value) {
$model = FilterAttr::find()->where(['id' => $value, 'is_delete' => FilterAttr::IS_DELETE_NO])->One();
if ($model) {
$model->is_delete = FilterAttr::IS_DELETE_YES;
if (!$model->save()) {
throw new Exception('goodsAttribute delete false');
}
}
}
}
/**
* @param $goodsFilterAttr
* @throws Exception
* 删除商品筛选属性
*/
public static function delFilterAttribute($goodsFilterAttr)
{
foreach ($goodsFilterAttr as $key => $value) {
$value->is_delete = FilterAttr::IS_DELETE_YES;
if (!$value->save()) {
throw new Exception('goods attribute delete false');
}
}
}
/**
* @param $attribute
* @param $goodsId
* @return array
* @throws Exception
* 保存商品筛选属性
*/
public static function addFilterAttribute($attribute, $goodsId)
{
$newAttr = [];
if (!$attribute) {
return [];
}
foreach ($attribute as $value) {
foreach ($value['value'] as $k => $v) {
$goodsFilterAttrModel = new FilterAttr();
$goodsFilterAttrModel->attr_id = $value['id'];
$attr = FilterAttr::find()->where(['goods_id' => $goodsId, 'attr_id' => $value['id'], 'attr_value' => $v, 'is_delete' => FilterAttr::IS_DELETE_NO])->one();
if ($attr) {
$newAttr[$attr->id] = $attr->attr_value; //原有的数据
} else {
$goodsFilterAttrModel->goods_id = $goodsId;
$goodsFilterAttrModel->attr_value = $v;
if (!$goodsFilterAttrModel->save()) {
throw new Exception('goodsAttribute save false');
}
$newAttr[$goodsFilterAttrModel->id] = $goodsFilterAttrModel->attr_value; //新增的数据
}
}
}
return $newAttr;
}
/**
* @param $id
* @return Attribute|array|null
* 获取筛选属性信息
*/
public static function getFilterAttribute($id)
{
$goodsFilterAttributes = FilterAttr::find()->where(['goods_id' => $id, 'is_delete' => FilterAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->all();
$filter = [];
$goodsFilterAttributeModel = [];
if (!$goodsFilterAttributes) {
return $goodsFilterAttributeModel;
}
foreach ($goodsFilterAttributes as $key => $value) {
$attribute = Attribute::findOne($value->attr_id);
if (!in_array($attribute->name, $filter)) {
$filter[] = $attribute->name;
$attribute = ['name' => $attribute->name, 'id' => $attribute->id, 'value' => [$value->attr_value]];
$goodsFilterAttributeModel[] = $attribute;
} else {
foreach ($goodsFilterAttributeModel as $k => $v) {
if ($v['name'] == $attribute->name) {
$goodsFilterAttributeModel[$k]['value'][] = $value->attr_value;
}
}
}
}
return $goodsFilterAttributeModel;
}
/**
* @param $goodsModel
* @return bool
*
*/
public static function judgeGoodsCategory($goodsModel)
{
$skus = GoodsSku::find()->where(['goods_id' => $goodsModel->id, 'is_delete' => GoodsSku::IS_DELETE_NO])->all();
$attrId = [];
foreach ($skus as $sku) {
$attrId = array_merge(explode(',', $sku->goods_attr), $attrId);
}
$goodsAttr = array_unique(GoodsAttr::find()->select(['attr_id'])->where(['id' => $attrId, 'is_delete' => GoodsAttr::IS_DELETE_NO])->andWhere(['!=', 'attr_id', 0])->column());
$attrArr = array_unique(Attribute::find()->select(['cat_id'])->where(['is_delete' => Attribute::IS_DELETE_NO, 'id' => $goodsAttr])->column());
if (in_array($goodsModel->cat_id, $attrArr)) {
return true; //存在,则返回true,表示后台分类不得修改
}
return false; //否则返回false,表示后台分类可以修改
}
public static function categoryBtreeList()
{
}
}

42
vendor/antgoods/goods/src/migrations/m191119_021851_create_table_shop_category.php

@ -1,42 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_021851_create_table_shop_category
*/
class m191119_021851_create_table_shop_category extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="前端商品类别表"';
$this->createTable('antgoods_shop_category', [
'id' => $this->primaryKey(),
'name'=>$this->string(60)->notNull()->comment('类别名称'),
'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'),
'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(0)->comment('排序'),
'icon_type'=>$this->tinyInteger(1)->defaultValue(null)->comment('图标类型'),
'icon'=>$this->string(64)->defaultValue(null)->comment('图标'),
'filter_attr'=>$this->text()->comment('筛选属性'),
'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);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_shop_category');
return true;
}
}

39
vendor/antgoods/goods/src/migrations/m191119_022641_create_table_category.php

@ -1,39 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_022641_create_table_category
*/
class m191119_022641_create_table_category extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="后台商品类别表"';
$this->createTable('antgoods_category', [
'id' => $this->primaryKey(),
'name'=>$this->string(60)->notNull()->comment('类别名称'),
'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'),
'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(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);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_category');
return true;
}
}

36
vendor/antgoods/goods/src/migrations/m191119_022939_create_table_attribute.php

@ -1,36 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_022939_create_table_attribute
*/
class m191119_022939_create_table_attribute extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="属性表"';
$this->createTable('antgoods_attribute', [
'id' => $this->primaryKey(),
'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(0)->comment('是否删除,1为已删除'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
],$tableOptions);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_attribute');
return true;
}
}

35
vendor/antgoods/goods/src/migrations/m191119_023115_create_table_goods_attr.php

@ -1,35 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_023115_create_table_goods_attr
*/
class m191119_023115_create_table_goods_attr extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="商品属性表"';
$this->createTable('antgoods_goods_attr', [
'id' => $this->primaryKey(),
'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);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_goods_attr');
return true;
}
}

33
vendor/antgoods/goods/src/migrations/m191119_024029_create_table_brand.php

@ -1,33 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_024029_create_table_brand
*/
class m191119_024029_create_table_brand extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="品牌表"';
$this->createTable('antgoods_brand', [
'id' => $this->primaryKey(),
'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);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_brand');
return true;
}
}

27
vendor/antgoods/goods/src/migrations/m191119_024205_create_table_goods.php

@ -1,27 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_024205_create_table_goods
*/
class m191119_024205_create_table_goods extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$sql = file_get_contents(__DIR__."/sql/goods.sql");
$this->execute($sql);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable("antgoods_goods");
return true;
}
}

27
vendor/antgoods/goods/src/migrations/m191119_024345_create_table_goods_sku.php

@ -1,27 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_024345_create_table_goods_sku
*/
class m191119_024345_create_table_goods_sku extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$sql = file_get_contents(__DIR__."/sql/goods_sku.sql");
$this->execute($sql);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable("antgoods_goods_sku");
return true;
}
}

36
vendor/antgoods/goods/src/migrations/m191119_025607_create_table_supplier.php

@ -1,36 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_025607_create_table_supplier
*/
class m191119_025607_create_table_supplier extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="供应商表"';
$this->createTable('antgoods_supplier', [
'id' => $this->primaryKey(),
'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('更新时间'),
],$tableOptions);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_supplier');
return true;
}
}

35
vendor/antgoods/goods/src/migrations/m191119_025843_create_table_filter_attr.php

@ -1,35 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191119_025843_create_table_filter_attr
*/
class m191119_025843_create_table_filter_attr extends Migration
{
/**
* {@inheritdoc}
*/
public function up()
{
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="筛选属性表"';
$this->createTable('antgoods_filter_attr', [
'id' => $this->primaryKey(),
'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);
}
/**
* {@inheritdoc}
*/
public function down()
{
$this->dropTable('antgoods_filter_attr');
return true;
}
}

22
vendor/antgoods/goods/src/migrations/m191125_012449_update_column_icon_type_in_antgoods_category.php

@ -1,22 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191125_012449_update_column_icon_type_in_antgoods_category
*/
class m191125_012449_update_column_icon_type_in_antgoods_category extends Migration
{
public function up()
{
$this->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;
}
}

20
vendor/antgoods/goods/src/migrations/m191125_083820_drop_column_icon_type_in_table_antgoods_category.php

@ -1,20 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191125_083820_drop_column_icon_type_in_table_antgoods_category
*/
class m191125_083820_drop_column_icon_type_in_table_antgoods_category extends Migration
{
public function up()
{
$this->dropColumn('antgoods_category', 'icon_type');
}
public function down()
{
$this->addColumn('antgoods_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型'));
return true;
}
}

26
vendor/antgoods/goods/src/migrations/m191125_084547_update_column_pid_and_icon_in_table_antgoods_category.php

@ -1,26 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191125_084547_update_column_pid_and_icon_in_table_antgoods_category
*/
class m191125_084547_update_column_pid_and_icon_in_table_antgoods_category extends Migration
{
public function up()
{
$this->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;
}
}

20
vendor/antgoods/goods/src/migrations/m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category.php

@ -1,20 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category
*/
class m191125_104137_drop_column_icon_type_in_table_antgoods_shop_category extends Migration
{
public function up()
{
$this->dropColumn('antgoods_shop_category', 'icon_type');
}
public function down()
{
$this->addColumn('antgoods_shop_category', 'icon_type', $this->tinyInteger(1)->defaultValue(null)->comment('图标类型'));
return true;
}
}

26
vendor/antgoods/goods/src/migrations/m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category.php

@ -1,26 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category
*/
class m191125_104510_update_column_pid_and_icon_in_table_antgoods_shop_category extends Migration
{
public function up()
{
$this->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;
}
}

20
vendor/antgoods/goods/src/migrations/m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku.php

@ -1,20 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku
*/
class m191127_114228_add_column_is_manaul_in_table_antgoods_goods_sku extends Migration
{
public function up()
{
$this->addColumn('antgoods_goods_sku', 'is_manaul', $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('是否手动'));
}
public function down()
{
$this->dropColumn('antgoods_goods_sku', 'is_manaul');
return true;
}
}

20
vendor/antgoods/goods/src/migrations/m191129_010349_add_column_sku_mode_in_antgoods_goods.php

@ -1,20 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191129_010349_add_column_sku_mode_in_antgoods_goods
*/
class m191129_010349_add_column_sku_mode_in_antgoods_goods extends Migration
{
public function up()
{
$this->addColumn('antgoods_goods', 'sku_mode', $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('sku类型'));
}
public function down()
{
$this->dropColumn('antgoods_goods', 'sku_mode');
return true;
}
}

26
vendor/antgoods/goods/src/migrations/m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr.php

@ -1,26 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr
*/
class m191129_020131_add_columns_goods_id_and_attr_id_in_table_antgoods_goods_attr extends Migration
{
public function up()
{
$this->dropColumn('antgoods_goods_attr', 'goods_id');
$this->dropColumn('antgoods_goods_attr', 'attr_id');
$this->addColumn('antgoods_goods_attr', 'goods_id', $this->integer(11)->notNull()->defaultValue(0)->comment('商品id'));
$this->addColumn('antgoods_goods_attr', 'attr_id', $this->integer(11)->notNull()->defaultValue(0)->comment('属性id'));
}
public function down()
{
$this->dropColumn('antgoods_goods_attr', 'goods_id');
$this->dropColumn('antgoods_goods_attr', 'attr_id');
$this->addColumn('antgoods_goods_attr', 'goods_id', $this->integer(11)->notNull()->comment('商品id'));
$this->addColumn('antgoods_goods_attr', 'attr_id', $this->integer(11)->notNull()->comment('属性id'));
return true;
}
}

20
vendor/antgoods/goods/src/migrations/m191130_004933_add_column_cat_id_in_table_antgoods_attribute.php

@ -1,20 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191130_004933_add_column_cat_id_in_table_antgoods_attribute
*/
class m191130_004933_add_column_cat_id_in_table_antgoods_attribute extends Migration
{
public function up()
{
$this->addColumn('antgoods_attribute', 'cat_id', $this->integer(11)->notNull()->defaultValue(0)->comment('后台商品分类id'));
}
public function down()
{
$this->dropColumn('antgoods_attribute', 'cat_id');
return true;
}
}

27
vendor/antgoods/goods/src/migrations/m191202_082041_drop_columns_in_table_antgoods_goods_sku.php

@ -1,27 +0,0 @@
<?php
use yii\db\Migration;
/**
* Class m191202_082041_drop_columns_in_table_antgoods_goods_sku
*/
class m191202_082041_drop_columns_in_table_antgoods_goods_sku extends Migration
{
public function up()
{
$this->dropColumn('antgoods_goods_sku', 'weight');
$this->dropColumn('antgoods_goods_sku', 'length');
$this->dropColumn('antgoods_goods_sku', 'width');
$this->dropColumn('antgoods_goods_sku', 'height');
$this->dropColumn('antgoods_goods_sku', 'diameter');
}
public function down()
{
$this->addColumn('antgoods_goods_sku', 'weight', $this->integer(8)->defaultValue(null)->comment('重量'));
$this->addColumn('antgoods_goods_sku', 'length', $this->integer(8)->defaultValue(null)->comment('长度'));
$this->addColumn('antgoods_goods_sku', 'width', $this->integer(8)->defaultValue(null)->comment('宽度'));
$this->addColumn('antgoods_goods_sku', 'height', $this->integer(8)->defaultValue(null)->comment('高度'));
$this->addColumn('antgoods_goods_sku', 'diameter', $this->integer(8)->defaultValue(null)->comment('直径'));
}
}

37
vendor/antgoods/goods/src/migrations/sql/goods.sql

@ -1,37 +0,0 @@
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) 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',
`weight` mediumint(8) DEFAULT NULL unique COMMENT '重量',
`length` mediumint(8) DEFAULT NULL unique COMMENT '长度',
`width` mediumint(8) DEFAULT NULL unique COMMENT '宽度',
`height` mediumint(8) DEFAULT NULL unique COMMENT '高度',
`diameter` mediumint(8) DEFAULT NULL unique COMMENT '直径',
`unit` varchar(16) DEFAULT NULL COMMENT '单位',
`sold_count` int(10) DEFAULT NULL unique COMMENT '已售数量',
`limit_count` int(10) DEFAULT NULL COMMENT '限购数量',
`stock` int(10) DEFAULT NULL COMMENT '库存',
`stock_warn` int(10) DEFAULT NULL COMMENT '库存警告',
`market_price` int(20) DEFAULT NULL unique COMMENT '市场价',
`price` int(20) DEFAULT NULL unique COMMENT '销售价',
`brief` varchar(255) DEFAULT NULL COMMENT '简介',
`description` text COMMENT '详细介绍',
`image` int(11) DEFAULT NULL COMMENT '图片id',
`model_id` int(11) DEFAULT NULL COMMENT '模型id',
`is_sale` tinyint(1) DEFAULT '0' COMMENT '该商品是否开放销售,1为是,0为否',
`sort_order` smallint(3) DEFAULT NULL COMMENT '排序',
`bouns_points` mediumint(8) DEFAULT NULL COMMENT '奖励积分',
`experience_points` mediumint(8) DEFAULT NULL COMMENT '经验值',
`is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除',
`express_template` int(11) DEFAULT NULL COMMENT '配送详情id',
`created_at` int(10) DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品表';

24
vendor/antgoods/goods/src/migrations/sql/goods_sku.sql

@ -1,24 +0,0 @@
DROP TABLE IF EXISTS `antgoods_goods_sku`;
CREATE TABLE `antgoods_goods_sku` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`goods_id` int(11) NOT NULL COMMENT '商品id',
`goods_code` varchar(50) 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 '长度',
`width` mediumint(8) DEFAULT NULL COMMENT '宽度',
`height` mediumint(8) DEFAULT NULL COMMENT '高度',
`diameter` mediumint(8) DEFAULT NULL COMMENT '直径',
`sold_count` int(10) DEFAULT NULL COMMENT '已售数量',
`stock` int(10) DEFAULT NULL COMMENT '库存',
`market_price` int(20) DEFAULT NULL COMMENT '市场价',
`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 '0' COMMENT '排序',
`is_delete` tinyint(1) DEFAULT '0' COMMENT '是否删除,1为已删除',
`created_at` int(10) DEFAULT '0' COMMENT '创建时间',
`updated_at` int(10) DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商品sku表';

111
vendor/antgoods/goods/src/models/ars/Attribute.php

@ -1,111 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
use antgoods\goods\models\ars\Category;
/**
* This is the model class for table "antgoods_attribute".
*
* @property int $id
* @property string $name 属性名
* @property string $value 属性值
* @property int $type 类型
* @property int $sort_order 排序
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
* @property int $cat_id 后台商品分类id
*/
class Attribute extends \yii\db\ActiveRecord
{
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
//类型type
const TYPE_ATTR = 1;//商品sku属性
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_attribute';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name', 'value'], 'required'],
[['value'], 'string'],
[['type', 'sort_order', 'is_delete', 'cat_id'], 'integer'],
[['name'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => '规格名称',
'value' => '规格内容(每项以逗号隔开)',
'type' => '类型',
'sort_order' => '排序',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
'cat_id' => '后台商品分类',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
/**
* @return array
* 数据键值对
*/
public static function modelColumn()
{
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
public function beforeSave($insert)
{
if(!$this->type){
$this->type = self::TYPE_ATTR;
}
return parent::beforeSave($insert); // TODO: Change the autogenerated stub
}
public function getCategory()
{
return $this->hasOne(Category::className(), ['id' => 'cat_id']);
}
}

82
vendor/antgoods/goods/src/models/ars/Brand.php

@ -1,82 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_brand".
*
* @property int $id
* @property string $name 品牌名
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Brand extends \yii\db\ActiveRecord
{
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_brand';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['is_delete'], 'integer'],
[['name'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => '品牌名',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
public static function modelColumn()
{
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
}

114
vendor/antgoods/goods/src/models/ars/Category.php

@ -1,114 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
use common\models\ars\File;
/**
* This is the model class for table "antgoods_category".
*
* @property int $id
* @property string $name 类别名称
* @property int $pid 父级id
* @property int $goods_count 商品数量
* @property int $sort_order 排序
* @property int $icon 图标
* @property int $is_show 是否显示,1为不显示
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Category extends \yii\db\ActiveRecord
{
public $iconImageId;
public $iconImagePath;
//是否显示is_show
const IS_SHOW_DISPLAY = 0;//显示
const IS_SHOW_HIDE = 1;//隐藏
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
public static $isShow = [
self::IS_SHOW_DISPLAY => '显示',
self::IS_SHOW_HIDE => '隐藏'
];
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_category';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'icon'], 'integer'],
[['name'], 'string', 'max' => 60],
[['iconImageId'], 'string'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => '类别名称',
'pid' => '父级',
'goods_count' => '商品数量',
'sort_order' => '排序',
'icon' => '图标',
'is_show' => '是否显示',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
/**
* @return array
* 数据键值对
*/
public static function modelColumn()
{
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
public function getIconFile()
{
return $this->hasOne(File::className(), ['id' => 'icon']);
}
}

81
vendor/antgoods/goods/src/models/ars/FilterAttr.php

@ -1,81 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_filter_attr".
*
* @property int $id
* @property int $goods_id 商品id
* @property int $attr_id 属性id
* @property string $attr_value 属性值
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class FilterAttr extends \yii\db\ActiveRecord
{
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_filter_attr';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['goods_id', 'attr_id', 'attr_value'], 'required'],
[['goods_id', 'attr_id', 'is_delete'], 'integer'],
[['attr_value'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'goods_id' => '商品id',
'attr_id' => '属性id',
'attr_value' => '属性值',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
}

232
vendor/antgoods/goods/src/models/ars/Goods.php

@ -1,232 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
use antgoods\goods\models\ars\Category;
use antgoods\goods\models\ars\ShopCategory;
use common\models\ars\File;
use antgoods\goods\models\ars\Brand;
use antgoods\goods\models\ars\Supplier;
/**
* This is the model class for table "antgoods_goods".
*
* @property int $id
* @property int $pid 父级id
* @property int $cat_id 后台商品类别id
* @property int $brand_id 品牌id
* @property int $shop_cat_id 前端商品类别id
* @property string $name 商品名称
* @property string $sn 商品唯一货号
* @property string $code 商品货码
* @property int $supplier_id 供应商id
* @property int $weight 重量
* @property int $length 长度
* @property int $width 宽度
* @property int $height 高度
* @property int $diameter 直径
* @property string $unit 单位
* @property int $sold_count 已售数量
* @property int $limit_count 限购数量
* @property int $stock 库存
* @property int $stock_warn 库存警告
* @property int $market_price 市场价
* @property int $price 销售价
* @property string $brief 简介
* @property string $description 详细介绍
* @property int $image 图片id
* @property int $model_id 模型id
* @property int $is_sale 该商品是否开放销售,1为是,0为否
* @property int $sort_order 排序
* @property int $bouns_points 奖励积分
* @property int $experience_points 经验值
* @property int $is_delete 是否删除,1为已删除
* @property int $express_template 配送详情id
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
* @property int $sku_mode sku类型
*/
class Goods extends \yii\db\ActiveRecord
{
//商品封面图
public $coverImagePath;
public $coverImageId;
//商品详情图
public $detailImagePath;
public $detailImageId;
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
//该商品是否开放销售is_sale
const IS_SALE_NO = 0;//否
const IS_SALE_YES = 1;//是
//sku类型
const SKU_MODE_ATTR = 1;//SKU类型属性
const SKU_MODE_MANUAL = 2;//SKU类型手写
public static $isSale = [
self::IS_SALE_NO => '不在售',
self::IS_SALE_YES => '在售'
];
public $ruleVerify = 0;//规则验证是否通过
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_goods';
}
/**
* {@inheritdoc}
*/
public function rules()
{
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', 'sku_mode'], 'integer'],
[['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],
[['unit'], 'string', 'max' => 16],
[['brief'], 'string', 'max' => 255],
[['weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'market_price', 'price'], 'checkNegative'],
];
}
/**
* @param $attribute
* @param $params
* 验证是否为负数
*/
public function checkNegative($attribute, $params)
{
if ($this->$attribute < 0) {
$this->addError($attribute, "不得为负数");
}
}
/**
* @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}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'pid' => '父级id',
'cat_id' => '后台商品类别',
'brand_id' => '品牌',
'shop_cat_id' => '前端商品类别',
'name' => '商品名称',
'sn' => '商品唯一货号',
'code' => '商品货码',
'supplier_id' => '供应商',
'weight' => '重量',
'length' => '长度',
'width' => '宽度',
'height' => '高度',
'diameter' => '直径',
'unit' => '单位',
'sold_count' => '已售数量',
'limit_count' => '限购数量',
'stock' => '库存',
'stock_warn' => '库存警告',
'market_price' => '市场价',
'price' => '销售价',
'brief' => '简介',
'description' => '详细介绍',
'image' => '首页图片',
'model_id' => '模型id',
'is_sale' => '销售状态',
'sort_order' => '排序',
'bouns_points' => '奖励积分',
'experience_points' => '经验值',
'is_delete' => '是否删除,1为已删除',
'express_template' => '配送详情id',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
/**
* @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
}
public function getCategory()
{
return $this->hasOne(Category::className(), ['id' => 'cat_id']);
}
public function getShopCategory()
{
return $this->hasOne(ShopCategory::className(), ['id' => 'shop_cat_id']);
}
public function getImageFile()
{
return $this->hasOne(File::className(), ['id' => 'image']);
}
public function getBrand()
{
return $this->hasOne(Brand::className(), ['id' => 'brand_id']);
}
public function getSupplier()
{
return $this->hasOne(Supplier::className(), ['id' => 'supplier_id']);
}
}

81
vendor/antgoods/goods/src/models/ars/GoodsAttr.php

@ -1,81 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_goods_attr".
*
* @property int $id
* @property int $goods_id 商品id
* @property int $attr_id 属性id
* @property string $attr_value 属性名
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class GoodsAttr extends \yii\db\ActiveRecord
{
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_goods_attr';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['attr_value'], 'required'],
[['goods_id', 'attr_id', 'is_delete'], 'integer'],
[['attr_value'], 'string', 'max' => 50],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'goods_id' => '商品id',
'attr_id' => '属性id',
'attr_value' => '属性名',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
}

102
vendor/antgoods/goods/src/models/ars/GoodsSku.php

@ -1,102 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_goods_sku".
*
* @property int $id
* @property int $goods_id 商品id
* @property string $goods_code 商品条码
* @property string $goods_sn 商品唯一货号
* @property string $goods_attr 属性匹配
* @property int $sold_count 已售数量
* @property int $stock 库存
* @property int $market_price 市场价
* @property int $price 销售价
* @property int $model_id 模型id
* @property int $is_sale 该商品是否开放销售,1为是,0为否
* @property int $sort_order 排序
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
* @property int $is_manaul 是否手动
*/
class GoodsSku extends \yii\db\ActiveRecord
{
//是否手动is_manaul
const IS_MANUAL_YES = 1; //是手动
const IS_MANUAL_NO = 0; //不是手动
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_goods_sku';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['goods_id', 'goods_sn'], 'required'],
[['goods_id', 'diameter', 'sold_count', 'stock', 'market_price', 'price', 'model_id', 'is_sale', 'sort_order', 'is_delete', 'is_manaul'], 'integer'],
[['goods_code'], 'string', 'max' => 50],
[['goods_sn', 'goods_attr'], 'string', 'max' => 60],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'goods_id' => '商品id',
'goods_code' => '商品条码',
'goods_sn' => '商品唯一货号',
'goods_attr' => '属性匹配',
'sold_count' => '已售数量',
'stock' => '库存',
'market_price' => '市场价',
'price' => '销售价',
'model_id' => '模型id',
'is_sale' => '该商品是否开放销售,1为是,0为否',
'sort_order' => '排序',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
}

122
vendor/antgoods/goods/src/models/ars/ShopCategory.php

@ -1,122 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
use common\models\ars\File;
/**
* This is the model class for table "antgoods_shop_category".
*
* @property int $id
* @property string $name 类别名称
* @property int $pid 父级id
* @property int $goods_count 商品数量
* @property string $keywords 关键字
* @property string $desc 描述
* @property int $sort_order 排序
* @property string $icon 图标
* @property string $filter_attr 筛选属性
* @property int $is_show 是否显示,1为不显示
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class ShopCategory extends \yii\db\ActiveRecord
{
public $iconImageId;
public $iconImagePath;
//是否显示is_show
const IS_SHOW_DISPLAY = 0;//显示
const IS_SHOW_HIDE = 1;//隐藏
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
public static $isShow = [
self::IS_SHOW_DISPLAY => '显示',
self::IS_SHOW_HIDE => '隐藏'
];
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_shop_category';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['pid', 'goods_count', 'sort_order', 'icon', 'is_show', 'is_delete', 'iconImageId'], 'integer'],
[['filter_attr'], 'safe'],
[['name'], 'string', 'max' => 60],
[['keywords'], 'string', 'max' => 100],
[['desc'], 'string', 'max' => 255],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => '类别名称',
'pid' => '父级',
'goods_count' => '商品数量',
'keywords' => '关键字',
'desc' => '描述',
'sort_order' => '排序',
'icon' => '图标',
'filter_attr' => '筛选属性',
'is_show' => '是否显示',
'is_delete' => '是否删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
/**
* @return array
* 数据键值对
*/
public static function modelColumn()
{
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
public function getIconFile()
{
return $this->hasOne(File::className(), ['id' => 'icon']);
}
}

96
vendor/antgoods/goods/src/models/ars/Supplier.php

@ -1,96 +0,0 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_supplier".
*
* @property int $id
* @property string $name 供应商名称
* @property string $full_name 供应商全称
* @property string $phone 手机号码
* @property string $address 地址
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Supplier extends \yii\db\ActiveRecord
{
//是否删除is_delete
const IS_DELETE_NO = 0;//未删除
const IS_DELETE_YES = 1;//已删除
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_supplier';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name', 'full_name', 'phone', 'address'], 'required'],
[['is_delete'], 'integer'],
[['name', 'full_name', 'address'], 'string', 'max' => 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' => '手机号已被使用'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => '供应商名称',
'full_name' => '供应商全称',
'phone' => '手机号码',
'address' => '地址',
'is_delete' => '是否删除,1为已删除',
'created_at' => '创建时间',
'updated_at' => '更新时间',
];
}
/**
* @author linyao
* @email 602604991@qq.com
* @created Nov 8, 2019
*
* 行为存储创建时间和更新时间
*/
public function behaviors()
{
return [
[
'class' => TimestampBehavior::className(),
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {
return time();
},
],
];
}
/**
* @return array
* 数据键值对
*/
public static function modelColumn()
{
return $column = self::find()->select(['name'])->where(['is_delete' => self::IS_DELETE_NO])->indexBy('id')->column();
}
}

162
vendor/antgoods/goods/src/models/searchs/AttributeSearch.php

@ -1,162 +0,0 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\Attribute;
/**
* AttributeSearch represents the model behind the search form of `antgoods\goods\models\ars\Attribute`.
*/
class AttributeSearch extends Attribute
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'type', 'sort_order', 'is_delete', 'created_at', 'updated_at'], 'integer'],
[['name', 'value'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
'name',
'value',
'sort_order',
['attribute' => 'cat_id',
'value' => function ($model){
return $model->cat_id ? $model->category->name : '无限制';
},
],
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
'config' => [
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
],
];
}
/**
* @param $params
* @return ActiveDataProvider
* 不分页的所有数据
*/
public function allData($params)
{
$query = Attribute::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Attribute::find()->where(['is_delete' => Attribute::IS_DELETE_NO]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSizeLimit' => [1, 200]
],
'sort' => [
'defaultOrder' => [
'id' => SORT_DESC,
]
],
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* @param $query
* @param $dataProvider
* @return ActiveDataProvider
* 条件筛选
*/
private function filter($query, $dataProvider){
$query->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');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'type' => $this->type,
'sort_order' => $this->sort_order,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'value', $this->value]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
$end = strtotime($arr[1]) + 3600 * 24;
$query->andFilterWhere(['between', 'created_at', $start, $end]);
}
return $dataProvider;
}
}

152
vendor/antgoods/goods/src/models/searchs/BrandSearch.php

@ -1,152 +0,0 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\Brand;
/**
* BrandSearch represents the model behind the search form of `antgoods\goods\models\ars\Brand`.
*/
class BrandSearch extends Brand
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'is_delete', 'created_at', 'updated_at'], 'integer'],
[['name'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
'name',
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
'config' => [
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
],
];
}
/**
* @param $params
* @return ActiveDataProvider
* 不分页的所有数据
*/
public function allData($params)
{
$query = Brand::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Brand::find()->where(['is_delete' => Brand::IS_DELETE_NO]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSizeLimit' => [1, 200]
],
'sort' => [
'defaultOrder' => [
'id' => SORT_DESC,
]
],
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* @param $query
* @param $dataProvider
* @return ActiveDataProvider
* 条件筛选
*/
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');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
$end = strtotime($arr[1]) + 3600 * 24;
$query->andFilterWhere(['between', 'created_at', $start, $end]);
}
return $dataProvider;
}
}

172
vendor/antgoods/goods/src/models/searchs/CategorySearch.php

@ -1,172 +0,0 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\Category;
use yii\bootstrap4\Html;
/**
* CategorySearch represents the model behind the search form of `antgoods\goods\models\ars\Category`.
*/
class CategorySearch extends Category
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'created_at', 'updated_at', 'icon'], 'integer'],
[['name'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
'name',
['attribute' => 'icon',
'contentOptions' => [
'align' => 'center',
],
'width'=>'10%',
'format' => 'raw',
'value' => function ($model) {
return $model->iconFile ?
Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px'])
: '<div class="table_not_setting">未设置</div>';
}
],
'sort_order',
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
'config' => [
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
],
];
}
/**
* @param $params
* @return ActiveDataProvider
* 不分页的所有数据
*/
public function allData($params)
{
$query = Category::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Category::find()->where(['is_delete' => Category::IS_DELETE_NO]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSizeLimit' => [1, 200]
],
'sort' => [
'defaultOrder' => [
'id' => SORT_DESC,
]
],
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* @param $query
* @param $dataProvider
* @return ActiveDataProvider
* 条件筛选
*/
private function filter($query, $dataProvider){
$query->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');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'pid' => $this->pid,
'goods_count' => $this->goods_count,
'sort_order' => $this->sort_order,
'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]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
$end = strtotime($arr[1]) + 3600 * 24;
$query->andFilterWhere(['between', 'created_at', $start, $end]);
}
return $dataProvider;
}
}

241
vendor/antgoods/goods/src/models/searchs/GoodsSearch.php

@ -1,241 +0,0 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\Goods;
use yii\bootstrap4\Html;
use antgoods\goods\models\ars\Category;
use antgoods\goods\models\ars\ShopCategory;
/**
* GoodsSearch represents the model behind the search form of `antgoods\goods\models\ars\Goods`.
*/
class GoodsSearch extends Goods
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', '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', 'created_at', 'updated_at'], 'integer'],
[['name', 'sn', 'code', 'unit', 'brief', 'description'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
['attribute' => 'image',
'contentOptions' => [
'align' => 'center',
],
'width'=>'10%',
'format' => 'raw',
'value' => function ($model) {
return $model->image ?
Html::img(['/'.$model->imageFile->path], ['style' => 'width:80px'])
: '<div class="table_not_setting">未设置</div>';
}
],
'name',
[
'attribute' => 'cat_id',
'width' => '10%',
'value' => function ($model) {
return $model->category ? $model->category->name : '';
},
],
[
'attribute' => 'shop_cat_id',
'width' => '10%',
'value' => function ($model) {
return $model->shopCategory ? $model->shopCategory->name : '';
},
],
[
'attribute' => 'stock',
'width' => '5%',
'value' => function ($model) {
if ($model->stock == -1) {
return '未开启';
} else {
return $model->stock;
}
},
],
'price',
['attribute' => 'is_sale',
'width' => '5%',
'value' =>
function ($model) {
return $model->is_sale==Goods::IS_SALE_YES ? '在售' : '不在售';
},
],
'updated_at:datetime',
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
'config' => [
[
'name' => 'view',
'icon' => 'list',
'title' => '详情',
],
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'edit-sku',
'icon' => 'hard-drive',
'title' => '商品sku'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
],
];
}
/**
* @param $params
* @return ActiveDataProvider
* 不分页的所有数据
*/
public function allData($params)
{
$query = Goods::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Goods::find()->where(['is_delete' => Goods::IS_DELETE_NO]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSizeLimit' => [1, 200]
],
'sort' => [
'defaultOrder' => [
'id' => SORT_DESC,
]
],
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* @param $query
* @param $dataProvider
* @return ActiveDataProvider
* 条件筛选
*/
private function filter($query, $dataProvider){
$query->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');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'pid' => $this->pid,
'cat_id' => $this->cat_id,
'brand_id' => $this->brand_id,
'shop_cat_id' => $this->shop_cat_id,
'supplier_id' => $this->supplier_id,
'weight' => $this->weight,
'length' => $this->length,
'width' => $this->width,
'height' => $this->height,
'diameter' => $this->diameter,
'sold_count' => $this->sold_count,
'limit_count' => $this->limit_count,
'stock' => $this->stock,
'stock_warn' => $this->stock_warn,
'market_price' => $this->market_price,
'price' => $this->price,
'image' => $this->image,
'model_id' => $this->model_id,
'is_sale' => $this->is_sale,
'sort_order' => $this->sort_order,
'bouns_points' => $this->bouns_points,
'experience_points' => $this->experience_points,
'is_delete' => $this->is_delete,
'express_template' => $this->express_template,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'sn', $this->sn])
->andFilterWhere(['like', 'code', $this->code])
->andFilterWhere(['like', 'unit', $this->unit])
->andFilterWhere(['like', 'brief', $this->brief])
->andFilterWhere(['like', 'description', $this->description]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
$end = strtotime($arr[1]) + 3600 * 24;
$query->andFilterWhere(['between', 'created_at', $start, $end]);
}
return $dataProvider;
}
}

162
vendor/antgoods/goods/src/models/searchs/ShopCategorySearch.php

@ -1,162 +0,0 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\bootstrap4\Html;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\ShopCategory;
/**
* ShopCategorySearch represents the model behind the search form of `antgoods\goods\models\ars\ShopCategory`.
*/
class ShopCategorySearch extends ShopCategory
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'pid', 'goods_count', 'sort_order', 'is_show', 'is_delete', 'created_at', 'updated_at', 'icon'], 'integer'],
[['name', 'keywords', 'desc', 'filter_attr'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
'name',
['attribute' => 'icon',
'contentOptions' => [
'align' => 'center',
],
'width'=>'10%',
'format' => 'raw',
'value' => function ($model) {
return $model->iconFile ?
Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px'])
: '<div class="table_not_setting">未设置</div>';
}
],
'sort_order',
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
],
];
}
/**
* @param $params
* @return ActiveDataProvider
* 不分页的所有数据
*/
public function allData($params)
{
$query = ShopCategory::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = ShopCategory::find()
->where(['is_delete' => ShopCategory::IS_DELETE_NO]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSizeLimit' => [1, 200]
],
'sort' => [
'defaultOrder' => [
'id' => SORT_DESC,
]
],
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* @param $query
* @param $dataProvider
* @return ActiveDataProvider
* 条件筛选
*/
private function filter($query, $dataProvider){
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'pid' => $this->pid,
'goods_count' => $this->goods_count,
'sort_order' => $this->sort_order,
'icon' => $this->icon,
'is_show' => $this->is_show,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'keywords', $this->keywords])
->andFilterWhere(['like', 'desc', $this->desc])
->andFilterWhere(['like', 'filter_attr', $this->filter_attr]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
$end = strtotime($arr[1]) + 3600 * 24;
$query->andFilterWhere(['between', 'created_at', $start, $end]);
}
return $dataProvider;
}
}

161
vendor/antgoods/goods/src/models/searchs/SupplierSearch.php

@ -1,161 +0,0 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\Supplier;
/**
* SupplierSearch represents the model behind the search form of `antgoods\goods\models\ars\Supplier`.
*/
class SupplierSearch extends Supplier
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'is_delete', 'created_at', 'updated_at'], 'integer'],
[['name', 'full_name', 'phone', 'address'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
'name',
'full_name',
'phone',
'address',
//'is_delete',
//'created_at',
//'updated_at',
[
'class' => 'iron\grid\ActionColumn',
'align' => 'center',
'config' => [
[
'name' => 'update',
'icon' => 'pencil',
'title' => '修改'
],
[
'name' => 'delete',
'icon' => 'trash',
'title' => '删除',
'contents' => '确定删除?'
]
],
],
];
}
/**
* @param $params
* @return ActiveDataProvider
* 不分页的所有数据
*/
public function allData($params)
{
$query = Supplier::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false,
'sort' => false
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Supplier::find()->where(['is_delete' => Supplier::IS_DELETE_NO]);
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSizeLimit' => [1, 200]
],
'sort' => [
'defaultOrder' => [
'id' => SORT_DESC,
]
],
]);
$this->load($params);
return $this->filter($query, $dataProvider);
}
/**
* @param $query
* @param $dataProvider
* @return ActiveDataProvider
* 条件筛选
*/
private function filter($query, $dataProvider){
$query->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');
return $dataProvider;
}
// grid filtering conditions
$query->andFilterWhere([
'id' => $this->id,
'is_delete' => $this->is_delete,
'created_at' => $this->created_at,
'updated_at' => $this->updated_at,
]);
$query->andFilterWhere(['like', 'name', $this->name])
->andFilterWhere(['like', 'full_name', $this->full_name])
->andFilterWhere(['like', 'phone', $this->phone])
->andFilterWhere(['like', 'address', $this->address]);
if ($this->created_at_range) {
$arr = explode(' ~ ', $this->created_at_range);
$start = strtotime($arr[0]);
$end = strtotime($arr[1]) + 3600 * 24;
$query->andFilterWhere(['between', 'created_at', $start, $end]);
}
return $dataProvider;
}
}

32
vendor/antgoods/goods/src/views/attribute/_form.php

@ -1,32 +0,0 @@
<?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
use linyao\widgets\Select2;
use antgoods\goods\models\ars\Category;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Attribute */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="attribute-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'value')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'cat_id')->widget(Select2::className(), ["items" => array_merge([0 => '请选择'], Category::modelColumn()), "promptText" => false]) ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

49
vendor/antgoods/goods/src/views/attribute/_search.php

@ -1,49 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model common\models\searchs\AttributeSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'validateOnType' => true,
]);
?>
<div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col">
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
</div>
<div class="form-group">
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

18
vendor/antgoods/goods/src/views/attribute/create.php

@ -1,18 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Attribute */
$this->title = '创建规格';
$this->params['breadcrumbs'][] = ['label' => '规格管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="attribute-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

28
vendor/antgoods/goods/src/views/attribute/index.php

@ -1,28 +0,0 @@
<?php
use yii\helpers\Html;
use iron\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\AttributeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '规格管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-12">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filter' => $this->render("_search", ['model' => $searchModel]),
'batch' => [
[
"label" => "删除",
"url" => "attribute/deletes"
],
],
'columns' => $columns
]);
?>
</div>
</div>

19
vendor/antgoods/goods/src/views/attribute/update.php

@ -1,19 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Attribute */
$this->title = '编辑规格: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '规格管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = 'Update ';
?>
<div class="attribute-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

33
vendor/antgoods/goods/src/views/attribute/view.php

@ -1,33 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Attribute */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '规格管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="attribute-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'value:ntext',
'type',
'sort_order',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

24
vendor/antgoods/goods/src/views/brand/_form.php

@ -1,24 +0,0 @@
<?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Brand */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="brand-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

49
vendor/antgoods/goods/src/views/brand/_search.php

@ -1,49 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model common\models\searchs\BrandSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'validateOnType' => true,
]);
?>
<div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col">
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
</div>
<div class="form-group">
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

18
vendor/antgoods/goods/src/views/brand/create.php

@ -1,18 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Brand */
$this->title = '创建品牌';
$this->params['breadcrumbs'][] = ['label' => '品牌管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="brand-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

28
vendor/antgoods/goods/src/views/brand/index.php

@ -1,28 +0,0 @@
<?php
use yii\helpers\Html;
use iron\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\BrandSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '品牌管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-12">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filter' => $this->render("_search", ['model' => $searchModel]),
'batch' => [
[
"label" => "删除",
"url" => "brand/deletes"
],
],
'columns' => $columns
]);
?>
</div>
</div>

19
vendor/antgoods/goods/src/views/brand/update.php

@ -1,19 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Brand */
$this->title = '编辑品牌: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '品牌管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = '编辑 ';
?>
<div class="brand-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

30
vendor/antgoods/goods/src/views/brand/view.php

@ -1,30 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Brand */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '品牌管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="brand-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

47
vendor/antgoods/goods/src/views/category/_form.php

@ -1,47 +0,0 @@
<?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
use blobt\widgets\Icheck;
use yii\helpers\Url;
use antgoods\goods\models\ars\Category;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Category */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="category-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'pid')->dropDownList(array_merge([0 => '一级分类'], Category::modelColumn())) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'iconImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'iconImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 1,
'fillInAttribute' => 'iconImageId',
'model' => $model,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->iconImageId]),
],
])->label('类目图片') ?>
<?= $form->field($model, 'is_show')->widget(Icheck::className(), ["items" => $model::$isShow, 'type' => "radio"]) ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

49
vendor/antgoods/goods/src/views/category/_search.php

@ -1,49 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model common\models\searchs\CategorySearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'validateOnType' => true,
]);
?>
<div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col">
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
</div>
<div class="form-group">
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

18
vendor/antgoods/goods/src/views/category/create.php

@ -1,18 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Category */
$this->title = '创建后台商品分类';
$this->params['breadcrumbs'][] = ['label' => '后台商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="category-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

28
vendor/antgoods/goods/src/views/category/index.php

@ -1,28 +0,0 @@
<?php
use yii\helpers\Html;
use iron\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\CategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '后台商品分类';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-12">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filter' => $this->render("_search", ['model' => $searchModel]),
'batch' => [
[
"label" => "删除",
"url" => "category/deletes"
],
],
'columns' => $columns
]);
?>
</div>
</div>

19
vendor/antgoods/goods/src/views/category/update.php

@ -1,19 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Category */
$this->title = '编辑后台商品分类: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '后台商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = '编辑 ';
?>
<div class="category-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

41
vendor/antgoods/goods/src/views/category/view.php

@ -1,41 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Category */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '后台商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="category-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'pid',
'goods_count',
'sort_order',
'icon_type',
'icon',
[
'attribute' => 'is_show',
'value' => function ($model) {
return $model->is_show == \antgoods\goods\models\ars\Category::IS_SHOW_DISPLAY ? '显示':'隐藏';
}
],
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

107
vendor/antgoods/goods/src/views/goods/_form.php

@ -1,107 +0,0 @@
<?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
use antgoods\goods\models\ars\Category;
use antgoods\goods\models\ars\Brand;
use antgoods\goods\models\ars\ShopCategory;
use antgoods\goods\models\ars\Supplier;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="goods-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'shop_cat_id')->dropDownList(ShopCategory::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'sn')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'supplier_id')->dropDownList(Supplier::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'weight')->textInput() ?>
<?= $form->field($model, 'length')->textInput() ?>
<?= $form->field($model, 'width')->textInput() ?>
<?= $form->field($model, 'height')->textInput() ?>
<?= $form->field($model, 'diameter')->textInput() ?>
<?= $form->field($model, 'unit')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'limit_count')->textInput() ?>
<?= $form->field($model, 'stock')->textInput() ?>
<?= $form->field($model, 'stock_warn')->textInput() ?>
<?= $form->field($model, 'market_price')->textInput() ?>
<?= $form->field($model, 'price')->textInput() ?>
<?= $form->field($model, 'brief')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'description')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'model_id')->textInput() ?>
<?= $form->field($model, 'is_sale')->radioList($model::$isSale) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'bouns_points')->textInput() ?>
<?= $form->field($model, 'experience_points')->textInput() ?>
<?= $form->field($model, 'express_template')->textInput() ?>
<?= $form->field($model, 'coverImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 1,
'fillInAttribute' => 'coverImageId',
'model' => $model,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId]),
],
])->label('商品封面图') ?>
<?= $form->field($model, 'detailImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 5,
'fillInAttribute' => 'detailImageId',
'model' => $model,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->detailImageId]),
],
])->label('商品详情图') ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

49
vendor/antgoods/goods/src/views/goods/_search.php

@ -1,49 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model common\models\searchs\GoodsSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'validateOnType' => true,
]);
?>
<div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col">
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
</div>
<div class="form-group">
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

22
vendor/antgoods/goods/src/views/goods/attribute.php

@ -1,22 +0,0 @@
<?php
use antgoods\goods\models\ars\Attribute;
use antgoods\goods\web\GoodsAttributeAsset;
$param = [];
$value = [];
$attrId = [];
$allAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR])->asArray()->all();
GoodsAttributeAsset::register($this);
?>
<div class="content-box">
<input type="hidden" id="attribute" name="attribute"/>
<div id="sku-choose"></div>
</div>
<script>
var csrf = "<?= Yii::$app->request->csrfToken ?>";
var allAttr = <?= isset($allAttr) ? json_encode($allAttr) : [] ?>; // 所有数据
var currentAttr = <?= isset($model) ? json_encode($model) : [] ?>; // 默认数据(之前已选择的数据)
var canNotDeleteAttr =<?=isset($attrValue) ? json_encode($attrValue) : [] ?>; // 已设置sku的值,不可删除
</script>

72
vendor/antgoods/goods/src/views/goods/create.php

@ -1,72 +0,0 @@
<?php
use kartik\tabs\TabsX;
use yii\bootstrap4\ActiveForm;
use yii\bootstrap4\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
$this->title = '创建商品';
$this->params['breadcrumbs'][] = ['label' => '商品列表', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
Yii::$app->params['bsVersion'] = '4.x';
?>
<div class="goods-create">
<div class="goods-form">
<?php
$form = ActiveForm::begin(['options' => ['class' => 'container-fluid']]);
echo TabsX::widget([
'bordered' => true,
'items' => [
[
'label' => '<i class="fas fa-user"></i> 基本信息',
'content' => $this->render('goods', ['model' => $model,
'form' => $form,
'judgeGoodsCategory' => false, //表示后台分类可以修改
]),
],
[
'label' => '<i class="fas fa-list-alt"></i> 筛选规格',
'content' => $this->render('filter_attribute', [
'filterModel' => [],
'filterAttrValue' => [],
]),
],
[
'label' => '<i class="fas fa-list-alt"></i> 商品规格',
'content' => $this->render('attribute', [
'model' => [],
'attrValue' => [],
]),
],
[
'label' => '<i class="fas fa-ad"></i> 详情上传',
'content' => $this->render('new_editor', ['model' => $model,
'form' => $form,
]),
],
[
'label' => '<i class="fas fa-picture-o"></i> 图片上传',
'content' => $this->render('picture', [
'model' => $model,
'form' => $form
]),
],
],
'position' => TabsX::POS_ABOVE,
'encodeLabels' => false
]);
?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>

22
vendor/antgoods/goods/src/views/goods/filter_attribute.php

@ -1,22 +0,0 @@
<?php
use antgoods\goods\models\ars\Attribute;
use antgoods\goods\web\GoodsFilterAttributeAsset;
$param = [];
$value = [];
$attrId = [];
$allFilterAttr = Attribute::find()->where(['type' => Attribute::TYPE_ATTR])->asArray()->all();
GoodsFilterAttributeAsset::register($this);
?>
<div class="content-box">
<input type="hidden" id="attribute" name="attribute"/>
<div id="filter-choose"></div>
</div>
<script>
var csrf = "<?= Yii::$app->request->csrfToken ?>";
var allFilterAttr = <?= isset($allFilterAttr) ? json_encode($allFilterAttr) : [] ?>; // 所有数据
var currentFilterAttr = <?= isset($filterModel) ? json_encode($filterModel) : [] ?>; // 默认数据(之前已选择的数据)
var canNotDeleteFilterAttr =<?=isset($filterAttrValue) ? json_encode($filterAttrValue) : [] ?>; // 已设置sku的值,不可删除
</script>

63
vendor/antgoods/goods/src/views/goods/goods.php

@ -1,63 +0,0 @@
<?php
use antgoods\goods\models\ars\Category;
use antgoods\goods\models\ars\Brand;
use antgoods\goods\models\ars\ShopCategory;
use antgoods\goods\models\ars\Supplier;
use linyao\widgets\Select2;
use yii\bootstrap4\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
/* @var $form yii\widgets\ActiveForm */
?>
<?= $form->field($model, 'cat_id')->dropDownList(Category::modelColumn(), ['prompt' => '请选择', 'disabled' => $judgeGoodsCategory]) ?>
<?= $form->field($model, 'brand_id')->dropDownList(Brand::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'shop_cat_id')->dropDownList(ShopCategory::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'sn')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'code')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'supplier_id')->dropDownList(Supplier::modelColumn(), ['prompt' => '请选择']) ?>
<?= $form->field($model, 'weight')->textInput() ?>
<?= $form->field($model, 'length')->textInput() ?>
<?= $form->field($model, 'width')->textInput() ?>
<?= $form->field($model, 'height')->textInput() ?>
<?= $form->field($model, 'diameter')->textInput() ?>
<?= $form->field($model, 'unit')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'limit_count')->textInput() ?>
<?= $form->field($model, 'stock')->textInput() ?>
<?= $form->field($model, 'stock_warn')->textInput() ?>
<?= $form->field($model, 'market_price')->textInput() ?>
<?= $form->field($model, 'price')->textInput() ?>
<?= $form->field($model, 'brief')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'is_sale')->radioList($model::$isSale) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'bouns_points')->textInput() ?>
<?= $form->field($model, 'experience_points')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>

28
vendor/antgoods/goods/src/views/goods/index.php

@ -1,28 +0,0 @@
<?php
use yii\helpers\Html;
use iron\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\GoodsSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '商品列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-12">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filter' => $this->render("_search", ['model' => $searchModel]),
'batch' => [
[
"label" => "删除",
"url" => "goods/deletes"
],
],
'columns' => $columns
]);
?>
</div>
</div>

31
vendor/antgoods/goods/src/views/goods/new_editor.php

@ -1,31 +0,0 @@
<?php
/**
* Created by PhpStorm.
* User: livan
* Date: 2018/7/9
* Time: 14:22
*/
use yii\helpers\Html;
?>
<div>
<div class="row">
<div class="col-lg-3">
<?= $form->field($model, 'description')->widget('common\widgets\ueditor\Ueditor',[
'options'=>[
'initialFrameWidth' => 760,//宽度
'initialFrameHeight' => 500,//高度
]
]) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
</div>
</div>

37
vendor/antgoods/goods/src/views/goods/picture.php

@ -1,37 +0,0 @@
<?php
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
/* @var $form yii\widgets\ActiveForm */
?>
<?= $form->field($model, 'coverImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'coverImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 1,
'fillInAttribute' => 'coverImageId',
'model' => $model,
'ruleVerify' => $model->ruleVerify,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->coverImageId]),
],
])->label('商品封面图') ?>
<?= $form->field($model, 'detailImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'detailImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 5,
'fillInAttribute' => 'detailImageId',
'model' => $model,
'ruleVerify' => $model->ruleVerify,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->detailImageId]),
],
])->label('商品详情图') ?>

15
vendor/antgoods/goods/src/views/goods/sku_edit.php

@ -1,15 +0,0 @@
<?php
use antgoods\goods\web\GoodsSkuEditAsset;
$this->title = '添加SKU';
$this->params['breadcrumbs'][] = ['label' => '商品列表', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
GoodsSkuEditAsset::register($this);
?>
<div id="app"></div>
<script>
var sku = <?=json_encode($sku)?>;
var attributes = <?=json_encode($attributes)?>;
var csrfToken = "<?= Yii::$app->request->csrfToken ?>";
</script>

74
vendor/antgoods/goods/src/views/goods/update.php

@ -1,74 +0,0 @@
<?php
use yii\bootstrap4\Html;
use yii\bootstrap4\ActiveForm;
use kartik\tabs\TabsX;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
$this->title = '编辑商品: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '商品管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = '编辑 ';
Yii::$app->params['bsVersion'] = '4.x';
?>
<div class="goods-update">
<div class="goods-form">
<?php
$form = ActiveForm::begin(['options' => ['class' => 'container-fluid']]);
echo TabsX::widget([
'bordered' => true,
'items' => [
[
'label' => '<i class="fas fa-user"></i> 基本信息',
'content' => $this->render('goods', [
'model' => $model,
'form' => $form,
'judgeGoodsCategory' => $judgeGoodsCategory
]),
],
[
'label' => '<i class="fas fa-list-alt"></i> 筛选规格',
'content' => $this->render('filter_attribute', [
'filterModel' => $filterAttributeModel,
'filterAttrValue' => [],
]),
],
[
'label' => '<i class="fas fa-list-alt"></i> 商品规格',
'content' => $this->render('attribute', [
'model' => $attributeModel,
'attrValue' => $attrValue,
'goodsModel' => $model,
]),
],
[
'label' => '<i class="fas fa-picture-o"></i> 图片上传',
'content' => $this->render('picture', [
'model' => $model,
'form' => $form,
]),
],
],
'position' => TabsX::POS_ABOVE,
'encodeLabels' => false
]);
?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<?php
// $this->render('_form', [
// 'model' => $model,
// ])
?>
</div>

113
vendor/antgoods/goods/src/views/goods/view.php

@ -1,113 +0,0 @@
<?php
use antgoods\goods\models\ars\Goods;
use yii\bootstrap4\Html;
use yii\widgets\DetailView;
use common\models\ars\File;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '商品管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="goods-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'sn',
[
'attribute' => 'cat_id',
'width' => '10%',
'value' => function ($model) {
return $model->category ? $model->category->name : '';
},
],
[
'attribute' => 'shop_cat_id',
'width' => '10%',
'value' => function ($model) {
return $model->shopCategory ? $model->shopCategory->name : '';
},
],
[
'attribute' => 'brand_id',
'width' => '10%',
'value' => function ($model) {
return $model->brand ? $model->brand->name : '';
},
],
'code',
[
'attribute' => 'supplier_id',
'width' => '10%',
'value' => function ($model) {
return $model->supplier ? $model->supplier->name : '';
},
],
'weight',
'length',
'width',
'height',
'diameter',
'unit',
[
'attribute' => 'stock',
'width' => '5%',
'value' => function ($model) {
if ($model->stock == -1) {
return '未开启';
} else {
return $model->stock;
}
},
],
'market_price',
'price',
'brief',
['attribute' => 'image',
'format' => 'raw',
'value' => function ($model) {
return $model->image ?
Html::img(['/'.$model->imageFile->path], ['style' => 'width:80px'])
: '<div class="table_not_setting">未设置</div>';
}
],
[
'label' => '详情图',
'format' => 'raw',
'value' => function ($model) {
$image = '';
$imgs = File::findAll(['own_id' => $model->id, 'own_type' => File::OWN_TYPE_GOODS_DETAILS, 'is_delete' => File::IS_DELETE_NO]);
foreach ($imgs as $img) {
$image .= Html::img(['/'.$img->path], ['style' => 'width:150px']);
}
return $image;
}
],
['attribute' => 'is_sale',
'width' => '5%',
'value' =>
function ($model) {
return $model->is_sale ? Goods::$isSale[$model->is_sale] : '未设置';
},
],
'sort_order',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

55
vendor/antgoods/goods/src/views/shop-category/_form.php

@ -1,55 +0,0 @@
<?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
use blobt\widgets\Icheck;
use yii\helpers\Url;
use antgoods\goods\models\ars\Attribute;
use linyao\widgets\Select2;
use antgoods\goods\models\ars\ShopCategory;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\ShopCategory */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="shop-category-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'pid')->dropDownList(array_merge([0 => '一级分类'], ShopCategory::modelColumn())) ?>
<?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'iconImageId')->hiddenInput()->label('') ?>
<?= $form->field($model, 'iconImagePath')->widget(\iron\widgets\Upload::className(), [
'url' => 'upload',
'deleteUrl' => 'img-id-del',
'dragdropWidth'=> 800,
'afterSave' => 'save-file',
'maxCount' => 1,
'fillInAttribute' => 'iconImageId',
'model' => $model,
'previewConfig' => [
'url' => Url::to(['image-file', 'fileidstr' => $model->iconImageId]),
],
])->label('类目图片') ?>
<?= $form->field($model, 'filter_attr')->widget(Select2::className(), ["items" => Attribute::modelColumn(), "promptText" => false, 'options' => ['multiple' => true, 'placeholder' => '请选择...'] ]) ?>
<?= $form->field($model, 'is_show')->widget(Icheck::className(), ["items" => $model::$isShow, 'type' => "radio"]) ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

49
vendor/antgoods/goods/src/views/shop-category/_search.php

@ -1,49 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model common\models\searchs\ShopCategorySearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'validateOnType' => true,
]);
?>
<div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col">
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
</div>
<div class="form-group">
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

18
vendor/antgoods/goods/src/views/shop-category/create.php

@ -1,18 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\ShopCategory */
$this->title = '创建前端商品分类';
$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="shop-category-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

28
vendor/antgoods/goods/src/views/shop-category/index.php

@ -1,28 +0,0 @@
<?php
use yii\helpers\Html;
use iron\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\ShopCategorySearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '前端商品分类';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-12">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filter' => $this->render("_search", ['model' => $searchModel]),
'batch' => [
[
"label" => "删除",
"url" => "shopcategory/deletes"
],
],
'columns' => $columns
]);
?>
</div>
</div>

19
vendor/antgoods/goods/src/views/shop-category/update.php

@ -1,19 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\ShopCategory */
$this->title = '编辑前端商品分类: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = '编辑 ';
?>
<div class="shop-category-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

64
vendor/antgoods/goods/src/views/shop-category/view.php

@ -1,64 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use antgoods\goods\models\ars\ShopCategory;
use antgoods\goods\models\ars\Attribute;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\ShopCategory */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '前端商品分类', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
$filter_attr_arr = explode(',', $model->filter_attr);
$attr_str = '';
foreach ($filter_attr_arr as $filter_attr_id) {
$attr = Attribute::findOne($filter_attr_id);
if ($attr) {
$attr_str = $attr_str . ',' . $attr->name;
}
}
$attr_str = substr($attr_str, 1);
?>
<div class="shop-category-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'keywords',
'desc',
'sort_order',
['attribute' => 'icon',
'width'=>'10%',
'format' => 'raw',
'value' => function ($model) {
return $model->iconFile ?
\yii\bootstrap4\Html::img(['/'.$model->iconFile->path], ['style' => 'width:80px'])
: '未设置';
}
],
['attribute' => 'filter_attr',
'value' => $attr_str
],
['attribute' => 'is_show',
'width' => '5%',
'value' =>
function ($model) {
return $model->is_show == ShopCategory::IS_SHOW_HIDE ? '隐藏' : '显示';
},
],
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

30
vendor/antgoods/goods/src/views/supplier/_form.php

@ -1,30 +0,0 @@
<?php
use yii\helpers\Html;
use yii\bootstrap4\ActiveForm;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Supplier */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="supplier-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'full_name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'phone')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

49
vendor/antgoods/goods/src/views/supplier/_search.php

@ -1,49 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use \blobt\widgets\DateRangePicker;
/* @var $this yii\web\View */
/* @var $model common\models\searchs\SupplierSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
'validateOnType' => true,
]);
?>
<div class="row">
<div class="col">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
</div>
<div class="col">
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
</div>
<div class="form-group">
<?= Html::submitButton('<i class="fa fa-filter"></i>', ['class' => 'btn btn-default']) ?>
<?= Html::resetButton('<i class="fa fa-eraser"></i>', ['class' => 'btn btn-default']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>

18
vendor/antgoods/goods/src/views/supplier/create.php

@ -1,18 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Supplier */
$this->title = '创建供应商';
$this->params['breadcrumbs'][] = ['label' => '供应商管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="supplier-create">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

28
vendor/antgoods/goods/src/views/supplier/index.php

@ -1,28 +0,0 @@
<?php
use yii\helpers\Html;
use iron\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\SupplierSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = '供应商管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="row">
<div class="col-12">
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filter' => $this->render("_search", ['model' => $searchModel]),
'batch' => [
[
"label" => "删除",
"url" => "supplier/deletes"
],
],
'columns' => $columns
]);
?>
</div>
</div>

19
vendor/antgoods/goods/src/views/supplier/update.php

@ -1,19 +0,0 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Supplier */
$this->title = '编辑供应商: ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => '供应商管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
$this->params['breadcrumbs'][] = '编辑 ';
?>
<div class="supplier-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

33
vendor/antgoods/goods/src/views/supplier/view.php

@ -1,33 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Supplier */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => '供应商管理', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="supplier-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'name',
'full_name',
'phone',
'address',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>

22
vendor/antgoods/goods/src/web/GoodsAttributeAsset.php

@ -1,22 +0,0 @@
<?php
namespace antgoods\goods\web;
use yii\web\AssetBundle;
/**
* Main backend application asset bundle.
*/
class GoodsAttributeAsset extends AssetBundle
{
public $sourcePath = "@antgoods/goods/src/assets";
public $css = [
];
public $js = [
// 'custom/sku.49a56a9198d9c3ec233c.js'
'custom/sku.52802ed907a316501cd7.js'
];
public $depends = [
'yii\web\YiiAsset',
];
}

21
vendor/antgoods/goods/src/web/GoodsFilterAttributeAsset.php

@ -1,21 +0,0 @@
<?php
namespace antgoods\goods\web;
use yii\web\AssetBundle;
/**
* Main backend application asset bundle.
*/
class GoodsFilterAttributeAsset extends AssetBundle
{
public $sourcePath = "@antgoods/goods/src/assets";
public $css = [
];
public $js = [
'custom/sku.9a46222d01b3d601e5ad.js'
];
public $depends = [
'yii\web\YiiAsset',
];
}

21
vendor/antgoods/goods/src/web/GoodsSkuEditAsset.php

@ -1,21 +0,0 @@
<?php
namespace antgoods\goods\web;
use yii\web\AssetBundle;
/**
* Main backend application asset bundle.
*/
class GoodsSkuEditAsset extends AssetBundle
{
public $sourcePath = "@antgoods/goods/src/assets";
public $css = [
];
public $js = [
'custom/sku_item.6649e882bedbeb22ea3d.js'
];
public $depends = [
'yii\web\YiiAsset',
];
}
Loading…
Cancel
Save