PresellGoodsItem.php 721 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\common\model;
  3. use think\model\concern\SoftDelete;
  4. class PresellGoodsItem extends BaseModel
  5. {
  6. use SoftDelete;
  7. protected $autoWriteTimestamp = true;
  8. protected $defaultSoftDelete = 0;
  9. function getContentAttr($fieldValue, $data)
  10. {
  11. return (array) json_decode($fieldValue, true);
  12. }
  13. function setContentAttr($fieldValue, $data)
  14. {
  15. return json_encode($fieldValue, JSON_UNESCAPED_UNICODE);
  16. }
  17. /**
  18. * @notes 商品规格详情
  19. * @return \think\model\relation\HasOne
  20. * @author lbzy
  21. * @datetime 2024-04-24 14:19:39
  22. */
  23. function detail()
  24. {
  25. return $this->hasOne(GoodsItem::class, 'id', 'item_id');
  26. }
  27. }