66 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
		
		
			
		
	
	
			66 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								namespace app\api\controller;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use app\common\basics\Api;
							 | 
						||
| 
								 | 
							
								use app\api\logic\IndexLogic;
							 | 
						||
| 
								 | 
							
								use app\common\logic\ChatLogic;
							 | 
						||
| 
								 | 
							
								use app\common\server\JsonServer;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class Index extends Api
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    public $like_not_need_login = ['index', 'indexCategory', 'config','copyright'];
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // 首页
							 | 
						||
| 
								 | 
							
								    public function index()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $terminal = $this->request->get('terminal', 'nmp');
							 | 
						||
| 
								 | 
							
								        $data = IndexLogic::index($this->user_id,$terminal);
							 | 
						||
| 
								 | 
							
								        return JsonServer::success('获取成功', $data);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // 首页分类
							 | 
						||
| 
								 | 
							
								    public function indexCategory()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $platform_category_id = $this->request->get('platform_category_id', '', 'intval');
							 | 
						||
| 
								 | 
							
								        if(empty($platform_category_id)) {
							 | 
						||
| 
								 | 
							
								            return JsonServer::error('平台分类id不能为空');
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        $data = IndexLogic::indexCategory($platform_category_id);
							 | 
						||
| 
								 | 
							
								        return JsonServer::success('获取成功', $data);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    // 通用配置
							 | 
						||
| 
								 | 
							
								    public function config()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $data = IndexLogic::config();
							 | 
						||
| 
								 | 
							
								        return JsonServer::success('获取成功', $data);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @notes 客服配置
							 | 
						||
| 
								 | 
							
								     * @return \think\response\Json
							 | 
						||
| 
								 | 
							
								     * @author 段誉
							 | 
						||
| 
								 | 
							
								     * @date 2021/12/15 17:16
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function chatConfig()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $shop_id = $this->request->get('shop_id/d');
							 | 
						||
| 
								 | 
							
								        $result = ChatLogic::getConfig($shop_id);
							 | 
						||
| 
								 | 
							
								        return JsonServer::success($result['msg'], [], $result['code']);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    /**
							 | 
						||
| 
								 | 
							
								     * @notes 版权资质
							 | 
						||
| 
								 | 
							
								     * @return \think\response\Json
							 | 
						||
| 
								 | 
							
								     * @author ljj
							 | 
						||
| 
								 | 
							
								     * @date 2022/2/22 10:16 上午
							 | 
						||
| 
								 | 
							
								     */
							 | 
						||
| 
								 | 
							
								    public function copyright()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $shop_id = $this->request->get('shop_id/d');
							 | 
						||
| 
								 | 
							
								        $result = IndexLogic::copyright($shop_id);
							 | 
						||
| 
								 | 
							
								        return JsonServer::success('', $result);
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |