mirror of
https://gitee.com/ShopeX/ECShopX
synced 2026-08-05 11:45:51 +08:00
bug fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "laravel/lumen",
|
||||
"version": "4.4.1",
|
||||
"version": "4.4.2",
|
||||
"description": "The Laravel Lumen Framework.",
|
||||
"keywords": ["framework", "laravel", "lumen"],
|
||||
"license": "MIT",
|
||||
|
||||
@@ -1769,6 +1769,15 @@ class Distributor extends Controller
|
||||
$pageSize = $request->get('pageSize') ?: -1;
|
||||
$page = $request->get('page') ?: 1;
|
||||
$data = $distributorItemsService->getDistributorRelItemList($filter, $pageSize, $page, ['item_id' => 'desc'], false);
|
||||
if (!empty($data['list'])) {
|
||||
$company = (new CompanysActivationEgo())->check($companyId);
|
||||
if (($company['product_model'] ?? '') === 'standard') {
|
||||
$data['list'] = $distributorItemsService->applyMultiSpecTotalStoreForDistributorRelItemList($data['list']);
|
||||
} else {
|
||||
$itemsService = new ItemsService();
|
||||
$data['list'] = $itemsService->applyMultiSpecTotalStoreForItemList($data['list']);
|
||||
}
|
||||
}
|
||||
$data['warning_store'] = $warningStore;
|
||||
$data['filter'] = $filter;
|
||||
|
||||
|
||||
@@ -795,7 +795,7 @@ class Distributor extends BaseController
|
||||
|
||||
$filter = [];
|
||||
|
||||
$filter['is_valid'] = 'true';
|
||||
// $filter['is_valid'] = 'true';
|
||||
|
||||
$type = $request->input('type', 0); // 过滤条件
|
||||
$noHaving = false; // 是否过滤离用户的经纬度比较远的店铺 【true 不过滤】【false 过滤】
|
||||
@@ -928,7 +928,12 @@ class Distributor extends BaseController
|
||||
$filter['distributor_self'] = 0;
|
||||
|
||||
// $filter['is_valid'] = 'true';
|
||||
$filter['is_valid'] = ['true', 'false'];
|
||||
if ($request->input('is_valid')) {
|
||||
$filter['is_valid'] = $request->input('is_valid');
|
||||
} else {
|
||||
$filter['is_valid'] = ['true', 'false'];
|
||||
}
|
||||
|
||||
if ($request->input('get_shop')) {
|
||||
$filter['shop_id|neq'] = '';
|
||||
}
|
||||
|
||||
@@ -429,6 +429,115 @@ class DistributorItemsService
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺关联商品列表:多规格(nospec=false)时汇总同一 goods 下全部子规格的「有效库存」。
|
||||
* 与 GoodsBundle\Services\ItemsService::applyMultiSpecTotalStoreForItemList 对齐思路,
|
||||
* 并按 distribution_distributor_items.is_total_store 区分总部库存(items.store)与店铺库存(关联表 store)。
|
||||
*
|
||||
* @param array $list getDistributorRelItemList 等返回的行(须含 company_id、goods_id、distributor_id、nospec、store)
|
||||
* @return array
|
||||
*/
|
||||
public function applyMultiSpecTotalStoreForDistributorRelItemList(array $list)
|
||||
{
|
||||
if (!$list) {
|
||||
return $list;
|
||||
}
|
||||
$companyId = $list[0]['company_id'] ?? null;
|
||||
if ($companyId === null || $companyId === '') {
|
||||
return $list;
|
||||
}
|
||||
$distributorId = (int) ($list[0]['distributor_id'] ?? 0);
|
||||
|
||||
$multiGoodsIds = [];
|
||||
foreach ($list as $row) {
|
||||
if (!$this->isMultiSpecNospecForStore($row['nospec'] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
$gid = $row['goods_id'] ?? null;
|
||||
if ($gid !== null && $gid !== '') {
|
||||
$multiGoodsIds[$gid] = true;
|
||||
}
|
||||
}
|
||||
if (!$multiGoodsIds) {
|
||||
return $list;
|
||||
}
|
||||
|
||||
$goodsIdList = array_keys($multiGoodsIds);
|
||||
$rsGoods = $this->itemsRepository->getLists(
|
||||
['company_id' => $companyId, 'goods_id' => $goodsIdList],
|
||||
'goods_id, item_id, store'
|
||||
);
|
||||
if (!$rsGoods) {
|
||||
return $list;
|
||||
}
|
||||
|
||||
$itemsByGoods = [];
|
||||
foreach ($rsGoods as $g) {
|
||||
$itemsByGoods[$g['goods_id']][] = $g;
|
||||
}
|
||||
|
||||
$allItemIds = array_unique(array_column($rsGoods, 'item_id'));
|
||||
$dRel = $this->entityRepository->lists(
|
||||
[
|
||||
'company_id' => $companyId,
|
||||
'distributor_id' => $distributorId,
|
||||
'item_id' => $allItemIds,
|
||||
],
|
||||
[],
|
||||
-1,
|
||||
1
|
||||
);
|
||||
$dByItemId = array_column($dRel['list'] ?? [], null, 'item_id');
|
||||
|
||||
$totalByGoodsId = [];
|
||||
foreach ($itemsByGoods as $goodsId => $skuRows) {
|
||||
$sum = 0;
|
||||
foreach ($skuRows as $sku) {
|
||||
$iid = $sku['item_id'];
|
||||
if (!isset($dByItemId[$iid])) {
|
||||
continue;
|
||||
}
|
||||
$di = $dByItemId[$iid];
|
||||
if ($this->isDistributorRowUsingTotalStore($di)) {
|
||||
$sum += (int) ($sku['store'] ?? 0);
|
||||
} else {
|
||||
$sum += (int) ($di['store'] ?? 0);
|
||||
}
|
||||
}
|
||||
$totalByGoodsId[$goodsId] = $sum;
|
||||
}
|
||||
|
||||
foreach ($list as $k => $v) {
|
||||
if (!$this->isMultiSpecNospecForStore($v['nospec'] ?? null)) {
|
||||
continue;
|
||||
}
|
||||
$gid = $v['goods_id'] ?? null;
|
||||
if ($gid === null || $gid === '') {
|
||||
continue;
|
||||
}
|
||||
if (array_key_exists($gid, $totalByGoodsId)) {
|
||||
$list[$k]['store'] = $totalByGoodsId[$gid];
|
||||
}
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $nospec 与 Items 一致:true 为单规格,false/0/'false' 为多规格
|
||||
*/
|
||||
private function isMultiSpecNospecForStore($nospec): bool
|
||||
{
|
||||
return $nospec === false || $nospec === 'false' || $nospec === 0 || $nospec === '0';
|
||||
}
|
||||
|
||||
private function isDistributorRowUsingTotalStore(array $distributorItemRow): bool
|
||||
{
|
||||
$v = $distributorItemRow['is_total_store'] ?? false;
|
||||
|
||||
return $v === true || $v === 'true' || $v === 1 || $v === '1';
|
||||
}
|
||||
|
||||
// 获取产地国信息
|
||||
private function getorigincountry($list, $company_id)
|
||||
{
|
||||
@@ -790,6 +899,9 @@ class DistributorItemsService
|
||||
|
||||
$result['list'] = $em->select('i.*')->execute()->fetchAll();
|
||||
$result['list'] = $this->getDistributorSkuReplace($companyId, $distributorId, $result['list'], true);
|
||||
// 多语言
|
||||
$service = new MultiLangService();
|
||||
$result['list'] = $service->getListAddLang($result['list'],['item_name'],'items',$this->getLang(),'item_id');
|
||||
} else {
|
||||
$result['list'] = [];
|
||||
}
|
||||
|
||||
@@ -177,13 +177,12 @@ class TradeExportService implements ExportFileInterface
|
||||
$orderList[$key][$k] = $value[$k] / 100;
|
||||
}
|
||||
} elseif ($k == 'payPoint') {
|
||||
// 新增:处理订单实付积分
|
||||
if (isset($value['payType']) && $value['payType'] == 'point') {
|
||||
// 积分支付时,订单实付积分 = payFee 的值(积分无需除以100)
|
||||
$orderList[$key][$k] = isset($value['payFee']) ? $value['payFee'] : 0;
|
||||
// 现金/混合支付时,订单实付积分取订单主表 point_use
|
||||
if (isset($value['payType']) && $value['payType'] != 'point') {
|
||||
$orderList[$key][$k] = $value['pointUse'] ?? $value['point_use'] ?? 0;
|
||||
} else {
|
||||
// 非积分支付时,订单实付积分为0
|
||||
$orderList[$key][$k] = 0;
|
||||
// 纯积分支付时,兼容使用交易单 payFee 作为积分值
|
||||
$orderList[$key][$k] = isset($value['payFee']) ? $value['payFee'] : 0;
|
||||
}
|
||||
} elseif (in_array($k, ['timeStart', 'timeExpire']) && isset($value[$k]) && $value[$k]) {
|
||||
$orderList[$key][$k] = date('Y-m-d H:i:s', $value[$k]);
|
||||
|
||||
@@ -2614,12 +2614,11 @@ class Items extends BaseController
|
||||
$filter['audit_status'] = 'approved';
|
||||
$filter['item_type'] = 'normal';
|
||||
|
||||
if (isset($params['keywords']) && $params['keywords']) {
|
||||
$filter['or'] = [
|
||||
'item_name|contains' => $params['keywords'],
|
||||
'item_bn' => $params['keywords'],
|
||||
'barcode' => $params['keywords'],
|
||||
];
|
||||
if (isset($params['keywords'])) {
|
||||
$kw = trim((string) $params['keywords']);
|
||||
if ($kw !== '') {
|
||||
$filter['keywords'] = $kw;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($params['item_name']) && $params['item_name']) {
|
||||
@@ -2638,6 +2637,7 @@ class Items extends BaseController
|
||||
$pageSize = intval($params['pageSize']);
|
||||
|
||||
$itemsService = new ItemsService();
|
||||
$filter = $itemsService->_filter($filter);
|
||||
$company = (new CompanysActivationEgo())->check($filter['company_id']);
|
||||
if ($filter['distributor_id'] == 0 || $company['product_model'] == 'platform') {
|
||||
$result = $itemsService->getSkuItemsList($filter, $page, $pageSize);
|
||||
|
||||
@@ -2504,6 +2504,7 @@ class ItemsService
|
||||
$or = [
|
||||
'or'=>[
|
||||
'item_bn|contains'=> $filter['keywords'],
|
||||
'barcode'=> $filter['keywords'],
|
||||
// ['item_name|contains'=> $filter['keywords']],
|
||||
]
|
||||
];
|
||||
|
||||
@@ -347,6 +347,8 @@ class TradeService implements InterfacesTrade
|
||||
$value['receipt_type'] = $orderListData[$value['orderId']]['receipt_type'];
|
||||
$value['order_holder'] = $orderListData[$value['orderId']]['order_holder'];
|
||||
$value['self_delivery_fee'] = $orderListData[$value['orderId']]['self_delivery_fee'] ?? 0;
|
||||
$value['point_use'] = $orderListData[$value['orderId']]['point_use'] ?? 0;
|
||||
$value['pointUse'] = $orderListData[$value['orderId']]['point_use'] ?? 0;
|
||||
if (isset($selfDeliveryOperatorIds[$value['orderId']]) && $selfDeliveryOperatorIds[$value['orderId']] > 0) {
|
||||
$value['self_delivery_operator_id'] = $selfDeliveryOperatorIds[$value['orderId']] ?? 0;
|
||||
$value['self_delivery_operator_mobile'] = $selfDeliveryOperator[$value['self_delivery_operator_id']]['mobile'] ?? '';
|
||||
|
||||
@@ -348,12 +348,13 @@ class BrokerageService
|
||||
if (!$promoterInfo || $promoterInfo['disabled']) {
|
||||
continue;
|
||||
}
|
||||
app('log')->info(':export brokerage:'.__FUNCTION__.__LINE__.': promoterInfo :' . json_encode($promoterInfo));
|
||||
// 推广员生成业绩,应不需要验证门店导购是否绑定店铺
|
||||
// app('log')->info(':export brokerage:'.__FUNCTION__.__LINE__.': promoterInfo :' . json_encode($promoterInfo));
|
||||
|
||||
if($this->orderInfo['orderInfo']['distributor_id'] > 0 && !$this->checkSalespersonShop($promoterInfo['user_id'])){
|
||||
continue;
|
||||
}
|
||||
app('log')->info(':export brokerage:'.__FUNCTION__.__LINE__.': promoterInfo-userid OK :' . $promoterInfo['user_id']);
|
||||
// if($this->orderInfo['orderInfo']['distributor_id'] > 0 && !$this->checkSalespersonShop($promoterInfo['user_id'])){
|
||||
// continue;
|
||||
// }
|
||||
// app('log')->info(':export brokerage:'.__FUNCTION__.__LINE__.': promoterInfo-userid OK :' . $promoterInfo['user_id']);
|
||||
|
||||
//通用返佣比例
|
||||
$ratio = $config['popularize_ratio'][$this->ratioType][$name]['ratio'];
|
||||
|
||||
@@ -730,6 +730,9 @@ class PagesTemplateServices
|
||||
}
|
||||
|
||||
if ($pages_template_id) {
|
||||
if ($distributor_id > 0 && $weapp_pages == 'index') {
|
||||
$weapp_pages = 'distributor_index';
|
||||
}
|
||||
$filter = [
|
||||
'company_id' => $params['company_id'],
|
||||
'pages_template_id' => $pages_template_id,
|
||||
|
||||
@@ -25,7 +25,7 @@ use OrdersBundle\Traits\GetOrderServiceTrait;
|
||||
|
||||
use AftersalesBundle\Services\AftersalesService;
|
||||
|
||||
use ThirdPartyBundle\Services\SaasErpCentre\OrderAftersalesService;
|
||||
// use ThirdPartyBundle\Services\SaasErpCentre\OrderAftersalesService;
|
||||
use ThirdPartyBundle\Services\SaasErpCentre\OrderRefundService;
|
||||
use ThirdPartyBundle\Services\SaasErpCentre\OrderService as SaasErpOrderService;
|
||||
use ThirdPartyBundle\Services\SaasErpCentre\Request as SaasErpRequest;
|
||||
@@ -68,13 +68,18 @@ class Refund extends Controller
|
||||
}
|
||||
|
||||
$orderRefundSerrvice = new OrderRefundService();
|
||||
// 售后仅退款获取售后单号
|
||||
// 售后单号为空时,通过$params['refund_bn']获取售后单号
|
||||
if (!$aftersales_bn && isset($params['refund_bn'])) {
|
||||
$aftersalesRefundInfo = $orderRefundSerrvice->getAftersalesRefundInfoByRefundBn($params['refund_bn']);
|
||||
$aftersales_bn = $aftersalesRefundInfo['aftersales_bn'] ?? '';
|
||||
}
|
||||
// 售后单号为空时,通过$params['refund_id']获取售后单号
|
||||
if (!$aftersales_bn) {
|
||||
$aftersalesRefundInfo = $orderRefundSerrvice->getAftersalesRefundInfoByRefundBn($params['refund_id']);
|
||||
$aftersales_bn = $aftersalesRefundInfo['aftersales_bn'] ?? '';
|
||||
}
|
||||
|
||||
$orderAftersalesService = new OrderAftersalesService();
|
||||
// $orderAftersalesService = new OrderAftersalesService();
|
||||
|
||||
try {
|
||||
// 无售后单 直接全额退款 未发货,取消订单,直接退款
|
||||
|
||||
Reference in New Issue
Block a user