feat: 细节优化
This commit is contained in:
parent
c6b986f06f
commit
f39f3a3ce6
|
|
@ -544,3 +544,20 @@ if (!function_exists('maskExceptFirstChar')) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!function_exists('maskPhone')) {
|
||||||
|
function maskPhone($phone) {
|
||||||
|
$length = strlen($phone);
|
||||||
|
|
||||||
|
if ($length === 11) {
|
||||||
|
return substr($phone, 0, 3) . '****' . substr($phone, 7);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($length >= 3) {
|
||||||
|
return substr($phone, 0, 3) . str_repeat('*', $length - 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_repeat('*', $length);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,27 @@ class Order extends Model
|
||||||
{
|
{
|
||||||
return maskExceptFirstChar($val);
|
return maskExceptFirstChar($val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getTelAttr(string $val, array $data)
|
||||||
|
{
|
||||||
|
if ($data['status'] !== \app\admin\model\Order::STATUS_DISPATCHED) {
|
||||||
|
return maskPhone($val);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImagesAttr($val)
|
||||||
|
{
|
||||||
|
if (empty($val)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$images = explode(',', $val);
|
||||||
|
foreach ($images as $k => $v) {
|
||||||
|
$images[$k] = cdnurl($v, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $images;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,8 @@ class OrderDispatchService extends BaseService
|
||||||
'tel',
|
'tel',
|
||||||
'remark',
|
'remark',
|
||||||
'detail',
|
'detail',
|
||||||
|
'images',
|
||||||
|
'status',
|
||||||
];
|
];
|
||||||
$orderDispatchFields = [
|
$orderDispatchFields = [
|
||||||
'id',
|
'id',
|
||||||
|
|
@ -331,7 +333,7 @@ class OrderDispatchService extends BaseService
|
||||||
$orderDispatch->images = $this->removeStrCdnUrl($params['complete_images']);
|
$orderDispatch->images = $this->removeStrCdnUrl($params['complete_images']);
|
||||||
$orderDispatch->finish_time = $time;
|
$orderDispatch->finish_time = $time;
|
||||||
|
|
||||||
if ($params['receive_type'] === 1) {
|
if ($params['receive_type'] == 1) {
|
||||||
$orderDispatch->image = $this->removeStrCdnUrl($params['payment_image']);
|
$orderDispatch->image = $this->removeStrCdnUrl($params['payment_image']);
|
||||||
$orderDispatch->offline_total_type = $params['offline_total_type'];
|
$orderDispatch->offline_total_type = $params['offline_total_type'];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user