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(); } } /** * 获取市场经理(只搜索状态为正常的经理) * id为键,name为值 */ public static function getMmInfoArray() { $list = self::select('id','name') ->where('status',2) ->whereNull('deleted_at') ->get(); $array = []; if(count($list) > 0){ foreach ($list as $key => $value){ $array[$value->id] = $value->name; } } return $array; } /** * 根据id获取单条记录 */ public static function getMmInfo($id,$field = '*') { return self::select($field)->find($id); }}