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.
|
|
<?php
namespace App\Models;
use Dcat\Admin\Admin;use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\SoftDeletes;
class LanzuMmInfo extends Model{ use HasDateTimeFormatter; use SoftDeletes; 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(); } }/** * 获取市场经理(只搜索状态为正常的经理) * 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); }}
|