Browse Source

基础配置

lizhen_gitee 2 months ago
parent
commit
974fe3fd98
2 changed files with 23 additions and 0 deletions
  1. 22 0
      application/api/controller/Baseconfig.php
  2. 1 0
      application/extra/site.php

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

@@ -17,8 +17,30 @@ 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();
+
+
+        //结果
         $config = [
             'kefu_phone' => config('site.kefuphoneno'),//客服电话号
+            'index_add_address' => $add_address,        //首页是否添加地址
+            'index_show_product' => $index_show_product,//首页弹窗商品
 
         ];
 

+ 1 - 0
application/extra/site.php

@@ -51,4 +51,5 @@ return array (
   'takecash_plat_bili' => '1',
   'user_default_avatar' => '/uploads/20240522/47eb7f0430d48a73346b1630692e20ae.png',
   'unishop_order_hexiaomoney_bili' => '10',
+  'index_show_product' => '18',
 );