|
|
|
@ -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() |
|
|
|
{ |
|
|
|
|
|
|
|
@ -189,6 +197,15 @@ class NotifyController extends BaseController |
|
|
|
|
|
|
|
// 公众号模板消息
|
|
|
|
$res = $this->miniprogramService->sendTemMsgForOnlineOrder($orderMain->global_order_id); |
|
|
|
|
|
|
|
co(function () use ($orderMain) { |
|
|
|
$openid = User::query()->where(['id' => $orderMain->user_id])->value('openid'); |
|
|
|
$unionid = $this->userInfoService->getPaidUnionId($openid, ['mch_id' => config('wxpay.mch_id'), 'out_trade_no' => $orderMain->global_order_id]); |
|
|
|
if ($unionid) { |
|
|
|
User::query()->where(['id' => $orderMain->user_id, 'openid' => $openid])->update(['unionid' => $unionid]); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
@ -276,6 +293,15 @@ class NotifyController extends BaseController |
|
|
|
|
|
|
|
// 公众号模板消息
|
|
|
|
$res = $this->miniprogramService->sendTemMsgForOfflineOrder($orderMain->global_order_id); |
|
|
|
|
|
|
|
co(function () use ($orderMain) { |
|
|
|
$openid = User::query()->where(['id' => $orderMain->user_id])->value('openid'); |
|
|
|
$unionid = $this->userInfoService->getPaidUnionId($openid, ['mch_id' => config('wxpay.mch_id'), 'out_trade_no' => $orderMain->global_order_id]); |
|
|
|
if ($unionid) { |
|
|
|
User::query()->where(['id' => $orderMain->user_id, 'openid' => $openid])->update(['unionid' => $unionid]); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
|