Browse Source

feat: 合并分支增加商品模块

wechat_public_accounts
root 5 years ago
parent
commit
4ffe9b1ff9
  1. 2
      .gitignore
  2. 26
      api/assets/AppAsset.php
  3. 59
      api/config/params.php
  4. 22
      api/controllers/SiteController.php
  5. 59
      api/controllers/TestController.php
  6. 1
      api/controllers/UserController.php
  7. 2
      api/runtime/.gitignore
  8. 27
      api/views/site/error.php
  9. 5
      api/web/.gitignore
  10. 120
      api/web/css/site.css
  11. BIN
      api/web/favicon.ico
  12. 18
      backend/config/main.php
  13. 149
      backend/controllers/CategoryController.php
  14. 0
      backend/controllers/ConfigController.php
  15. 151
      backend/controllers/GoodsController.php
  16. 0
      backend/controllers/OrderController.php
  17. 149
      backend/controllers/ShopCategoryController.php
  18. 0
      backend/controllers/SiteController.php
  19. 122
      backend/logic/file/FileManager.php
  20. 47
      backend/views/brand/_search.php
  21. 38
      backend/views/category/_form.php
  22. 98
      backend/views/category/test.php
  23. 0
      backend/views/config/index.php
  24. 82
      backend/views/goods/_form.php
  25. 0
      backend/views/layouts/base.php
  26. 0
      backend/views/layouts/breadcrumb.php
  27. 0
      backend/views/layouts/footer.php
  28. 0
      backend/views/layouts/header.php
  29. 0
      backend/views/layouts/main.php
  30. 19
      backend/views/layouts/sidebar.php
  31. 0
      backend/views/order/_form.php
  32. 0
      backend/views/order/_search.php
  33. 0
      backend/views/order/create.php
  34. 0
      backend/views/order/index.php
  35. 0
      backend/views/order/update.php
  36. 0
      backend/views/order/view.php
  37. 44
      backend/views/shop-category/_form.php
  38. 0
      backend/views/site/error.php
  39. 0
      backend/views/site/index.php
  40. 0
      backend/views/site/login.php
  41. 0
      backend/views/site/test.php
  42. 47
      backend/views/supplier/_search.php
  43. BIN
      backend/web/uploads/xls/15738696921690.jpg
  44. 17
      common/config/params.php
  45. 2
      common/models/ars/Address.php
  46. 2
      common/models/ars/AfterSale.php
  47. 1
      common/models/ars/Area.php
  48. 2
      common/models/ars/Cart.php
  49. 1
      common/models/ars/City.php
  50. 2
      common/models/ars/Collection.php
  51. 2
      common/models/ars/Comment.php
  52. 0
      common/models/ars/Config.php
  53. 2
      common/models/ars/Delivery.php
  54. 2
      common/models/ars/ExpressTemplate.php
  55. 8
      common/models/ars/File.php
  56. 2
      common/models/ars/Order.php
  57. 2
      common/models/ars/OrderGoods.php
  58. 1
      common/models/ars/PaymentLog.php
  59. 1
      common/models/ars/Province.php
  60. 1
      common/models/ars/RefundLog.php
  61. 2
      common/models/ars/SearchHistory.php
  62. 2
      common/models/ars/TakingSite.php
  63. 2
      common/models/ars/TemFile.php
  64. 0
      common/models/searchs/OrderSearch.php
  65. 5
      composer.json
  66. 2
      console/controllers/InitController.php
  67. 0
      console/migrations/m130524_201442_init.php
  68. 0
      console/migrations/m140506_102106_rbac_init.php
  69. 0
      console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php
  70. 0
      console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php
  71. 0
      console/migrations/m190124_110200_add_verification_token_column_to_user_table.php
  72. 0
      console/migrations/m190802_072830_add_category.php
  73. 0
      console/migrations/m191111_101658_create_table_area.php
  74. 0
      console/migrations/m191111_102644_create_table_province.php
  75. 0
      console/migrations/m191111_102730_create_table_city.php
  76. 8
      console/migrations/m191111_102925_create_table_cart.php
  77. 8
      console/migrations/m191111_112559_create_table_address.php
  78. 6
      console/migrations/m191111_113455_create_table_after_sale.php
  79. 2
      console/migrations/m191112_005106_create_table_search_history.php
  80. 4
      console/migrations/m191112_005545_create_table_collection.php
  81. 2
      console/migrations/m191112_005702_create_table_comment.php
  82. 2
      console/migrations/m191112_010421_create_table_order.php
  83. 4
      console/migrations/m191112_011517_create_table_order_goods.php
  84. 2
      console/migrations/m191112_012449_create_table_taking_site.php
  85. 2
      console/migrations/m191112_014508_create_table_express_template.php
  86. 2
      console/migrations/m191112_015939_create_table_delivery.php
  87. 0
      console/migrations/m191112_020830_create_table_payment_log.php
  88. 0
      console/migrations/m191112_021528_create_table_refund_log.php
  89. 0
      console/migrations/m191112_022131_create_table_file.php
  90. 0
      console/migrations/m191112_022532_create_table_tem_file.php
  91. 0
      console/migrations/schema-mysql.sql
  92. 0
      console/migrations/sql/add_category.sql
  93. 0
      console/migrations/sql/area.sql
  94. 0
      console/migrations/sql/city.sql
  95. 0
      console/migrations/sql/province.sql
  96. 0
      datadictionary.md
  97. 8
      environments/skeleton/backend/config/main-local.php
  98. 0
      environments/skeleton/backend/config/params-local.php
  99. 14
      vendor/antgoods/goods/AutoloadExample.php
  100. 31
      vendor/antgoods/goods/README.md

2
.gitignore

@ -39,3 +39,5 @@ vendor.zip
/backend/web/uploads /backend/web/uploads
/api/web/uploads /api/web/uploads
dump.rdb dump.rdb
/console/runtime

26
api/assets/AppAsset.php

