From 93b6717e2c33a35d5a8e55b4d937371df62c871d Mon Sep 17 00:00:00 2001 From: wangxiaowei Date: Tue, 8 Oct 2024 14:57:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B7=BB=E5=8A=A0=E7=BB=91?= =?UTF-8?q?=E5=AE=9A=E7=94=A8=E6=88=B7=E6=9D=83=E9=99=90=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/LocalStore.php | 20 ++++++++++++++------ app/api/logic/LocalStoreLogic.php | 20 +++++++++++++++----- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/app/api/controller/LocalStore.php b/app/api/controller/LocalStore.php index 9a774aaa..fca485e3 100755 --- a/app/api/controller/LocalStore.php +++ b/app/api/controller/LocalStore.php @@ -3,6 +3,7 @@ namespace app\api\controller; use app\api\logic\LocalStoreLogic; +use app\api\logic\MallNewsLogic; use app\api\logic\UserLogic; use app\common\basics\Api; use app\common\enum\NoticeEnum; @@ -398,13 +399,20 @@ class LocalStore extends Api // 绑定用户列表 public function bindList() { - try { - $post = $this->request->post(); - LocalStoreLogic::bindList($post); - return JsonServer::success('添加成功'); - } catch (\Exception $e) { - return JsonServer::error($e->getMessage()); + if($this->request->isGet()) { + $data = LocalStoreLogic::bindList($post); + return JsonServer::success('获取成功', $data); + }else{ + return JsonServer::error('请求方式错误'); } + +// try { +// $post = $this->request->post(); +// LocalStoreLogic::bindList($post); +// return JsonServer::success('添加成功'); +// } catch (\Exception $e) { +// return JsonServer::error($e->getMessage()); +// } } // 绑定用户 diff --git a/app/api/logic/LocalStoreLogic.php b/app/api/logic/LocalStoreLogic.php index 3022231b..55aec7b6 100644 --- a/app/api/logic/LocalStoreLogic.php +++ b/app/api/logic/LocalStoreLogic.php @@ -496,11 +496,21 @@ class LocalStoreLogic extends Logic public static function bindList($post) { - $user = LocalStoreBind::where([ - 'lstore_id' => $post['lstore_id'], - 'is_unbind' => 0, - ])->group('bind_user_id')->select()->toArray(); - dump($user);die; + $list = LocalStoreBind::where(['lstore_id' => $post['lstore_id'], 'is_unbind' => 0]) + ->order('id desc') + ->page($post['page_no'], $post['page_size']) + ->select(); + + $count = LocalStoreBind::where(['lstore_id' => $post['lstore_id'], 'is_unbind' => 0])->count(); + $more = is_more($count, $post['page_no'], $post['page_size']); //是否有下一页 + + return [ + 'lists' => $list, + 'page_no' => $post['page_no'], + 'page_size' => $post['page_size'], + 'count' => $count, + 'more' => $more, + ]; } public static function bindUser($post)