Browse Source

antgoods增加goods的crud文件

wechat_public_accounts
linyaostalker 5 years ago
parent
commit
b675ebbe8d
  1. 6
      backend/config/main.php
  2. 88
      common/models/ars/Address.php
  3. 80
      common/models/ars/AfterSale.php
  4. 51
      common/models/ars/Area.php
  5. 84
      common/models/ars/Cart.php
  6. 51
      common/models/ars/City.php
  7. 73
      common/models/ars/Collection.php
  8. 80
      common/models/ars/Comment.php
  9. 86
      common/models/ars/Delivery.php
  10. 95
      common/models/ars/ExpressTemplate.php
  11. 86
      common/models/ars/File.php
  12. 121
      common/models/ars/Order.php
  13. 86
      common/models/ars/OrderGoods.php
  14. 85
      common/models/ars/PaymentLog.php
  15. 49
      common/models/ars/Province.php
  16. 71
      common/models/ars/RefundLog.php
  17. 80
      common/models/ars/SearchHistory.php
  18. 84
      common/models/ars/TakingSite.php
  19. 80
      common/models/ars/TemFile.php
  20. 149
      vendor/antgoods/goods/src/controllers/GoodsController.php
  21. 81
      vendor/antgoods/goods/src/models/ars/Attribute.php
  22. 74
      vendor/antgoods/goods/src/models/ars/Brand.php
  23. 87
      vendor/antgoods/goods/src/models/ars/Category.php
  24. 78
      vendor/antgoods/goods/src/models/ars/FilterAttr.php
  25. 135
      vendor/antgoods/goods/src/models/ars/Goods.php
  26. 78
      vendor/antgoods/goods/src/models/ars/GoodsAttr.php
  27. 105
      vendor/antgoods/goods/src/models/ars/GoodsSku.php
  28. 96
      vendor/antgoods/goods/src/models/ars/ShopCategory.php
  29. 81
      vendor/antgoods/goods/src/models/ars/Supplier.php
  30. 197
      vendor/antgoods/goods/src/models/searchs/GoodsSearch.php
  31. 82
      vendor/antgoods/goods/src/views/goods/_form.php
  32. 49
      vendor/antgoods/goods/src/views/goods/_search.php
  33. 18
      vendor/antgoods/goods/src/views/goods/create.php
  34. 28
      vendor/antgoods/goods/src/views/goods/index.php
  35. 19
      vendor/antgoods/goods/src/views/goods/update.php
  36. 59
      vendor/antgoods/goods/src/views/goods/view.php

6
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',

88
common/models/ars/Address.php

@ -0,0 +1,88 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_address".
*
* @property int $id
* @property int $user_id 用户id
* @property string $consignee 收件人
* @property string $phone 电话
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
* @property string $address 详细地址
* @property int $status 状态,0-默认值 1-默认地址
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Address extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_address';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id', 'consignee', 'phone', 'address'], 'required'],
[['user_id', 'status'], 'integer'],
[['address'], 'string'],
[['consignee', 'phone'], 'string', 'max' => 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();
},
],
];
}
}

80
common/models/ars/AfterSale.php

@ -0,0 +1,80 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_after_sale".
*
* @property int $id
* @property int $operator_id 操作者
* @property int $user_id 用户id
* @property string $wx_refund_id 微信退款单号
* @property string $after_sale_sn 售后单号
* @property int $order_goods_id 订单商品id
* @property int $count 退换货的商品数量
* @property int $amount 退货时实际退的金额
* @property int $type 类型
* @property int $reason 退换货理由
* @property string $description 描述
* @property string $take_shipping_sn 用户发货物流单号
* @property string $send_shipping_sn 换货商家发货的物流单号
* @property string $remarks 店家备注
* @property int $applyed_at 申请时间
* @property int $dealed_at 处理时间
* @property int $finished_at 完成时间
*/
class AfterSale extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_after_sale';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['operator_id', 'user_id', 'amount'], 'required'],
[['operator_id', 'user_id', 'order_goods_id', 'count', 'amount', 'type', 'reason', 'applyed_at', 'dealed_at', 'finished_at'], 'integer'],
[['description', 'remarks'], 'string'],
[['wx_refund_id', 'after_sale_sn'], 'string', 'max' => 64],
[['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' => '完成时间',
];
}
}

