| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?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 OrderCommissionModel extends BaseModel
- {
- // 设置数据表
- protected $table = 'order_commission';
- protected $appends = ['state_text'];
- // 状态
- public function getStateTextAttribute()
- {
- return $this->state>0?'已到账':'冻结中';
- }
- /**
- * 佣金用户
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function user()
- {
- return $this->hasOne(MemberModel::class, 'id', 'user_id')
- ->select(['id','openid', 'mobile', 'nickname', 'realname', 'status']);
- }
- /**
- * 下单用户
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function orderUser()
- {
- return $this->hasOne(MemberModel::class, 'id', 'order_user_id')
- ->select(['id','openid', 'mobile', 'nickname', 'realname', 'status']);
- }
- /**
- * 佣金订单
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function order()
- {
- return $this->hasOne(OrderModel::class, 'id', 'order_id')
- ->with(['orderGoods'])
- ->select(['id', 'order_no', 'user_id','total','pay_total','status']);
- }
- }
|