From 601cabb393d6e148e02152c18ef5e89665e7d787 Mon Sep 17 00:00:00 2001 From: lq Date: Thu, 3 Apr 2025 16:35:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=94=BE=E6=8E=A5=E5=8F=A3=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/controllers/OpenApiController.php | 110 ++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 admin/controllers/OpenApiController.php diff --git a/admin/controllers/OpenApiController.php b/admin/controllers/OpenApiController.php new file mode 100644 index 0000000..6af1822 --- /dev/null +++ b/admin/controllers/OpenApiController.php @@ -0,0 +1,110 @@ +request->post('prescription'); + + //处方开具待支付订阅消息通知 + \Yii::$app->queue->push(new PrescriptionCreated([ + 'orderId' => $prescription, + ])); + + + //处方生成短信通知药师审方 + \Yii::$app->queue->push(new WaitApprovalMessageJob([ + 'orderId' => $prescription, + ])); + return ['ok']; + } + + /** + * 处理处方过期 + * @return string[] + * @throws \yii\base\Exception + */ + public function prescriptionOver(): array + { + $orderId = \Yii::$app->request->post('order_id'); + $userId = \Yii::$app->request->post('user_id'); + $type = \Yii::$app->request->post('type'); + if($type === 1){ + // 自动退款 + $ProductRefundForm = new ProductRefundForm(); + $ProductRefundForm->refund([ + 'order_id' => $orderId, + 'user_id' => $userId + ]); + } else { + // 订单自动失效 + $ProductCancelForm = new ProductCancelForm(); + $ProductCancelForm->cancel([ + 'order_id' => $orderId, + 'user_id' => $userId + ], '处方失效,订单自动失效'); + } + return ['ok']; + } + + public function actionSendOrder() + { + // 订单自动同步任务 + \Yii::$app->queue->push(new ProductOrderSyncJob([ + 'orderId' => 126, + ])); + } + + public function getWeChatQrCode() + { + $id = \Yii::$app->request->post('id'); + $store = Store::find()->where(['id' => $id])->one(); + if (!$store) { + return ['error' => '店铺不存在']; + } + if (!$store->qr_code) { + + $scene = 'STORE_QR_CODE'.'_'.$this->id; + $weappService = new WeappService(); + $url= $weappService->getQrcode($scene); + $store->qr_code=$url; + $store->saveOrFail(); + + return ['ok']; + } + return ['']; + } + +} \ No newline at end of file