fix: bug修复

This commit is contained in:
2024-10-29 17:38:47 +08:00
parent 48bf3e6f33
commit 260c1f052d
33 changed files with 1032 additions and 664 deletions

View File

@@ -1,4 +1,5 @@
<?php
namespace app\admin\controller;
use PHPExcel;
@@ -41,7 +42,7 @@ class ProductPurchaseLinks extends BaseController
->order('links.id', 'sort')
->group('links.product_id')
->paginate(10);
$data = [];
foreach ($list as $val) {
if (empty($data[$val['spu']])) {
@@ -49,7 +50,6 @@ class ProductPurchaseLinks extends BaseController
$data[$val['spu']] = $val;
}
}
if (!$list->isEmpty()) {
$others = Db::name('product_purchase_links')->alias('links')
->field([
@@ -75,7 +75,7 @@ class ProductPurchaseLinks extends BaseController
}
}
}
$this->assign('list', $data);
$this->assign('page', $list->render());
@@ -160,7 +160,7 @@ class ProductPurchaseLinks extends BaseController
$rows = $sheet->getHighestRow(); //总行数
$xlsx = [];
for($i = 2; $i <= $rows; $i++) {
for ($i = 2; $i <= $rows; $i++) {
// $xlsx[行号] = 数据
$xlsx[$i] = [
'spu' => $sheet->getCellByColumnAndRow(0, $i)->getValue(),
@@ -171,7 +171,7 @@ class ProductPurchaseLinks extends BaseController
// 错误提示
$errors = [];
// 验证成功数据
$valid_data = [];
@@ -272,7 +272,7 @@ class ProductPurchaseLinks extends BaseController
])
->join('product_purchase_link_platforms platforms', 'platforms.id=links.platform_id')
->join('product', 'product.id=links.product_id')
->where(function($query) {
->where(function ($query) {
$query->where('product.is_show', '=', 0)->where('links.country_code', '=', $this->country_code);
if (request()->has('skeyword')) {
$query->where(function ($q) {