You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
937 B
37 lines
937 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class LanzuMmInfo extends Model
|
|
{
|
|
use HasDateTimeFormatter;
|
|
protected $table = 'lanzu_mm_info';
|
|
protected $dateFormat = 'U';
|
|
|
|
public function Withdraw()
|
|
{
|
|
return $this->hasOne('\App\Models\LanzuMmWithdraw','mm_id','id');
|
|
}
|
|
|
|
public static function getMmInfoCount()
|
|
{
|
|
$adu = Admin::user();
|
|
if ($adu->isRole('lanzu_mp')){
|
|
$mpInfo = LanzuMpInfo::where('admin_user_id',$adu->id)->select('id')->first();
|
|
if ($mpInfo){
|
|
$ids = ImsCjdcMarket::where('mp_id',$mpInfo->id)->get()->pluck('id');
|
|
$count = self::whereIn('market_id',$ids)->count();
|
|
return $count;
|
|
}else{
|
|
return 0;
|
|
}
|
|
}else{
|
|
return self::count();
|
|
}
|
|
}
|
|
}
|