Pārlūkot izejas kodu

数据挪走了

lizhen_gitee 2 mēneši atpakaļ
vecāks
revīzija
c32767982b

+ 0 - 21
application/api/controller/Baseconfig.php

@@ -17,31 +17,10 @@ class Baseconfig extends Api
    
     public function index(){
 
-        //默认不弹窗,登录了但是没有地址,就弹窗
-        $add_address = 0;
-        if($this->auth->isLogin()){
-            $address = Db::name('unishop_address')->where('user_id',$this->auth->id)->find();
-            if(empty($address)){
-                $add_address = 1;
-            }
-        }
-
-        //首页弹窗商品
-        $index_show_product = null;
-        $map = [
-            'id' => config('site.index_show_product'),
-            'switch' => 1,
-            'deletetime' => null,
-        ];
-        $index_show_product = Db::name('unishop_product')->field('id,image,title')->where($map)->find();
-        $index_show_product = info_domain_image($index_show_product,['image']);
-
 
         //结果
         $config = [
             'kefu_phone' => config('site.kefuphoneno'),//客服电话号
-            'index_add_address' => $add_address,        //首页是否添加地址
-            'index_show_product' => $index_show_product,//首页弹窗商品
 
         ];
 

+ 24 - 0
application/api/controller/Index.php

@@ -25,9 +25,33 @@ class Index extends Api
         //多个头条
         $sys = Db::name('index_sys')->order('id desc')->select();
 
+        //默认不弹窗,登录了但是没有地址,就弹窗
+        $add_address = 0;
+        if($this->auth->isLogin()){
+            $address = Db::name('unishop_address')->where('user_id',$this->auth->id)->find();
+            if(empty($address)){
+                $add_address = 1;
+            }
+        }
+
+        //首页弹窗商品
+        $index_show_product = null;
+        $map = [
+            'id' => config('site.index_show_product'),
+            'switch' => 1,
+            'deletetime' => null,
+        ];
+        $index_show_product = Db::name('unishop_product')->field('id,image,title')->where($map)->find();
+        $index_show_product = info_domain_image($index_show_product,['image']);
+
+
+
         $result = [
             'tag' => $tag,
             'sys' => $sys,
+            'index_add_address' => $add_address,        //首页是否添加地址
+            'index_show_product' => $index_show_product,//首页弹窗商品
+
         ];
 
         $this->success(1, $result);