gorden před 6 měsíci
rodič
revize
3fb9d787ce

+ 103 - 106
app/admin/controller/order/WholeController.php

@@ -2082,58 +2082,58 @@ class WholeController extends Curd
             Db::commit();
 
             // 打小票
-//            if (!empty($premises) && isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') {
-//                dump("insert 打小票");
-//                if ($premises->dept_category != '餐厅') {
-//                    $restaurant = SysDept::where('dept_super_id', $premises->dept_id)->where('dept_category', '餐厅')->first();
-//                } else {
-//                    $restaurant = $premises;
-//                }
-//
-//                if (!empty($restaurant->dept_extend_json)) {
-//                    $deptExtendJson = json_decode($restaurant->dept_extend_json, true);
-//                    if (isset($deptExtendJson['printer'])) {
-//                        foreach ($deptExtendJson['printer'] as $key => $item) {
-//                            if (strpos($key, '结算') !== false && $params['order_status_payment'] == 'SUCCESS') {
-//                                $voteData = [
-//                                    'func' => 'procActionToPrinter',
-//                                    'sign' => '',
-//                                    'data' => [
-//                                        'printer_premises' => $restaurant->dept_id,
-//                                        'printer_device' => [
-//                                            $key
-//                                        ],
-//                                        'printer_action' => 'ExecPrintOrder',
-//                                        'printer_data' => [
-//                                            'order_id' => $params['orderId'],
-//                                            'order_batch' => ''
-//                                        ]
-//                                    ]
-//                                ];
-//                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
-//                            }
-//                            if ((strpos($key, '前台') !== false || strpos($key, '后厨') !== false)) {
-//                                $voteData = [
-//                                    'func' => 'procActionToPrinter',
-//                                    'sign' => '',
-//                                    'data' => [
-//                                        'printer_premises' => $restaurant->dept_id,
-//                                        'printer_device' => [
-//                                            $key
-//                                        ],
-//                                        'printer_action' => 'ExecPrintOrder',
-//                                        'printer_data' => [
-//                                            'order_id' => $params['orderId'],
-//                                            'order_batch' => ''
-//                                        ]
-//                                    ]
-//                                ];
-//                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
-//                            }
-//                        }
-//                    }
-//                }
-//            }
+            if (!empty($premises) && isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') {
+                dump("insert 打小票");
+                if ($premises->dept_category != '餐厅') {
+                    $restaurant = SysDept::where('dept_super_id', $premises->dept_id)->where('dept_category', '餐厅')->first();
+                } else {
+                    $restaurant = $premises;
+                }
+
+                if (!empty($restaurant->dept_extend_json)) {
+                    $deptExtendJson = json_decode($restaurant->dept_extend_json, true);
+                    if (isset($deptExtendJson['printer'])) {
+                        foreach ($deptExtendJson['printer'] as $key => $item) {
+                            if (strpos($key, '结算') !== false && $params['order_status_payment'] == 'SUCCESS') {
+                                $voteData = [
+                                    'func' => 'procActionToPrinter',
+                                    'sign' => '',
+                                    'data' => [
+                                        'printer_premises' => $restaurant->dept_id,
+                                        'printer_device' => [
+                                            $key
+                                        ],
+                                        'printer_action' => 'ExecPrintOrder',
+                                        'printer_data' => [
+                                            'order_id' => $params['orderId'],
+                                            'order_batch' => ''
+                                        ]
+                                    ]
+                                ];
+                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
+                            }
+                            if ((strpos($key, '前台') !== false || strpos($key, '后厨') !== false)) {
+                                $voteData = [
+                                    'func' => 'procActionToPrinter',
+                                    'sign' => '',
+                                    'data' => [
+                                        'printer_premises' => $restaurant->dept_id,
+                                        'printer_device' => [
+                                            $key
+                                        ],
+                                        'printer_action' => 'ExecPrintOrder',
+                                        'printer_data' => [
+                                            'order_id' => $params['orderId'],
+                                            'order_batch' => ''
+                                        ]
+                                    ]
+                                ];
+                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
+                            }
+                        }
+                    }
+                }
+            }
 
             if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
                 _syslog("订单", "支付异常,检查是否有轮询");
@@ -2418,8 +2418,6 @@ class WholeController extends Curd
                     // 账户支付的金额
                     $params['order_amount_pay'] = $orderAmountPay;
                 }
-//                $params['order_status_system'] = $systemStatus;
-//                $params['order_status_payment'] = 'SUCCESS';
             }
 
             $orderConfigJson = [];
@@ -2560,58 +2558,57 @@ class WholeController extends Curd
             Db::commit();
 
             // 打小票
