<?php

namespace App\Modules\User\Models;

use Illuminate\Database\Eloquent\Model;

class Xcxuser extends Model
{
    protected $table = 'xcx_users';
    protected $fillable = ['uid','openid','unionid','distribution_channel_id','u'];
    
    public static function getAddUserNum($sendOrderId,$distribution_channel_id){
    	 return self::where(['u'=>$sendOrderId,'distribution_channel_id'=>$distribution_channel_id])->count();
    }
    
    public static function getDistributionTodayAddUserNum($distribution_channel_id){
    	$today = date('Y-m-d');
    	return self::where(['distribution_channel_id'=>$distribution_channel_id])
    	->where('created_at','>=',$today)
    	->count();
    }
    
    public static function getDistributionTotalAddUserNum($distribution_channel_id){
    	return self::where(['distribution_channel_id'=>$distribution_channel_id])->count();
    }
}