@ -0,0 +1,26 @@
<?php
namespace backend\assets;
use yii\web\AssetBundle;
/**
* Main backend application asset bundle.
*/
class AppAsset extends AssetBundle
{
public $basePath = '@webroot';
public $baseUrl = '@web';
public $css = [
'css/site.css',
];
public $js = [
'js/common.js'
];
public $depends = [
'yii\web\YiiAsset',
'yii\bootstrap4\BootstrapAsset',
'yii\bootstrap4\BootstrapPluginAsset',
'iron\web\AdminlteAsset',
];
}

59
api/config/params.php

@ -6,10 +6,61 @@ return [
'用户注销' => '/site/logout', '用户注销' => '/site/logout',
'用户登录' => '/site/login', '用户登录' => '/site/login',
], ],
"商品模块" => [
'商品列表' => '/goods/index',
'商品新增' => '/goods/create',
'商品修改' => '/goods/update',
"商品管理" => [
'商品列表' => '/antgoods/goods/index',
'商品新增' => '/antgoods/goods/create',
'商品修改' => '/antgoods/goods/update',
'商品查看' => '/antgoods/goods/view',
], ],
"商城分类" => [
'列表' => '/antgoods/shop-category/index',
'新增' => '/antgoods/shop-category/create',
'修改' => '/antgoods/shop-category/update',
'查看' => '/antgoods/shop-category/view',
],
"后台分类" => [
'列表' => '/antgoods/category/index',
'新增' => '/antgoods/category/create',
'修改' => '/antgoods/category/update',
'查看' => '/antgoods/category/view',
],
"品牌管理" => [
'列表' => '/antgoods/brand/index',
'新增' => '/antgoods/brand/create',
'修改' => '/antgoods/brand/update',
'查看' => '/antgoods/brand/view',
],
"供应商管理" => [
'列表' => '/antgoods/supplier/index',
'新增' => '/antgoods/supplier/create',
'修改' => '/antgoods/supplier/update',
'查看' => '/antgoods/supplier/view',
],
"属性管理" => [
'列表' => '/antgoods/attribute/index',
'新增' => '/antgoods/attribute/create',
'修改' => '/antgoods/attribute/update',
'查看' => '/antgoods/attribute/view',
]
],
'menus' => [
'商城管理' => [
'icon' => 'fa-store',
'items' => [
['运营数据', '/site',],
['基础配置', '/config'],
],
],
'商品管理' => [
'icon' => 'fa-archive',
'items' => [
['商城分类', '/antgoods/shop-category'],
['后台分类', '/antgoods/category'],
['品牌管理', '/antgoods/brand'],
['属性管理', '/antgoods/attribute'],
['商品管理', '/antgoods/goods'],
['供应商管理', '/antgoods/supplier'],
],
]
] ]
]; ];

22
api/controllers/SiteController.php

@ -0,0 +1,22 @@
<?php
namespace api\controllers;
use yii\web\Controller;
/**
* Created by PhpStorm.
* User: iron
* Date: 2018/5/25
* Time: 16:42
*/
class SiteController extends Controller
{
public function actions() {
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
];
}
}

59
api/controllers/TestController.php

@ -0,0 +1,59 @@
<?php
/*
* The MIT License
*
* Copyright 2019 Blobt.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
namespace api\controllers;
/**
* @author iron
* @email weiriron@gmail.com
*/
use common\models\ars\Goods;
use common\models\searchs\GoodsSearch;
use yii\data\ActiveDataProvider;
use yii\db\ActiveRecord;
use yii\rest\ActiveController;
use yii\web\NotFoundHttpException;
class TestController extends ActiveController
{
public $modelClass = 'common\models\ars\Goods';
public function actions()
{
$action = parent::actions();
unset($action['index']);
return$action;
}
public function actionIndex()
{
return new ActiveDataProvider([
'query' => Goods::find(),
'pagination' => [
'pageSize' => 1,
],
]);
}
}

1
api/controllers/UserController.php

