GoodsPic.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 app\models\common\Upload;
  10. /**
  11. * This is the model class for table "{{%goods_pic}}".
  12. *
  13. * @property integer $id
  14. * @property integer $goods_id
  15. * @property string $pic_url
  16. * @property integer $is_delete
  17. */
  18. class GoodsPic extends \yii\db\ActiveRecord
  19. {
  20. /**
  21. * @inheritdoc
  22. */
  23. public static function tableName()
  24. {
  25. return '{{%goods_pic}}';
  26. }
  27. /**
  28. * @inheritdoc
  29. */
  30. public function rules()
  31. {
  32. return [
  33. [['goods_id', 'is_delete'], 'integer'],
  34. [['pic_url'], 'required'],
  35. [['pic_url'], 'string'],
  36. ];
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function attributeLabels()
  42. {
  43. return [
  44. 'id' => 'ID',
  45. 'goods_id' => 'Goods ID',
  46. 'pic_url' => 'Pic Url',
  47. 'is_delete' => 'Is Delete',
  48. ];
  49. }
  50. public function afterFind()
  51. {
  52. parent::afterFind();
  53. try {
  54. $this->pic_url = Upload::getImgStyle($this->pic_url);
  55. } catch (\Throwable $e) {}
  56. }
  57. }