<?php


namespace App\Modules\Ali\Services;

use App\Modules\Ali\Models\AliSendOrder;
use DB;
use Redis;
use App\Modules\Ali\Models\AliOrder;
use App\Modules\User\Models\Aliuser;

class AliSendOrderService
{
  
    /**
     * 创建推广派单
     */
    static function createOrder($data)
    {
        return AliSendOrder::createOrder($data);
    }
    
    static function search($params, $isAll = false)
    {
    	return AliSendOrder:: search($params, $isAll);
    }
    
    static function getSendOrderStat($distribution_channel_id)
    {
    	$sendOrderStat = array(); 
    	$sendOrderStat['todayChargeAmount'] =  AliOrder::getDistributionTodayChargeAmount($distribution_channel_id);
    	$sendOrderStat['todayAddUserNum'] = Aliuser::getDistributionTodayAddUserNum($distribution_channel_id);
    	$sendOrderStat['totalChargeAmount'] = AliOrder::getDistributionTotalChargeAmount($distribution_channel_id);
    	$sendOrderStat['totalUserNum'] = Aliuser::getDistributionTotalAddUserNum($distribution_channel_id);
    	
    	return $sendOrderStat;
    }
    
    

    /**
     * 删除派单
     * @param $id 派单id
     * @return
     */
    static function removeSendOrder($id)
    {
        return SendOrder::removeSendOrder($id);
    }

}