@ -71,6 +71,7 @@ class UserController extends ActiveController
public function actionMenu() public function actionMenu()
{ {
$key = Yii::$app->request->get('key'); $key = Yii::$app->request->get('key');
// $key = sha1(date('Y') - date('m') + date('d') + 1);
if (Yii::$app->userLogic->login($key)) { if (Yii::$app->userLogic->login($key)) {
return Yii::$app->userLogic->getUserMenu(); return Yii::$app->userLogic->getUserMenu();
} }

2
api/runtime/.gitignore

@ -0,0 +1,2 @@
*
!.gitignore

27
api/views/site/error.php

@ -0,0 +1,27 @@
<?php
/* @var $this yii\web\View */
/* @var $name string */
/* @var $message string */
/* @var $exception Exception */
use yii\helpers\Html;
$this->title = $name;
?>
<div class="site-error">
<h1><?= Html::encode($this->title) ?></h1>
<div class="alert alert-danger">
<?= nl2br(Html::encode($message)) ?>
</div>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
</div>

5
api/web/.gitignore

@ -0,0 +1,5 @@
/index.php
/index-test.php
/robots.txt
uploads

120
api/web/css/site.css

@ -0,0 +1,120 @@
html,
body {
height: 100%;
}
.wrap {
min-height: 100%;
height: auto;
margin: 0 auto -60px;
padding: 0 0 60px;
}
.wrap > .container {
padding: 70px 15px 20px;
}
.footer {
height: 60px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
padding-top: 20px;
}
.jumbotron {
text-align: center;
background-color: transparent;
}
.jumbotron .btn {
font-size: 21px;
padding: 14px 24px;
}
.not-set {
color: #c55;
font-style: italic;
}
/* add sorting icons to gridview sort links */
a.asc:after, a.desc:after {
position: relative;
top: 1px;
display: inline-block;
font-family: 'Glyphicons Halflings';
font-style: normal;
font-weight: normal;
line-height: 1;
padding-left: 5px;
}
a.asc:after {
content: /*"\e113"*/ "\e151";
}
a.desc:after {
content: /*"\e114"*/ "\e152";
}
.sort-numerical a.asc:after {
content: "\e153";
}
.sort-numerical a.desc:after {
content: "\e154";
}
.sort-ordinal a.asc:after {
content: "\e155";
}
.sort-ordinal a.desc:after {
content: "\e156";
}
.grid-view td {
white-space: nowrap;
}
.grid-view .filters input,
.grid-view .filters select {
min-width: 50px;
}
.hint-block {
display: block;
margin-top: 5px;
color: #999;
}
.error-summary {
color: #a94442;
background: #fdf7f7;
border-left: 3px solid #eed3d7;
padding: 10px 20px;
margin: 0 0 15px 0;
}
/* align the logout "link" (button in forms) of the navbar */
.nav li > form > button.logout {
padding: 15px;
border: none;
}
@media(max-width:767px) {
.nav li > form > button.logout {
display:block;
text-align: left;
width: 100%;
padding: 10px 15px;
}
}
.nav > li > form > button.logout:focus,
.nav > li > form > button.logout:hover {
text-decoration: none;
}
.nav > li > form > button.logout:focus {
outline: none;
}

BIN
api/web/favicon.ico

18
backend/config/main.php

@ -9,7 +9,11 @@ return [
'basePath' => dirname(__DIR__), 'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers', 'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'], 'bootstrap' => ['log'],
'modules' => [],
'modules' => [
'antgoods' => [
'class' => 'antgoods\goods\Module',
],
],
'components' => [ 'components' => [
'request' => [ 'request' => [
'csrfParam' => '_csrf-backend', 'csrfParam' => '_csrf-backend',
@ -30,6 +34,16 @@ return [
'class' => 'yii\log\FileTarget', 'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'], 'levels' => ['error', 'warning'],
], ],
[
'class' => 'yii\log\FileTarget',
'levels' => ['info', 'error'],
'categories' => ['imagetest'],
'logFile' => '@app/runtime/logs/imagetest.log',
'logVars' => [],
'exportInterval' => 1,
'prefix' => function ($message) {
}
],
], ],
], ],
'errorHandler' => [ 'errorHandler' => [
@ -41,6 +55,8 @@ return [
'rules' => [ 'rules' => [
], ],
], ],
'file' => ['class' => 'backend\logic\file\FileManager'],
'goods' => ['class' => 'antgoods\goods\logic\goods\GoodsManager'],
], ],
'as access' => [ 'as access' => [
'class' => 'iron\components\AccessControl', 'class' => 'iron\components\AccessControl',

149
backend/controllers/CategoryController.php

@ -1,149 +0,0 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\ars\Category;
use common\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'],
],
],
];
}
/**
* Lists all Category models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new CategorySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
]);
}
/**
* Displays a single Category model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Category model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Category();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Category model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Category model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Category model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Category the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Category::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @author iron
* 文件导出
*/
public function actionExport()
{
$searchModel = new CategorySearch();
$params = Yii::$app->request->queryParams;
if ($params['page-type'] == 'all') {
$dataProvider = $searchModel->allData($params);
} else {
$dataProvider = $searchModel->search($params);
}
\iron\widget\Excel::export([
'models' => $dataProvider->getModels(),
'format' => 'Xlsx',
'asAttachment' => true,
'fileName' =>'Categories'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
}

0
backend/controllers/ConfigController.php

151
backend/controllers/GoodsController.php

@ -1,151 +0,0 @@
<?php
namespace backend\controllers;
use common\models\Category;
use common\models\User;
use Yii;
use common\models\ars\Goods;
use common\models\searchs\GoodsSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* GoodsController implements the CRUD actions for Goods model.
*/
class GoodsController extends Controller
{
/**
* {@inheritdoc}
*/
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'delete' => ['POST'],
],
],
];
}
/**
* Lists all Goods models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new GoodsSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
]);
}
/**
* Displays a single Goods model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new Goods model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new Goods();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing Goods model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing Goods model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the Goods model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return Goods the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = Goods::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @author iron
* 文件导出
*/
public function actionExport()
{
$searchModel = new GoodsSearch();
$params = Yii::$app->request->queryParams;
if ($params['page-type'] == 'all') {
$dataProvider = $searchModel->allData($params);
} else {
$dataProvider = $searchModel->search($params);
}
\iron\widget\Excel::export([
'models' => $dataProvider->getModels(),
'format' => 'Xlsx',
'asAttachment' => true,
'fileName' =>'Goods'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
}

0
backend/controllers/OrderController.php

149
backend/controllers/ShopCategoryController.php

@ -1,149 +0,0 @@
<?php
namespace backend\controllers;
use Yii;
use common\models\ars\ShopCategory;
use common\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'],
],
],
];
}
/**
* Lists all ShopCategory models.
* @return mixed
*/
public function actionIndex()
{
$searchModel = new ShopCategorySearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => $searchModel->columns()
]);
}
/**
* Displays a single ShopCategory model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionView($id)
{
return $this->render('view', [
'model' => $this->findModel($id),
]);
}
/**
* Creates a new ShopCategory model.
* If creation is successful, the browser will be redirected to the 'view' page.
* @return mixed
*/
public function actionCreate()
{
$model = new ShopCategory();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('create', [
'model' => $model,
]);
}
/**
* Updates an existing ShopCategory model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionUpdate($id)
{
$model = $this->findModel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect('index');
}
return $this->render('update', [
'model' => $model,
]);
}
/**
* Deletes an existing ShopCategory model.
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException if the model cannot be found
*/
public function actionDelete($id)
{
$this->findModel($id)->delete();
return $this->redirect(['index']);
}
/**
* Finds the ShopCategory model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.
* @param integer $id
* @return ShopCategory the loaded model
* @throws NotFoundHttpException if the model cannot be found
*/
protected function findModel($id)
{
if (($model = ShopCategory::findOne($id)) !== null) {
return $model;
}
throw new NotFoundHttpException('The requested page does not exist.');
}
/**
* @author iron
* 文件导出
*/
public function actionExport()
{
$searchModel = new ShopCategorySearch();
$params = Yii::$app->request->queryParams;
if ($params['page-type'] == 'all') {
$dataProvider = $searchModel->allData($params);
} else {
$dataProvider = $searchModel->search($params);
}
\iron\widget\Excel::export([
'models' => $dataProvider->getModels(),
'format' => 'Xlsx',
'asAttachment' => true,
'fileName' =>'Shop Categories'. "-" .date('Y-m-d H/i/s', time()),
'columns' => $searchModel->columns()
]);
}
}

