Shop.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. use yii\db\ActiveRecord;
  9. use yii\behaviors\TimestampBehavior;
  10. use Yii;
  11. /**
  12. * This is the model class for table "{{%shop}}".
  13. *
  14. * @property integer $id
  15. * @property integer $store_id
  16. * @property integer $user_id
  17. * @property string $name
  18. * @property string $mobile
  19. * @property string $address
  20. * @property integer $is_delete
  21. * @property integer $created_at
  22. * @property string $longitude
  23. * @property string $latitude
  24. * @property integer $score
  25. * @property string $cover_url
  26. * @property string $pic_url
  27. * @property string $shop_time
  28. * @property string $content
  29. * @property integer $is_default
  30. * @property int|null $province
  31. * @property int|null $city
  32. * @property int|null $district
  33. * @property int|null $shop_audit 审核状态(-1未通过,0待审核,1通过)
  34. * @property string|null $refuse_desc 拒接原因
  35. */
  36. class Shop extends \yii\db\ActiveRecord
  37. {
  38. /**
  39. * @inheritdoc
  40. */
  41. public static function tableName()
  42. {
  43. return '{{%shop}}';
  44. }
  45. public function behaviors()
  46. {
  47. return [
  48. [
  49. 'class' => TimestampBehavior::class,
  50. 'attributes' => [
  51. ActiveRecord::EVENT_BEFORE_INSERT => ['created_at']
  52. ]
  53. ]
  54. ];
  55. }
  56. const IS_DELETE_YES = 1;//已删除
  57. const IS_DELETE_NO = 0;//未删除
  58. const SHOP_AUDIT_YES = 1;// 审核通过
  59. const SHOP_AUDIT_NO = -1;// 审核拒绝
  60. const SHOP_AUDIT_WAIT = 0;// 等待审核
  61. /**
  62. * @inheritdoc
  63. */
  64. public function rules()
  65. {
  66. return [
  67. [['store_id', 'is_delete', 'score', 'is_default', 'province', 'city', 'district', 'user_id', 'shop_audit'], 'integer'],
  68. [['longitude', 'latitude', 'cover_url', 'pic_url', 'content'], 'string'],
  69. [['name', 'mobile', 'address', 'shop_time', 'refuse_desc'], 'string', 'max' => 255],
  70. [['created_at'], 'safe']
  71. ];
  72. }
  73. /**
  74. * @inheritdoc
  75. */
  76. public function attributeLabels()
  77. {
  78. return [
  79. 'id' => 'ID',
  80. 'store_id' => 'Store ID',
  81. 'user_id' => '用户id',
  82. 'name' => 'Name',
  83. 'mobile' => 'Mobile',
  84. 'address' => 'Address',
  85. 'is_delete' => 'Is Delete',
  86. 'created_at' => '添加时间',
  87. 'longitude' => 'Longitude',
  88. 'latitude' => 'Latitude',
  89. 'score' => '评分 1~5',
  90. 'cover_url' => '自提点大图',
  91. 'pic_url' => '自提点小图',
  92. 'shop_time' => '营业时间',
  93. 'content' => '自提点介绍',
  94. 'is_default' => '是否设为默认 0--否 1--是 (只能设置一个自提点为默认自提点)',
  95. 'province' => '省份',
  96. 'city' => '城市',
  97. 'district' => '区县',
  98. 'shop_audit' => '审核状态(-1未通过,0待审核,1通过)',
  99. 'refuse_desc' => '拒接原因',
  100. ];
  101. }
  102. // public function getShopPic()
  103. // {
  104. // return $this->hasMany(ShopPic::className(), ['shop_id'=>'id'])->where(['is_delete'=>0]);
  105. // }
  106. }