51
common/models/ars/Area.php

@ -0,0 +1,51 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "area".
*
* @property int $id
* @property string $name
* @property int $area_id
* @property int $city_id
*/
class Area extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'area';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['area_id', 'city_id'], 'integer'],
[['name'], 'string', 'max' => 32],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => 'name',
'area_id' => 'area_id',
'city_id' => 'city_id',
];
}
}

84
common/models/ars/Cart.php

@ -0,0 +1,84 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_cart".
*
* @property int $id
* @property int $user_id 用户id
* @property int $goods_id 商品id
* @property string $goods_name 商品名称
* @property int $goods_img 商品图片
* @property int $goods_price 商品售价
* @property int $sku_id 商品sku的id
* @property int $goods_count 商品数量
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Cart extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_cart';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id', 'goods_id', 'goods_name', 'sku_id'], 'required'],
[['user_id', 'goods_id', 'goods_img', 'goods_price', 'sku_id', 'goods_count'], 'integer'],
[['goods_name'], 'string', 'max' => 120],
];
}
/**
* {@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();
},
],
];
}
}

51
common/models/ars/City.php

@ -0,0 +1,51 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "city".
*
* @property int $id
* @property int $city_id
* @property string $name
* @property int $province_id
*/
class City extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'city';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['city_id', 'province_id'], 'integer'],
[['name'], 'string', 'max' => 32],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'city_id' => 'city_id',
'name' => 'name',
'province_id' => 'province_id',
];
}
}

73
common/models/ars/Collection.php

@ -0,0 +1,73 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_collection".
*
* @property int $id
* @property int $user_id 用户id
* @property int $goods_id 商品id
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class Collection extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_collection';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id', 'goods_id'], 'required'],
[['user_id', 'goods_id'], 'integer'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => '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();
},
],
];
}
}

80
common/models/ars/Comment.php

@ -0,0 +1,80 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_comment".
*
* @property int $id
* @property int $user_id 用户id
* @property int $order_goods_id 订单详情商品id
* @property int $star 星级
* @property string $content 评论内容
* @property int $status 状态:1为显示,0为不显示
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class Comment extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_comment';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id'], 'required'],
[['user_id', 'order_goods_id', 'star', 'status'], 'integer'],
[['content'], 'string'],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => '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();
},
],
];
}
}

86
common/models/ars/Delivery.php

@ -0,0 +1,86 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_delivery".
*
* @property int $id
* @property int $order_id 订单id
* @property string $shipping_name 货流名称
* @property string $shipping_id 运货单位
* @property int $type 类型
* @property string $goods 商品
* @property int $status 状态
* @property string $decription 描述
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class Delivery extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_delivery';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['order_id', 'type', 'status'], 'integer'],
[['shipping_id'], 'required'],
[['goods', 'decription'], 'string'],
[['shipping_name'], 'string', 'max' => 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();
},
],
];
}
}

95
common/models/ars/ExpressTemplate.php

