2022-07-28 13:46:08 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\Goods;
|
|
|
|
|
|
2022-08-16 21:02:31 +08:00
|
|
|
use App\Events\StockUpdateEvent;
|
2022-08-04 14:25:12 +08:00
|
|
|
use App\Exports\GoodsSkusExport;
|
2022-07-28 13:46:08 +08:00
|
|
|
use App\Http\Controllers\Controller;
|
2022-08-03 16:41:15 +08:00
|
|
|
use App\Http\Requests\GoodsRequest;
|
|
|
|
|
use App\Http\Requests\GoodsSkuRequest;
|
2022-08-03 11:14:08 +08:00
|
|
|
use App\Models\Goods;
|
2022-08-04 13:55:28 +08:00
|
|
|
use App\Models\Log;
|
2022-08-01 17:06:43 +08:00
|
|
|
use App\Models\Log as LogModel;
|
2022-08-09 10:34:36 +08:00
|
|
|
use App\Utils\DateTimeUtils;
|
2022-07-28 13:46:08 +08:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use App\Models\GoodsSku;
|
|
|
|
|
use App\Http\Resources\GoodsSkuResource;
|
2022-08-01 04:18:07 +08:00
|
|
|
use App\Imports\GoodsSkusImport;
|
2022-08-03 16:41:15 +08:00
|
|
|
use Illuminate\Support\Facades\DB;
|
2022-08-02 11:43:46 +08:00
|
|
|
use Illuminate\Support\Facades\Validator;
|
|
|
|
|
use Illuminate\Validation\Rule;
|
2022-08-01 04:18:07 +08:00
|
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
|
use Maatwebsite\Excel\Facades\Excel;
|
2022-08-03 20:28:42 +08:00
|
|
|
use App\Models\DailyStockRecord;
|
2022-07-28 13:46:08 +08:00
|
|
|
|
|
|
|
|
class GoodsSkusController extends Controller
|
|
|
|
|
{
|
2022-08-01 17:06:43 +08:00
|
|
|
public function __construct(Request $request)
|
2022-08-01 05:07:38 +08:00
|
|
|
{
|
2022-08-01 17:06:43 +08:00
|
|
|
$this->log = new LogModel([
|
|
|
|
|
'module' => 'goods',
|
|
|
|
|
'action' => $request->getMethod(),
|
|
|
|
|
'target_type' => 'goods_sku',
|
|
|
|
|
]);
|
2022-08-01 05:07:38 +08:00
|
|
|
}
|
|
|
|
|
|
2022-07-28 13:46:08 +08:00
|
|
|
public function index(Request $request)
|
|
|
|
|
{
|
2022-08-03 11:14:08 +08:00
|
|
|
$goods = Goods::query()->filter()->get()->toArray();
|
|
|
|
|
$goodsIds = array_column($goods, 'id');
|
|
|
|
|
// 状态变更时间查询,日志
|
2022-08-04 13:55:28 +08:00
|
|
|
$ids = [];
|
|
|
|
|
if ($request->get('keyword_type', '') && $request->get('keyword_value', '')) {
|
|
|
|
|
$ids = Log::query()->where('target_type', 'sku')
|
|
|
|
|
->where('target_field', $request->keyword_type)
|
|
|
|
|
->whereBetween('created_at', explode(' - ', $request->keyword_value))
|
|
|
|
|
->pluck('sku_id')
|
|
|
|
|
->toArray();
|
|
|
|
|
}
|
2022-08-09 10:34:36 +08:00
|
|
|
$day = DateTimeUtils::getToday();
|
2022-08-03 11:14:08 +08:00
|
|
|
$goodsSkus = GoodsSku::query()
|
|
|
|
|
->whereIn('goods_id', $goodsIds)
|
2022-08-04 13:55:28 +08:00
|
|
|
->when($ids, function ($query, $ids) {
|
|
|
|
|
return $query->whereIn('id', $ids);
|
|
|
|
|
})
|
2022-08-03 11:14:08 +08:00
|
|
|
->filter()
|
|
|
|
|
->with(['goods' => function ($query) {
|
|
|
|
|
$query->with(['type:id,name', 'brand:id,name']);
|
|
|
|
|
}])
|
2022-08-03 20:28:42 +08:00
|
|
|
->with(['daily' => function ($query) use ($day) {
|
2022-08-08 17:25:12 +08:00
|
|
|
$query->where('day', $day);
|
2022-08-03 11:14:08 +08:00
|
|
|
}])
|
2022-08-12 16:20:40 +08:00
|
|
|
->orderBy('updated_at', 'desc')
|
2022-08-03 11:14:08 +08:00
|
|
|
->paginate();
|
|
|
|
|
|
|
|
|
|
return GoodsSkuResource::collection($goodsSkus);
|
2022-07-28 13:46:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function show($id)
|
|
|
|
|
{
|
2022-08-02 20:15:57 +08:00
|
|
|
return new GoodsSkuResource(GoodsSku::query()
|
|
|
|
|
->with(['goods' => function ($query) {
|
|
|
|
|
$query->with(['type:id,name', 'brand:id,name']);
|
|
|
|
|
}])
|
|
|
|
|
->find($id));
|
2022-07-28 13:46:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function update($id, Request $request)
|
|
|
|
|
{
|
2022-08-03 16:41:15 +08:00
|
|
|
$goodsRules = (new GoodsRequest())->arrayRules('goods.');
|
|
|
|
|
$skuRules = (new GoodsSkuRequest())->arrayRules('sku.');
|
|
|
|
|
$validator = Validator::make($request->all(), array_merge($goodsRules, $skuRules));
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
|
|
|
|
|
|
|
|
|
return response($this->res, $this->res['httpCode']);
|
|
|
|
|
}
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
// 商品规格更新
|
|
|
|
|
$sku = GoodsSku::query()->find($id);
|
|
|
|
|
$this->setBeforeUpdate($sku->toArray());
|
|
|
|
|
$sku->update($request->sku);
|
|
|
|
|
$this->setAfterUpdate($sku->toArray());
|
|
|
|
|
$this->addLog($id, 'update');
|
|
|
|
|
// 商品更新
|
|
|
|
|
$goods = Goods::query()->find($sku->goods_id);
|
2022-08-09 20:40:39 +08:00
|
|
|
$this->log = new LogModel([
|
|
|
|
|
'module' => 'goods',
|
|
|
|
|
'action' => $request->getMethod(),
|
|
|
|
|
'target_type' => 'goods',
|
|
|
|
|
]);
|
2022-08-03 16:41:15 +08:00
|
|
|
$this->setBeforeUpdate($goods->toArray());
|
|
|
|
|
$goods->update($request->goods);
|
|
|
|
|
$this->setAfterUpdate($goods->toArray());
|
2022-08-09 20:40:39 +08:00
|
|
|
$this->addLog($sku->goods_id, 'update');
|
2022-08-03 16:41:15 +08:00
|
|
|
DB::commit();
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
$this->res = [
|
|
|
|
|
'httpCode' => 400,
|
|
|
|
|
'errorCode' => 400416,
|
|
|
|
|
'errorMessage' => $exception->getMessage(),
|
|
|
|
|
];
|
|
|
|
|
}
|
2022-07-28 13:46:08 +08:00
|
|
|
|
2022-08-03 16:41:15 +08:00
|
|
|
return response($this->res, $this->res['httpCode']);
|
2022-08-02 11:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function batchUpdate(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$appendRules = [
|
2022-08-03 20:28:42 +08:00
|
|
|
'updateType' => ['required', 'string', Rule::in(['newest', 'inventory', 'stock'])],
|
2022-08-03 11:14:08 +08:00
|
|
|
'skus' => ['required', 'array'],
|
|
|
|
|
'skus.*.id' => [
|
2022-08-02 11:43:46 +08:00
|
|
|
'required',
|
|
|
|
|
Rule::exists('goods_skus', 'id'),
|
|
|
|
|
],
|
|
|
|
|
];
|
2022-08-08 16:00:47 +08:00
|
|
|
$skuRules = (new GoodsSkuRequest())->arrayRules('skus.*.');
|
|
|
|
|
$validator = Validator::make($request->all(), array_merge($appendRules, $skuRules));
|
2022-08-03 20:28:42 +08:00
|
|
|
if ($validator->fails()) {
|
|
|
|
|
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
|
|
|
|
|
|
|
|
|
return response($this->res, $this->res['httpCode']);
|
|
|
|
|
}
|
|
|
|
|
$function = $request->updateType;
|
|
|
|
|
|
|
|
|
|
return $this->$function($request);
|
2022-08-02 11:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-03 20:28:42 +08:00
|
|
|
private function newest($request)
|
2022-08-02 11:43:46 +08:00
|
|
|
{
|
2022-08-03 20:28:42 +08:00
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
$logs = [];
|
|
|
|
|
foreach ($request->skus as $sku) {
|
|
|
|
|
$costLog = $arrivedLog = [
|
|
|
|
|
'module' => 'goods',
|
|
|
|
|
'action' => $request->getMethod(),
|
|
|
|
|
'target_type' => 'goods_sku',
|
|
|
|
|
'target_id' => $sku['id'],
|
|
|
|
|
'user_id' => $request->user()->id
|
|
|
|
|
];
|
|
|
|
|
// 成本
|
2022-08-04 13:55:28 +08:00
|
|
|
$goodsSku = GoodsSku::query()->where('id', $sku['id'])->first(['id', 'cost', 'stock', 'num']);
|
2022-08-03 20:28:42 +08:00
|
|
|
$costLog['target_field'] = 'cost';
|
|
|
|
|
$costLog['before_update'] = $goodsSku->cost;
|
|
|
|
|
$goodsSku->cost = $sku['cost'];
|
|
|
|
|
$goodsSku->reference_price = $sku['cost'] * 1.5;
|
2022-08-04 13:55:28 +08:00
|
|
|
$goodsSku->stock += $sku['arrived_today_num'];
|
|
|
|
|
$goodsSku->num += $sku['arrived_today_num'];
|
2022-08-03 20:28:42 +08:00
|
|
|
$goodsSku->save();
|
|
|
|
|
$costLog['after_update'] = $goodsSku->cost;
|
|
|
|
|
$logs[] = $costLog;
|
|
|
|
|
// 今日到货
|
2022-08-09 10:34:36 +08:00
|
|
|
$record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', DateTimeUtils::getToday())->first(['id', 'arrived_today_num']);
|
2022-08-03 20:28:42 +08:00
|
|
|
$arrivedLog['target_field'] = 'arrived_today_num';
|
|
|
|
|
$arrivedLog['before_update'] = $record->arrived_today_num;
|
2022-08-04 13:55:28 +08:00
|
|
|
$record->arrived_today_num += $sku['arrived_today_num'];
|
2022-08-03 20:28:42 +08:00
|
|
|
$record->save();
|
|
|
|
|
$arrivedLog['after_update'] = $record->arrived_today_num;
|
|
|
|
|
$logs[] = $arrivedLog;
|
|
|
|
|
}
|
|
|
|
|
$log = new LogModel();
|
|
|
|
|
$log->batchInsert($logs);
|
|
|
|
|
DB::commit();
|
2022-08-16 21:02:31 +08:00
|
|
|
event(new StockUpdateEvent(array_column($request->skus, 'id')));
|
2022-08-03 20:28:42 +08:00
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
$this->res = [
|
|
|
|
|
'httpCode' => 400,
|
|
|
|
|
'errorCode' => 400500,
|
|
|
|
|
'errorMessage' => $exception->getMessage(),
|
|
|
|
|
];
|
2022-08-02 11:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-03 20:28:42 +08:00
|
|
|
return response($this->res, $this->res['httpCode']);
|
2022-08-02 11:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-03 20:28:42 +08:00
|
|
|
private function inventory($request)
|
2022-08-02 11:43:46 +08:00
|
|
|
{
|
2022-08-03 20:28:42 +08:00
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
|
|
|
|
$logs = [];
|
|
|
|
|
foreach ($request->skus as $sku) {
|
|
|
|
|
$inventoryLog = [
|
|
|
|
|
'module' => 'goods',
|
|
|
|
|
'action' => $request->getMethod(),
|
|
|
|
|
'target_type' => 'goods_sku',
|
|
|
|
|
'target_id' => $sku['id'],
|
|
|
|
|
'user_id' => $request->user()->id
|
|
|
|
|
];
|
2022-08-09 10:34:36 +08:00
|
|
|
$record = DailyStockRecord::query()->where('sku_id', $sku['id'])->where('day', DateTimeUtils::getToday())->first(['id', 'inventory']);
|
2022-08-03 20:28:42 +08:00
|
|
|
$inventoryLog['target_field'] = 'inventory';
|
|
|
|
|
$inventoryLog['before_update'] = $record->inventory;
|
|
|
|
|
$record->inventory = $sku['inventory'];
|
|
|
|
|
$record->save();
|
|
|
|
|
$inventoryLog['after_update'] = $record->inventory;
|
|
|
|
|
$logs[] = $inventoryLog;
|
|
|
|
|
}
|
|
|
|
|
$log = new LogModel();
|
|
|
|
|
$log->batchInsert($logs);
|
|
|
|
|
DB::commit();
|
|
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
$this->res = [
|
|
|
|
|
'httpCode' => 400,
|
|
|
|
|
'errorCode' => 400500,
|
|
|
|
|
'errorMessage' => $exception->getMessage(),
|
|
|
|
|
];
|
2022-08-02 11:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-03 20:28:42 +08:00
|
|
|
return response($this->res, $this->res['httpCode']);
|
2022-08-02 11:43:46 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-08 20:02:08 +08:00
|
|
|
private function stock($request)
|
2022-08-03 20:28:42 +08:00
|
|
|
{
|
2022-08-08 20:02:08 +08:00
|
|
|
$skus = $request->skus;
|
2022-08-03 20:28:42 +08:00
|
|
|
$update = reset($skus);
|
|
|
|
|
DB::beginTransaction();
|
|
|
|
|
try {
|
2022-08-12 16:20:40 +08:00
|
|
|
$sku = GoodsSku::query()->where('id', $update['id'])->first(['id', 'two_days_ago_num', 'yesterday_num', 'num', 'stock', 'reserve']);
|
2022-08-03 20:28:42 +08:00
|
|
|
$record = DailyStockRecord::query()
|
|
|
|
|
->where('sku_id', $sku->id)
|
2022-08-09 10:34:36 +08:00
|
|
|
->where('day', DateTimeUtils::getToday())
|
2022-08-03 20:28:42 +08:00
|
|
|
->first();
|
|
|
|
|
$this->setBeforeUpdate([
|
|
|
|
|
'two_days_ago_num' => $sku->two_days_ago_num,
|
|
|
|
|
'yesterday_num' => $sku->yesterday_num,
|
|
|
|
|
'arrived_today_num' => $record->arrived_today_num,
|
2022-08-12 16:20:40 +08:00
|
|
|
'num' => $sku->num,
|
|
|
|
|
'stock' => $sku->stock,
|
2022-08-03 20:28:42 +08:00
|
|
|
]);
|
|
|
|
|
$sku->two_days_ago_num = $update['two_days_ago_num'];
|
2022-08-04 13:55:28 +08:00
|
|
|
$sku->yesterday_num = $update['yesterday_num'];
|
2022-08-15 10:43:49 +08:00
|
|
|
$sku->num = $update['two_days_ago_num'] + $update['yesterday_num'] + $update['arrived_today_num'];
|
|
|
|
|
$sku->stock += ($update['two_days_ago_num'] + $update['yesterday_num'] + $update['arrived_today_num'] - $record->arrived_today_num - $sku->two_days_ago_num - $sku->yesterday_num);
|
2022-08-03 20:28:42 +08:00
|
|
|
$sku->save();
|
|
|
|
|
$record->arrived_today_num = $update['arrived_today_num'];
|
|
|
|
|
$record->save();
|
|
|
|
|
$this->setAfterUpdate([
|
|
|
|
|
'two_days_ago_num' => $sku->two_days_ago_num,
|
|
|
|
|
'yesterday_num' => $sku->yesterday_num,
|
|
|
|
|
'arrived_today_num' => $record->arrived_today_num,
|
2022-08-12 16:20:40 +08:00
|
|
|
'num' => $sku->num,
|
|
|
|
|
'stock' => $sku->stock,
|
2022-08-03 20:28:42 +08:00
|
|
|
]);
|
|
|
|
|
$this->addLog($sku->id, 'stock');
|
|
|
|
|
DB::commit();
|
2022-08-16 21:02:31 +08:00
|
|
|
event(new StockUpdateEvent($sku));
|
2022-08-03 20:28:42 +08:00
|
|
|
} catch (\Exception $exception) {
|
|
|
|
|
DB::rollBack();
|
|
|
|
|
$this->res = [
|
|
|
|
|
'httpCode' => 400,
|
|
|
|
|
'errorCode' => 400416,
|
|
|
|
|
'errorMessage' => $exception->getMessage(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response($this->res, $this->res['httpCode']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateField($id, Request $request)
|
2022-08-02 11:43:46 +08:00
|
|
|
{
|
|
|
|
|
$rules = [
|
2022-08-03 20:28:42 +08:00
|
|
|
'updateField' => [
|
|
|
|
|
'required',
|
|
|
|
|
Rule::in(['reference_price', 'reserve', 'loss_num', 'status'])
|
2022-08-02 11:43:46 +08:00
|
|
|
],
|
2022-08-03 20:28:42 +08:00
|
|
|
'reference_price' => [
|
2022-08-02 11:43:46 +08:00
|
|
|
'sometimes',
|
|
|
|
|
'numeric',
|
|
|
|
|
'gt:0'
|
|
|
|
|
],
|
2022-08-03 20:28:42 +08:00
|
|
|
'reserve' => [
|
2022-08-02 11:43:46 +08:00
|
|
|
'sometimes',
|
|
|
|
|
'integer',
|
|
|
|
|
],
|
2022-08-03 20:28:42 +08:00
|
|
|
'loss_num' => [
|
2022-08-02 11:43:46 +08:00
|
|
|
'sometimes',
|
|
|
|
|
'integer',
|
|
|
|
|
],
|
2022-08-03 20:28:42 +08:00
|
|
|
'reason' => [
|
2022-08-02 11:43:46 +08:00
|
|
|
'sometimes',
|
2022-08-03 20:28:42 +08:00
|
|
|
'required',
|
|
|
|
|
'string'
|
2022-08-03 20:41:04 +08:00
|
|
|
],
|
|
|
|
|
'status' => [
|
|
|
|
|
'sometimes',
|
|
|
|
|
'required',
|
|
|
|
|
'integer',
|
|
|
|
|
Rule::in([0, 1, 2])],
|
2022-08-02 11:43:46 +08:00
|
|
|
];
|
2022-08-03 20:28:42 +08:00
|
|
|
$validator = Validator::make($request->all(), $rules);
|
|
|
|
|
if ($validator->fails()) {
|
|
|
|
|
$this->setValidatorFailResponse($validator->getMessageBag()->getMessages());
|
2022-08-12 17:45:33 +08:00
|
|
|
goto end;
|
2022-08-03 20:28:42 +08:00
|
|
|
}
|
|
|
|
|
$updateField = \request('updateField');
|
2022-08-12 16:20:40 +08:00
|
|
|
$sku = GoodsSku::query()->find($id);
|
2022-08-03 20:28:42 +08:00
|
|
|
if ('loss_num' === $updateField) {
|
2022-08-12 16:20:40 +08:00
|
|
|
$record = DailyStockRecord::query()
|
2022-08-03 20:28:42 +08:00
|
|
|
->where('sku_id', $id)
|
2022-08-09 10:34:36 +08:00
|
|
|
->where('day', DateTimeUtils::getToday())
|
2022-08-03 20:28:42 +08:00
|
|
|
->first(['id', 'loss_num']);
|
2022-08-04 13:55:28 +08:00
|
|
|
$this->log->message = $request->get('reason');
|
2022-08-12 16:20:40 +08:00
|
|
|
$this->setBeforeUpdate($record->loss_num);
|
|
|
|
|
$record->loss_num += $request->loss_num;
|
|
|
|
|
$record->save();
|
|
|
|
|
$this->setAfterUpdate($record->loss_num);
|
|
|
|
|
$sku->stock -= $request->loss_num;
|
2022-08-12 17:52:28 +08:00
|
|
|
} else {
|
|
|
|
|
$sku->$updateField = $request->$updateField;
|
2022-08-12 16:20:40 +08:00
|
|
|
}
|
|
|
|
|
$this->setBeforeUpdate($sku->$updateField);
|
|
|
|
|
if ('reserve' === $updateField) {
|
|
|
|
|
$changeNum = $sku->reserve - $request->reserve;
|
2022-08-12 17:45:33 +08:00
|
|
|
if (0 > $changeNum + $sku->stock) {
|
|
|
|
|
$this->setValidatorFailResponse('预留量超过库存数量');
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
2022-08-12 16:20:40 +08:00
|
|
|
$sku->stock += $changeNum;
|
2022-08-03 20:28:42 +08:00
|
|
|
}
|
2022-08-12 16:20:40 +08:00
|
|
|
$sku->save();
|
2022-08-16 21:02:31 +08:00
|
|
|
if (in_array($updateField, ['reserve', 'loss_num'])) {
|
|
|
|
|
event(new StockUpdateEvent($sku));
|
|
|
|
|
}
|
2022-08-12 16:20:40 +08:00
|
|
|
$this->setAfterUpdate($sku->$updateField);
|
2022-08-03 20:28:42 +08:00
|
|
|
$this->addLog($id, $updateField);
|
2022-08-12 17:45:33 +08:00
|
|
|
end:
|
2022-08-03 20:28:42 +08:00
|
|
|
|
|
|
|
|
return response($this->res, $this->res['httpCode']);
|
2022-07-28 13:46:08 +08:00
|
|
|
}
|
2022-08-01 04:18:07 +08:00
|
|
|
|
|
|
|
|
public function store(Request $request)
|
|
|
|
|
{
|
|
|
|
|
if (!$request->hasFile('goodsSkus')) {
|
|
|
|
|
$this->res = [
|
|
|
|
|
'httpCode' => 404,
|
|
|
|
|
'errorCode' => 404404,
|
|
|
|
|
'errorMessage' => 'not found goodsSkus file',
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
try {
|
2022-08-09 10:57:03 +08:00
|
|
|
$import = new GoodsSkusImport();
|
|
|
|
|
$path = $request->file('goodsSkus');
|
|
|
|
|
Excel::import($import, $path);
|
2022-08-01 17:06:43 +08:00
|
|
|
$this->addLog(0, 'import');
|
2022-08-01 04:18:07 +08:00
|
|
|
} catch (ValidationException $exception) {
|
|
|
|
|
$this->setValidatorFailResponse($exception->validator->getMessageBag()->getMessages());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response($this->res, $this->res['httpCode']);
|
|
|
|
|
}
|
2022-08-04 14:25:12 +08:00
|
|
|
|
|
|
|
|
public function export(Request $request)
|
|
|
|
|
{
|
|
|
|
|
$type = $request->get('exportType');
|
|
|
|
|
ob_end_clean();
|
|
|
|
|
return Excel::download(new GoodsSkusExport($type), $type, '.xlsx');
|
|
|
|
|
}
|
2022-07-28 13:46:08 +08:00
|
|
|
}
|