链街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.

39 lines
1001 B

6 years ago
6 years ago
6 years ago
6 years ago
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Admin;
  4. use Dcat\Admin\Traits\HasDateTimeFormatter;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Database\Eloquent\SoftDeletes;
  7. class LanzuMmInfo extends Model
  8. {
  9. use HasDateTimeFormatter;
  10. use SoftDeletes;
  11. protected $table = 'lanzu_mm_info';
  12. protected $dateFormat = 'U';
  13. public function Withdraw()
  14. {
  15. return $this->hasOne('\App\Models\LanzuMmWithdraw','mm_id','id');
  16. }
  17. public static function getMmInfoCount()
  18. {
  19. $adu = Admin::user();
  20. if ($adu->isRole('lanzu_mp')){
  21. $mpInfo = LanzuMpInfo::where('admin_user_id',$adu->id)->select('id')->first();
  22. if ($mpInfo){
  23. $ids = ImsCjdcMarket::where('mp_id',$mpInfo->id)->get()->pluck('id');
  24. $count = self::whereIn('market_id',$ids)->count();
  25. return $count;
  26. }else{
  27. return 0;
  28. }
  29. }else{
  30. return self::count();
  31. }
  32. }
  33. }