Merge branch 'master' of https://gitee.com/hainatravel/information-system
commit
b69668a905
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
//获取毫秒
|
||||
function get_microtime (){
|
||||
list($s1, $s2) = explode(' ', microtime());
|
||||
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
|
||||
}
|
||||
|
||||
//获取钉钉登录sign
|
||||
function get_loginsign($microtime,$appsecret){
|
||||
$microtime = $microtime;
|
||||
$sign = hash_hmac('sha256',$microtime,$appsecret,true);
|
||||
$signature = base64_encode($sign);
|
||||
return $signature;
|
||||
}
|
||||
|
||||
//发送请求函数
|
||||
function GetPost_http($url, $data = '',$format='') {
|
||||
if(!isset($_SERVER['HTTP_USER_AGENT'])){
|
||||
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400';
|
||||
}
|
||||
$curl = curl_init(); // 启动一个CURL会话
|
||||
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检查
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // 从证书中检查SSL加密算法是否存在
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // 模拟用户使用的浏览器
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
|
||||
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
|
||||
if (!empty($data)) {
|
||||
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $data); // Post提交的数据包
|
||||
if($format == 'json'){
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json; charset=utf-8"));
|
||||
}
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 40); // 设置超时限制防止死循环
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT_MS, 40000); // 设置超时限制防止死循环
|
||||
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
|
||||
$tmpInfo = curl_exec($curl); // 执行操作
|
||||
$errno = curl_errno($curl);
|
||||
if ($errno !== 0) {
|
||||
log_message('error', 'dingding'.$errno.curl_error($curl));
|
||||
}
|
||||
curl_close($curl); //关闭CURL会话
|
||||
return $tmpInfo; //返回数据
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
if (!defined('BASEPATH'))
|
||||
exit('No direct script access allowed');
|
||||
|
||||
|
||||
class ding_login_model extends CI_Model {
|
||||
|
||||
function __construct(){
|
||||
parent::__construct();
|
||||
$this->HT = $this->load->database('HT', TRUE);
|
||||
}
|
||||
|
||||
public function addorupdateuser($data){
|
||||
$sql = "
|
||||
IF NOT EXISTS(
|
||||
select * from Dingding_User where ddu_Unionid = ?
|
||||
)
|
||||
INSERT INTO Dingding_User (ddu_Name,ddu_Unionid,ddu_Mobile,ddu_Email,ddu_Position,ddu_Avatar,ddu_Datetime) VALUES (N?,?,?,?,N?,?,?)
|
||||
|
||||
ELSE
|
||||
UPDATE Dingding_User SET
|
||||
ddu_Name = N?,
|
||||
ddu_Mobile = ?,
|
||||
ddu_Email = ?,
|
||||
ddu_Position = N?,
|
||||
ddu_Avatar = ?,
|
||||
ddu_Datetime = ?
|
||||
WHERE ddu_Unionid = ?
|
||||
";
|
||||
$query = $this->HT->query($sql,array($data['unionid'],$data['name'],$data['unionid'],$data['mobile'],$data['orgEmail'],$data['position'],$data['avatar'],$data['datetime'],$data['name'],$data['mobile'],$data['orgEmail'],$data['position'],$data['avatar'],$data['datetime'],$data['unionid']));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,205 @@
|
||||
<?php
|
||||
header("Cache-Control: no-cache");
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION ENVIRONMENT
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* You can load different configurations depending on your
|
||||
* current environment. Setting the environment also influences
|
||||
* things like logging and error reporting.
|
||||
*
|
||||
* This can be set to anything, but default usage is:
|
||||
*
|
||||
* development
|
||||
* testing
|
||||
* production
|
||||
*
|
||||
* NOTE: If you change these, also change the error_reporting() code below
|
||||
*
|
||||
*/
|
||||
define('ENVIRONMENT', 'development');
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* ERROR REPORTING
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* Different environments will require different levels of error reporting.
|
||||
* By default development will show errors but testing and live will hide them.
|
||||
*/
|
||||
|
||||
if (defined('ENVIRONMENT'))
|
||||
{
|
||||
switch (ENVIRONMENT)
|
||||
{
|
||||
case 'development':
|
||||
error_reporting(E_ALL);
|
||||
break;
|
||||
|
||||
case 'testing':
|
||||
case 'production':
|
||||
error_reporting(0);
|
||||
break;
|
||||
|
||||
default:
|
||||
exit('The application environment is not set correctly.');
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* SYSTEM FOLDER NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* This variable must contain the name of your "system" folder.
|
||||
* Include the path if the folder is not in the same directory
|
||||
* as this file.
|
||||
*
|
||||
*/
|
||||
$system_path = '../system';
|
||||
|
||||
/*
|
||||
*---------------------------------------------------------------
|
||||
* APPLICATION FOLDER NAME
|
||||
*---------------------------------------------------------------
|
||||
*
|
||||
* If you want this front controller to use a different "application"
|
||||
* folder then the default one you can set its name here. The folder
|
||||
* can also be renamed or relocated anywhere on your server. If
|
||||
* you do, use a full server path. For more info please see the user guide:
|
||||
* http://codeigniter.com/user_guide/general/managing_apps.html
|
||||
*
|
||||
* NO TRAILING SLASH!
|
||||
*
|
||||
*/
|
||||
|
||||
$application_folder = 'webht';
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* DEFAULT CONTROLLER
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* Normally you will set your default controller in the routes.php file.
|
||||
* You can, however, force a custom routing by hard-coding a
|
||||
* specific controller class/function here. For most applications, you
|
||||
* WILL NOT set your routing here, but it's an option for those
|
||||
* special instances where you might want to override the standard
|
||||
* routing in a specific front controller that shares a common CI installation.
|
||||
*
|
||||
* IMPORTANT: If you set the routing here, NO OTHER controller will be
|
||||
* callable. In essence, this preference limits your application to ONE
|
||||
* specific controller. Leave the function name blank if you need
|
||||
* to call functions dynamically via the URI.
|
||||
*
|
||||
* Un-comment the $routing array below to use this feature
|
||||
*
|
||||
*/
|
||||
// The directory name, relative to the "controllers" folder. Leave blank
|
||||
// if your controller is not in a sub-folder within the "controllers" folder
|
||||
// $routing['directory'] = '';
|
||||
|
||||
// The controller class file name. Example: Mycontroller.php
|
||||
// $routing['controller'] = '';
|
||||
|
||||
// The controller function you wish to be called.
|
||||
// $routing['function'] = '';
|
||||
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* CUSTOM CONFIG VALUES
|
||||
* -------------------------------------------------------------------
|
||||
*
|
||||
* The $assign_to_config array below will be passed dynamically to the
|
||||
* config class when initialized. This allows you to set custom config
|
||||
* items or override any default config values found in the config.php file.
|
||||
* This can be handy as it permits you to share one application between
|
||||
* multiple front controller files, with each file containing different
|
||||
* config values.
|
||||
*
|
||||
* Un-comment the $assign_to_config array below to use this feature
|
||||
*
|
||||
*/
|
||||
// $assign_to_config['name_of_config_item'] = 'value of config item';
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// END OF USER CONFIGURABLE SETTINGS. DO NOT EDIT BELOW THIS LINE
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
* ---------------------------------------------------------------
|
||||
* Resolve the system path for increased reliability
|
||||
* ---------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// Set the current directory correctly for CLI requests
|
||||
if (defined('STDIN'))
|
||||
{
|
||||
chdir(dirname(__FILE__));
|
||||
}
|
||||
|
||||
if (realpath($system_path) !== FALSE)
|
||||
{
|
||||
$system_path = realpath($system_path).'/';
|
||||
}
|
||||
|
||||
// ensure there's a trailing slash
|
||||
$system_path = rtrim($system_path, '/').'/';
|
||||
|
||||
// Is the system path correct?
|
||||
if ( ! is_dir($system_path))
|
||||
{
|
||||
exit("Your system folder path does not appear to be set correctly. Please open the following file and correct this: ".pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
}
|
||||
|
||||
/*
|
||||
* -------------------------------------------------------------------
|
||||
* Now that we know the path, set the main path constants
|
||||
* -------------------------------------------------------------------
|
||||
*/
|
||||
// The name of THIS file
|
||||
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
|
||||
|
||||
// The PHP file extension
|
||||
define('EXT', '.php');
|
||||
|
||||
// Path to the system folder
|
||||
define('BASEPATH', str_replace("\\", "/", $system_path));
|
||||
|
||||
// Path to the front controller (this file)
|
||||
define('FCPATH', str_replace(SELF, '', __FILE__));
|
||||
|
||||
// Name of the "system folder"
|
||||
define('SYSDIR', trim(strrchr(trim(BASEPATH, '/'), '/'), '/'));
|
||||
|
||||
|
||||
// The path to the "application" folder
|
||||
if (is_dir($application_folder))
|
||||
{
|
||||
define('APPPATH', $application_folder.'/');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( ! is_dir(BASEPATH.$application_folder.'/'))
|
||||
{
|
||||
exit("Your application folder path does not appear to be set correctly. Please open the following file and correct this: ".SELF);
|
||||
}
|
||||
|
||||
define('APPPATH', BASEPATH.$application_folder.'/');
|
||||
}
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* LOAD THE BOOTSTRAP FILE
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* And away we go...
|
||||
*
|
||||
*/
|
||||
require_once BASEPATH.'core/CodeIgniter'.EXT;
|
||||
|
||||
/* End of file index.php */
|
||||
/* Location: ./index.php */
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue