|
|
@@ -444,15 +444,23 @@ function asteriskString($str) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function getPostageRegion() {
|
|
|
- $lists = cache('postageRegion');
|
|
|
+function getPostageRegion($ids = []) {
|
|
|
+ $id_str = '';
|
|
|
+ if(!empty($ids)){
|
|
|
+ $id_str = implode(',',$ids);
|
|
|
+ }
|
|
|
+ $lists = cache('postageRegion'.$id_str);
|
|
|
if(empty($lists)){
|
|
|
- $lists = PostageRegion::field(['*'])->select()->toArray();
|
|
|
- cache('postageRegion',$lists);
|
|
|
+ $lists = PostageRegion::field(['*'])->whereIn('id',$ids)->select()->toArray();
|
|
|
+ cache('postageRegion'.$id_str,$lists);
|
|
|
}
|
|
|
return $lists;
|
|
|
}
|
|
|
-
|
|
|
+// 通过市查询省id
|
|
|
+function getProvinceByCityId($city_id) {
|
|
|
+ $postageRegion = array_column(getPostageRegion([$city_id]), null, 'id');
|
|
|
+ return $postageRegion[$city_id]['pid'];
|
|
|
+}
|
|
|
// 获取随机字符串
|
|
|
function generateRandomString($length = 8,$basic_method = 4) {
|
|
|
$characters = '';
|