CpCalculate.php 645 B

12345678910111213141516171819
  1. <?php
  2. namespace App\Modules\CpSub\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class CpCalculate extends Model
  5. {
  6. protected $table = 'cp_calculates';
  7. protected $fillable = ['cp_user_id','month','bid','current_month_book_num','total_amount','available_amount','last_amount','created_at','updated_at','book_name','cp_source','calculate_date'];
  8. public static function getCpCalculate($cp_source) {
  9. $cp_source = self::where(['cp_source'=>$cp_source,'status'=>1])->first();
  10. if(is_null($cp_source)){
  11. $cp_source = self::where(['cp_source'=>'default','status'=>1])->first();
  12. }
  13. return $cp_source;
  14. }
  15. }