@@ -22,6 +22,21 @@ class AccountLogModel extends BaseModel
// 设置数据表
protected $table = 'account_logs';
+ protected $appends = ['time_text','type_name'];
+
+ // 时间
+ public function getTimeTextAttribute()
+ {
+ return $this->create_time? datetime($this->create_time,'Y-m-d H:i:s') : '';
+ }
+ // 类型
+ public function getTypeNameAttribute()
+ $types = [1=>'订单付款-商品',2=>'充值-余额',3=>'订单退款-商品',4=>'余额提现',5=>'余额转出-驳回',6=>'平台转入-余额',7=>'收益-企业',8=>'收益-佣金',9=>'收益-其他',10=>'转账-余额'];
+ return $this->remark? $this->remark : (isset($types[$this->type])?$types[$this->type]:'账户交易');
/**
* 用户
* @return \Illuminate\Database\Eloquent\Relations\HasOne