From 23062a786db283f7823bac4ab6038d11660a70e7 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 19 Nov 2019 13:57:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0antgoods=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 5 + .../goods/src/controllers/GoodsController.php | 149 ------------- .../antgoods/goods/src/models/ars/Goods.php | 133 ------------ .../goods/src/models/searchs/GoodsSearch.php | 197 ------------------ .../antgoods/goods/src/views/goods/_form.php | 82 -------- .../goods/src/views/goods/_search.php | 49 ----- .../antgoods/goods/src/views/goods/create.php | 18 -- .../antgoods/goods/src/views/goods/index.php | 28 --- .../antgoods/goods/src/views/goods/update.php | 19 -- .../antgoods/goods/src/views/goods/view.php | 59 ------ 10 files changed, 5 insertions(+), 734 deletions(-) delete mode 100755 vendor/antgoods/goods/src/controllers/GoodsController.php delete mode 100755 vendor/antgoods/goods/src/models/ars/Goods.php delete mode 100755 vendor/antgoods/goods/src/models/searchs/GoodsSearch.php delete mode 100644 vendor/antgoods/goods/src/views/goods/_form.php delete mode 100644 vendor/antgoods/goods/src/views/goods/_search.php delete mode 100644 vendor/antgoods/goods/src/views/goods/create.php delete mode 100644 vendor/antgoods/goods/src/views/goods/index.php delete mode 100644 vendor/antgoods/goods/src/views/goods/update.php delete mode 100644 vendor/antgoods/goods/src/views/goods/view.php diff --git a/composer.json b/composer.json index 83a43bb..8a68eb5 100755 --- a/composer.json +++ b/composer.json @@ -35,5 +35,10 @@ "yiisoft/yii2-debug": "^2.0@dev", "kint-php/kint": "dev-master", "yiisoft/yii2-gii": "^2.0@dev" + }, + "autoload": { + "psr-4": { + "antgoods\\goods\\": "vendor/antgoods/goods/src" + } } } diff --git a/vendor/antgoods/goods/src/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php deleted file mode 100755 index 7180f54..0000000 --- a/vendor/antgoods/goods/src/controllers/GoodsController.php +++ /dev/null @@ -1,149 +0,0 @@ - [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'delete' => ['POST'], - ], - ], - ]; - } - - /** - * Lists all Goods models. - * @return mixed - */ - public function actionIndex() - { - $searchModel = new GoodsSearch(); - $dataProvider = $searchModel->search(Yii::$app->request->queryParams); - - return $this->render('index', [ - 'searchModel' => $searchModel, - 'dataProvider' => $dataProvider, - 'columns' => $searchModel->columns() - ]); - } - - /** - * Displays a single Goods model. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionView($id) - { - return $this->render('view', [ - 'model' => $this->findModel($id), - ]); - } - - /** - * Creates a new Goods model. - * If creation is successful, the browser will be redirected to the 'view' page. - * @return mixed - */ - public function actionCreate() - { - $model = new Goods(); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('create', [ - 'model' => $model, - ]); - } - - /** - * Updates an existing Goods model. - * If update is successful, the browser will be redirected to the 'view' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionUpdate($id) - { - $model = $this->findModel($id); - - if ($model->load(Yii::$app->request->post()) && $model->save()) { - return $this->redirect('index'); - } - - return $this->render('update', [ - 'model' => $model, - ]); - } - - /** - * Deletes an existing Goods model. - * If deletion is successful, the browser will be redirected to the 'index' page. - * @param integer $id - * @return mixed - * @throws NotFoundHttpException if the model cannot be found - */ - public function actionDelete($id) - { - $this->findModel($id)->delete(); - - return $this->redirect(['index']); - } - - /** - * Finds the Goods model based on its primary key value. - * If the model is not found, a 404 HTTP exception will be thrown. - * @param integer $id - * @return Goods the loaded model - * @throws NotFoundHttpException if the model cannot be found - */ - protected function findModel($id) - { - if (($model = Goods::findOne($id)) !== null) { - return $model; - } - - throw new NotFoundHttpException('The requested page does not exist.'); - } - /** - * @author iron - * 文件导出 - */ - public function actionExport() - { - $searchModel = new GoodsSearch(); - $params = Yii::$app->request->queryParams; - if ($params['page-type'] == 'all') { - $dataProvider = $searchModel->allData($params); - } else { - $dataProvider = $searchModel->search($params); - } - \iron\widget\Excel::export([ - 'models' => $dataProvider->getModels(), - 'format' => 'Xlsx', - 'asAttachment' => true, - 'fileName' =>'Goods'. "-" .date('Y-m-d H/i/s', time()), - 'columns' => $searchModel->columns() - ]); - } -} diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php deleted file mode 100755 index f2ecddd..0000000 --- a/vendor/antgoods/goods/src/models/ars/Goods.php +++ /dev/null @@ -1,133 +0,0 @@ - 120], - [['sn'], 'string', 'max' => 60], - [['code'], 'string', 'max' => 50], - [['unit'], 'string', 'max' => 16], - [['brief'], 'string', 'max' => 255], - ]; - } - - /** - * {@inheritdoc} - */ - public function attributeLabels() - { - return [ - 'id' => 'id', - 'pid' => '父级id', - 'cat_id' => '后台商品类别id', - 'brand_id' => '品牌id', - 'shop_cat_id' => '前端商品类别id', - 'name' => '商品名称', - 'sn' => '商品唯一货号', - 'code' => '商品货码', - 'supplier_id' => '供应商id', - 'weight' => '重量', - 'length' => '长度', - 'width' => '宽度', - 'height' => '高度', - 'diameter' => '直径', - 'unit' => '单位', - 'sold_count' => '已售数量', - 'limit_count' => '限购数量', - 'stock' => '库存', - 'stock_warn' => '库存警告', - 'market_price' => '市场价', - 'price' => '销售价', - 'brief' => '简介', - 'description' => '详细介绍', - 'image' => '图片id', - 'model_id' => '模型id', - 'is_sale' => '该商品是否开放销售,1为是,0为否', - '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(); - }, - ], - ]; - } -} diff --git a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php deleted file mode 100755 index 84736a0..0000000 --- a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php +++ /dev/null @@ -1,197 +0,0 @@ - 'blobt\grid\CheckboxColumn', - 'width' => '2%', - 'align' => 'center' - ], - 'id', - 'pid', - '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', - //'is_sale', - //'sort_order', - //'bouns_points', - //'experience_points', - //'is_delete', - //'express_template', - //'created_at', - //'updated_at', - [ - 'class' => 'iron\grid\ActionColumn', - 'align' => 'center', - ], - ]; - } - /** - * @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(); - - // 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, - '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; - } -} diff --git a/vendor/antgoods/goods/src/views/goods/_form.php b/vendor/antgoods/goods/src/views/goods/_form.php deleted file mode 100644 index 149e969..0000000 --- a/vendor/antgoods/goods/src/views/goods/_form.php +++ /dev/null @@ -1,82 +0,0 @@ - - -
- - - - field($model, 'pid')->textInput() ?> - - field($model, 'cat_id')->textInput() ?> - - field($model, 'brand_id')->textInput() ?> - - field($model, 'shop_cat_id')->textInput() ?> - - field($model, 'name')->textInput(['maxlength' => true]) ?> - - field($model, 'sn')->textInput(['maxlength' => true]) ?> - - field($model, 'code')->textInput(['maxlength' => true]) ?> - - field($model, 'supplier_id')->textInput() ?> - - field($model, 'weight')->textInput() ?> - - field($model, 'length')->textInput() ?> - - field($model, 'width')->textInput() ?> - - field($model, 'height')->textInput() ?> - - field($model, 'diameter')->textInput() ?> - - field($model, 'unit')->textInput(['maxlength' => true]) ?> - - field($model, 'sold_count')->textInput() ?> - - field($model, 'limit_count')->textInput() ?> - - field($model, 'stock')->textInput() ?> - - field($model, 'stock_warn')->textInput() ?> - - field($model, 'market_price')->textInput() ?> - - field($model, 'price')->textInput() ?> - - field($model, 'brief')->textInput(['maxlength' => true]) ?> - - field($model, 'description')->textarea(['rows' => 6]) ?> - - field($model, 'image')->textInput() ?> - - field($model, 'model_id')->textInput() ?> - - field($model, 'is_sale')->textInput() ?> - - field($model, 'sort_order')->textInput() ?> - - field($model, 'bouns_points')->textInput() ?> - - field($model, 'experience_points')->textInput() ?> - - field($model, 'is_delete')->textInput() ?> - - field($model, 'express_template')->textInput() ?> - -
- 'btn btn-success']) ?> - 'btn btn-info']) ?> -
- - - -
diff --git a/vendor/antgoods/goods/src/views/goods/_search.php b/vendor/antgoods/goods/src/views/goods/_search.php deleted file mode 100644 index 9a86777..0000000 --- a/vendor/antgoods/goods/src/views/goods/_search.php +++ /dev/null @@ -1,49 +0,0 @@ - - - ['index'], - 'method' => 'get', - 'validateOnType' => true, - ]); -?> -
-
- field($model, 'id', [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "检索ID", - "class" => "form-control", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ]) - ?> -
-
- field($model, "created_at_range", [ - "template" => "{input}{error}", - "inputOptions" => [ - "placeholder" => "创建时间", - ], - "errorOptions" => [ - "class" => "error-tips" - ] - ])->widget(DateRangePicker::className()); - ?> -
-
- ', ['class' => 'btn btn-default']) ?> - ', ['class' => 'btn btn-default']) ?> -
-
- \ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/goods/create.php b/vendor/antgoods/goods/src/views/goods/create.php deleted file mode 100644 index d32b1b8..0000000 --- a/vendor/antgoods/goods/src/views/goods/create.php +++ /dev/null @@ -1,18 +0,0 @@ -title = '创建 Goods'; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/vendor/antgoods/goods/src/views/goods/index.php b/vendor/antgoods/goods/src/views/goods/index.php deleted file mode 100644 index 82c38b2..0000000 --- a/vendor/antgoods/goods/src/views/goods/index.php +++ /dev/null @@ -1,28 +0,0 @@ -title = 'Goods'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-
- $dataProvider, - 'filter' => $this->render("_search", ['model' => $searchModel]), - 'batch' => [ - [ - "label" => "删除", - "url" => "goods/deletes" - ], - ], - 'columns' => $columns - ]); - ?> -
-
\ No newline at end of file diff --git a/vendor/antgoods/goods/src/views/goods/update.php b/vendor/antgoods/goods/src/views/goods/update.php deleted file mode 100644 index afaf45f..0000000 --- a/vendor/antgoods/goods/src/views/goods/update.php +++ /dev/null @@ -1,19 +0,0 @@ -title = '编辑 Goods: ' . $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; -$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; -$this->params['breadcrumbs'][] = 'Update '; -?> -
- - render('_form', [ - 'model' => $model, - ]) ?> - -
diff --git a/vendor/antgoods/goods/src/views/goods/view.php b/vendor/antgoods/goods/src/views/goods/view.php deleted file mode 100644 index e2a57f2..0000000 --- a/vendor/antgoods/goods/src/views/goods/view.php +++ /dev/null @@ -1,59 +0,0 @@ -title = $model->name; -$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']]; -$this->params['breadcrumbs'][] = $this->title; -\yii\web\YiiAsset::register($this); -?> -
- -

- 'btn btn-success']) ?> -

- - $model, - 'attributes' => [ - 'id', - 'pid', - '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:ntext', - 'image', - 'model_id', - 'is_sale', - 'sort_order', - 'bouns_points', - 'experience_points', - 'is_delete', - 'express_template', - 'created_at', - 'updated_at', - ], - ]) ?> - -