You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.7 KiB

  1. <?php
  2. namespace backend\modules\shop\models\ars;
  3. use Yii;
  4. use yii\behaviors\TimestampBehavior;
  5. /**
  6. * This is the model class for table "ats_express_area".
  7. *
  8. * @property int $id
  9. * @property string $province 省份
  10. * @property string $city 城市
  11. * @property string $area 区域
  12. * @property int $express_template 运费模板id
  13. * @property int $extra_price 续重运费
  14. * @property int $basic_price 基本运费
  15. * @property int $basic_count 基本数量
  16. * @property int $extra_count 续重数量
  17. * @property int $updated_at 更新时间
  18. * @property int $created_at 创建时间
  19. */
  20. class ExpressArea extends \yii\db\ActiveRecord
  21. {
  22. public static $formList = [
  23. 1 => [
  24. "basic_count"=>"基本重量(KG)",
  25. "basic_price"=>"基本运费(元)",
  26. "extra_count"=>"续重重量(KG)",
  27. "extra_price"=>"续重运费(元)"
  28. ],
  29. 2 => [
  30. "basic_count"=>"基本数量(件)",
  31. "basic_price"=>"基本运费(元)",
  32. "extra_count"=>"续重数量(件)",
  33. "extra_price"=>"续重运费(元)"
  34. ]
  35. ];
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public static function tableName()
  40. {
  41. return 'ats_express_area';
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function rules()
  47. {
  48. return [
  49. [['province', 'city', 'area'], 'string'],
  50. [['express_template'], 'integer'],
  51. [['extra_price', 'basic_price', 'basic_count', 'extra_count'], 'safe'],
  52. [['extra_price', 'basic_price', 'basic_count', 'extra_count'], 'number'],
  53. ];
  54. }
  55. /**
  56. * {@inheritdoc}
  57. */
  58. public function attributeLabels()
  59. {
  60. return [
  61. 'id' => 'id',
  62. 'province' => '省份',
  63. 'city' => '城市',
  64. 'area' => '区域',
  65. 'express_template' => '运费模板id',
  66. 'extra_price' => '续重运费',
  67. 'basic_price' => '基本运费',
  68. 'basic_count' => '基本数量',
  69. 'extra_count' => '续重数量',
  70. 'updated_at' => '更新时间',
  71. 'created_at' => '创建时间',
  72. ];
  73. }
  74. /**
  75. * @author linyao
  76. * @email 602604991@qq.com
  77. * @created Nov 8, 2019
  78. *
  79. * 行为存储创建时间和更新时间
  80. */
  81. public function behaviors()
  82. {
  83. return [
  84. [
  85. 'class' => TimestampBehavior::className(),
  86. 'createdAtAttribute' => 'created_at',
  87. 'updatedAtAttribute' => 'updated_at',
  88. 'value' => function() {
  89. return time();
  90. },
  91. ],
  92. ];
  93. }
  94. }