| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- // +----------------------------------------------------------------------
- // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
- // +----------------------------------------------------------------------
- // | 版权所有 2017~2021 LARAVEL研发中心
- // +----------------------------------------------------------------------
- // | 官方网站: http://www.laravel.cn
- // +----------------------------------------------------------------------
- // | Author: laravel开发员 <laravel.qq.com>
- // +----------------------------------------------------------------------
- namespace App\Models;
- /**
- * 账户明细-模型
- * @author laravel开发员
- * @since 2020/11/11
- * @package App\Models
- */
- 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
- */
- public function member()
- {
- return $this->hasOne(MemberModel::class, 'id','user_id')
- ->select(['id','mobile','nickname','status']);
- }
- }
|