WechatNotifyController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * 重庆赤晓店信息科技有限公司
  4. * https://www.chixiaodian.com
  5. * Copyright (c) 2023 赤店商城 All rights reserved.
  6. */
  7. namespace app\modules\common\controllers;
  8. use app\models\ReOrder;
  9. use app\modules\common\models\NotifyForm;
  10. use app\utils\OrderNo;
  11. use app\utils\Wechat\Wechat;
  12. use app\utils\Wechat\WechatProfit;
  13. use app\utils\Wechat\WechatShare;
  14. use EasyWeChat\Kernel\Exceptions\Exception;
  15. use EasyWeChat\Kernel\BaseClient;
  16. use yii\web\Controller;
  17. use app\utils\IotCloudHelper;
  18. use app\models\Store;
  19. use app\models\OrderUnion;
  20. use app\models\Order;
  21. use app\models\WechatConfig;
  22. use app\modules\common\models\WechatNotifyForm;
  23. /**
  24. * 微信回调类
  25. * Class WechatNotifyController
  26. * @package app\modules\common\controllers
  27. */
  28. class WechatNotifyController extends Controller
  29. {
  30. public static $plugins = [
  31. 'SC' => '\app\plugins\scanCodePay\controllers\CallbackController::execute'
  32. ];
  33. public function actionTest() {
  34. $a = \app\utils\Wechat\B2b\B2bPay::find(297, 'ML20250318094814299906');
  35. // $b = \app\utils\Wechat\B2b\B2bPay::notify($msg);
  36. // $c = \app\utils\Wechat\B2b\B2bPay::getretailopenidlist(297);
  37. $c = \app\utils\Wechat\B2b\B2bPay::setmchprofitrate(297, 20);
  38. var_dump($a, $b, $c);die;
  39. }
  40. /**
  41. * 入口文件
  42. * @throws \Exception
  43. */
  44. public function actionIndex() {
  45. $store_id = get_params('store_id');
  46. $xml = simplexml_load_string(\Yii::$app->request->getRawBody());
  47. \Yii::error(['WECHAT NOTIFY INDEX <==========> ', \Yii::$app->request->getRawBody()]);
  48. return (new WechatNotifyForm())->notifyIndex($store_id, $xml);
  49. }
  50. private function pluginCallback($message, $orderNoHead) {
  51. call_user_func(self::$plugins[$orderNoHead], $message);
  52. }
  53. }