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

37 lines
937 B

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