Просмотр исходного кода

Merge branch 'master' of http://git.huaml.com/zhh/huahuibao

shish 5 лет назад
Родитель
Сommit
584b1a2d29

+ 4 - 2
app-hd/controllers/OrderController.php

@@ -159,13 +159,15 @@ class OrderController extends BaseController
             if (empty($product)) {
                 util::fail('请选择花材');
             }
-            $actPrice = 0;
+            $actPrice = $post['packingFee']??0; //包装费
             $orderProduct = [];
+            $productInfo = ProductClass::formatProductInfo($product);
+            $actPrice = bcadd($actPrice,$productInfo['price'],2);
             foreach ($product as $key => $val) {
                 $productId = $val['productId'];
                 $bigNum = $val['bigNum'];
                 $smallNum = $val['smallNum'];
-                $actPrice += 2;
+
                 $orderProduct[] = [
                     'productId' => $productId,
                     'bigNum' => $bigNum,

+ 33 - 0
app-hd/controllers/StockController.php

@@ -0,0 +1,33 @@
+<?php
+/**
+ * User: admin
+ * Date Time: 2021/5/19 19:31
+ */
+
+namespace hd\controllers;
+
+use bizGhs\stock\classes\StockRecordClass;
+use common\components\dateUtil;
+use common\components\util;
+use Yii;
+class StockController extends BaseController
+{
+    //库存明细 linqh 2021.1.26
+    public function actionDetail()
+    {
+        $get = Yii::$app->request->get();
+        $itemId = $get['itemId']??0;
+        $where = ['itemId'=>$itemId,'shopId'=>$this->shopId];
+
+        $searchTime = $get['searchTime'] ?? '';
+        if (!empty($searchTime)) {
+            $startTime = $get['startTime'] ?? '';
+            $endTime = $get['endTime'] ?? '';
+            $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
+            $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
+        }
+
+        $list = StockRecordClass::getRecordList($where);
+        util::success($list);
+    }
+}

+ 14 - 1
biz-ghs/ws/services/WsService.php

@@ -22,5 +22,18 @@ class WsService
 
     //零售端采购时,提示供货商(下所有有开启通知的员工),你有新订单
     //商城客户下单时,提示零售花店(下所有有开启通知的员工) 你有新的订单
-    //todo
+    public static function newOrderNotice($shopAdminId)
+    {
+        $url = 'https://img.theflorist.cn/audio/new_order0.mp3';
+        $data = [
+            'type'=>'new_order',
+            'url'=>$url,
+        ];
+        try{
+            Gateway::sendToUid($shopAdminId, json_encode($data));
+        }catch (\Exception $exception){
+            Yii::warning("ws arrivalNotice error ". $exception->getMessage());
+        }
+        return true;
+    }
 }

+ 17 - 0
biz-hd/purchase/services/PurchaseService.php

@@ -10,6 +10,8 @@ use biz\shop\models\Shop;
 use bizGhs\custom\classes\CustomClass;
 use bizGhs\order\classes\OrderClass;
 use bizGhs\order\services\OrderService;
+use bizGhs\ws\services\WsService;
+use bizHd\admin\classes\ShopAdminClass;
 use bizHd\base\services\BaseService;
 use bizHd\purchase\classes\PurchaseClass;
 use common\components\dict;
@@ -266,6 +268,21 @@ class PurchaseService extends BaseService
         $ghs->expendAmount = bcadd($ghs->expendAmount, $actPrice, 2);
         $ghs->expendNum += 1;
         $ghs->save();
+
+        //通知供货商语音播放  ghsId =>shopId =>shopAdminIds
+        $ghsInfo = GhsClass::getById($ghsId);
+        if($ghsInfo){
+            $ghsShopId = $ghsInfo['shopId'];
+            if($ghsShopId){
+                $ghsShopAdminIds = \bizGhs\shop\classes\ShopAdminClass::getRemindAdminIdsByShopId($ghsShopId);
+                if($ghsShopAdminIds){
+                    foreach ($ghsShopAdminIds as $v){
+                        WsService::newOrderNotice($v);
+                    }
+                }
+            }
+        }
+
     }
 
 }

+ 3 - 1
biz/ghs/classes/GhsClass.php

@@ -172,8 +172,10 @@ class GhsClass extends BaseClass
     public static function formatGhsInfo($ghs)
     {
         return [
-            'id' => $id,
+
         ];
     }
 
+    
+
 }