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.
46 lines
1.0 KiB
46 lines
1.0 KiB
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
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');
|
|
}
|
|
|
|
/**
|
|
* 获取市场经理(只搜索状态为正常的经理)
|
|
* 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);
|
|
}
|
|
}
|