12345678910111213141516171819202122232425 |
- <?php
- namespace app\common\model;
- use think\Model;
- class UserCoupon extends Model
- {
- protected $autoWriteTimestamp=true;
- protected $updateTime=null;
- public function bindGoods(){
- return $this->hasMany(UserCouponGoods::class);
- }
- protected static function init()
- {
- self::beforeWrite(function (self $coupon){
- if($coupon['type']==2){
- unset($coupon['amount_full']);
- }
- });
- }
- }
|