<?php
class Api extends BaseController{
	public function getCorpConf(){
		$weixinJsApiInfo = array();
		$weixinJsApiInfo['noncestr'] = $this->getRandChar(12);
		$weixinJsApiInfo['timestamp'] = time();
		$weixinJsApiInfo['url'] =  $_GET['url']?:'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
		$weixinJsApiInfo['jsapi_ticket'] = getJsTicket();
		ksort( $weixinJsApiInfo, SORT_STRING );
		$str = NULL;
		foreach ($weixinJsApiInfo as $key => $value) {
			$str .= "$key=$value&";
		}
		$str = substr($str, 0 , -1);
		$_signature = sha1 (  $str );
		$res['beta'] = true;
		$res['debug'] = true;
		$res['corpid'] = c('CorpID');
		$res['agentid'] = c('agentid');
		$res['timestamp'] = $weixinJsApiInfo['timestamp'];
		$res['nonceStr'] = $weixinJsApiInfo['noncestr'];
		$res['signature'] = $_signature;
		$res['jsApiList'] = ['onMenuShareAppMessage','onMenuShareWechat','onMenuShareTimeline'];
		echo json_encode( $res );
	}

}