12345678910111213141516171819 |
- <?php
- namespace App\Modules\CpSub\Models;
- use Illuminate\Database\Eloquent\Model;
- class CpCalculate extends Model
- {
- protected $table = 'cp_calculates';
- 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'];
-
- public static function getCpCalculate($cp_source) {
- $cp_source = self::where(['cp_source'=>$cp_source,'status'=>1])->first();
- if(is_null($cp_source)){
- $cp_source = self::where(['cp_source'=>'default','status'=>1])->first();
- }
- return $cp_source;
- }
- }
|