12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Db;
- use Redis;
- /**
- * 基础配置接口
- */
- class Baseconfig extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
-
- 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,//首页弹窗商品
- ];
- $this->success('success',$config);
- }
- //自提点
- public function zitidian(){
- $list = Db::name('zitidian')->order('id desc')->select();
- $this->success('success',$list);
- }
- }
|