afa 11 місяців тому
батько
коміт
ac66f24a9f

+ 7 - 7
application/api/controller/Home.php

@@ -41,7 +41,7 @@ class Home extends Api
         ];
         // banner
         $resp['banner_list'] = $announcement
-            ->field('id,'.$this->lan.'_title,img_url,createtime')
+            ->field('id,'.$this->lan.'_title as title,img_url,createtime')
             ->where('type_id', $announcement::Banner)
             ->where('status', $announcement::NORMAL)
             ->limit(0,10)
@@ -50,7 +50,7 @@ class Home extends Api
 
         // 最新公告
         $resp['notice_list'] = $announcement
-            ->field('id,'.$this->lan.'_title,img_url,createtime')
+            ->field('id,'.$this->lan.'_title as title,img_url,createtime')
             ->where('type_id', $announcement::Announ)
             ->where('status', $announcement::NORMAL)
             ->limit(0,10)
@@ -58,7 +58,7 @@ class Home extends Api
             ->select();
         //分类
         $resp['type_list'] = $productsModel->where('status', $productsModel::NORMAL)
-            ->field('id,'.$this->lan.'_title')
+            ->field('id,'.$this->lan.'_title as title')
             ->order('sort desc')
             ->select();    
         $this->success('', $resp);
@@ -74,7 +74,7 @@ class Home extends Api
         // 热销
         $resp['product_list'] = $productPopular->alias('a')
            ->join("product_list b", "a.product_id = b.id", "left")
-           ->field('a.id,'.'b.'.$this->lan.'_name,b.thum as img_url,price,cost_price,stock,num,start_time,end_time')
+           ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,cost_price,stock,num,start_time,end_time')
            ->limit(2)
            ->where('a.status', '<', $productPopular::STOP)
            ->order('a.weigh desc')
@@ -85,7 +85,7 @@ class Home extends Api
             ->join("product_list b", "a.product_id = b.id", "left")
             ->join("user u", "a.user_id = u.id", "left")
             ->join("products d", "b.type_id = d.id", "left")
-            ->field('a.id,'.'b.'.$this->lan.'_name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title')
+            ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title as title')
             ->where('a.status', $productTransfer::NORMAL)
             ->limit(2)
             ->order('a.id DESC')
@@ -112,7 +112,7 @@ class Home extends Api
             $order = array();
             $info = $productPopular->alias('a')
                 ->join("product_list b", "a.product_id = b.id", "left")
-                ->field('a.id,a.product_id,'.'b.'.$this->lan.'_name,b.images as img_url,price,cost_price,stock,num,start_time,end_time')
+                ->field('a.id,a.product_id,'.'b.'.$this->lan.'_name as name,b.images as img_url,price,cost_price,stock,num,start_time,end_time')
                 ->where('a.id', $ids)
                 ->order('a.weigh desc')
                 ->find();
@@ -149,7 +149,7 @@ class Home extends Api
   
             $info = $productTransfer->alias('a')
                 ->join("product_list b", "a.product_id = b.id", "left")
-                ->field('a.id,a.product_id,a.area_id,'.'b.'.$this->lan.'_name,b.images as img_url,price,fees')
+                ->field('a.id,a.product_id,a.area_id,'.'b.'.$this->lan.'_name as name,b.images as img_url,price,fees')
                 ->where('a.id', $ids)
                 ->find();
          

+ 5 - 4
application/api/controller/Product.php

@@ -24,12 +24,12 @@ class Product extends Api
      */
     public function getPopularList(ProductsModel $productsModel, ProductPopular $productPopular)
     {
-        $list = $productsModel->column('id,'.$this->lan.'_title');
+        $list = $productsModel->column('id,'.$this->lan.'_title as title');
         $resp = array();
         foreach ($list as $kk =>$val) {
             $pro = $productPopular->alias('a')
                 ->join("product_list b", "a.product_id = b.id", "left")
-                ->field('a.id,'.'b.'.$this->lan.'_name,b.thum as img_url,price,cost_price,stock,num,start_time,end_time')
+                ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,cost_price,stock,num,start_time,end_time')
                 ->where('a.status', '<', $productPopular::STOP)
                 ->where('b.type_id', $kk)
                 ->order('a.weigh desc')
@@ -61,8 +61,9 @@ class Product extends Api
             ->join("product_list b", "a.product_id = b.id", "left")
             ->join("user u", "a.user_id = u.id", "left")
             ->join("products d", "b.type_id = d.id", "left")
-            ->field('a.id,'.'b.'.$this->lan.'_name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title')
-            ->where('a.status', $productTransfer::NORMAL)->where($map)
+            ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title as title')
+            ->where('a.status', $productTransfer::NORMAL)
+            ->where($map)
             ->order($order)
             ->paginate($this->pageSize);
         $this->success('', $list);

+ 1 - 1
application/api/controller/User.php

@@ -75,7 +75,7 @@ class User extends Api
         $list = $productOrder->alias('a')
               ->join("product_list b", "b.id = a.product_id", "left")
               ->join("products c", "c.id = b.type_id", "left")
-              ->field('a.id as order_id,a.product_id,'.'b.'.$this->lan.'_name,b.images as img_url,a.price,a.status,a.type_id,c.'.$this->lan.'_title')
+              ->field('a.id as order_id,a.product_id,'.'b.'.$this->lan.'_name as name,b.images as img_url,a.price,a.status,a.type_id,c.'.$this->lan.'_title as title')
               ->where('a.user_id', $this->auth->id)
               ->order('a.id DESC')
               ->paginate($this->pageSize);