|
|
@@ -5,6 +5,7 @@ namespace bizHd\order\classes;
|
|
|
use biz\goods\classes\GoodsClass;
|
|
|
use biz\goods\models\Goods;
|
|
|
use biz\shop\classes\ShopAdminClass;
|
|
|
+use biz\shop\classes\ShopClass;
|
|
|
use biz\shop\models\Shop;
|
|
|
use biz\stat\classes\StatOrderCountClass;
|
|
|
use bizGhs\stat\classes\StatYjClass;
|
|
|
@@ -160,11 +161,11 @@ class OrderClass extends BaseClass
|
|
|
}
|
|
|
$date = date("Y-m-d H:i:s");
|
|
|
$order->payTime = $date;
|
|
|
- if($order->fromtType == dict::getDict("fromType","shop")){
|
|
|
+ if ($order->fromtType == dict::getDict("fromType", "shop")) {
|
|
|
$shopAdminIds = \bizGhs\shop\classes\ShopAdminClass::getRemindAdminIdsByShopId($order->shopId);
|
|
|
- if($shopAdminIds){
|
|
|
- foreach ($shopAdminIds as $v){
|
|
|
- WsService::arrivalNotice($v,$order->actPrice);
|
|
|
+ if ($shopAdminIds) {
|
|
|
+ foreach ($shopAdminIds as $v) {
|
|
|
+ WsService::arrivalNotice($v, $order->actPrice);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -206,7 +207,7 @@ class OrderClass extends BaseClass
|
|
|
OrderSendClass::placeOrder(['orderId' => $orderId, 'payTime' => $current, 'orderSn' => $orderSn]);
|
|
|
|
|
|
$shopId = $order->shopId;
|
|
|
- $shop = Shop::findBySql('select * from ' . Shop::tableName() . ' where id = :id for update', ['id' => $shopId])->one();
|
|
|
+ $shop = ShopClass::getLockById($shopId);
|
|
|
$shop->unSendOrder += 1;
|
|
|
$shop->unPayOrder -= 1;
|
|
|
$shop->save();
|
|
|
@@ -219,14 +220,29 @@ class OrderClass extends BaseClass
|
|
|
self::updateGoodsActualSold($orderGoods);
|
|
|
}
|
|
|
|
|
|
- if (isset($order->shopAdminId) && !empty($order->shopAdminId)) {
|
|
|
+ if (isset($order->shopAdminId) == false) {
|
|
|
+ util::fail('没有员工信息');
|
|
|
+ }
|
|
|
+ if (isset($order->fromType) == false) {
|
|
|
+ util::fail('没有来源信息');
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($order->shopAdminId)) {
|
|
|
//员工开单,自取订单,直接完成
|
|
|
if ($order->sendType == self::SEND_TYPE_NO) {
|
|
|
OrderSendClass::withoutSend($order);
|
|
|
}
|
|
|
} else {
|
|
|
+
|
|
|
+ //客户微信支付
|
|
|
+ if ($payWay == dict::getDict('payWay', 'wxPay')) {
|
|
|
+ $capitalType = dict::getDict('capitalType', 'xhOrder');
|
|
|
+ $amount = $order->actPrice;
|
|
|
+ ShopClass::customCreateOrderAddBalance($shop, $amount, $order, $capitalType);
|
|
|
+ }
|
|
|
+
|
|
|
//门店和朋友圈订单并且没有填写收花人的直接将订单置为自取并且是完成状态
|
|
|
- if (isset($order->fromType) && in_array($order->fromType, [0, 2])) {
|
|
|
+ if (in_array($order->fromType, [dict::getDict("fromType", "shop"), dict::getDict("fromType", "friend")])) {
|
|
|
if (isset($order->receiveMobile) && isset($order->address)) {
|
|
|
if (empty($order->receiveMobile) && empty($order->address)) {
|
|
|
OrderSendClass::withoutSend($order);
|
|
|
@@ -236,10 +252,10 @@ class OrderClass extends BaseClass
|
|
|
};
|
|
|
|
|
|
//下单通知,来自mall linqh 2021.5.19
|
|
|
- if($order->fromtType == dict::getDict("fromType","mall")){
|
|
|
+ if ($order->fromtType == dict::getDict("fromType", "mall")) {
|
|
|
$shopIdAdminIds = \bizGhs\shop\classes\ShopAdminClass::getRemindAdminIdsByShopId($shopId);
|
|
|
- if($shopIdAdminIds){
|
|
|
- foreach ($shopIdAdminIds as $v){
|
|
|
+ if ($shopIdAdminIds) {
|
|
|
+ foreach ($shopIdAdminIds as $v) {
|
|
|
WsService::newOrderNotice($v);
|
|
|
}
|
|
|
}
|