@ -0,0 +1,95 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_express_template".
*
* @property int $id
* @property string $name 名称
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
* @property int $billing_type 账单类型
* @property int $extra_weight_type 续重重量类型
* @property int $exemption_type 包邮类型
* @property int $basic_price 基本运费
* @property int $extra_price 续重运费
* @property int $exemption_amount 包邮金额
* @property int $support_taking 是否支持自提,1为不支持
* @property string $taking_site 自提地点
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class ExpressTemplate extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_express_template';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['province', 'city', 'area', 'taking_site'], 'string'],
[['billing_type', 'extra_weight_type', 'exemption_type', 'basic_price', 'extra_price', 'exemption_amount', 'support_taking'], 'integer'],
[['name'], 'string', 'max' => 255],
];
}
/**
* {@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();
},
],
];
}
}

86
common/models/ars/File.php

@ -0,0 +1,86 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_file".
*
* @property int $id
* @property int $pid 父级id
* @property string $name 名称
* @property int $type 类型
* @property int $own_type 拥有者类型
* @property int $own_id 拥有者id
* @property string $alias 别名
* @property string $path 地址
* @property int $is_delete 是否删除,1为已删除
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class File extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_file';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['pid', 'type', 'own_type', 'own_id', 'is_delete'], 'integer'],
[['name', 'path'], 'string', 'max' => 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();
},
],
];
}
}

121
common/models/ars/Order.php

@ -0,0 +1,121 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_order".
*
* @property int $id
* @property int $user_id 用户id
* @property string $order_sn 订单号
* @property string $invoice_id 发票单号
* @property int $status 状态
* @property int $type 类型
* @property int $goods_count 商品数量
* @property int $goods_amount 商品金额
* @property int $shipping_amount 物流金额
* @property int $shipping_type 物流类型
* @property string $consignee 收件人
* @property string $phone 手机号码
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
* @property int $taking_site 自提点
* @property int $pay_type 支付方式
* @property int $pay_at 支付时间
* @property string $payment_sn 付款单号
* @property int $payment_amount 支付金额
* @property int $receivables 应收款
* @property string $remarks 备注
* @property int $discount_amount 折扣金额
* @property string $discount_decription 折扣说明
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class Order extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_order';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id'], 'required'],
[['user_id', 'status', 'type', 'goods_count', 'goods_amount', 'shipping_amount', 'shipping_type', 'taking_site', 'pay_type', 'pay_at', 'payment_amount', 'receivables', 'discount_amount'], 'integer'],
[['discount_decription'], 'string'],
[['order_sn', 'invoice_id'], 'string', 'max' => 64],
[['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();
},
],
];
}
}

86
common/models/ars/OrderGoods.php

@ -0,0 +1,86 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_order_goods".
*
* @property int $id
* @property int $order_id 订单id
* @property int $goods_id 商品id
* @property int $goods_img 商品图片
* @property string $goods_name 商品名称
* @property int $goods_count 商品数量
* @property string $sku_value 商品sku
* @property int $price 销售价
* @property int $market_price 市场价
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class OrderGoods extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_order_goods';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['order_id', 'goods_id'], 'required'],
[['order_id', 'goods_id', 'goods_img', 'goods_count', 'price', 'market_price'], 'integer'],
[['goods_name', 'sku_value'], 'string', 'max' => 120],
];
}
/**
* {@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();
},
],
];
}
}

85
common/models/ars/PaymentLog.php

@ -0,0 +1,85 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_payment_log".
*
* @property int $id
* @property int $order_id 订单id
* @property string $wx_refund_id 微信退款单号
* @property string $mch_id 商户号
* @property int $order_amount 订单金额
* @property int $payment_amount 支付金额
* @property int $type 类型
* @property int $status 状态
* @property string $refund_account 退款账户
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class PaymentLog extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_payment_log';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['order_id', 'order_amount', 'payment_amount', 'type', 'status'], 'integer'],
[['wx_refund_id', 'mch_id', 'refund_account'], 'string', 'max' => 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();
},
],
];
}
}

49
common/models/ars/Province.php

@ -0,0 +1,49 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "province".
*
* @property int $id
* @property string $name
* @property int $province_id
*/
class Province extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'province';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['province_id'], 'integer'],
[['name'], 'string', 'max' => 16],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'name' => 'name',
'province_id' => 'province_id',
];
}
}

71
common/models/ars/RefundLog.php

@ -0,0 +1,71 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_refund_log".
*
* @property int $id
* @property int $order_id 订单id
* @property string $wx_refund_id 微信退款单号
* @property int $reason 理由
* @property int $order_amount 订单金额
* @property int $refund_amount 退款金额
* @property int $refunded_amount 已退款金额
* @property int $type 类型
* @property int $status 状态
* @property string $refund_account 退款账户
* @property int $operator_id 操作者
* @property int $applyed_at 申请时间
* @property int $confirmed_at 确认时间
* @property int $finished_at 完成时间
*/
class RefundLog extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_refund_log';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['order_id', 'reason', 'order_amount', 'refund_amount', 'refunded_amount', 'type', 'status', 'operator_id', 'applyed_at', 'confirmed_at', 'finished_at'], 'integer'],
[['wx_refund_id', 'refund_account'], 'string', 'max' => 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' => '完成时间',
];
}
}

80
common/models/ars/SearchHistory.php

@ -0,0 +1,80 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_search_history".
*
* @property int $id
* @property int $user_id 用户id
* @property string $keyword 关键字
* @property int $count 次数
* @property int $status 状态
* @property int $type 类型
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class SearchHistory extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_search_history';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id'], 'required'],
[['user_id', 'count', 'status', 'type'], 'integer'],
[['keyword'], 'string', 'max' => 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();
},
],
];
}
}