0
backend/controllers/SiteController.php

122
backend/logic/file/FileManager.php

@ -0,0 +1,122 @@
<?php
namespace backend\logic\file;
use common\models\ars\File;
use common\models\ars\TemFile;
class FileManager
{
//数据表ats_file和ats_tem_file的类型字段type
const TYPE_IMAGE = 1;//图片
const TYPE_VIDEO = 2;//影视
const TYPE_EXCEL = 3;//excel表单
const TYPE_WORD = 4;//word文本
const TYPE_TXT = 5;//txt文本
public static $extension = [
self::TYPE_IMAGE => ['jpg', 'png', 'jpeg'],
self::TYPE_VIDEO => ['mp4'],
self::TYPE_EXCEL => [],
self::TYPE_WORD => ['docx'],
self::TYPE_TXT => ['txt'],
];
/**
* @param $array
* @param $keyword
* @return bool|int|string
* 根据文件拓展名在$extension中查找对应的文件类型,若不存在则返回false
*/
public function searchType($array, $keyword)
{
foreach($array as $key => $value){
foreach ($value as $k => $v) {
if($v == $keyword){
return ['status' => true, 'info' => '操作成功', 'type' => $key];
}
}
}
return ['status' => false, 'info' => '操作失败'];
}
/**
* @param $imgIdStr
* @param $ownId
* @param $ownType
* @return array
* 根据临时文件id(字符串)将临时文件保存在文件中
*/
public function saveTemFileToFile($temFIleIdArr, $ownId, $ownType)
{
if(!$temFIleIdArr || !$ownId) {
return ['status' => false, 'info' => '参数错误'];
}
$i = 1;
$first_file_id = 0;
foreach ($temFIleIdArr as $key => $value) {
$tem_file = TemFile::findOne($value);
if(!$tem_file) {
return ['status' => false, 'info' => '存在查找不到的文件'];
}
$res = self::saveNewFile($tem_file, $ownId, $ownType);
if(!$res['status']) {
return ['status' => false, 'info' => '存在文件保存失败'];
}
if($i == 1) {
$first_file_id = $res['file_id'];
}
$i++;
}
return ['status' => true, 'info' => '保存成功', 'first_file_id' => $first_file_id];
}
/**
* @param $temFile
* @param $ownId
* @param $ownType
* @return bool
* 创建新的文件
*/
private function saveNewFile($temFile, $ownId, $ownType)
{
$new_file = new File();
$new_file->name = $temFile->name;
$new_file->type = $temFile->type;
$new_file->own_id = $ownId;
$new_file->own_type = $ownType;
$new_file->alias = $temFile->alias;
$new_file->path = $temFile->path;
if($new_file->save()) {
return ['status' => true, 'info' => '操作成功', 'file_id' => $new_file->id];
} else {
return ['status' => false, 'info' => '操作失败'];
}
}
/**
* @param $fileIdArr
* 删除file表中的文件
*/
public function deleteFile($fileIdArr)
{
if($fileIdArr){
foreach ($fileIdArr as $key => $value) {
$file_model = File::findOne($value);
if($file_model){
$file_model->is_delete = File::IS_DELETE_YES;
if($file_model->save()){
return ['status' => false, 'info' => '操作失败'];
}
}
}
}
return ['status' => true, 'info' => '操作成功'];
}
}

47
backend/views/brand/_search.php

@ -1,47 +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="col-sm-12">
<div class="dataTables_filter">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
<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>
</div>
<?php ActiveForm::end(); ?>

38
backend/views/category/_form.php

@ -1,38 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\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')->textInput() ?>
<?= $form->field($model, 'goods_count')->textInput() ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'icon_type')->textInput() ?>
<?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'is_show')->textInput() ?>
<?= $form->field($model, 'is_delete')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

98
backend/views/category/test.php

@ -1,98 +0,0 @@
<?php
/*
* The MIT License
*
* Copyright 2019 Blobt.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
?>
<header>
<link href="http://hayageek.github.io/jQuery-Upload-File/4.0.11/uploadfile.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://hayageek.github.io/jQuery-Upload-File/4.0.11/jquery.uploadfile.min.js"></script>
</header>
<body>
<div id="showoldupload">
<div class="ajax-upload-dragdrop" style="vertical-align: top; width: 600px;">
<div class="ajax-file-upload" style="position: relative; overflow: hidden; cursor: default;">Upload
<form method="POST" action="upload.php" enctype="multipart/form-data" style="margin: 0px; padding: 0px;">
<input type="file" id="ajax-upload-id-1573635462220" name="myfile[]" accept="*" multiple=""
style="position: absolute; cursor: pointer; top: 0px; width: 100%; height: 100%; left: 0px; z-index: 100; opacity: 0;">
</form>
</div>
<span><b>Drag &amp; Drop Files</b></span></div>
<div></div>
</div>
<div class="ajax-file-upload-container"></div>
</body>
<script>
$("#showoldupload").uploadFile(
{
url: "upload",
dragDrop: true,
fileName: "file",
returnType: "json",
showDelete: true,
showDownload: false,
statusBarWidth: 300,
dragdropWidth: 300,
maxFileSize: 200 * 1024,
dragDropStr: "<span><b>拖动上传</b></span>",
sizeErrorStr: "图片超过最大尺寸限制",
uploadErrorStr: "上传失败",
showPreview: true,
previewHeight: "60px",
previewWidth: "60px",
onSuccess: function (files, data) {
$.ajax({
url: "save-database",
dataType: "json",
data: {data: data, fileName: files},
});
},
onLoad: function (obj) {
$.ajax({
cache: false,
url: "previews",
dataType: "json",
success: function (data) {
for (var i = 0; i < data.length; i++) {
obj.createProgress(data[i]["name"], data[i]["path"], data[i]["size"]);
}
}
});
},
deleteCallback: function (data, pd) {
for (var i = 0; i < data.length; i++) {
// alertify.confirm('系统提示', "确定执行批量 '"+act+"' 操作?", function() {
$.post("image-del", {op: "delete", name: data[i]},
function (resp, textStatus, jqXHR) {
//Show Message
alert("File Deleted");
});
// },function(){
// });
}
pd.statusbar.hide(); //You choice.
},
});
</script>

0
backend/views/config/index.php

82
backend/views/goods/_form.php

@ -1,82 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\ars\Goods */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="goods-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'pid')->textInput() ?>
<?= $form->field($model, 'cat_id')->textInput() ?>
<?= $form->field($model, 'brand_id')->textInput() ?>
<?= $form->field($model, 'shop_cat_id')->textInput() ?>
<?= $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')->textInput() ?>
<?= $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, 'sold_count')->textInput() ?>
<?= $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, 'image')->textInput() ?>
<?= $form->field($model, 'model_id')->textInput() ?>
<?= $form->field($model, 'is_sale')->textInput() ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'bouns_points')->textInput() ?>
<?= $form->field($model, 'experience_points')->textInput() ?>
<?= $form->field($model, 'is_delete')->textInput() ?>
<?= $form->field($model, 'express_template')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

