1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace app\common\model\card;
- use app\common\library\helper;
- use app\common\model\BaseModel;
- /**
- 我的米卡商品模型
- * @package app\common\model
- */
- class UserRiceCardGoods extends BaseModel
- {
- // 是否除外
- const EXCEPT_YES = 1; // 除外商品
- const EXCEPT_NO = 0; // 可兑换商品
- protected $name = 'user_rice_card_goods';
- // /**
- // * 关联 米卡表
- // */
- // public function riceCard()
- // {
- // return $this->belongsTo('RiceCard', 'card_id');
- // }
- // public function image()
- // {
- // $model = "app\\common\\model\\UploadFile";
- // return $this->belongsTo($model, 'image_id', 'file_id');
- // }
- /**
- * 获取器:规格属性
- * @param $value
- * @return array
- */
- public function getGoodsPropsAttr($value)
- {
- return helper::jsonDecode($value);
- }
- /**
- * 设置器:规格属性
- * @param $value
- * @return string
- */
- // public function setGoodsPropsAttr($value)
- // {
- // return helper::jsonEncode($value);
- // }
- /**
- * 获取记录
- * @param int $id
- * @param array $with
- * @return static
- */
- public static function detail(int $id, array $with = [])
- {
- return static::get($id, $with);
- }
-
- }
|