UserRiceCardGoods.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. namespace app\common\model\card;
  3. use app\common\library\helper;
  4. use app\common\model\BaseModel;
  5. /**
  6. 我的米卡商品模型
  7. * @package app\common\model
  8. */
  9. class UserRiceCardGoods extends BaseModel
  10. {
  11. // 是否除外
  12. const EXCEPT_YES = 1; // 除外商品
  13. const EXCEPT_NO = 0; // 可兑换商品
  14. protected $name = 'user_rice_card_goods';
  15. // /**
  16. // * 关联 米卡表
  17. // */
  18. // public function riceCard()
  19. // {
  20. // return $this->belongsTo('RiceCard', 'card_id');
  21. // }
  22. // public function image()
  23. // {
  24. // $model = "app\\common\\model\\UploadFile";
  25. // return $this->belongsTo($model, 'image_id', 'file_id');
  26. // }
  27. /**
  28. * 获取器:规格属性
  29. * @param $value
  30. * @return array
  31. */
  32. public function getGoodsPropsAttr($value)
  33. {
  34. return helper::jsonDecode($value);
  35. }
  36. /**
  37. * 设置器:规格属性
  38. * @param $value
  39. * @return string
  40. */
  41. // public function setGoodsPropsAttr($value)
  42. // {
  43. // return helper::jsonEncode($value);
  44. // }
  45. /**
  46. * 获取记录
  47. * @param int $id
  48. * @param array $with
  49. * @return static
  50. */
  51. public static function detail(int $id, array $with = [])
  52. {
  53. return static::get($id, $with);
  54. }
  55. }