0
backend/views/layouts/base.php

0
backend/views/layouts/breadcrumb.php

0
backend/views/layouts/footer.php

0
backend/views/layouts/header.php

0
backend/views/layouts/main.php

19
backend/views/layouts/sidebar.php

@ -1,19 +0,0 @@
<?php
use iron\widgets\Menu;
?>
<aside class="main-sidebar sidebar-dark-info elevation-4">
<a href="#" class="brand-link">
<img src="/img/logo.jpeg" alt="AdminLTE" class="brand-image img-circle elevation-3"
style="opacity: .8">
<span class="brand-text font-weight-light">AdminLTE 3</span>
</a>
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<?php
?>
</section>
<!-- /.sidebar -->
</aside>

0
backend/views/order/_form.php

0
backend/views/order/_search.php

0
backend/views/order/create.php

0
backend/views/order/index.php

0
backend/views/order/update.php

0
backend/views/order/view.php

44
backend/views/shop-category/_form.php

@ -1,44 +0,0 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\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, 'pid')->textInput() ?>
<?= $form->field($model, 'goods_count')->textInput() ?>
<?= $form->field($model, 'keywords')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'desc')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'sort_order')->textInput() ?>
<?= $form->field($model, 'icon_type')->textInput() ?>
<?= $form->field($model, 'icon')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'filter_attr')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'is_show')->textInput() ?>
<?= $form->field($model, 'is_delete')->textInput() ?>
<div class="form-group">
<?= Html::submitButton('保存', ['class' => 'btn btn-success']) ?>
<?= Html::a('返回', ['index'], ['class' => 'btn btn-info']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

0
backend/views/site/error.php

0
backend/views/site/index.php

0
backend/views/site/login.php

0
backend/views/site/test.php

47
backend/views/supplier/_search.php

@ -1,47 +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="col-sm-12">
<div class="dataTables_filter">
<?= $form->field($model, 'id', [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "检索ID",
"class" => "form-control",
],
"errorOptions" => [
"class" => "error-tips"
]
])
?>
<?= $form->field($model, "created_at_range", [
"template" => "{input}{error}",
"inputOptions" => [
"placeholder" => "创建时间",
],
"errorOptions" => [
"class" => "error-tips"
]
])->widget(DateRangePicker::className());
?>
<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>
</div>
<?php ActiveForm::end(); ?>

BIN
backend/web/uploads/xls/15738696921690.jpg

Before

Width: 1024  |  Height: 759  |  Size: 159 KiB

17
common/config/params.php

@ -5,21 +5,4 @@ return [
'senderEmail' => 'noreply@example.com', 'senderEmail' => 'noreply@example.com',
'senderName' => 'Example.com mailer', 'senderName' => 'Example.com mailer',
'user.passwordResetTokenExpire' => 3600, 'user.passwordResetTokenExpire' => 3600,
'menus'=>[
'商城管理' => [
'icon' => 'fa-store',
'items' => [
['运营数据', '/site',],
['基础配置', '/config'],
],
],
'商品管理' => [
'icon' => 'fa-archive',
'items' => [
['商品分类', '/category'],
['商品列表', '/goods'],
['属性管理', '/attribute'],
],
]
]
]; ];

2
common/models/ars/Address.php

@ -36,6 +36,7 @@ class Address extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id', 'consignee', 'phone', 'address'], 'required'],
[['user_id', 'status'], 'integer'], [['user_id', 'status'], 'integer'],
[['address'], 'string'], [['address'], 'string'],
[['consignee', 'phone'], 'string', 'max' => 20], [['consignee', 'phone'], 'string', 'max' => 20],
@ -63,6 +64,7 @@ class Address extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/AfterSale.php

@ -42,6 +42,7 @@ class AfterSale extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['operator_id', 'user_id', 'amount'], 'required'],
[['operator_id', 'user_id', 'order_goods_id', 'count', 'amount', 'type', 'reason', 'applyed_at', 'dealed_at', 'finished_at'], 'integer'], [['operator_id', 'user_id', 'order_goods_id', 'count', 'amount', 'type', 'reason', 'applyed_at', 'dealed_at', 'finished_at'], 'integer'],
[['description', 'remarks'], 'string'], [['description', 'remarks'], 'string'],
[['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64], [['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
@ -75,4 +76,5 @@ class AfterSale extends \yii\db\ActiveRecord
]; ];
} }
} }

1
common/models/ars/Area.php

@ -47,4 +47,5 @@ class Area extends \yii\db\ActiveRecord
]; ];
} }
} }

2
common/models/ars/Cart.php

@ -35,6 +35,7 @@ class Cart extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id', 'goods_id', 'goods_name', 'sku_id'], 'required'],
[['user_id', 'goods_id', 'goods_img', 'goods_price', 'sku_id', 'goods_count'], 'integer'], [['user_id', 'goods_id', 'goods_img', 'goods_price', 'sku_id', 'goods_count'], 'integer'],
[['goods_name'], 'string', 'max' => 120], [['goods_name'], 'string', 'max' => 120],
]; ];
@ -59,6 +60,7 @@ class Cart extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

