<?php



namespace app\common\repositories\store\order;

use app\common\repositories\BaseRepository;
use app\common\dao\store\order\StoreImportDao;

class StoreImportRepository extends BaseRepository
{
    /**
     * StoreGroupOrderRepository constructor.
     * @param StoreImportDeliveryDao $dao
     */
    public function __construct(StoreImportDao $dao)
    {
        $this->dao = $dao;
    }

    public function getList($where,$page,$limit)
    {
        $query = $this->dao->getSearch($where);
        $count = $query->count();
        $list = $query->page($page,$limit)->order('create_time DESC')->select();

        return compact('count','list');
    }

    public function create(int $merId, string $import, int $type = 1)
    {
        $data =  [
            'import_type' => $import,
            'count' => 0,
            'success' => 0,
            'mer_id' => $merId,
            'status' => 0,
            'type' => $type
        ];

        return $this->dao->create($data);
    }
}
