diff --git a/backend/config/main.php b/backend/config/main.php index 272465d..ec8c2c0 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -9,7 +9,11 @@ return [ 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'bootstrap' => ['log'], - 'modules' => [], + 'modules' => [ + 'antgoods' => [ + 'class' => 'antgoods\goods\Module', + ], + ], 'components' => [ 'request' => [ 'csrfParam' => '_csrf-backend', diff --git a/common/models/ars/Address.php b/common/models/ars/Address.php new file mode 100644 index 0000000..aec13fb --- /dev/null +++ b/common/models/ars/Address.php @@ -0,0 +1,88 @@ + 20], + [['province', 'city', 'area'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'consignee' => '收件人', + 'phone' => '电话', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'address' => '详细地址', + 'status' => '状态,0-默认值 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(); + }, + ], + ]; + } +} diff --git a/common/models/ars/AfterSale.php b/common/models/ars/AfterSale.php new file mode 100644 index 0000000..4cf35b1 --- /dev/null +++ b/common/models/ars/AfterSale.php @@ -0,0 +1,80 @@ + 64], + [['take_shipping_sn', 'send_shipping_sn'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'operator_id' => '操作者', + 'user_id' => '用户id', + 'wx_refund_id' => '微信退款单号', + 'after_sale_sn' => '售后单号', + 'order_goods_id' => '订单商品id', + 'count' => '退换货的商品数量', + 'amount' => '退货时实际退的金额', + 'type' => '类型', + 'reason' => '退换货理由', + 'description' => '描述', + 'take_shipping_sn' => '用户发货物流单号', + 'send_shipping_sn' => '换货商家发货的物流单号', + 'remarks' => '店家备注', + 'applyed_at' => '申请时间', + 'dealed_at' => '处理时间', + 'finished_at' => '完成时间', + ]; + } + + +} diff --git a/common/models/ars/Area.php b/common/models/ars/Area.php new file mode 100644 index 0000000..254681b --- /dev/null +++ b/common/models/ars/Area.php @@ -0,0 +1,51 @@ + 32], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => 'name', + 'area_id' => 'area_id', + 'city_id' => 'city_id', + ]; + } + + +} diff --git a/common/models/ars/Cart.php b/common/models/ars/Cart.php new file mode 100644 index 0000000..ef6477f --- /dev/null +++ b/common/models/ars/Cart.php @@ -0,0 +1,84 @@ + 120], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'goods_id' => '商品id', + 'goods_name' => '商品名称', + 'goods_img' => '商品图片', + 'goods_price' => '商品售价', + 'sku_id' => '商品sku的id', + 'goods_count' => '商品数量', + '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/common/models/ars/City.php b/common/models/ars/City.php new file mode 100644 index 0000000..ae87412 --- /dev/null +++ b/common/models/ars/City.php @@ -0,0 +1,51 @@ + 32], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'city_id' => 'city_id', + 'name' => 'name', + 'province_id' => 'province_id', + ]; + } + + +} diff --git a/common/models/ars/Collection.php b/common/models/ars/Collection.php new file mode 100644 index 0000000..2a1a771 --- /dev/null +++ b/common/models/ars/Collection.php @@ -0,0 +1,73 @@ + 'id', + 'user_id' => '用户id', + 'goods_id' => '商品id', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Comment.php b/common/models/ars/Comment.php new file mode 100644 index 0000000..2701ecf --- /dev/null +++ b/common/models/ars/Comment.php @@ -0,0 +1,80 @@ + 'id', + 'user_id' => '用户id', + 'order_goods_id' => '订单详情商品id', + 'star' => '星级', + 'content' => '评论内容', + 'status' => '状态:1为显示,0为不显示', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Delivery.php b/common/models/ars/Delivery.php new file mode 100644 index 0000000..85d1d0e --- /dev/null +++ b/common/models/ars/Delivery.php @@ -0,0 +1,86 @@ + 50], + [['shipping_id'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'shipping_name' => '货流名称', + 'shipping_id' => '运货单位', + 'type' => '类型', + 'goods' => '商品', + 'status' => '状态', + 'decription' => '描述', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/ExpressTemplate.php b/common/models/ars/ExpressTemplate.php new file mode 100644 index 0000000..e3e6b81 --- /dev/null +++ b/common/models/ars/ExpressTemplate.php @@ -0,0 +1,95 @@ + 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '名称', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'billing_type' => '账单类型', + 'extra_weight_type' => '续重重量类型', + 'exemption_type' => '包邮类型', + 'basic_price' => '基本运费', + 'extra_price' => '续重运费', + 'exemption_amount' => '包邮金额', + 'support_taking' => '是否支持自提,1为不支持', + 'taking_site' => '自提地点', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/File.php b/common/models/ars/File.php new file mode 100644 index 0000000..fc1be27 --- /dev/null +++ b/common/models/ars/File.php @@ -0,0 +1,86 @@ + 255], + [['alias'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'pid' => '父级id', + 'name' => '名称', + 'type' => '类型', + 'own_type' => '拥有者类型', + 'own_id' => '拥有者id', + 'alias' => '别名', + 'path' => '地址', + 'is_delete' => '是否删除,1为已删除', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Order.php b/common/models/ars/Order.php new file mode 100644 index 0000000..6f03a52 --- /dev/null +++ b/common/models/ars/Order.php @@ -0,0 +1,121 @@ + 64], + [['consignee', 'phone'], 'string', 'max' => 20], + [['province', 'city', 'area'], 'string', 'max' => 10], + [['payment_sn'], 'string', 'max' => 120], + [['remarks'], 'string', 'max' => 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'order_sn' => '订单号', + 'invoice_id' => '发票单号', + 'status' => '状态', + 'type' => '类型', + 'goods_count' => '商品数量', + 'goods_amount' => '商品金额', + 'shipping_amount' => '物流金额', + 'shipping_type' => '物流类型', + 'consignee' => '收件人', + 'phone' => '手机号码', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'taking_site' => '自提点', + 'pay_type' => '支付方式', + 'pay_at' => '支付时间', + 'payment_sn' => '付款单号', + 'payment_amount' => '支付金额', + 'receivables' => '应收款', + 'remarks' => '备注', + 'discount_amount' => '折扣金额', + 'discount_decription' => '折扣说明', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/OrderGoods.php b/common/models/ars/OrderGoods.php new file mode 100644 index 0000000..fa4d65d --- /dev/null +++ b/common/models/ars/OrderGoods.php @@ -0,0 +1,86 @@ + 120], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'goods_id' => '商品id', + 'goods_img' => '商品图片', + 'goods_name' => '商品名称', + 'goods_count' => '商品数量', + 'sku_value' => '商品sku', + 'price' => '销售价', + 'market_price' => '市场价', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/PaymentLog.php b/common/models/ars/PaymentLog.php new file mode 100644 index 0000000..9055f33 --- /dev/null +++ b/common/models/ars/PaymentLog.php @@ -0,0 +1,85 @@ + 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'wx_refund_id' => '微信退款单号', + 'mch_id' => '商户号', + 'order_amount' => '订单金额', + 'payment_amount' => '支付金额', + 'type' => '类型', + 'status' => '状态', + 'refund_account' => '退款账户', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/Province.php b/common/models/ars/Province.php new file mode 100644 index 0000000..b03ffe6 --- /dev/null +++ b/common/models/ars/Province.php @@ -0,0 +1,49 @@ + 16], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => 'name', + 'province_id' => 'province_id', + ]; + } + + +} diff --git a/common/models/ars/RefundLog.php b/common/models/ars/RefundLog.php new file mode 100644 index 0000000..33ed965 --- /dev/null +++ b/common/models/ars/RefundLog.php @@ -0,0 +1,71 @@ + 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'order_id' => '订单id', + 'wx_refund_id' => '微信退款单号', + 'reason' => '理由', + 'order_amount' => '订单金额', + 'refund_amount' => '退款金额', + 'refunded_amount' => '已退款金额', + 'type' => '类型', + 'status' => '状态', + 'refund_account' => '退款账户', + 'operator_id' => '操作者', + 'applyed_at' => '申请时间', + 'confirmed_at' => '确认时间', + 'finished_at' => '完成时间', + ]; + } + + +} diff --git a/common/models/ars/SearchHistory.php b/common/models/ars/SearchHistory.php new file mode 100644 index 0000000..17fc86c --- /dev/null +++ b/common/models/ars/SearchHistory.php @@ -0,0 +1,80 @@ + 255], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '用户id', + 'keyword' => '关键字', + 'count' => '次数', + 'status' => '状态', + 'type' => '类型', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/TakingSite.php b/common/models/ars/TakingSite.php new file mode 100644 index 0000000..cbd36bd --- /dev/null +++ b/common/models/ars/TakingSite.php @@ -0,0 +1,84 @@ + 120], + [['province', 'city', 'area'], 'string', 'max' => 10], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '名称', + 'province' => '省份', + 'city' => '城市', + 'area' => '区域', + 'address' => '地址', + 'is_default' => '是否为默认,1为默认', + 'updated_at' => '更新时间', + 'created_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/common/models/ars/TemFile.php b/common/models/ars/TemFile.php new file mode 100644 index 0000000..52c228d --- /dev/null +++ b/common/models/ars/TemFile.php @@ -0,0 +1,80 @@ + 255], + [['alias'], 'string', 'max' => 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'user_id' => '父级id', + 'name' => '名称', + 'type' => '类型', + 'alias' => '别名', + 'path' => '地址', + 'updated_at' => '更新时间', + 'created_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/controllers/GoodsController.php b/vendor/antgoods/goods/src/controllers/GoodsController.php new file mode 100644 index 0000000..7180f54 --- /dev/null +++ b/vendor/antgoods/goods/src/controllers/GoodsController.php @@ -0,0 +1,149 @@ + [ + '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/Attribute.php b/vendor/antgoods/goods/src/models/ars/Attribute.php new file mode 100644 index 0000000..c68e652 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Attribute.php @@ -0,0 +1,81 @@ + 50], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '属性名', + 'value' => '属性值', + 'type' => '类型', + '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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Brand.php b/vendor/antgoods/goods/src/models/ars/Brand.php new file mode 100644 index 0000000..a225e59 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Brand.php @@ -0,0 +1,74 @@ + 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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Category.php b/vendor/antgoods/goods/src/models/ars/Category.php new file mode 100644 index 0000000..9fe01df --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Category.php @@ -0,0 +1,87 @@ + 60], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'is_show' => '是否显示,1为不显示', + '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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/FilterAttr.php b/vendor/antgoods/goods/src/models/ars/FilterAttr.php new file mode 100644 index 0000000..2036d55 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/FilterAttr.php @@ -0,0 +1,78 @@ + 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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Goods.php b/vendor/antgoods/goods/src/models/ars/Goods.php new file mode 100644 index 0000000..841efc8 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Goods.php @@ -0,0 +1,135 @@ + 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/ars/GoodsAttr.php b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php new file mode 100644 index 0000000..b888e46 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/GoodsAttr.php @@ -0,0 +1,78 @@ + 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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/GoodsSku.php b/vendor/antgoods/goods/src/models/ars/GoodsSku.php new file mode 100644 index 0000000..7e4644a --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/GoodsSku.php @@ -0,0 +1,105 @@ + 50], + [['goods_sn', 'goods_attr'], 'string', 'max' => 60], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'goods_id' => '商品id', + 'goods_code' => '商品条码', + 'goods_sn' => '商品唯一货号', + 'goods_attr' => '属性匹配', + 'weight' => '重量', + 'length' => '长度', + 'width' => '宽度', + 'height' => '高度', + 'diameter' => '直径', + '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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/ShopCategory.php b/vendor/antgoods/goods/src/models/ars/ShopCategory.php new file mode 100644 index 0000000..2ffb20c --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/ShopCategory.php @@ -0,0 +1,96 @@ + 60], + [['keywords'], 'string', 'max' => 100], + [['desc'], 'string', 'max' => 255], + [['icon'], 'string', 'max' => 64], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'id', + 'name' => '类别名称', + 'pid' => '父级id', + 'goods_count' => '商品数量', + 'keywords' => '关键字', + 'desc' => '描述', + 'sort_order' => '排序', + 'icon_type' => '图标类型', + 'icon' => '图标', + 'filter_attr' => '筛选属性', + 'is_show' => '是否显示,1为不显示', + '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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/ars/Supplier.php b/vendor/antgoods/goods/src/models/ars/Supplier.php new file mode 100644 index 0000000..73d51f6 --- /dev/null +++ b/vendor/antgoods/goods/src/models/ars/Supplier.php @@ -0,0 +1,81 @@ + 50], + [['phone'], 'string', 'max' => 20], + ]; + } + + /** + * {@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(); + }, + ], + ]; + } +} diff --git a/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php new file mode 100644 index 0000000..738cbf2 --- /dev/null +++ b/vendor/antgoods/goods/src/models/searchs/GoodsSearch.php @@ -0,0 +1,197 @@ + '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 new file mode 100644 index 0000000..5956348 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/_form.php @@ -0,0 +1,82 @@ + + +
+ + + + 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 new file mode 100644 index 0000000..9a86777 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/_search.php @@ -0,0 +1,49 @@ + + + ['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 new file mode 100644 index 0000000..4f1d258 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/create.php @@ -0,0 +1,18 @@ +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 new file mode 100644 index 0000000..82c38b2 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/index.php @@ -0,0 +1,28 @@ +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 new file mode 100644 index 0000000..9689d6d --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/update.php @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000..27f0963 --- /dev/null +++ b/vendor/antgoods/goods/src/views/goods/view.php @@ -0,0 +1,59 @@ +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', + ], + ]) ?> + +