84
common/models/ars/TakingSite.php

@ -0,0 +1,84 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_taking_site".
*
* @property int $id
* @property string $name 名称
* @property string $province 省份
* @property string $city 城市
* @property string $area 区域
* @property string $address 地址
* @property int $is_default 是否为默认,1为默认
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class TakingSite extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_taking_site';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['address'], 'string'],
[['is_default'], 'integer'],
[['name'], 'string', 'max' => 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();
},
],
];
}
}

80
common/models/ars/TemFile.php

@ -0,0 +1,80 @@
<?php
namespace common\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "ats_tem_file".
*
* @property int $id
* @property int $user_id 父级id
* @property string $name 名称
* @property int $type 类型
* @property string $alias 别名
* @property string $path 地址
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class TemFile extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'ats_tem_file';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['user_id', 'type'], 'integer'],
[['name', 'path'], 'string', 'max' => 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();
},
],
];
}
}

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

@ -0,0 +1,149 @@
<?php
namespace antgoods\goods\controllers;
use Yii;
use antgoods\goods\models\ars\Goods;
use antgoods\goods\models\searchs\GoodsSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
/**
* 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()
]);
}
}

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

@ -0,0 +1,81 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_attribute".
*
* @property int $id
* @property string $name 属性名
* @property string $value 属性值
* @property int $type 类型
* @property int $sort_order 排序
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Attribute extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_attribute';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name', 'value'], 'required'],
[['value'], 'string'],
[['type', 'sort_order', 'is_delete'], 'integer'],
[['name'], 'string', 'max' => 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();
},
],
];
}
}

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

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

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

@ -0,0 +1,87 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_category".
*
* @property int $id
* @property string $name 类别名称
* @property int $pid 父级id
* @property int $goods_count 商品数量
* @property int $sort_order 排序
* @property int $icon_type 图标类型
* @property string $icon 图标
* @property int $is_show 是否显示,1为不显示
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Category extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_category';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'],
[['name'], 'string', 'max' => 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();
},
],
];
}
}

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

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

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

@ -0,0 +1,135 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_goods".
*
* @property int $id
* @property int $pid 父级id
* @property int $cat_id 后台商品类别id
* @property int $brand_id 品牌id
* @property int $shop_cat_id 前端商品类别id
* @property string $name 商品名称
* @property string $sn 商品唯一货号
* @property string $code 商品货码
* @property int $supplier_id 供应商id
* @property int $weight 重量
* @property int $length 长度
* @property int $width 宽度
* @property int $height 高度
* @property int $diameter 直径
* @property string $unit 单位
* @property int $sold_count 已售数量
* @property int $limit_count 限购数量
* @property int $stock 库存
* @property int $stock_warn 库存警告
* @property int $market_price 市场价
* @property int $price 销售价
* @property string $brief 简介
* @property string $description 详细介绍
* @property int $image 图片id
* @property int $model_id 模型id
* @property int $is_sale 该商品是否开放销售,1为是,0为否
* @property int $sort_order 排序
* @property int $bouns_points 奖励积分
* @property int $experience_points 经验值
* @property int $is_delete 是否删除,1为已删除
* @property int $express_template 配送详情id
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Goods extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_goods';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['pid', 'cat_id', 'brand_id', 'shop_cat_id', 'supplier_id', 'weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'limit_count', 'stock', 'stock_warn', 'market_price', 'price', 'image', 'model_id', 'is_sale', 'sort_order', 'bouns_points', 'experience_points', 'is_delete', 'express_template'], 'integer'],
[['cat_id', 'brand_id', 'shop_cat_id', 'name', 'sn'], 'required'],
[['description'], 'string'],
[['name'], 'string', 'max' => 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();
},
],
];
}
}

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

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

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

@ -0,0 +1,105 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_goods_sku".
*
* @property int $id
* @property int $goods_id 商品id
* @property string $goods_code 商品条码
* @property string $goods_sn 商品唯一货号
* @property string $goods_attr 属性匹配
* @property int $weight 重量
* @property int $length 长度
* @property int $width 宽度
* @property int $height 高度
* @property int $diameter 直径
* @property int $sold_count 已售数量
* @property int $stock 库存
* @property int $market_price 市场价
* @property int $price 销售价
* @property int $model_id 模型id
* @property int $is_sale 该商品是否开放销售,1为是,0为否
* @property int $sort_order 排序
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class GoodsSku extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_goods_sku';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['goods_id', 'goods_sn'], 'required'],
[['goods_id', 'weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'stock', 'market_price', 'price', 'model_id', 'is_sale', 'sort_order', 'is_delete'], 'integer'],
[['goods_code'], 'string', 'max' => 50],
[['goods_sn', 'goods_attr'], 'string', 'max' => 60],
];
}
/**
* {@inheritdoc}
*/
public function attributeLabels()
{
return [
'id' => 'id',
'goods_id' => '商品id',
'goods_code' => '商品条码',
'goods_sn' => '商品唯一货号',
'goods_attr' => '属性匹配',
'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();
},
],
];
}
}

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

