diff --git a/app/Controller/v3/NotifyController.php b/app/Controller/v3/NotifyController.php index bf8e57e..6754641 100644 --- a/app/Controller/v3/NotifyController.php +++ b/app/Controller/v3/NotifyController.php @@ -12,6 +12,7 @@ use App\Model\v3\GoodsActivity; use App\Model\v3\Order; use App\Model\v3\OrderGoods; use App\Model\v3\OrderMain; +use App\Model\v3\User; use App\Service\v3\Interfaces\BadgeServiceInterface; use App\Service\v3\Interfaces\CouponRebateServiceInterface; use App\Service\v3\Interfaces\CouponServiceInterface; @@ -25,6 +26,7 @@ use App\Service\v3\Interfaces\OrderOfflineServiceInterface; use App\Service\v3\Interfaces\OrderOnlineServiceInterface; use App\Service\v3\Interfaces\OrderStatisticsServiceInterface; use App\Service\v3\Interfaces\SeparateAccountsServiceInterface; +use App\Service\v3\Interfaces\UserInfoServiceInterface; use EasyWeChat\Factory; use Hyperf\DbConnection\Db; use Hyperf\Guzzle\CoroutineHandler; @@ -114,6 +116,12 @@ class NotifyController extends BaseController */ protected $orderStatisticsService; + /** + * @Inject + * @var UserInfoServiceInterface + */ + protected $userInfoService; + public function wxminiOnline() { @@ -276,6 +284,11 @@ class NotifyController extends BaseController // 公众号模板消息 $res = $this->miniprogramService->sendTemMsgForOfflineOrder($orderMain->global_order_id); + + $openid = User::query()->where(['id' => $orderMain->user_id])->value('openid'); + $res = $this->userInfoService->getPaidUnionId($openid); + $this->log->event('test_get_paid_unionid', ['res' => $res]); + return true; } catch (Exception $e) { diff --git a/app/Service/v3/Implementations/UserInfoService.php b/app/Service/v3/Implementations/UserInfoService.php index 8e2e401..9232aa5 100644 --- a/app/Service/v3/Implementations/UserInfoService.php +++ b/app/Service/v3/Implementations/UserInfoService.php @@ -102,5 +102,12 @@ class UserInfoService implements UserInfoServiceInterface })->first(); return $employees; } - + + public function getPaidUnionId($openid) + { + $config = config('applet'); + $app = Factory::miniProgram($config); + $app['guzzle_handler'] = CoroutineHandler::class; + return $app->base->getPaidUnionid($openid); + } } \ No newline at end of file diff --git a/app/Service/v3/Interfaces/UserInfoServiceInterface.php b/app/Service/v3/Interfaces/UserInfoServiceInterface.php index e10f7c5..f3378ee 100644 --- a/app/Service/v3/Interfaces/UserInfoServiceInterface.php +++ b/app/Service/v3/Interfaces/UserInfoServiceInterface.php @@ -10,5 +10,5 @@ interface UserInfoServiceInterface public function detail($userId); public function getStoreByUID($userId); public function getEmployeesByUID($userId); - + public function getPaidUnionId($openid); } \ No newline at end of file