| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace ghs\controllers;
- use common\components\feiePrintLogUtil;
- use common\components\feieyunCallbackUtil;
- use common\components\util;
- use Yii;
- /**
- * 飞鹅云打印回调
- */
- class FeieyunController extends BaseController
- {
- /** 飞鹅回调无需登录 */
- public $guestAccess = ['call-back'];
- /**
- * 飞鹅打印状态回调
- * POST application/x-www-form-urlencoded
- */
- public function actionCallBack()
- {
- $post = Yii::$app->request->post();
- if (empty($post)) {
- $raw = file_get_contents('php://input');
- if (!empty($raw)) {
- parse_str($raw, $post);
- }
- }
- Yii::info('飞鹅打印回调: ' . json_encode($post, JSON_UNESCAPED_UNICODE), __METHOD__);
- if (!feieyunCallbackUtil::verify($post)) {
- Yii::warning('飞鹅打印回调验签失败: ' . json_encode($post, JSON_UNESCAPED_UNICODE), __METHOD__);
- util::stop('飞鹅打印回调验签失败');
- }
- $feieOrderId = trim((string)($post['orderId'] ?? ''));
- $status = intval($post['status'] ?? 0);
- $stime = intval($post['stime'] ?? 0);
- if ($feieOrderId !== '') {
- feiePrintLogUtil::updateByCallback($feieOrderId, $stime, $status, $post);
- }
- // 飞鹅要求 5 秒内返回 SUCCESS
- util::stop('SUCCESS');
- }
- }
|