ProductCopy.php 893 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\common\model\store\product;
  3. use app\common\model\BaseModel;
  4. use app\common\model\store\StoreCategory;
  5. use app\common\model\system\merchant\Merchant;
  6. class ProductCopy extends BaseModel
  7. {
  8. /**
  9. * @Author:Qinii
  10. * @Date: 2020/5/8
  11. * @return string
  12. */
  13. public static function tablePk(): string
  14. {
  15. return 'store_product_copy_id';
  16. }
  17. /**
  18. * @Author:Qinii
  19. * @Date: 2020/5/8
  20. * @return string
  21. */
  22. public static function tableName(): string
  23. {
  24. return 'store_product_copy';
  25. }
  26. public function getInfoAttr($value)
  27. {
  28. return json_decode($value) ?: $value;
  29. }
  30. public function setInfoAttr($value)
  31. {
  32. return json_encode($value,JSON_UNESCAPED_UNICODE);
  33. }
  34. public function merchant()
  35. {
  36. return $this->hasOne(Merchant::class,'mer_id','mer_id');
  37. }
  38. }