'订单支付', self::TYPE_CHARGE=>'充值', self::TYPE_TAKECASH=>'提现', self::TYPE_TAKECASH_REJECT=>'提现驳回', self::TYPE_SETTLE=>'订单结算', self::TYPE_PROFIT=>'盈利', self::TYPE_REFUND=>'退款', self::ADMIN=>'后台变更', ]; public function user(){ return $this->belongsTo(User::class); } public function getTypeTextAttr($v, $d) { return self::$types[$d['type']]??'-'; } /* protected static function init() { self::afterInsert(function (self $log){ #结算的时候新增一条盈利记录 if($log['type']==self::TYPE_SETTLE){ $order=UserOrder::where('id',$log['order_id'])->find(); if($order){ self::create([ 'type'=>self::TYPE_PROFIT, 'money'=>$log['money'], ]); } } }); }*/ }