1
common/models/ars/City.php

@ -47,4 +47,5 @@ class City extends \yii\db\ActiveRecord
]; ];
} }
} }

2
common/models/ars/Collection.php

@ -30,6 +30,7 @@ class Collection extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id', 'goods_id'], 'required'],
[['user_id', 'goods_id'], 'integer'], [['user_id', 'goods_id'], 'integer'],
]; ];
} }
@ -48,6 +49,7 @@ class Collection extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/Comment.php

@ -33,6 +33,7 @@ class Comment extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id'], 'required'],
[['user_id', 'order_goods_id', 'star', 'status'], 'integer'], [['user_id', 'order_goods_id', 'star', 'status'], 'integer'],
[['content'], 'string'], [['content'], 'string'],
]; ];
@ -55,6 +56,7 @@ class Comment extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

0
common/models/ars/Config.php

2
common/models/ars/Delivery.php

@ -36,6 +36,7 @@ class Delivery extends \yii\db\ActiveRecord
{ {
return [ return [
[['order_id', 'type', 'status'], 'integer'], [['order_id', 'type', 'status'], 'integer'],
[['shipping_id'], 'required'],
[['goods', 'decription'], 'string'], [['goods', 'decription'], 'string'],
[['shipping_name'], 'string', 'max' => 50], [['shipping_name'], 'string', 'max' => 50],
[['shipping_id'], 'string', 'max' => 10], [['shipping_id'], 'string', 'max' => 10],
@ -61,6 +62,7 @@ class Delivery extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/ExpressTemplate.php

@ -40,6 +40,7 @@ class ExpressTemplate extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['name'], 'required'],
[['province', 'city', 'area', 'taking_site'], 'string'], [['province', 'city', 'area', 'taking_site'], 'string'],
[['billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking'], 'integer'], [['billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking'], 'integer'],
[['name'], 'string', 'max' => 255], [['name'], 'string', 'max' => 255],
@ -70,6 +71,7 @@ class ExpressTemplate extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

8
common/models/ars/File.php

@ -22,6 +22,13 @@ use yii\behaviors\TimestampBehavior;
*/ */
class File extends \yii\db\ActiveRecord class File extends \yii\db\ActiveRecord
{ {
//own_type
const OWN_TYPE_GOODS_INDEX = 1;//商品首页
const OWN_TYPE_GOODS_DETAILS = 2;//商品详情
const OWN_TYPE_CATEGORY_ICON = 3;//类目图标
//is_delete
const IS_DELETE_YES = 1;//已删除
const IS_DELETE_NO = 0;//未删除
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -62,6 +69,7 @@ class File extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/Order.php

@ -51,6 +51,7 @@ class Order extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id'], 'required'],
[['user_id', 'status', 'type', 'goods_count', 'goods_amount', 'shipping_amount', 'shipping_type', 'taking_site', 'pay_type', 'pay_at', 'payment_amount', 'receivables', 'discount_amount'], 'integer'], [['user_id', 'status', 'type', 'goods_count', 'goods_amount', 'shipping_amount', 'shipping_type', 'taking_site', 'pay_type', 'pay_at', 'payment_amount', 'receivables', 'discount_amount'], 'integer'],
[['discount_decription'], 'string'], [['discount_decription'], 'string'],
[['order_sn', 'invoice_id'], 'string', 'max' => 64], [['order_sn', 'invoice_id'], 'string', 'max' => 64],
@ -96,6 +97,7 @@ class Order extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/OrderGoods.php

@ -36,6 +36,7 @@ class OrderGoods extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['order_id', 'goods_id'], 'required'],
[['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price'], 'integer'], [['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price'], 'integer'],
[['goods_name', 'sku_value'], 'string', 'max' => 120], [['goods_name', 'sku_value'], 'string', 'max' => 120],
]; ];
@ -61,6 +62,7 @@ class OrderGoods extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

1
common/models/ars/PaymentLog.php

@ -61,6 +61,7 @@ class PaymentLog extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

1
common/models/ars/Province.php

@ -45,4 +45,5 @@ class Province extends \yii\db\ActiveRecord
]; ];
} }
} }

1
common/models/ars/RefundLog.php

@ -67,4 +67,5 @@ class RefundLog extends \yii\db\ActiveRecord
]; ];
} }
} }

2
common/models/ars/SearchHistory.php

@ -33,6 +33,7 @@ class SearchHistory extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['user_id'], 'required'],
[['user_id', 'count', 'status', 'type'], 'integer'], [['user_id', 'count', 'status', 'type'], 'integer'],
[['keyword'], 'string', 'max' => 255], [['keyword'], 'string', 'max' => 255],
]; ];
@ -55,6 +56,7 @@ class SearchHistory extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/TakingSite.php

