__('未中奖'), '2' => __('实物奖品'), '3' => __('优惠券'), '4' => __('红包'), '5' => __('兑换码'), '6' => __('商城奖品') ]; } /** * 发放方式列表 */ public function getDeliverTypeList() { return [ '1' => __('自动发放'), '2' => __('手动发放') ]; } /** * 状态列表 */ public function getStatusList() { return [ '0' => __('禁用'), '1' => __('启用') ]; } // 获取器 public function getTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); $list = $this->getTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getDeliverTypeTextAttr($value, $data) { $value = $value ? $value : (isset($data['deliver_type']) ? $data['deliver_type'] : ''); $list = $this->getDeliverTypeList(); return isset($list[$value]) ? $list[$value] : ''; } public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); $list = $this->getStatusList(); return isset($list[$value]) ? $list[$value] : ''; } // 关联关系 public function activity() { return $this->belongsTo('Activity', 'activity_id', 'id'); } public function winRecord() { return $this->hasMany('WinRecord', 'prize_id', 'id'); } public function goods() { return $this->belongsTo('app\\common\\model\\shop\\Goods', 'goods_id', 'id'); } public function goodsSku() { return $this->belongsTo('app\\common\\model\\shop\\GoodsSku', 'goods_sku_id', 'id'); } public function coupon() { return $this->belongsTo('app\\common\\model\\shop\\Coupon', 'coupon_id', 'id'); } }