Commit e42b1a4e by 杨树贤

地址接口不分页

parent 660d3237
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="fb90add0-1393-48c2-9f26-72365d42cd03" name="变更" comment=""> <list default="true" id="fb90add0-1393-48c2-9f26-72365d42cd03" name="变更" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Controllers/Api/AuthApiController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Api/AuthApiController.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/Api/UserAddressApiController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Api/UserAddressApiController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Services/InquiryService.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Services/InquiryService.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/app/Http/Controllers/Api/UserApiController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Controllers/Api/UserApiController.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app/Http/Services/UserAddressService.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/Http/Services/UserAddressService.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bootstrap/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/app.php" afterDir="false" /> <change beforePath="$PROJECT_DIR$/bootstrap/app.php" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/app.php" afterDir="false" />
<change beforePath="$PROJECT_DIR$/bootstrap/cache/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/cache/.gitignore" afterDir="false" /> <change beforePath="$PROJECT_DIR$/bootstrap/cache/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/bootstrap/cache/.gitignore" afterDir="false" />
<change beforePath="$PROJECT_DIR$/storage/app/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/app/.gitignore" afterDir="false" /> <change beforePath="$PROJECT_DIR$/storage/app/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/storage/app/.gitignore" afterDir="false" />
...@@ -189,7 +190,7 @@ ...@@ -189,7 +190,7 @@
<workItem from="1667266026118" duration="40321000" /> <workItem from="1667266026118" duration="40321000" />
<workItem from="1667959054458" duration="183000" /> <workItem from="1667959054458" duration="183000" />
<workItem from="1667986756173" duration="14315000" /> <workItem from="1667986756173" duration="14315000" />
<workItem from="1668150640953" duration="15808000" /> <workItem from="1668150640953" duration="18277000" />
</task> </task>
<servers /> <servers />
</component> </component>
......
...@@ -17,7 +17,7 @@ class UserAddressApiController extends Controller ...@@ -17,7 +17,7 @@ class UserAddressApiController extends Controller
{ {
$userId = $request->user->id; $userId = $request->user->id;
$data = UserAddressService::getUserAddressList($userId); $data = UserAddressService::getUserAddressList($userId);
return $this->setSuccessData($data['data'], $data['total']); return $this->setSuccessData($data['data'],count($data['data']));
} }
public function detail(Request $request) public function detail(Request $request)
......
...@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api; ...@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Api;
use App\Http\Requests\UserUpdate; use App\Http\Requests\UserUpdate;
use App\Models\UserModel; use App\Models\UserModel;
use http\Client\Curl\User;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Validation\ValidatesRequests;
...@@ -101,7 +102,13 @@ class UserApiController extends Controller ...@@ -101,7 +102,13 @@ class UserApiController extends Controller
return $this->setError('Email code invalid'); return $this->setError('Email code invalid');
} }
$result = UserModel::where('id', $userId)->update(['email' => $email]); //先判断下邮箱是否存在
$existEmail = UserModel::where('email', $email)->exists();
if ($existEmail) {
return $this->setError('Email has been registered');
}
$result = UserModel::where('id', $userId)->update(['email' => $email,'update_time' => time()]);
if (!$result) { if (!$result) {
return $this->setError('Change email failed'); return $this->setError('Change email failed');
} }
......
...@@ -57,7 +57,7 @@ class UserAddressService ...@@ -57,7 +57,7 @@ class UserAddressService
]); ]);
} }
])->where('user_id', $userId)->orderBy('address_id', 'desc'); ])->where('user_id', $userId)->orderBy('address_id', 'desc');
$result = $query->paginate(10)->toArray(); $result = $query->get()->toArray();
foreach ($result['data'] as &$item) { foreach ($result['data'] as &$item) {
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
$item['country'] = \Arr::get($item['country'], 'name'); $item['country'] = \Arr::get($item['country'], 'name');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment