<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

function get_wx_openid($retmethod,$return=false){
    
    $returnUrl = urlencode(url($retmethod,'','',true));
    $mcaddr = config('ext.app_config');
    $mcaddr = $mcaddr['sx_mc']['addr'];
    if(!$mcaddr){
        exit('未安装管理中心，无法使用本系统。');
    }
    $redUrl = $mcaddr.'/getopenid?get_type=2&return_url='.$returnUrl;
    if(!$return){
       header('Location:'.$redUrl);
//        redirect($redUrl);
    }else{
        return $redUrl;
    }
    
    
}
// 清除静态页面
function cleanStaticHtml(){
    unlink(ROOT_PATH.'public/login.html');
}
/*
 * 用于处理第三方接口请求时参数为多维数组的情况
 * */
function getThirdParams($param,$input){
    if(strpos($param,'.')){
        $params = explode('.',$param);
        $retVal = $input;
        foreach($params as $v){
            $retVal = $retVal[$v];
        }
        return $retVal;
    }else{
        return $input[$param];
    }
}

