<?php

namespace app\admin\controller\market;
use app\admin\controller\BaseController;
use support\Request;
use support\Db;


/**
 * 市场营销客户支撑系统
 * Class Users
 * @package app\api\controller\market
 */
class MarketApi extends BaseController
{

    /**
     * Notes:报文接口
     * @return \support\Response
     * User: szd
     * Date: 2023/11/19
     */
    public function funcMarketApi()
    {
        include_once(__DIR__ . "/marketapi/config.php");
        include_once(__DIR__ . "/marketapi/functions.php");
        
        global $configs;
        global $connDB;
        
        funcComAutoLoad(array('path' => __DIR__ . '/marketapi/configs/extension/', 'method' => 'include_once'));
        funcComAutoLoad(array('path' => __DIR__ . '/marketapi/applications/', 'method' => 'include_once'));
        funcComAutoLoad(array('path' => __DIR__ . '/marketapi/configs/database/conf' . $configs['system']['database'] . '.php', 'method' => 'include_once'));

        $connDB = connectDB();

        $post = array();
        
        list($post['application'], $post['handle']) = explode(".", $this->request->post('func'));
        
        $returns = $post['handle']($this->request->post('data'));
        
        if($returns['success']){
             return json_success($returns['data'], $returns['page']);
        }else{
            throw new \Exception(json_encode($returns));
        }
       
    }

    

}
