CpBookCalculate.php 971 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Modules\CpSub\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class CpBookCalculate extends Model
  5. {
  6. protected $table = 'cp_book_calculates';
  7. protected $fillable = ['cp_source','bid','start_date','status','available_amount_ratio','last_amount_ratio','total_amount_ratio','created_at','updated_at'];
  8. public static function getCpBookCalculate($cp_source,$bid) {
  9. return self::where(['cp_source'=>$cp_source,'bid'=>$bid,'status'=>1])
  10. ->where('start_date','<=',date('Y-m-d',strtotime('-1 day')))
  11. ->where('end_date','>=',date('Y-m-d',strtotime('-1 day')))
  12. ->first();
  13. }
  14. public static function getAllCpBookCalculateBids()
  15. {
  16. return self::where(['status'=>1])
  17. ->where('start_date','<=',date('Y-m-d',strtotime('-1 day')))
  18. ->where('end_date','>=',date('Y-m-d',strtotime('-1 day')))
  19. ->get()
  20. ->pluck('bid')
  21. ->all();
  22. }
  23. }