更新短信取货
This commit is contained in:
parent
5c42122443
commit
5493e16daf
@ -26,12 +26,42 @@ class DeliveryGoods
|
|||||||
public function sendLogisticsCode($uid, $orderId, $orderSn) {
|
public function sendLogisticsCode($uid, $orderId, $orderSn) {
|
||||||
//收货人短信
|
//收货人短信
|
||||||
$phone = StoreOrder::where('order_id', $orderId)->value('user_phone');
|
$phone = StoreOrder::where('order_id', $orderId)->value('user_phone');
|
||||||
|
$realName = StoreOrder::where('order_id', $orderId)->value('real_name');
|
||||||
|
if ($realName) {
|
||||||
|
$realName = $this->hidestr($realName, 1, 0);
|
||||||
|
} else {
|
||||||
|
$realName = '**';
|
||||||
|
}
|
||||||
$logisticsCode = StoreOrder::where('order_id', $orderId)->value('logistics_code');
|
$logisticsCode = StoreOrder::where('order_id', $orderId)->value('logistics_code');
|
||||||
$logisticsPhone = StoreOrder::where('order_id', $orderId)->value('logistics_phone');
|
$logisticsPhone = StoreOrder::where('order_id', $orderId)->value('logistics_phone');
|
||||||
if ($phone) {
|
if ($phone) {
|
||||||
Log::info("发送短信 {$phone}, orderId: {$orderId}");
|
Log::info("发送短信 {$phone}, orderId: {$orderId}");
|
||||||
SmsService::create()->send($phone, 'TAKEGOOD_CODE', ['number' => substr($orderSn, -6), 'number2' => $logisticsCode, 'phone' => $logisticsPhone ?? '']);
|
SmsService::create()->send($phone, 'PICKUP_CODE', ['name' => $realName, 'number' => substr($orderSn, -6), 'number2' => $logisticsCode, 'phone' => $logisticsPhone ?? '']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hidestr($string, $start = 0, $length = 0, $re = '*') {
|
||||||
|
if (empty($string)) return false;
|
||||||
|
$strarr = array();
|
||||||
|
$mb_strlen = mb_strlen($string);
|
||||||
|
while ($mb_strlen) {
|
||||||
|
$strarr[] = mb_substr($string, 0, 1, 'utf8');
|
||||||
|
$string = mb_substr($string, 1, $mb_strlen, 'utf8');
|
||||||
|
$mb_strlen = mb_strlen($string);
|
||||||
|
}
|
||||||
|
$strlen = count($strarr);
|
||||||
|
$begin = $start >= 0 ? $start : ($strlen - abs($start));
|
||||||
|
$end = $last = $strlen - 1;
|
||||||
|
if ($length > 0) {
|
||||||
|
$end = $begin + $length - 1;
|
||||||
|
} elseif ($length < 0) {
|
||||||
|
$end -= abs($length);
|
||||||
|
}
|
||||||
|
for ($i=$begin; $i<=$end; $i++) {
|
||||||
|
$strarr[$i] = $re;
|
||||||
|
}
|
||||||
|
if ($begin >= $end || $begin >= $last || $end > $last) return false;
|
||||||
|
return implode('', $strarr);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user