链街Dcat后台
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

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. class LanzuMmInfo extends Model
  6. {
  7. use HasDateTimeFormatter;
  8. protected $table = 'lanzu_mm_info';
  9. protected $dateFormat = 'U';
  10. public function Withdraw()
  11. {
  12. return $this->hasOne('\App\Models\LanzuMmWithdraw','mm_id','id');
  13. }
  14. /**
  15. * 获取市场经理(只搜索状态为正常的经理)
  16. * id为键,name为值
  17. */
  18. public static function getMmInfoArray()
  19. {
  20. $list = self::select('id','name')
  21. ->where('status',2)
  22. ->whereNull('deleted_at')
  23. ->get();
  24. $array = [];
  25. if(count($list) > 0){
  26. foreach ($list as $key => $value){
  27. $array[$value->id] = $value->name;
  28. }
  29. }
  30. return $array;
  31. }
  32. /**
  33. * 根据id获取单条记录
  34. */
  35. public static function getMmInfo($id,$field = '*')
  36. {
  37. return self::select($field)->find($id);
  38. }
  39. }