SendOrderBreadevenStat.php 1.3 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Modules\Statistic\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class SendOrderBreadevenStat extends Model
  5. {
  6. protected $table = 'send_order_breakeven_stats';
  7. protected $fillable = [
  8. 'distribution_channel_id', 'official_account_id', 'official_account_name', 'date', 'force_user_num',
  9. 'total_force_user_num', 'unsubscribe_in_one_day_user_num', 'created_at', 'updated_at', 'recharge_amount_in_one_day',
  10. 'recharge_amount_in_three_days', 'recharge_amount_in_one_month', 'recharge_amount_in_two_months', 'recharge_amount_in_three_months'];
  11. static function getInfo($params = [], $isAll = false)
  12. {
  13. $search_object = self::orderBy('created_at', 'desc');
  14. if (isset($params['end_date']) && $params['end_date']) $search_object->where('date', '<=', $params['end_date']);
  15. if (isset($params['start_date']) && $params['start_date']) $search_object->where('date', '>=', $params['start_date']);
  16. if (isset($params['distribution_channel_id']) && $params['distribution_channel_id']) $search_object->where('distribution_channel_id', $params['distribution_channel_id']);
  17. if ($isAll) {
  18. return $search_object->get();
  19. } else {
  20. return $search_object->paginate();
  21. }
  22. }
  23. }