| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- namespace App\Module\Promotion\Models;
- use App\Module\Promotion\Enums\PROFIT_SOURCE_TYPE;
- use App\Module\Promotion\Enums\REFERRAL_LEVEL;
- use Illuminate\Database\Eloquent\Relations\BelongsTo;
- use UCore\ModelCore;
- /**
- * 团队收益记录
- *
- * field start
- * field end
- */
- class PromotionProfit extends ModelCore
- {
- /**
- * 与模型关联的表名
- *
- * @var string
- */
- protected $table = 'promotion_profits';
- /**
- * 指示模型是否应该被打上时间戳
- *
- * @var bool
- */
- public $timestamps = false;
- // attrlist start
- protected $fillable = [
- ];
- // attrlist end
- /**
- * 应该被转换为原生类型的属性
- *
- * @var array
- */
- protected $casts = [
- 'profit_rate' => 'float',
- 'source_type' => PROFIT_SOURCE_TYPE::class,
- 'relation_type' => REFERRAL_LEVEL::class,
- ];
- /**
- * 获取收益用户信息
- *
- * @return BelongsTo
- */
- public function user()
- {
- return $this->belongsTo('App\Models\User', 'user_id');
- }
- /**
- * 获取团队成员信息
- *
- * @return BelongsTo
- */
- public function promotionMember()
- {
- return $this->belongsTo('App\Models\User', 'promotion_member_id');
- }
- /**
- * 获取物品信息
- *
- * @return BelongsTo
- */
- public function item()
- {
- return $this->belongsTo('App\Module\GameItems\Models\Item', 'item_id');
- }
- }
|