feat: 集成隐私小号功能保护用户手机号
新增隐私小号服务类,在订单创建时自动绑定隐私手机号,收货时自动解绑 在快递发货和收货流程中使用隐私小号替代真实手机号,保护用户隐私 添加数据库字段存储绑定关系,提供系统配置开关和测试脚本
This commit is contained in:
@@ -21,6 +21,7 @@ use app\services\agent\AgentLevelServices;
|
||||
use app\services\activity\coupon\StoreCouponUserServices;
|
||||
use app\services\agent\DivisionServices;
|
||||
use app\services\other\CityAreaServices;
|
||||
use app\services\other\PrivacyPhoneServices;
|
||||
use app\services\pay\PayServices;
|
||||
use app\services\product\brand\StoreBrandServices;
|
||||
use app\services\product\category\StoreProductCategoryServices;
|
||||
@@ -196,12 +197,33 @@ class StoreOrderCreateServices extends BaseServices
|
||||
$userAddress = $addressInfo['province'] . ' ' . $addressInfo['city'] . ' ' . $addressInfo['district'] . ' ' . $addressInfo['street'] . ' ' . $addressInfo['detail'];
|
||||
$userLocation = $addressInfo['longitude'] . ' ' . $addressInfo['latitude'];
|
||||
$type = $is_channel == 1 ? 20 : $type;
|
||||
|
||||
$realPhone = $addressInfo['phone'];
|
||||
$orderUserPhone = $realPhone;
|
||||
$bindId = '';
|
||||
$privatePhoneStatus = 0;
|
||||
|
||||
/** @var PrivacyPhoneServices $privacyPhoneServices */
|
||||
$privacyPhoneServices = app()->make(PrivacyPhoneServices::class);
|
||||
if ($privacyPhoneServices->isEnabled() && $realPhone) {
|
||||
try {
|
||||
$privateData = $privacyPhoneServices->bindForOrder($realPhone);
|
||||
if ($privateData['user_phone']) {
|
||||
$orderUserPhone = $privateData['user_phone'];
|
||||
$bindId = $privateData['bind_id'];
|
||||
$privatePhoneStatus = $privateData['status'];
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('隐私小号绑定失败', ['error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
$orderInfo = [
|
||||
'uid' => $uid,
|
||||
'type' => $type,
|
||||
'order_id' => $this->getNewOrderId(),
|
||||
'real_name' => $addressInfo['real_name'],
|
||||
'user_phone' => $addressInfo['phone'],
|
||||
'user_phone' => $orderUserPhone,
|
||||
'user_address' => $userAddress,
|
||||
'user_location' => $userLocation,
|
||||
'cart_id' => $cartIds,
|
||||
@@ -247,6 +269,8 @@ class StoreOrderCreateServices extends BaseServices
|
||||
'send_gift_price' => $priceData['sendGiftPrice'],
|
||||
'send_gift_mark' => $sendGiftMark,
|
||||
'channel' => $is_channel,
|
||||
'private_bind_id' => $bindId,
|
||||
'private_phone_status' => $privatePhoneStatus,
|
||||
];
|
||||
if ($userInfo['user_type'] == 'wechat' || $userInfo['user_type'] == 'routine') {
|
||||
/** @var WechatUserServices $wechatServices */
|
||||
@@ -264,7 +288,7 @@ class StoreOrderCreateServices extends BaseServices
|
||||
}
|
||||
|
||||
$priceData['coupon_id'] = $couponId;
|
||||
$order = $this->transaction(function () use ($cartIds, $couponId, $orderInfo, $cartInfo, $key, $userInfo, $useIntegral, $priceData, $type, $activity_id, $uid, $addressId, $promotions_give) {
|
||||
$order = $this->transaction(function () use ($cartIds, $couponId, $orderInfo, $cartInfo, $key, $userInfo, $useIntegral, $priceData, $type, $activity_id, $uid, $addressId, $promotions_give, $realPhone) {
|
||||
//创建订单
|
||||
$order = $this->dao->save($orderInfo);
|
||||
if ($couponId) {
|
||||
|
||||
Reference in New Issue
Block a user