|
|
@@ -11,6 +11,7 @@ use bizGhs\custom\classes\AccountMoneyClass;
|
|
|
use bizGhs\custom\classes\CustomClass;
|
|
|
use bizGhs\express\classes\GhsDeliveryOrderClass;
|
|
|
use bizGhs\order\classes\OrderClass;
|
|
|
+use bizGhs\order\classes\ShMethodClass;
|
|
|
use bizHd\cg\classes\CgMergeSnClass;
|
|
|
use bizHd\purchase\classes\PurchaseClass;
|
|
|
use bizHd\purchase\classes\PurchaseItemClass;
|
|
|
@@ -520,6 +521,9 @@ class PurchaseController extends BaseController
|
|
|
|
|
|
$post['product'] = $productList;
|
|
|
|
|
|
+ // xhShMethod 门店下单前保留花材合计,供后续 packCost 计算(pfLevel==0 分支会 unset itemTotalAmount)
|
|
|
+ $shMethodItemAmount = $post['itemTotalAmount'] ?? 0;
|
|
|
+
|
|
|
$sendType = $post['sendType'] ?? 0;
|
|
|
$transType = $post['transType'] ?? 0;
|
|
|
if ($sendType == dict::getDict('sendType', 'thirdSend')) {
|
|
|
@@ -568,7 +572,7 @@ class PurchaseController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
//如果已经算过一次打包费和运费了,则不再费了
|
|
|
- $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
|
|
|
+ $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $sendType);
|
|
|
if (!$needAdd) {
|
|
|
$packCost = 0;
|
|
|
if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
|
|
|
@@ -618,7 +622,7 @@ class PurchaseController extends BaseController
|
|
|
}
|
|
|
|
|
|
//如果已经算过一次打包费和运费了,则不再费了
|
|
|
- $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId);
|
|
|
+ $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $sendType);
|
|
|
if ($needAdd == false) {
|
|
|
$sendCost = 0;
|
|
|
}
|
|
|
@@ -627,218 +631,248 @@ class PurchaseController extends BaseController
|
|
|
//标记为昆明到地方订单
|
|
|
$post['localOrder'] = 1;
|
|
|
} else {
|
|
|
- //同城发货包装费和运费的计算
|
|
|
- $sendCost = 0;
|
|
|
- $sendDistance = 0;
|
|
|
- //特别注意,这边取供货商的shop信息
|
|
|
- $mapSet = ShopClass::hasIntraCity($ghsShopInfo);
|
|
|
- $openIntraCity = $mapSet['openIntraCity'] ?? 0;
|
|
|
- if ($sendType == dict::getDict('sendType', 'thirdSend')) {
|
|
|
- if ($openIntraCity == 2) {
|
|
|
- util::fail('不能使用跑腿');
|
|
|
+
|
|
|
+ // xhShMethod 门店:下单前按配置写入不满最低消费时的附加包装费/运费,关键词 sh_method_area
|
|
|
+ $newShMethod = dict::getNewMethodShop();
|
|
|
+ if (in_array($ghsShopId, $newShMethod)) {
|
|
|
+ $shMethodBigNum = 0;
|
|
|
+ foreach ($productList as $itemData) {
|
|
|
+ $shMethodBigNum += floatval($itemData['bigNum'] ?? 0);
|
|
|
+ }
|
|
|
+ $additionalCosts = ShMethodClass::calcFee(
|
|
|
+ $ghsShopId,
|
|
|
+ $ghsMainId,
|
|
|
+ $sendType,
|
|
|
+ $shMethodItemAmount,
|
|
|
+ $shMethodBigNum,
|
|
|
+ $customId,
|
|
|
+ $ghsInfo
|
|
|
+ );
|
|
|
+
|
|
|
+ // 如果产生了附加运费,与前面可能产生的 sendCost 进行累加或覆盖
|
|
|
+ if ($additionalCosts['sendCost'] > 0) {
|
|
|
+ $post['sendCost'] = bcadd($post['sendCost'] ?? 0, $additionalCosts['sendCost'], 2);
|
|
|
}
|
|
|
- if ($openIntraCity == 1) {
|
|
|
- // 生成随机订单号,不要跟原来的混起来,跑腿-销售单-
|
|
|
- $prefix = 'PT-XSD-' . $this->mainId . '-';
|
|
|
- $orderSn = $prefix . round(microtime(true) * 1000);
|
|
|
|
|
|
- // 使用 DeliveryQuoteUtil 获取配送报价
|
|
|
- try {
|
|
|
+ // 如果产生了附加包装费,覆盖前面赋值的 packCost
|
|
|
+ if ($additionalCosts['packCost'] > 0) {
|
|
|
+ $post['packCost'] = $additionalCosts['packCost'];
|
|
|
+ }
|
|
|
+ }else{
|
|
|
|
|
|
- if (empty($post['deliveryPlatform'])) {
|
|
|
- util::fail('请选择跑腿');
|
|
|
- }
|
|
|
+ //同城发货包装费和运费的计算
|
|
|
+ $sendCost = 0;
|
|
|
+ $sendDistance = 0;
|
|
|
+ //特别注意,这边取供货商的shop信息
|
|
|
+ $mapSet = ShopClass::hasIntraCity($ghsShopInfo);
|
|
|
+ $openIntraCity = $mapSet['openIntraCity'] ?? 0;
|
|
|
+ if ($sendType == dict::getDict('sendType', 'thirdSend')) {
|
|
|
+ if ($openIntraCity == 2) {
|
|
|
+ util::fail('不能使用跑腿');
|
|
|
+ }
|
|
|
+ if ($openIntraCity == 1) {
|
|
|
+ // 生成随机订单号,不要跟原来的混起来,跑腿-销售单-
|
|
|
+ $prefix = 'PT-XSD-' . $this->mainId . '-';
|
|
|
+ $orderSn = $prefix . round(microtime(true) * 1000);
|
|
|
+
|
|
|
+ // 使用 DeliveryQuoteUtil 获取配送报价
|
|
|
+ try {
|
|
|
+
|
|
|
+ if (empty($post['deliveryPlatform'])) {
|
|
|
+ util::fail('请选择跑腿');
|
|
|
+ }
|
|
|
|
|
|
- $quoteResult = DeliveryQuoteUtil::getDeliveryQuote([
|
|
|
- 'productList' => $productList,
|
|
|
- 'deliveryPlatform' => $post['deliveryPlatform'],
|
|
|
- 'deliveryBracketContent' => $post['deliveryBracketContent'], // 平台多报价识别id
|
|
|
- 'ghsInfo' => $ghsInfo,
|
|
|
- 'custom' => $custom,
|
|
|
- 'order' => [
|
|
|
- 'orderSn' => $orderSn,
|
|
|
- 'goodsType' => 1, //商品类型:0花束 1花材
|
|
|
- 'itemTotalAmount' => $post['itemTotalAmount'] ?? 0,
|
|
|
- 'remark' => $post['remark'] ?? '',
|
|
|
- ],
|
|
|
- 'mainId' => $this->mainId,
|
|
|
- 'productCount' => $productCount,
|
|
|
- ]);
|
|
|
-
|
|
|
- $sendCost = $quoteResult['sendCost'];
|
|
|
- $sendDistance = $quoteResult['sendDistance'];
|
|
|
- } catch (\Exception $e) {
|
|
|
- util::fail($e->getMessage());
|
|
|
+ $quoteResult = DeliveryQuoteUtil::getDeliveryQuote([
|
|
|
+ 'productList' => $productList,
|
|
|
+ 'deliveryPlatform' => $post['deliveryPlatform'],
|
|
|
+ 'deliveryBracketContent' => $post['deliveryBracketContent'], // 平台多报价识别id
|
|
|
+ 'ghsInfo' => $ghsInfo,
|
|
|
+ 'custom' => $custom,
|
|
|
+ 'order' => [
|
|
|
+ 'orderSn' => $orderSn,
|
|
|
+ 'goodsType' => 1, //商品类型:0花束 1花材
|
|
|
+ 'itemTotalAmount' => $post['itemTotalAmount'] ?? 0,
|
|
|
+ 'remark' => $post['remark'] ?? '',
|
|
|
+ ],
|
|
|
+ 'mainId' => $this->mainId,
|
|
|
+ 'productCount' => $productCount,
|
|
|
+ ]);
|
|
|
+
|
|
|
+ $sendCost = $quoteResult['sendCost'];
|
|
|
+ $sendDistance = $quoteResult['sendDistance'];
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ util::fail($e->getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- $post['sendCost'] = $sendCost;
|
|
|
- $post['sendDistance'] = $sendDistance;
|
|
|
+ $post['sendCost'] = $sendCost;
|
|
|
+ $post['sendDistance'] = $sendDistance;
|
|
|
|
|
|
- //出车、发快递、发物流可以算包装费
|
|
|
- $packCost = 0;
|
|
|
- if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
|
|
|
- noticeUtil::push("走的pfLevel=0", '15280215347');
|
|
|
- }
|
|
|
- $itemTotalAmount = $post['itemTotalAmount'] ?? 0;
|
|
|
- unset($post['itemTotalAmount']);
|
|
|
- if ($sendType == dict::getDict('sendType', 'express')) {
|
|
|
- $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $itemTotalAmount);
|
|
|
- if ($needAdd) {
|
|
|
- $packCost = $ghsShopInfo->packCost ?? 0;
|
|
|
+ // 出车(0)、发快递(4)、发物流可以算包装费
|
|
|
+ $packCost = 0;
|
|
|
+ if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
|
|
|
+ noticeUtil::push("走的pfLevel=0", '15280215347');
|
|
|
}
|
|
|
- }
|
|
|
- $post['packCost'] = $packCost;
|
|
|
- }
|
|
|
+ $itemTotalAmount = $post['itemTotalAmount'] ?? 0;
|
|
|
+ unset($post['itemTotalAmount']);
|
|
|
+
|
|
|
+ // sendType == 0 或 4 都要收包装费
|
|
|
+ if (in_array($sendType, [0, 4])) {
|
|
|
+ $needAdd = \bizHd\shop\classes\ShopClass::needAddPackCost($ghsShopInfo, $customId, $sendType, $itemTotalAmount);
|
|
|
+ if ($needAdd) {
|
|
|
+ $packCost = $ghsShopInfo->packCost ?? 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $post['packCost'] = $packCost;
|
|
|
|
|
|
- if (isset($ghsInfo['mainId']) && $ghsInfo['mainId'] == 14499) {
|
|
|
- noticeUtil::push("包装费:" . $packCost, '15280215347');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$respond = PurchaseService::createPurchase($post, $ghsInfo);
|
|
|
|
|
|
- if ($sendType == 0) {
|
|
|
- if (getenv('YII_ENV') == 'production') {
|
|
|
- //杭州斗南鲜花批发部,满500,10公里内免费配送,满1000,20公里免费配送
|
|
|
- if ($ghsShopId == 4608) {
|
|
|
- if ($respond->actPrice < 500) {
|
|
|
- $transaction->rollBack();
|
|
|
- util::fail('满500元支持免费配送');
|
|
|
- }
|
|
|
- }
|
|
|
- //叶上花,满500元市区免费配送
|
|
|
- if ($ghsShopId == 4804) {
|
|
|
- if ($respond->actPrice < 500) {
|
|
|
- $transaction->rollBack();
|
|
|
- util::fail('满500元支持免费配送');
|
|
|
- }
|
|
|
- }
|
|
|
- //花悠星 国恋 勇记 万丽 陆丰暂时不支持免费配送
|
|
|
- if ($ghsShopId == 7687 || $ghsShopId == 7831 || $ghsShopId == 7778 || $ghsShopId == 12003 || $ghsShopId == 38128) {
|
|
|
- util::fail('暂不支持送货上门,请选其它配送方式!');
|
|
|
- }
|
|
|
+ $newShMethod = dict::getNewMethodShop();
|
|
|
+ if (in_array($ghsShopId, $newShMethod)) {
|
|
|
+ // 使用 xhShMethod 配置校验配送限制,替代旧版门店硬编码规则,关键词 sh_method_area
|
|
|
+ $shMethodError = ShMethodClass::checkLimit(
|
|
|
+ $ghsShopId,
|
|
|
+ $ghsMainId,
|
|
|
+ $sendType,
|
|
|
+ $respond->actPrice ?? 0,
|
|
|
+ $respond->bigNum ?? 0,
|
|
|
+ $post['packCost'] ?? 0,
|
|
|
+ $post['sendCost'] ?? 0,
|
|
|
+ $post['wlName'] ?? '',
|
|
|
+ $customId,
|
|
|
+ $ghsInfo
|
|
|
+ );
|
|
|
+ if ($shMethodError !== '') {
|
|
|
+ $transaction->rollBack();
|
|
|
+ util::fail($shMethodError);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
|
|
|
- //广州鑫源花卉,选择送货上门必须选必选商品
|
|
|
- if ($ghsShopId == 12439) {
|
|
|
- $hasMust = array_intersect($ids, [3446945, 3446970, 3446973, 3446979, 3446995, 3447010, 3447023, 3459983, 4333184, 4317745, 1585738]);
|
|
|
- if (empty($hasMust)) {
|
|
|
- util::fail('请返回选择 必选商品');
|
|
|
+ if ($sendType == 0) {
|
|
|
+ if (getenv('YII_ENV') == 'production') {
|
|
|
+ //杭州斗南鲜花批发部,满500,10公里内免费配送,满1000,20公里免费配送
|
|
|
+ if ($ghsShopId == 4608) {
|
|
|
+ if ($respond->actPrice < 500) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ util::fail('满500元支持免费配送');
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if ($ghsShopId == 100883) {
|
|
|
- $hasMust = array_intersect($ids, [5017957,5036067,5036089,5036099,5017958,5036063,5017948,5035980,5036073,5036075,5036076,5036117,5036118,5017949,5035979,5035976,5035928,5035930,5036061,5035879]);
|
|
|
- if (empty($hasMust)) {
|
|
|
- util::fail('请返回选择 必选商品');
|
|
|
+ //叶上花,满500元市区免费配送
|
|
|
+ if ($ghsShopId == 4804) {
|
|
|
+ if ($respond->actPrice < 500) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ util::fail('满500元支持免费配送');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //花悠星 国恋 勇记 万丽 陆丰暂时不支持免费配送
|
|
|
+ if ($ghsShopId == 7687 || $ghsShopId == 7831 || $ghsShopId == 7778 || $ghsShopId == 12003 || $ghsShopId == 38128) {
|
|
|
+ util::fail('暂不支持送货上门,请选其它配送方式!');
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
- //三明易批花
|
|
|
- if ($ghsShopId == 82200) {
|
|
|
- if ($respond->actPrice < 100 || $respond->bigNum < 15) {
|
|
|
- $hasMust = array_intersect($ids, [4283478]);
|
|
|
+ //广州鑫源花卉,选择送货上门必须选必选商品
|
|
|
+ if ($ghsShopId == 12439) {
|
|
|
+ $hasMust = array_intersect($ids, [3446945, 3446970, 3446973, 3446979, 3446995, 3447010, 3447023, 3459983, 4333184, 4317745, 1585738]);
|
|
|
if (empty($hasMust)) {
|
|
|
- util::fail('没满100元且15扎,请返回选运费');
|
|
|
+ util::fail('请返回选择 必选商品');
|
|
|
}
|
|
|
}
|
|
|
- // 按当天计时,把 sendTimeWant 要限制在两天的时间范围之内
|
|
|
- $future = date("Y-m-d", strtotime('+2 day'));
|
|
|
- if (strtotime($respond->sendTimeWant) > strtotime($future)) {
|
|
|
- util::fail('配送日期只能选最近二天');
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- if ($ghsShopId == 77703) {
|
|
|
- //天天鲜花思明店,暂时关闭送货上门
|
|
|
- if ($respond->sendType == 0) {
|
|
|
- //util::fail('节日暂停送货上门,请选到店自取');
|
|
|
+ //情意花卉,必选品
|
|
|
+ if ($ghsShopId == 100883) {
|
|
|
+ $hasMust = array_intersect($ids, [5017957,5036067,5036089,5036099,5017958,5036063,5017948,5035980,5036073,5036075,5036076,5036117,5036118,5017949,5035979,5035976,5035928,5035930,5036061,5035879]);
|
|
|
+ if (empty($hasMust)) {
|
|
|
+ util::fail('请返回选择 必选商品');
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if ($ghsShopId == 86726) {
|
|
|
- //藏花林
|
|
|
- if ($respond->transType != 4 && $respond->transType != 5) {
|
|
|
- util::fail('请选同城配送或到店自取');
|
|
|
+ //三明易批花
|
|
|
+ if ($ghsShopId == 82200) {
|
|
|
+ if ($respond->actPrice < 100 || $respond->bigNum < 15) {
|
|
|
+ $hasMust = array_intersect($ids, [4283478]);
|
|
|
+ if (empty($hasMust)) {
|
|
|
+ util::fail('没满100元且15扎,请返回选运费');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 按当天计时,把 sendTimeWant 要限制在两天的时间范围之内
|
|
|
+ $future = date("Y-m-d", strtotime('+2 day'));
|
|
|
+ if (strtotime($respond->sendTimeWant) > strtotime($future)) {
|
|
|
+ util::fail('配送日期只能选最近二天');
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- } else {
|
|
|
|
|
|
- //好运鲜花批发,选择送货上门必须选必选商品
|
|
|
-// if ($ghsShopId == 36523) {
|
|
|
-// if ($respond->transType != 4 && $respond->transType != 5) {
|
|
|
-// util::fail('请选同城配送或到店自取');
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
-// if ($ghsShopId == 36523) {
|
|
|
-// if ($respond->actPrice < 50 || $respond->bigNum < 10) {
|
|
|
-// $hasMust = array_intersect($ids, [85295]);
|
|
|
-// if (empty($hasMust)) {
|
|
|
-// util::fail('没满50元且满10扎,请运费必选商品');
|
|
|
-// }
|
|
|
-// }
|
|
|
-// // 按当天计时,把 sendTimeWant 要限制在两天的时间范围之内
|
|
|
-// $future = date("Y-m-d", strtotime('+2 day'));
|
|
|
-// if (strtotime($respond->sendTimeWant) > strtotime($future)) {
|
|
|
-// util::fail('配送日期只能选最近二天');
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if ($ghsShopId == 77703) {
|
|
|
+ //天天鲜花思明店,暂时关闭送货上门
|
|
|
+ if ($respond->sendType == 0) {
|
|
|
+ //util::fail('节日暂停送货上门,请选到店自取');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ if ($ghsShopId == 86726) {
|
|
|
+ //藏花林
|
|
|
+ if ($respond->transType != 4 && $respond->transType != 5) {
|
|
|
+ util::fail('请选同城配送或到店自取');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- if (isset($ghsInfo['home'])) {
|
|
|
- if ($ghsInfo['home'] == 0) {
|
|
|
- util::fail('暂不支持送货上门,请选其它配送方式');
|
|
|
- }
|
|
|
- $homeAmount = $ghsInfo['homeAmount'] ? floatval($ghsInfo['homeAmount']) : 0;
|
|
|
- $homeNum = $ghsInfo['homeNum'] ? floatval($ghsInfo['homeNum']) : 0;
|
|
|
- if ($homeAmount > 0 && $homeAmount > $respond->actPrice) {
|
|
|
- util::fail("满{$homeAmount}元 可送货上门");
|
|
|
}
|
|
|
- if ($homeNum > 0 && $homeNum > $respond->bigNum) {
|
|
|
- util::fail("满{$homeNum}扎 可送货上门");
|
|
|
+
|
|
|
+ if (isset($ghsInfo['home'])) {
|
|
|
+ if ($ghsInfo['home'] == 0) {
|
|
|
+ util::fail('暂不支持送货上门,请选其它配送方式');
|
|
|
+ }
|
|
|
+ $homeAmount = $ghsInfo['homeAmount'] ? floatval($ghsInfo['homeAmount']) : 0;
|
|
|
+ $homeNum = $ghsInfo['homeNum'] ? floatval($ghsInfo['homeNum']) : 0;
|
|
|
+ if ($homeAmount > 0 && $homeAmount > $respond->actPrice) {
|
|
|
+ util::fail("满{$homeAmount}元 可送货上门");
|
|
|
+ }
|
|
|
+ if ($homeNum > 0 && $homeNum > $respond->bigNum) {
|
|
|
+ util::fail("满{$homeNum}扎 可送货上门");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- if ($sendType == 2) {
|
|
|
- //温州易批花,跑腿,不满100,要选10元的补运费商品
|
|
|
- if ($ghsShopId == 91115) {
|
|
|
- if ($respond->actPrice < 100) {
|
|
|
- $transaction->rollBack();
|
|
|
- $hasMust = array_intersect($ids, [4449812, 4449811]);
|
|
|
- if (empty($hasMust)) {
|
|
|
- util::fail('不满100,必选商品 补运费10元');
|
|
|
+ if ($sendType == 2) {
|
|
|
+ //温州易批花,跑腿,不满100,要选10元的补运费商品
|
|
|
+ if ($ghsShopId == 91115) {
|
|
|
+ if ($respond->actPrice < 100) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ $hasMust = array_intersect($ids, [4449812, 4449811]);
|
|
|
+ if (empty($hasMust)) {
|
|
|
+ util::fail('不满100,必选商品 补运费10元');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if ($sendType == 4) {
|
|
|
- //温州易批花,快递,不满100,要选10元的补运费商品
|
|
|
- if ($ghsShopId == 91115) {
|
|
|
- if ($respond->actPrice < 100) {
|
|
|
- $transaction->rollBack();
|
|
|
- $hasMust = array_intersect($ids, [4449812, 4449811]);
|
|
|
- if (empty($hasMust)) {
|
|
|
- util::fail('不满100,必选商品 补运费10元');
|
|
|
+ if ($sendType == 4) {
|
|
|
+ //温州易批花,快递,不满100,要选10元的补运费商品
|
|
|
+ if ($ghsShopId == 91115) {
|
|
|
+ if ($respond->actPrice < 100) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ $hasMust = array_intersect($ids, [4449812, 4449811]);
|
|
|
+ if (empty($hasMust)) {
|
|
|
+ util::fail('不满100,必选商品 补运费10元');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if ($sendType == 3) {
|
|
|
- //温州易批花,物流,不满200,要选10元的补运费商品
|
|
|
- if ($ghsShopId == 91115) {
|
|
|
- if ($respond->actPrice < 200) {
|
|
|
- $transaction->rollBack();
|
|
|
- $hasMust = array_intersect($ids, [4449812, 4449811]);
|
|
|
- if (empty($hasMust)) {
|
|
|
- util::fail('不满200,必选商品 补运费10元');
|
|
|
+ if ($sendType == 3) {
|
|
|
+ //温州易批花,物流,不满200,要选10元的补运费商品
|
|
|
+ if ($ghsShopId == 91115) {
|
|
|
+ if ($respond->actPrice < 200) {
|
|
|
+ $transaction->rollBack();
|
|
|
+ $hasMust = array_intersect($ids, [4449812, 4449811]);
|
|
|
+ if (empty($hasMust)) {
|
|
|
+ util::fail('不满200,必选商品 补运费10元');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$transaction->commit();
|
|
|
@@ -929,11 +963,15 @@ class PurchaseController extends BaseController
|
|
|
Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
|
|
|
}
|
|
|
} else {
|
|
|
- if (isset($info->sendType) && $info->sendType == 4) {
|
|
|
- //标记当天已收一次包装费,岭南批发市场用的功能
|
|
|
- $current = date("Y_m_d");
|
|
|
- $key = 'ghs_custom_today_has_get_pack_cost_' . $current . '_' . $customId;
|
|
|
+ //标记当配送方式已收一次包装费/运费,岭南批发市场用的功能,关键词 sh_method_area,只要有成功单就标记,不再要求金额必须>0
|
|
|
+ $current = date("Y_m_d");
|
|
|
+ if (isset($info->sendType) && in_array($info->sendType, [0, 4])) {
|
|
|
+ $key = 'ghs_custom_today_has_get_pack_cost_' . $info->sendType . '_' . $current . '_' . $customId;
|
|
|
Yii::$app->redis->executeCommand('SETEX', [$key, 86400, '1']);
|
|
|
+
|
|
|
+ // 兼容快递收运费的情况
|
|
|
+ $sendKey = 'ghs_custom_today_has_get_send_cost_' . $info->sendType . '_' . $current . '_' . $customId;
|
|
|
+ Yii::$app->redis->executeCommand('SETEX', [$sendKey, 86400, '1']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1172,7 +1210,7 @@ class PurchaseController extends BaseController
|
|
|
$startTime = $get['startTime'] ?? '';
|
|
|
$endTime = $get['endTime'] ?? '';
|
|
|
$period = dateUtil::formatTime($searchTime, $startTime, $endTime);
|
|
|
- $where['payTime'] = ['between', [$period['startTime'], $period['endTime']]];
|
|
|
+ $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
|
|
|
}
|
|
|
$ghsId = $get['ghsId'] ?? 0;
|
|
|
if (!empty($ghsId)) {
|