get(TaskExecutor::class); // $result = $exec->execute(new Task([MethodTask::class, 'handle'], [Coroutine::id()])); // $client = ApplicationContext::getContainer()->get(SSDBTask::class); // $result = $client->exec("set","bar","1234"); // $result = $client->exec("get","bar"); // $client = ApplicationContext::getContainer()->get(MethodTask::class); // $result = $client->handle("set"); // //$log = ApplicationContext::getContainer()->get(Log::class); // $log = $this->log; // // $log->push(['test'=>1,'user_id'=>290,'msg'=>'order']); // $log->event('t1',['test'=>1,'user_id'=>290,'msg'=>'order']); // // //$this->name = 'index1 action '. $result; // return $this->name; // $time = time(); // $msgInfo = array( // 'user' => '13161443713@163.com', // 'stime' => $time, // 'sig' => sha1('13161443713@163.com' . 'XsaHzgePdyWTfcMX' . $time), // 'apiname' => 'Open_printMsg', // 'sn' => '920527381', // 'content' => '1111', // 'times' => 1//打印次数 // ); // $this->client = new FeiePrintClient('api.feieyun.cn', 80); // if (!$this->client->post('/Api/Open/', $msgInfo)) { // return '12'; // } else { // //服务器返回的JSON字符串,建议要当做日志记录起来 // $result = $this->client->getContent(); // return $result; // } $globalOrderId = $this->request->input('order_main_id'); // 查询订单 $orderMain = OrderMain::query() ->where([ 'global_order_id' => $globalOrderId, 'type' => OrderType::ONLINE, 'state' => OrderState::REFUNDING ]) ->first(); // 订单不存在 if (empty($orderMain)) { $this->log->event( LogLabel::ORDER_OFFLINE_PAY_NOTIFY_LOG, ['global_order_id_fail' => $globalOrderId] ); return true; } // 线下回调 // $orderPaid = $this->orderOfflineService->doPaid($globalOrderId); // var_dump('orderOfflineService', $orderPaid); // $separate = $this->separateAccountsService->orderOfflinePaid($globalOrderId); // var_dump('separateAccountsService', $separate); // // // 喇叭通知,兼容旧音响,MQTT+IOT // $res = $this->mqttService->speakToStore($globalOrderId); // var_dump('mqttService', $res); // $res = $this->deviceService->pubMsgToStoreByOrderMainId($globalOrderId); // var_dump('deviceService', $res); // // // 公众号模板消息 // $res = $this->miniprogramService->sendTemMsgForOfflineOrder($globalOrderId); // var_dump('miniprogramService', $res); // 线上回调 // $res = $this->orderOnlineService->doByPaid($globalOrderId); // var_dump('orderOnlineService', $res); // $res = $this->separateAccountsService->orderOnlinePaid($globalOrderId); // var_dump('separateAccountsService', $res); // // // 优惠券返券 // $res = $this->couponRebateService->couponRebateInTask($globalOrderId); // var_dump('couponRebateService', $res); // // // 喇叭通知,兼容旧音响,MQTT+IOT // $res = $this->mqttService->speakToStore($globalOrderId); // var_dump('mqttService', $res); // $res = $this->deviceService->pubMsgToStoreByOrderMainId($globalOrderId); // var_dump('deviceService', $res); // // // 公众号模板消息 // $res = $this->miniprogramService->sendTemMsgForOnlineOrder($globalOrderId); // var_dump('miniprogramService', $res); // // // 打印订单,自动打印 // $res = $this->feiePrintService->feiePrint($globalOrderId); // var_dump('feiePrintService', $res); // 退款回调 // 添加退款时间 $orderMain->refund_time = time(); $orderMain->state = OrderState::REFUNDED; $res = $orderMain->save(); var_dump('$orderMain', $res); // 退款返还优惠券 $res = $this->couponService->orderRefundCoupons($orderMain->global_order_id); var_dump('couponService', $res); // 处理特价商品缓存 $orderChildren = Order::query()->where(['order_main_id' => $orderMain->global_order_id])->get()->toArray(); $orderGoods = OrderGoods::query() ->where(['activity_type' => 2]) ->whereIn('order_id', array_values(array_column($orderChildren, 'id')))->get(); foreach ($orderGoods as $key => &$item) { $this->goodsActivityService->clearCacheRecord($item['goods_id'], $item['number'], $orderMain->userId); } var_dump('$orderChildren', $orderChildren); // 添加用户的流水 $res = $this->financialService->userByOLOrderRefund($orderMain->user_id, $orderMain->global_order_id, $orderMain->money); var_dump('financialService', $res); } public function index2(RequestInterface $request) { $this->name = 'index2 action'; return $this->name; } public function index3(RequestInterface $request) { return $this->name; } }