lizhen_gitee пре 1 година
родитељ
комит
2ee92761f1
1 измењених фајлова са 9 додато и 5 уклоњено
  1. 9 5
      addons/unishop/controller/Address.php

+ 9 - 5
addons/unishop/controller/Address.php

@@ -50,7 +50,7 @@ class Address extends Base
     public function all()
     {
         $page = $this->request->post('page', 1);
-        $pagesize = $this->request->post('pagesize', 15);
+        $pagesize = $this->request->post('listrow', 15);
 
         $data = (new AddressModel())
             ->with([
@@ -170,7 +170,7 @@ class Address extends Base
      */
     public function delete()
     {
-        $address_id = $this->request->get('id', 0);
+        $address_id = $this->request->request('id', 0);
 
         $data = (new AddressModel())
             ->where([
@@ -200,7 +200,7 @@ class Address extends Base
      */
     public function area()
     {
-        $pid = $this->request->get('pid', 1);
+        $pid = $this->request->request('pid', 1);
         Cache::clear('area_pid_'.$pid);
         if (Cache::has('area_pid_'.$pid)) {
             $area = Cache::get('area_pid_'.$pid);
@@ -240,8 +240,12 @@ class Address extends Base
      */
     public function info()
     {
-        $id = $this->request->get('id');
-        $address = (new AddressModel())->where(['id' => $id, 'user_id' => $this->auth->id])->find()->toArray();
+        $id = $this->request->request('id');
+        $address = (new AddressModel())->with([
+            'province' => function($query) {$query->field('id,name');},
+            'city' => function($query) {$query->field('id,name');},
+            'area' => function($query) {$query->field('id,name');}
+        ])->where(['id' => $id, 'user_id' => $this->auth->id])->find()->toArray();
         $this->success('', $address);
     }