From 4cf5366fdcb6cdaf8dc241c17caf95b34c09a5b0 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 3 Jan 2024 14:36:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 26 ++++++++++++++ .../order/StoreOtherOrderCreateRepository.php | 3 ++ .../store/order/StoreOtherOrderRepository.php | 35 ++++++++----------- .../api/store/order/StoreOrderOther.php | 13 +++++++ crmeb/services/SmsService.php | 13 +++++++ 5 files changed, 70 insertions(+), 20 deletions(-) diff --git a/app/common.php b/app/common.php index cc258ef0..e324f660 100644 --- a/app/common.php +++ b/app/common.php @@ -13,9 +13,12 @@ use app\common\repositories\system\config\ConfigValueRepository; use app\common\repositories\system\groupData\GroupDataRepository; +use crmeb\jobs\SendSmsJob; use crmeb\services\UploadService; use Swoole\Lock; use think\db\BaseQuery; +use think\facade\Db; +use think\facade\Queue; if (!function_exists('go')) { function go(): bool @@ -1152,5 +1155,28 @@ if (!function_exists('checkSuffix')) { } } +if (!function_exists('Financial_Operations')) { + + function Financial_Operations($activity_type,$order_id,$tempId='ORDER_CREATE',$id=0){ + //发送运营财务短信 + $group_id=0; + if($activity_type==98){ + $group_id=Db::name('system_group')->where('group_key','city_operations')->value('group_id'); + }else{ + $group_id=Db::name('system_group')->where('group_key','town_operation')->value('group_id'); + } + if($group_id){ + $group_value=Db::name('system_group_data')->where('group_id',$group_id)->column('value'); + if($group_value){ + foreach($group_value as $k=>$v){ + $phone=json_decode($v,true); + Queue::push(SendSmsJob::class, ['tempId' => $tempId, 'phone' => $phone['phone'],'orderId'=>$order_id,'id'=>$id]);//短信通知 + } + } + + } + } +} + diff --git a/app/common/repositories/store/order/StoreOtherOrderCreateRepository.php b/app/common/repositories/store/order/StoreOtherOrderCreateRepository.php index ca8eda07..ee7f93d1 100644 --- a/app/common/repositories/store/order/StoreOtherOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOtherOrderCreateRepository.php @@ -722,6 +722,9 @@ class StoreOtherOrderCreateRepository extends StoreOtherOrderRepository Db::name('store_order_product_other')->insertAll($orderProduct); return $groupOrder; }); + + //下单发送运营财务短信 + Financial_Operations(98,$groupOrder['group_order_sn'],'ORDER_CREATE'); return $group; } } diff --git a/app/common/repositories/store/order/StoreOtherOrderRepository.php b/app/common/repositories/store/order/StoreOtherOrderRepository.php index a7d4ce4b..214891b5 100644 --- a/app/common/repositories/store/order/StoreOtherOrderRepository.php +++ b/app/common/repositories/store/order/StoreOtherOrderRepository.php @@ -298,6 +298,12 @@ class StoreOtherOrderRepository extends BaseRepository // if (!$is_combine) { // app()->make(MerchantRepository::class)->addLockMoney($order->mer_id, 'order', $order->order_id, $_payPrice); // } + //短信 订单通知商户 + $mer_phone=Db::name('merchant')->where('mer_id',$order->mer_id)->value('mer_phone'); + if($mer_phone){ + Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'phone' => $mer_phone,'orderId'=>$order->order_id,'id'=>0]);//短信通知 + } + } $userMerchantRepository->updatePayTime($uid, $order->mer_id, $order->pay_price); SwooleTaskService::merchant('notice', [ @@ -309,22 +315,6 @@ class StoreOtherOrderRepository extends BaseRepository ] ], $order->mer_id); - $group_id=0; - if($order->activity_type==98){ - $group_id=Db::name('system_group')->where('group_key','city_operations')->value('group_id'); - }else{ - $group_id=Db::name('system_group')->where('group_key','town_operation')->value('group_id'); - } - if($group_id){ - $group_value=Db::name('system_group_data')->where('group_id',$group_id)->column('value'); - if($group_value){ - foreach($group_value as $k=>$v){ - $phone=json_decode($v,true); - Queue::push(SendSmsJob::class, ['tempId' => 'ORDER_CREATE', 'phone' => $phone['phone'],'orderId'=>$order->order_id,'id'=>0]);//短信通知 - } - } - - } } $this->giveIntegral($groupOrder); @@ -332,6 +322,7 @@ class StoreOtherOrderRepository extends BaseRepository $storeOrderStatusRepository->batchCreateLog($orderStatus); $groupOrder->save(); Db::commit(); + return true; } catch (\Exception $e) { Log::error('财务点击支付失败'.$e->getMessage()); @@ -615,6 +606,8 @@ class StoreOtherOrderRepository extends BaseRepository $this->takeAfter($order, $user); $order->save(); $storeOrderStatusRepository->{$func}($orderStatus); + Financial_Operations(98,$order->order_id,'OTHER_ADMIN_TAKE_DELIVERY_CODE',$order->order_id); + }); // event('order.take', compact('order')); } @@ -1256,9 +1249,6 @@ class StoreOtherOrderRepository extends BaseRepository $query = $this->dao->search($where, null)->where($this->getOrderType($status)) ->with([ 'orderProduct', - 'merchant' => function ($query) { - return $query->field('mer_id,mer_name,is_trader,financial_bank,auto_margin_rate,commission_rate'); - }, 'verifyService' => function ($query) { return $query->field('service_id,nickname'); }, @@ -1278,7 +1268,7 @@ class StoreOtherOrderRepository extends BaseRepository }, ]); $count = $query->count(); - $list = $query->page($page, $limit)->select()->each(function ($item) { + $list = $query->page($page, $limit)->select()->each(function ($item) use($status){ $auto_margin= Db::name('financial_record_transfer') ->where('order_id',$item['order_id'])->where('financial_type','auto_margin')->where('financial_pm',0)->value('number'); $order_charge= Db::name('financial_record_transfer') @@ -1289,6 +1279,11 @@ class StoreOtherOrderRepository extends BaseRepository 'order_charge'=>$order_charge, 'order_charge_lv'=>$item->merchant->commission_rate?round($item->merchant->commission_rate,2):0, ]; + if(in_array($status,[4,5])){ + $item['merchant']= Db::name('merchant')->where('mer_id',$item['mer_id'])->field('mer_id,mer_name,is_trader,financial_bank,auto_margin_rate,commission_rate')->find(); + }else{ + $item['merchant']= Db::name('merchant')->where('uid',$item['uid'])->where('status',1)->field('mer_id,mer_name,is_trader,financial_bank,auto_margin_rate,commission_rate')->find(); + } }); return compact('count', 'list'); } diff --git a/app/controller/api/store/order/StoreOrderOther.php b/app/controller/api/store/order/StoreOrderOther.php index ab879fdc..d0ebd7f3 100644 --- a/app/controller/api/store/order/StoreOrderOther.php +++ b/app/controller/api/store/order/StoreOrderOther.php @@ -288,4 +288,17 @@ class StoreOrderOther extends BaseController $res = $orderRepository->show($id, $this->request->uid()); return app('json')->success($res); } + + /** + * 上传凭证 + */ + public function upload_voucher($order_id){ + $find=Db::name('store_order_other')->where('order_id',$order_id)->where('uid', $this->request->uid())->find(); + if($find){ + Financial_Operations(98,$order_id,'ADMIN_PAY_SUCCESS_CODE'); + return app('json')->success('操作成功'); + } + return app('json')->fail('操作失败'); + + } } diff --git a/crmeb/services/SmsService.php b/crmeb/services/SmsService.php index edd26381..1d47f918 100644 --- a/crmeb/services/SmsService.php +++ b/crmeb/services/SmsService.php @@ -12,8 +12,10 @@ namespace crmeb\services; use app\common\repositories\store\broadcast\BroadcastRoomRepository; +use app\common\repositories\store\order\StoreGroupOrderOtherRepository; use app\common\repositories\store\order\StoreGroupOrderRepository; use app\common\repositories\store\order\StoreOrderRepository; +use app\common\repositories\store\order\StoreOtherOrderRepository; use app\common\repositories\store\order\StoreRefundOrderRepository; use app\common\repositories\store\product\ProductRepository; use app\common\repositories\store\product\ProductTakeRepository; @@ -285,9 +287,20 @@ class SmsService case 'MERCHANT_CREDIT_BUY_NOTICE': self::sendMerMessage($id, $tempId, ['order_id' => $data['orderId']]); break; + //下单通知 case 'ORDER_CREATE': self::create()->send($data['phone'], $tempId, ['name' => $data['orderId']]); break; + //管理员确认收货提醒 + case 'OTHER_ADMIN_TAKE_DELIVERY_CODE': + $order = app()->make(StoreOtherOrderRepository::class)->get($id); + if (!$order) return; + self::sendMerMessage($order->mer_id, 'ADMIN_TAKE_DELIVERY_CODE', ['order_id' => $order->order_sn]); + break; + //管理员 支付成功提醒 + case 'OTHER_ADMIN_PAY_SUCCESS_CODE': + self::create()->send($data['phone'], 'ADMIN_PAY_SUCCESS_CODE', ['order_id' => $data['orderId']]); + break; } }