ProductCopy.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\model\store\product;
  12. use app\common\model\BaseModel;
  13. use app\common\model\store\StoreCategory;
  14. use app\common\model\system\merchant\Merchant;
  15. class ProductCopy extends BaseModel
  16. {
  17. /**
  18. * @Author:Qinii
  19. * @Date: 2020/5/8
  20. * @return string
  21. */
  22. public static function tablePk(): string
  23. {
  24. return 'store_product_copy_id';
  25. }
  26. /**
  27. * @Author:Qinii
  28. * @Date: 2020/5/8
  29. * @return string
  30. */
  31. public static function tableName(): string
  32. {
  33. return 'store_product_copy';
  34. }
  35. public function getInfoAttr($value)
  36. {
  37. return json_decode($value) ?: $value;
  38. }
  39. public function setInfoAttr($value)
  40. {
  41. return json_encode($value,JSON_UNESCAPED_UNICODE);
  42. }
  43. public function merchant()
  44. {
  45. return $this->hasOne(Merchant::class,'mer_id','mer_id');
  46. }
  47. }