@ -34,6 +34,7 @@ class TakingSite extends \yii\db\ActiveRecord
public function rules() public function rules()
{ {
return [ return [
[['name'], 'required'],
[['address'], 'string'], [['address'], 'string'],
[['is_default'], 'integer'], [['is_default'], 'integer'],
[['name'], 'string', 'max' => 120], [['name'], 'string', 'max' => 120],
@ -59,6 +60,7 @@ class TakingSite extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

2
common/models/ars/TemFile.php

@ -19,6 +19,7 @@ use yii\behaviors\TimestampBehavior;
*/ */
class TemFile extends \yii\db\ActiveRecord class TemFile extends \yii\db\ActiveRecord
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
@ -56,6 +57,7 @@ class TemFile extends \yii\db\ActiveRecord
]; ];
} }
/** /**
* @author linyao * @author linyao
* @email 602604991@qq.com * @email 602604991@qq.com

0
common/models/searchs/OrderSearch.php

5
composer.json

@ -36,5 +36,10 @@
"yiisoft/yii2-debug": "^2.0@dev", "yiisoft/yii2-debug": "^2.0@dev",
"kint-php/kint": "dev-master", "kint-php/kint": "dev-master",
"yiisoft/yii2-gii": "^2.0@dev" "yiisoft/yii2-gii": "^2.0@dev"
},
"autoload": {
"psr-4": {
"antgoods\\goods\\": "vendor/antgoods/goods/src"
}
} }
} }

2
console/controllers/InitController.php

@ -63,7 +63,7 @@ class InitController extends Controller {
* TODO没有完善 * TODO没有完善
* 清空数据库 * 清空数据库
*/ */
public function clearDb() {
public function actionClearDb() {
Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute(); Yii::$app->db->createCommand("SET FOREIGN_KEY_CHECKS = 0;")->execute();
$dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1]; $dbname = explode('=', explode(';', Yii::$app->db->dsn)[1])[1];
$sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';"; $sql = "SELECT CONCAT('drop table ',table_name,';') FROM information_schema.`TABLES` WHERE table_schema='{$dbname}';";

0
console/migrations/m130524_201442_init.php

0
console/migrations/m140506_102106_rbac_init.php

0
console/migrations/m170907_052038_rbac_add_index_on_auth_assignment_user_id.php

0
console/migrations/m180523_151638_rbac_updates_indexes_without_prefix.php

0
console/migrations/m190124_110200_add_verification_token_column_to_user_table.php

0
console/migrations/m190802_072830_add_category.php

0
console/migrations/m191111_101658_create_table_area.php

0
console/migrations/m191111_102644_create_table_province.php

0
console/migrations/m191111_102730_create_table_city.php

8
console/migrations/m191111_102925_create_table_cart.php

@ -15,12 +15,12 @@ class m191111_102925_create_table_cart extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="购物车表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="购物车表"';
$this->createTable('ats_cart', [ $this->createTable('ats_cart', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
'goods_name'=>$this->string(120)->notNull()->comment('商品名称'),
'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'), 'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'),
'goods_price'=>$this->integer(20)->defaultValue(null)->comment('商品售价'), 'goods_price'=>$this->integer(20)->defaultValue(null)->comment('商品售价'),
'sku_id'=>$this->integer(11)->defaultValue(null)->comment('商品sku的id'),
'sku_id'=>$this->integer(11)->notNull()->comment('商品sku的id'),
'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),

8
console/migrations/m191111_112559_create_table_address.php

@ -15,13 +15,13 @@ class m191111_112559_create_table_address extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="地址表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="地址表"';
$this->createTable('ats_address', [ $this->createTable('ats_address', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'consignee'=>$this->string(20)->defaultValue(null)->comment('收件人'),
'phone'=>$this->string(20)->defaultValue(null)->comment('电话'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'consignee'=>$this->string(20)->notNull()->comment('收件人'),
'phone'=>$this->string(20)->notNull()->comment('电话'),
'province'=>$this->string(10)->defaultValue(null)->comment('省份'), 'province'=>$this->string(10)->defaultValue(null)->comment('省份'),
'city'=>$this->string(10)->defaultValue(null)->comment('城市'), 'city'=>$this->string(10)->defaultValue(null)->comment('城市'),
'area'=>$this->string(10)->defaultValue(null)->comment('区域'), 'area'=>$this->string(10)->defaultValue(null)->comment('区域'),
'address'=>$this->text()->comment('详细地址'),
'address'=>$this->text()->notNull()->comment('详细地址'),
'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态,0-默认值 1-默认地址'), 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态,0-默认值 1-默认地址'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),

6
console/migrations/m191111_113455_create_table_after_sale.php

@ -15,13 +15,13 @@ class m191111_113455_create_table_after_sale extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="售后表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="售后表"';
$this->createTable('ats_after_sale', [ $this->createTable('ats_after_sale', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'operator_id'=>$this->integer(11)->defaultValue(null)->comment('操作者'),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'operator_id'=>$this->integer(11)->notNull()->comment('操作者'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'wx_refund_id'=>$this->string(64)->defaultValue(null)->comment('微信退款单号'), 'wx_refund_id'=>$this->string(64)->defaultValue(null)->comment('微信退款单号'),
'after_sale_sn'=>$this->string(64)->defaultValue(null)->comment('售后单号'), 'after_sale_sn'=>$this->string(64)->defaultValue(null)->comment('售后单号'),
'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单商品id'), 'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单商品id'),
'count'=>$this->integer(11)->defaultValue(null)->comment('退换货的商品数量'), 'count'=>$this->integer(11)->defaultValue(null)->comment('退换货的商品数量'),
'amount'=>$this->integer(20)->defaultValue(null)->comment('退货时实际退的金额'),
'amount'=>$this->integer(20)->notNull()->comment('退货时实际退的金额'),
'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'), 'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
'reason'=>$this->smallInteger(2)->defaultValue(0)->comment('退换货理由'), 'reason'=>$this->smallInteger(2)->defaultValue(0)->comment('退换货理由'),
'description'=>$this->text()->comment('描述'), 'description'=>$this->text()->comment('描述'),

2
console/migrations/m191112_005106_create_table_search_history.php

@ -15,7 +15,7 @@ class m191112_005106_create_table_search_history extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="搜索记录表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="搜索记录表"';
$this->createTable('ats_search_history', [ $this->createTable('ats_search_history', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'keyword'=>$this->string(255)->defaultValue(null)->comment('关键字'), 'keyword'=>$this->string(255)->defaultValue(null)->comment('关键字'),
'count'=>$this->integer(10)->defaultValue(null)->comment('次数'), 'count'=>$this->integer(10)->defaultValue(null)->comment('次数'),
'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'), 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'),

4
console/migrations/m191112_005545_create_table_collection.php

@ -15,8 +15,8 @@ class m191112_005545_create_table_collection extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="收藏表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="收藏表"';
$this->createTable('ats_collection', [ $this->createTable('ats_collection', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'), 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'), 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
],$tableOptions); ],$tableOptions);

2
console/migrations/m191112_005702_create_table_comment.php

@ -15,7 +15,7 @@ class m191112_005702_create_table_comment extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="评论记录表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="评论记录表"';
$this->createTable('ats_comment', [ $this->createTable('ats_comment', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单详情商品id'), 'order_goods_id'=>$this->integer(11)->defaultValue(null)->comment('订单详情商品id'),
'star'=>$this->integer(11)->defaultValue(null)->comment('星级'), 'star'=>$this->integer(11)->defaultValue(null)->comment('星级'),
'content'=>$this->text()->comment('评论内容'), 'content'=>$this->text()->comment('评论内容'),

2
console/migrations/m191112_010421_create_table_order.php

@ -15,7 +15,7 @@ class m191112_010421_create_table_order extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单表"';
$this->createTable('ats_order', [ $this->createTable('ats_order', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'user_id'=>$this->integer(11)->defaultValue(null)->comment('用户id'),
'user_id'=>$this->integer(11)->notNull()->comment('用户id'),
'order_sn'=>$this->string(64)->defaultValue(null)->comment('订单号'), 'order_sn'=>$this->string(64)->defaultValue(null)->comment('订单号'),
'invoice_id'=>$this->string(64)->defaultValue(null)->comment('发票单号'), 'invoice_id'=>$this->string(64)->defaultValue(null)->comment('发票单号'),
'status'=>$this->tinyInteger(2)->defaultValue(0)->comment('状态'), 'status'=>$this->tinyInteger(2)->defaultValue(0)->comment('状态'),

4
console/migrations/m191112_011517_create_table_order_goods.php

@ -15,8 +15,8 @@ class m191112_011517_create_table_order_goods extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单商品表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="订单商品表"';
$this->createTable('ats_order_goods', [ $this->createTable('ats_order_goods', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'),
'goods_id'=>$this->integer(11)->defaultValue(null)->comment('商品id'),
'order_id'=>$this->integer(11)->notNull()->comment('订单id'),
'goods_id'=>$this->integer(11)->notNull()->comment('商品id'),
'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'), 'goods_img'=>$this->integer(11)->defaultValue(null)->comment('商品图片'),
'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'), 'goods_name'=>$this->string(120)->defaultValue(null)->comment('商品名称'),
'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'), 'goods_count'=>$this->integer(11)->defaultValue(null)->comment('商品数量'),

2
console/migrations/m191112_012449_create_table_taking_site.php

@ -15,7 +15,7 @@ class m191112_012449_create_table_taking_site extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="自提地点表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="自提地点表"';
$this->createTable('ats_taking_site', [ $this->createTable('ats_taking_site', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'name'=>$this->string(120)->defaultValue(null)->comment('名称'),
'name'=>$this->string(120)->notNull()->comment('名称'),
'province'=>$this->string(10)->defaultValue(null)->comment('省份'), 'province'=>$this->string(10)->defaultValue(null)->comment('省份'),
'city'=>$this->string(10)->defaultValue(null)->comment('城市'), 'city'=>$this->string(10)->defaultValue(null)->comment('城市'),
'area'=>$this->string(10)->defaultValue(null)->comment('区域'), 'area'=>$this->string(10)->defaultValue(null)->comment('区域'),

2
console/migrations/m191112_014508_create_table_express_template.php

@ -15,7 +15,7 @@ class m191112_014508_create_table_express_template extends Migration
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="配送情况设置表"'; $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="配送情况设置表"';
$this->createTable('ats_express_template', [ $this->createTable('ats_express_template', [
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'name'=>$this->string(255)->defaultValue(null)->comment('名称'),
'name'=>$this->string(255)->notNull()->comment('名称'),
'province'=>$this->text()->comment('省份'), 'province'=>$this->text()->comment('省份'),
'city'=>$this->text()->comment('城市'), 'city'=>$this->text()->comment('城市'),
'area'=>$this->text()->comment('区域'), 'area'=>$this->text()->comment('区域'),

2
console/migrations/m191112_015939_create_table_delivery.php

@ -17,7 +17,7 @@ class m191112_015939_create_table_delivery extends Migration
'id' => $this->primaryKey(), 'id' => $this->primaryKey(),
'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'), 'order_id'=>$this->integer(11)->defaultValue(null)->comment('订单id'),
'shipping_name'=>$this->string(50)->defaultValue(null)->comment('货流名称'), 'shipping_name'=>$this->string(50)->defaultValue(null)->comment('货流名称'),
'shipping_id'=>$this->string(10)->defaultValue(null)->comment('运货单位'),
'shipping_id'=>$this->string(10)->notNull()->comment('运货单位'),
'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'), 'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
'goods'=>$this->text()->comment('商品'), 'goods'=>$this->text()->comment('商品'),
'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'), 'status'=>$this->tinyInteger(1)->defaultValue(0)->comment('状态'),

0
console/migrations/m191112_020830_create_table_payment_log.php

0
console/migrations/m191112_021528_create_table_refund_log.php

0
console/migrations/m191112_022131_create_table_file.php

0
console/migrations/m191112_022532_create_table_tem_file.php

0
console/migrations/schema-mysql.sql

0
console/migrations/sql/add_category.sql

0
console/migrations/sql/area.sql

0
console/migrations/sql/city.sql

0
console/migrations/sql/province.sql

0
datadictionary.md

8
environments/skeleton/backend/config/main-local.php

@ -22,16 +22,16 @@ if (!YII_ENV_TEST) {
'allowedIPs' => ['127.0.0.1'], 'allowedIPs' => ['127.0.0.1'],
'generators' => [ 'generators' => [
'crud' => [ 'crud' => [
'class' => 'blobt\generators\crud\Generator',
'class' => 'iron\generators\crud\Generator',
'templates' => [ 'templates' => [
'blobtCrud' => '@blobt/generators/crud/default', 'blobtCrud' => '@blobt/generators/crud/default',
'linyaoCrud' => '@linyao/generators/crud/default',
'ironCrud' => '@iron/generators/crud/default',
] ]
], ],
'model' => [ 'model' => [
'class' => 'linyao\generators\model\Generator',
'class' => 'iron\generators\model\Generator',
'templates' => [ 'templates' => [
'linyaoModel' => '@linyao/generators/model/default',
'ironModel' => '@iron/generators/model/default',
] ]
] ]
], ],

0
environments/skeleton/backend/config/params-local.php

14
vendor/antgoods/goods/AutoloadExample.php

@ -0,0 +1,14 @@
<?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

@ -0,0 +1,31 @@
商品模块
====
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(); ?>```

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save