|
@@ -234,7 +234,7 @@ class UserAddressRepository extends BaseRepository
|
|
234
|
// 查询省份 id (level = 1),未查到返回 0
|
234
|
// 查询省份 id (level = 1),未查到返回 0
|
|
235
|
if (!empty($data['province'])) {
|
235
|
if (!empty($data['province'])) {
|
|
236
|
$province = \think\facade\Db::name('regions')
|
236
|
$province = \think\facade\Db::name('regions')
|
|
237
|
- ->where('name', $data['province'])
|
|
|
|
|
|
237
|
+ ->whereLike('name', '%' . $data['province'] . '%')
|
|
238
|
->where('level', 1)
|
238
|
->where('level', 1)
|
|
239
|
->find();
|
239
|
->find();
|
|
240
|
$provinceId = $province ? (int)$province['id'] : 0;
|
240
|
$provinceId = $province ? (int)$province['id'] : 0;
|
|
@@ -244,7 +244,7 @@ class UserAddressRepository extends BaseRepository
|
|
244
|
// 查询城市 id (level = 2),未查到返回 0
|
244
|
// 查询城市 id (level = 2),未查到返回 0
|
|
245
|
if (!empty($data['city'])) {
|
245
|
if (!empty($data['city'])) {
|
|
246
|
$city = \think\facade\Db::name('regions')
|
246
|
$city = \think\facade\Db::name('regions')
|
|
247
|
- ->where('name', $data['city'])
|
|
|
|
|
|
247
|
+ ->whereLike('name', '%' . $data['city'] . '%')
|
|
248
|
->where('level', 2)
|
248
|
->where('level', 2)
|
|
249
|
->find();
|
249
|
->find();
|
|
250
|
$cityId = $city ? (int)$city['id'] : 0;
|
250
|
$cityId = $city ? (int)$city['id'] : 0;
|
|
@@ -254,7 +254,7 @@ class UserAddressRepository extends BaseRepository
|
|
254
|
// 查询区/县 id (level = 3),未查到返回 0
|
254
|
// 查询区/县 id (level = 3),未查到返回 0
|
|
255
|
if (!empty($data['district'])) {
|
255
|
if (!empty($data['district'])) {
|
|
256
|
$district = \think\facade\Db::name('regions')
|
256
|
$district = \think\facade\Db::name('regions')
|
|
257
|
- ->where('name', $data['district'])
|
|
|
|
|
|
257
|
+ ->whereLike('name', '%' . $data['district'] . '%')
|
|
258
|
->where('level', 3)
|
258
|
->where('level', 3)
|
|
259
|
->find();
|
259
|
->find();
|
|
260
|
$districtId = $district ? (int)$district['id'] : 0;
|
260
|
$districtId = $district ? (int)$district['id'] : 0;
|
|
@@ -264,7 +264,7 @@ class UserAddressRepository extends BaseRepository
|
|
264
|
// 查询街道/乡镇 id (level = 4),未查到返回 0
|
264
|
// 查询街道/乡镇 id (level = 4),未查到返回 0
|
|
265
|
if (!empty($data['street'])) {
|
265
|
if (!empty($data['street'])) {
|
|
266
|
$street = \think\facade\Db::name('regions')
|
266
|
$street = \think\facade\Db::name('regions')
|
|
267
|
- ->where('name', $data['street'])
|
|
|
|
|
|
267
|
+ ->whereLike('name', '%' . $data['street'] . '%')
|
|
268
|
->where('level', 4)
|
268
|
->where('level', 4)
|
|
269
|
->find();
|
269
|
->find();
|
|
270
|
$streetId = $street ? (int)$street['id'] : 0;
|
270
|
$streetId = $street ? (int)$street['id'] : 0;
|