-//            if (!empty($premises) && isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') {
-//                dump("insertCons 打小票");
-////            if (!empty($premises)){
-//                if ($premises->dept_category != '餐厅') {
-//                    $restaurant = SysDept::where('dept_super_id', $premises->dept_id)->where('dept_category', '餐厅')->first();
-//                } else {
-//                    $restaurant = $premises;
-//                }
-//                if (!empty($restaurant->dept_extend_json)) {
-//                    $deptExtendJson = json_decode($restaurant->dept_extend_json, true);
-//                    if (isset($deptExtendJson['printer'])) {
-//                        foreach ($deptExtendJson['printer'] as $key => $item) {
-//                            if (strpos($key, '结算') !== false && $params['order_status_payment'] == 'SUCCESS') {
-//                                $voteData = [
-//                                    'func' => 'procActionToPrinter',
-//                                    'sign' => '',
-//                                    'data' => [
-//                                        'printer_premises' => $restaurant->dept_id,
-//                                        'printer_device' => [
-//                                            $key
-//                                        ],
-//                                        'printer_action' => 'ExecPrintOrder',
-//                                        'printer_data' => [
-//                                            'order_id' => $params['orderId'],
-//                                            'order_batch' => ''
-//                                        ]
-//                                    ]
-//                                ];
-//                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
-//                            }
-//                            if ((strpos($key, '前台') !== false || strpos($key, '后厨') !== false)) {
-//                                $voteData = [
-//                                    'func' => 'procActionToPrinter',
-//                                    'sign' => '',
-//                                    'data' => [
-//                                        'printer_premises' => $restaurant->dept_id,
-//                                        'printer_device' => [
-//                                            $key
-//                                        ],
-//                                        'printer_action' => 'ExecPrintOrder',
-//                                        'printer_data' => [
-//                                            'order_id' => $params['orderId'],
-//                                            'order_batch' => ''
-//                                        ]
-//                                    ]
-//                                ];
-//                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
-//                            }
-//                        }
-//                    }
-//                }
-//            }
+            if (!empty($premises) && isset($params['submit_goods_classify']) && $params['submit_goods_classify'] == 'MEALS') {
+//            if (!empty($premises)){
+                if ($premises->dept_category != '餐厅') {
+                    $restaurant = SysDept::where('dept_super_id', $premises->dept_id)->where('dept_category', '餐厅')->first();
+                } else {
+                    $restaurant = $premises;
+                }
+                if (!empty($restaurant->dept_extend_json)) {
+                    $deptExtendJson = json_decode($restaurant->dept_extend_json, true);
+                    if (isset($deptExtendJson['printer'])) {
+                        foreach ($deptExtendJson['printer'] as $key => $item) {
+                            if (strpos($key, '结算') !== false && $params['order_status_payment'] == 'SUCCESS') {
+                                $voteData = [
+                                    'func' => 'procActionToPrinter',
+                                    'sign' => '',
+                                    'data' => [
+                                        'printer_premises' => $restaurant->dept_id,
+                                        'printer_device' => [
+                                            $key
+                                        ],
+                                        'printer_action' => 'ExecPrintOrder',
+                                        'printer_data' => [
+                                            'order_id' => $params['orderId'],
+                                            'order_batch' => ''
+                                        ]
+                                    ]
+                                ];
+                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
+                            }
+                            if ((strpos($key, '前台') !== false || strpos($key, '后厨') !== false)) {
+                                $voteData = [
+                                    'func' => 'procActionToPrinter',
+                                    'sign' => '',
+                                    'data' => [
+                                        'printer_premises' => $restaurant->dept_id,
+                                        'printer_device' => [
+                                            $key
+                                        ],
+                                        'printer_action' => 'ExecPrintOrder',
+                                        'printer_data' => [
+                                            'order_id' => $params['orderId'],
+                                            'order_batch' => ''
+                                        ]
+                                    ]
+                                ];
+                                http_post_json(getenv('VOTE_MENU_URL'), $voteData);
+                            }
+                        }
+                    }
+                }
+            }
 
             if ($params['settlement_now'] == 'Y' && $params['order_status_payment'] != 'SUCCESS') {
                 _syslog("订单", "支付异常,检查是否有轮询");

+ 4 - 4
app/admin/service/order/OrderService.php

@@ -279,8 +279,8 @@ class OrderService
     public static function findWxpay($orderId, $nbr = 0)
     {
         try {
-//            $result = Pay::wechat(config('payment.wxpay'))->find($orderId, 'pos');
-//            $result = json_decode(json_encode($result), true);
+            $result = Pay::wechat(config('payment.wxpay'))->find($orderId, 'pos');
+            $result = json_decode(json_encode($result), true);
         } catch (\Exception $e) {
             SupportLog::channel('pay')->error("FIND_WXPAY", ['msg' => $e->getMessage()]);
         }
@@ -312,8 +312,8 @@ class OrderService
     public static function findAlipay($orderId, $nbr = 0)
     {
         try {
-//            $result = Pay::alipay(config('payment.alipay'))->find($orderId);
-//            $result = json_decode(json_encode($result), true);
+            $result = Pay::alipay(config('payment.alipay'))->find($orderId);
+            $result = json_decode(json_encode($result), true);
         } catch (\Exception $e) {
             SupportLog::channel('pay')->error("FIND_ALIPAY", ['msg' => $e->getMessage()]);
         }