<?php

namespace App\Services\Business\MiaoXuan;

use App\Models\BusinessGoodsSku;
use App\Services\Business\BusinessClient;

class MiaoXuan extends BusinessClient
{

    public function auth()
    {
        // TODO: Implement auth() method.
    }

    public function downloadGoodsListAndBind($activityNo)
    {
    }

    public function bindGoods($goods)
    {
        Goods::bindGoods($goods, $this->shop->id);
    }

    public function incrQuantity($businessGoodsSku, $num, $incremental)
    {
        $appendParams = Goods::incrQuantity($this->shop->id, $num, $businessGoodsSku);
        $url = 'http://shop.chutang66.com/miaoxuan/stock';
        $this->formDataPostRequest($url, $appendParams);
    }

    public function downloadOrdersAndSave($beginTime, $endTime, $downloadType = 'default', $page = 1)
    {
    }

    public function batchIncrQuantity($businessGoodsSkus, $num, $incremental)
    {
        $batchAppendParams = [];
        foreach ($businessGoodsSkus as $businessGoodsSku) {
            $appendParams = Goods::incrQuantity($this->shop->id, $num, $businessGoodsSku);
            $batchAppendParams[] = $appendParams;
        }
        $this->batchAsyncPostRequest('http://shop.chutang66.com/miaoxuan/stock', $batchAppendParams);
    }

    public function downloadGoods($skuId)
    {
        // TODO: Implement downloadGoods() method.
    }

    public function createLogistic($orderSn, $waybillNo)
    {
        // TODO: Implement createLogistic() method.
    }

    public function cancelLogistic($orderSn, $waybillNo)
    {
        // TODO: Implement cancelLogistic() method.
    }
}
