<?php
/**
 * 订单服务
 * 订单基础操作服务
 * @author lixiaolin
 * @Date: 2021/4/2
 * @Time: 下午13:50
 * @Email: lixiaolin@bluearp.com
 * @version 1.0
 * @copyright BlueCity
 */

namespace App\Repository\Order;

use App\Repository\Order\Repository;
use Closure;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use phpDocumentor\Reflection\Types\Integer;

class WearingOrder extends Repository
{

    /**从文件导入订单数据
     * @param string $file 上传文件地址
     * @return array|mixed
     */
    public function importFile($file)
    {
//        $orderData = $this->loadFromFile($file);
    }

    /**
     * 对订单进行操作动作
     * @param string $event 进行的操作
     * @param int $orderID 操作订单id
     * @param array $data 订单数据
     * @param Closure $callBack 订单生成后续操作123
     * @return bool
     */
    public function event($event, $orderID, $data, Closure $callBack)
    {
        if ($event == 'merge')
        {
            return $this->eventMergeOrder();
        }
        //....
    }

    /**
     * 对订单进行合单操作
     * @param array $orderIDs 订单ID
     * @return bool
     */
    public function eventMergeOrder(array $orderIDs)
    {

    }


    /**
     * 对订单进行合单操作
     * @param array $orderIDs 订单ID
     * @return bool
     */
    public function eventDivergeOrder(Integer $orderIDs)
    {

    }


    public function create($data, closure $callBack)
    {
        $res = parent::create($data);
        if ($callBack)
        {
            $callBack();
        }

        return $res;
    }

}
