UserCoupon.php 467 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class UserCoupon extends Model
  5. {
  6. protected $autoWriteTimestamp=true;
  7. protected $updateTime=null;
  8. public function bindGoods(){
  9. return $this->hasMany(UserCouponGoods::class);
  10. }
  11. protected static function init()
  12. {
  13. self::beforeWrite(function (self $coupon){
  14. if($coupon['type']==2){
  15. unset($coupon['amount_full']);
  16. }
  17. });
  18. }
  19. }