信呼OA版本v2.3.8

This commit is contained in:
雨中磐石
2022-08-14 16:47:40 +08:00
parent 4640677d27
commit e3fcd913e3
1405 changed files with 133635 additions and 73 deletions

View File

@@ -0,0 +1,70 @@
<?php
/**
* 接口文件
* createname雨中磐石
* homeurlhttp://www.rockoa.com/
* Copyright (c) 2016 rainrock (www.rockoa.com)
* Date:2016-01-01
* explain返回200为正常
*/
//设置允许跨域用于最新版本APP
$origin = getheader('Origin');
if(!isempt($origin) && !contain($origin, HOST)){
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers:X-Requested-With');
header('Access-Control-Allow-Credentials:true');
if(arrvalue($_SERVER,'REQUEST_METHOD')=='OPTIONS'){
showreturn('ok');
}
}
class apiAction extends ActionNot
{
public $userrs = array();
public $cfrom = '';
public $token = '';
public function initAction()
{
$this->display= false;
$time = time();
$this->cfrom= $this->request('cfrom');
$this->token= $this->request('token', $this->admintoken);
$this->adminid = (int)$this->request('adminid', $this->adminid);
$this->adminname = '';
$boss = (M == 'login|api');
if(!$boss){
if($this->isempt($this->token))$this->showreturn('','token invalid', 199);
$lodb = m('login');
$onto = $lodb->getone("`uid`='$this->adminid' and `token`='$this->token' and `online`=1");
if(!$onto)$this->showreturn('','登录失效,请重新登录', 199);
$lodb->update("`moddt`='{$this->rock->now}'", $onto['id']);
}
$this->userrs = m('admin')->getone("`id`='$this->adminid' and `status`=1", '`name`,`user`,`id`,`ranking`,`deptname`,`deptid`');
if(!$this->userrs && !$boss){
$this->showreturn('', '用户已经不存在了,请重新登录', 199);
}
$this->adminname = arrvalue($this->userrs, 'name');
$this->rock->adminid = $this->adminid;
$this->rock->adminname = $this->adminname;
$this->admintoken = $this->token;
}
public function getvals($nae, $dev='')
{
$sv = $this->rock->jm->base64decode($this->post($nae));
if($this->isempt($sv))$sv=$dev;
return $sv;
}
public function getpostdata()
{
$postdata = '';
if(isset($GLOBALS['HTTP_RAW_POST_DATA']))$postdata = $GLOBALS['HTTP_RAW_POST_DATA'];
if($postdata=='')$postdata = trim(file_get_contents('php://input'));
return $postdata;
}
}