@ -0,0 +1,96 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_shop_category".
*
* @property int $id
* @property string $name 类别名称
* @property int $pid 父级id
* @property int $goods_count 商品数量
* @property string $keywords 关键字
* @property string $desc 描述
* @property int $sort_order 排序
* @property int $icon_type 图标类型
* @property string $icon 图标
* @property string $filter_attr 筛选属性
* @property int $is_show 是否显示,1为不显示
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class ShopCategory extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_shop_category';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name'], 'required'],
[['pid', 'goods_count', 'sort_order', 'icon_type', 'is_show', 'is_delete'], 'integer'],
[['filter_attr'], 'string'],
[['name'], 'string', 'max' => 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();
},
],
];
}
}

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

@ -0,0 +1,81 @@
<?php
namespace antgoods\goods\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
/**
* This is the model class for table "antgoods_supplier".
*
* @property int $id
* @property string $name 供应商名称
* @property string $full_name 供应商全称
* @property string $phone 手机号码
* @property string $address 地址
* @property int $is_delete 是否删除,1为已删除
* @property int $created_at 创建时间
* @property int $updated_at 更新时间
*/
class Supplier extends \yii\db\ActiveRecord
{
/**
* {@inheritdoc}
*/
public static function tableName()
{
return 'antgoods_supplier';
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['name', 'full_name', 'phone', 'address'], 'required'],
[['is_delete'], 'integer'],
[['name', 'full_name', 'address'], 'string', 'max' => 50],
[['phone'], 'string', 'max' => 20],
];
}
/**
* {@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();
},
],
];
}
}

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

@ -0,0 +1,197 @@
<?php
namespace antgoods\goods\models\searchs;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use yii\helpers\ArrayHelper;
use antgoods\goods\models\ars\Goods;
/**
* GoodsSearch represents the model behind the search form of `antgoods\goods\models\ars\Goods`.
*/
class GoodsSearch extends Goods
{
/**
* @return array
* 增加创建时间查询字段
*/
public function attributes()
{
return ArrayHelper::merge(['created_at_range'], parent::attributes());
}
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['id', 'pid', 'cat_id', 'brand_id', 'shop_cat_id', 'supplier_id', 'weight', 'length', 'width', 'height', 'diameter', 'sold_count', 'limit_count', 'stock', 'stock_warn', 'market_price', 'price', 'image', 'model_id', 'is_sale', 'sort_order', 'bouns_points', 'experience_points', 'is_delete', 'express_template', 'created_at', 'updated_at'], 'integer'],
[['name', 'sn', 'code', 'unit', 'brief', 'description'], 'safe'],
['created_at_range','safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* @return array
* 列格式
*/
public function columns()
{
return [
[
'class' => 'blobt\grid\CheckboxColumn',
'width' => '2%',
'align' => 'center'
],
'id',
'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;
}
}

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

@ -0,0 +1,82 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="goods-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, '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>

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

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

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

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

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

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

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

@ -0,0 +1,19 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
$this->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 ';
?>
<div class="goods-update">
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

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

@ -0,0 +1,59 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model antgoods\goods\models\ars\Goods */
$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Goods', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
\yii\web\YiiAsset::register($this);
?>
<div class="goods-view">
<p>
<?= Html::a('返回列表', ['index'], ['class' => 'btn btn-success']) ?>
</p>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id',
'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',
],
]) ?>
</div>
Loading…
Cancel
Save