StoreAttrTemplate.php 976 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\common\model\store;
  3. use app\common\model\BaseModel;
  4. /**
  5. * Class StoreAttrTemplate
  6. * @package app\common\model\store
  7. * @author zfy
  8. * @day 2020-05-06
  9. */
  10. class StoreAttrTemplate extends BaseModel
  11. {
  12. /**
  13. * @return string
  14. * @author zfy
  15. * @day 2020-03-30
  16. */
  17. public static function tablePk(): string
  18. {
  19. return 'attr_template_id';
  20. }
  21. /**
  22. * @return string
  23. * @author zfy
  24. * @day 2020-03-30
  25. */
  26. public static function tableName(): string
  27. {
  28. return 'store_attr_template';
  29. }
  30. /**
  31. * @param $val
  32. * @return mixed
  33. * @author zfy
  34. * @day 2020-05-06
  35. */
  36. public function getTemplateValueAttr($val)
  37. {
  38. return json_decode($val, true);
  39. }
  40. /**
  41. * @param $val
  42. * @return false|string
  43. * @author zfy
  44. * @day 2020-05-06
  45. */
  46. public function setTemplateValueAttr($val)
  47. {
  48. return json_encode($val);
  49. }
  50. }