diff --git a/.gitignore b/.gitignore index 575640412..ee1734d91 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .env /tests/tmp /tests/.phpunit.result.cache -public/uploads \ No newline at end of file +public/uploads +public/image \ No newline at end of file diff --git a/app/common/logic/PayNotifyLogic.php b/app/common/logic/PayNotifyLogic.php index 98556c7c2..49e30112e 100644 --- a/app/common/logic/PayNotifyLogic.php +++ b/app/common/logic/PayNotifyLogic.php @@ -80,7 +80,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); - Redis::send('push-platform-print', ['id' => $order['id']], 60); + // Redis::send('push-platform-print', ['id' => $order['id']], 60); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } @@ -114,7 +114,7 @@ class PayNotifyLogic extends BaseLogic $capitalFlowDao = new CapitalFlowLogic($user); $capitalFlowDao->userExpense('user_order_purchase_pay', 'order', $order['id'], $order['pay_price']); // self::afterPay($order); - Redis::send('push-platform-print', ['id' => $order['id']], 60); + // Redis::send('push-platform-print', ['id' => $order['id']], 60); PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } @@ -154,11 +154,11 @@ class PayNotifyLogic extends BaseLogic if ($order->pay_type == 9) { $extra['create_time'] = $order['create_time']; PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]); + Redis::send('push-platform-print', ['id' => $order['id']]); } else { PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); // Db::name('order_middle')->insert(['c_order_id' => $order['id']]); } - Redis::send('push-platform-print', ['id' => $order['id']]); if (!empty($extra['payer']['openid']) && $order->pay_type == 7) { Redis::send('push-delivery', ['order_id' => $order['order_id'], 'openid' => $extra['payer']['openid']], 5); } @@ -281,10 +281,11 @@ class PayNotifyLogic extends BaseLogic if ($order->pay_type == 9) { $extra['create_time'] = $order['create_time']; PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'cash_register', 'msg' => '您有一笔订单已支付', 'data' => $extra]); + Redis::send('push-platform-print', ['id' => $order['id']]); + } else { PushService::push('store_merchant_' . $order['store_id'], $order['store_id'], ['type' => 'store_merchant', 'msg' => '您有一笔新的订单']); } - Redis::send('push-platform-print', ['id' => $order['id']]); return true; } diff --git a/app/store/controller/store_order/StoreOrderController.php b/app/store/controller/store_order/StoreOrderController.php index de727787f..206e34efc 100644 --- a/app/store/controller/store_order/StoreOrderController.php +++ b/app/store/controller/store_order/StoreOrderController.php @@ -15,7 +15,12 @@ use app\common\logic\PayNotifyLogic; use app\common\logic\SystemStoreStaffLogic; use app\store\controller\BaseAdminController; use app\common\logic\store_order\StoreOrderLogic; +use app\common\model\store_branch_product\StoreBranchProduct; use app\common\model\store_order\StoreOrder; +use app\common\model\store_order_cart_info\StoreOrderCartInfo; +use app\common\model\store_product_unit\StoreProductUnit; +use app\common\model\system_store\SystemStore; +use app\common\model\system_store\SystemStoreStaff; use app\common\model\user_recharge\UserRecharge; use app\store\validate\store_order\StoreOrderValidate; use support\Log; @@ -396,8 +401,35 @@ class StoreOrderController extends BaseAdminController }else{ return $this->fail('发送失败'); } + } - + /** + * 订单打印 + */ + public function print(){ + $id=$this->request->get('id'); + $find = StoreOrder::where('id', $id)->find(); + if ($find) { + $merchant = SystemStore::where('id', $find['store_id'])->field('name,phone')->find(); + $mer_user_info = SystemStoreStaff::where('store_id', $find['store_id'])->where('is_admin',1)->field('staff_name,phone')->find(); + $user = User::where('id', $find['uid'])->field('nickname,mobile')->find(); + $find['system_store_name'] = $merchant['name']; + $find['pay_type_name'] = PayEnum::getPaySceneDesc($find['pay_type']); + $find['system_store_phone'] = $merchant['phone']; + $find['staff_name'] = $mer_user_info['staff_name']; + $find['staff_phone'] = $mer_user_info['phone']; + $find['nickname'] = $user['nickname']??''; + $find['user_mobile'] = $user['mobile']??''; + $find['info'] = StoreOrderCartInfo::where('oid', $find['id'])->field('store_id,product_id,cart_num,cart_info')->select()->each(function ($item) { + $goods = StoreBranchProduct::where(['store_id'=>$item['store_id'],'product_id'=>$item['product_id']])->field('store_name,unit')->find(); + $item['unit_name'] = StoreProductUnit::where('id', $goods['unit'])->value('name'); + $item['store_name'] = $goods['store_name']; + $item['total_price'] = $item['cart_info']['total_price']; + $item['price'] = $item['cart_info']['price']; + return $item; + }); + } + return $this->success('获取成功', $find); } }