Clerk.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use Yii;
  9. use yii\db\ActiveRecord;
  10. use yii\behaviors\TimestampBehavior;
  11. /**
  12. * This is the model class for table "{{%clerk}}".
  13. *
  14. * @property int $id 主键
  15. * @property int $store_id 商城id
  16. * @property int $user_id 用户id
  17. * @property int $shop_id 自提点id
  18. * @property int|null $order_count 核销订单数
  19. * @property float|null $money_count 核销总额
  20. * @property int|null $card_count 核销卡券数
  21. * @property int|null $created_at 添加时间
  22. * @property int|null $updated_at 更新时间
  23. * @property int $is_delete 是否删除
  24. */
  25. class Clerk extends \yii\db\ActiveRecord
  26. {
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public static function tableName()
  31. {
  32. return '{{%clerk}}';
  33. }
  34. const IS_DELETE_YES = 1;//已删除
  35. const IS_DELETE_NO = 0;//未删除
  36. public function behaviors()
  37. {
  38. return [
  39. [
  40. 'class' => TimestampBehavior::class,
  41. 'attributes' => [
  42. ActiveRecord::EVENT_BEFORE_INSERT => ['updated_at', 'created_at'],
  43. ActiveRecord::EVENT_BEFORE_UPDATE => 'updated_at'
  44. ]
  45. ]
  46. ];
  47. }
  48. /**
  49. * {@inheritdoc}
  50. */
  51. public function rules()
  52. {
  53. return [
  54. [['user_id', 'shop_id'], 'required'],
  55. [['id', 'store_id', 'user_id', 'shop_id', 'order_count', 'card_count', 'created_at', 'updated_at', 'is_delete'], 'integer'],
  56. [['money_count'], 'number'],
  57. [['id'], 'unique'],
  58. ];
  59. }
  60. /**
  61. * {@inheritdoc}
  62. */
  63. public function attributeLabels()
  64. {
  65. return [
  66. 'id' => '主键',
  67. 'store_id' => '商城id',
  68. 'user_id' => '用户id',
  69. 'shop_id' => '自提点id',
  70. 'order_count' => '核销订单数',
  71. 'money_count' => '核销总额',
  72. 'card_count' => '核销卡券数',
  73. 'created_at' => '添加时间',
  74. 'updated_at' => '更新时间',
  75. 'is_delete' => '是否删除',
  76. ];
  77. }
  78. }