信呼OA版本v2.3.8
This commit is contained in:
32
webmain/task/api/agentAction.php
Normal file
32
webmain/task/api/agentAction.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
class agentClassAction extends apiAction
|
||||
{
|
||||
/**
|
||||
* 手机app读取应用
|
||||
*/
|
||||
public function dataAction()
|
||||
{
|
||||
$agentarr = m('reim')->getappagent($this->adminid);
|
||||
$arr['agentjson'] = json_encode($agentarr['rows']);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* app上读取数组的
|
||||
*/
|
||||
public function dataappAction()
|
||||
{
|
||||
$agentarr = m('reim')->getappagent($this->adminid);
|
||||
$arr['agentarr'] = $agentarr;
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
public function getoptnumAction()
|
||||
{
|
||||
$num = $this->post('num');
|
||||
$mid = (int)$this->post('mid');
|
||||
|
||||
$arr = m('flow')->opt('getoptmenu', $num, $mid);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
}
|
||||
70
webmain/task/api/apiAction.php
Normal file
70
webmain/task/api/apiAction.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* 接口文件
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://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;
|
||||
}
|
||||
}
|
||||
195
webmain/task/api/asynrunAction.php
Normal file
195
webmain/task/api/asynrunAction.php
Normal file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
class asynrunClassAction extends apiAction
|
||||
{
|
||||
public $queuelogid = 0;
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
$this->display = false;
|
||||
$uid = (int)$this->get('adminid');
|
||||
$this->queuelogid = (int)$this->get('queuelogid','0');
|
||||
if($uid==0)$uid = 1;
|
||||
$key = $this->get('asynkey');
|
||||
$mykey = getconfig('asynkey');
|
||||
if($mykey != ''){
|
||||
$wodkey = md5(md5($mykey));
|
||||
if($wodkey != $key)exit('sorry,asyn');
|
||||
}
|
||||
$urs = m('admin')->getone($uid,'`id`,`name`,`user`');
|
||||
if($urs)$this->setNowUser($urs['id'], $urs['name'], $urs['user']);
|
||||
}
|
||||
|
||||
public function afterAction()
|
||||
{
|
||||
if($this->queuelogid > 0){
|
||||
$cont = ob_get_contents();
|
||||
m('log')->update(array('result' => $cont), $this->queuelogid);
|
||||
}
|
||||
}
|
||||
|
||||
public function asyntestAction()
|
||||
{
|
||||
$krand = $this->get('krand');
|
||||
m('option')->setval('asyntest', $krand);
|
||||
return $krand;
|
||||
}
|
||||
|
||||
//测试
|
||||
public function indexAction()
|
||||
{
|
||||
$runtime = $this->get('runtime');
|
||||
$this->rock->debugs('hehe:'.time().','.$runtime.'','yibu');
|
||||
echo 'lala'.time().'';
|
||||
}
|
||||
|
||||
//消息同步到微信企业会话
|
||||
public function wxchattbAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
return m('weixin:chat')->chattongbu($id);
|
||||
}
|
||||
|
||||
//消息同步到企业客服消息汇总
|
||||
public function wxkefutbAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
return m('weixin:kefu')->chattongbu($id);
|
||||
}
|
||||
|
||||
//薪资发放通知给人员
|
||||
public function salaryffAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
return m('flow')->initflow('hrsalary', $id)->todouser();
|
||||
}
|
||||
|
||||
//下载微信发送的图片到服务器
|
||||
public function downwxpicAction()
|
||||
{
|
||||
$picurl = $this->rock->jm->uncrypt($this->get('picurl'));
|
||||
$msgid = $this->get('msgid');
|
||||
return m('reim')->downwximg($picurl, $msgid);
|
||||
}
|
||||
|
||||
//下载微信上媒体文件
|
||||
public function downwxmediaAction()
|
||||
{
|
||||
$mediaid = $this->get('mediaid');
|
||||
$msgid = $this->get('msgid');
|
||||
$fileext = $this->get('fileext');
|
||||
$barr = m('weixin:media')->downmedia($mediaid, $fileext, $msgid);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//异步发送邮件
|
||||
public function sendemailAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
$msg = m('email')->sendemailcont($id);
|
||||
if($msg!='ok')m('log')->addlogs('邮件', $msg , 2);
|
||||
return $msg;
|
||||
}
|
||||
|
||||
//异步微信企业号发送提醒
|
||||
public function wxsendmsgAction()
|
||||
{
|
||||
$body = $this->get('body');
|
||||
if($body=='')return;
|
||||
$body = $this->jm->base64decode($body);
|
||||
$barr = m('weixin:index')->sendbody($body);
|
||||
m('log')->todolog('微信提醒', $barr);
|
||||
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//异步企业微信发送提醒
|
||||
public function wxqysendmsgAction()
|
||||
{
|
||||
$body = $this->get('body');
|
||||
$agentid = $this->get('agentid');
|
||||
if($body=='')return;
|
||||
$body = $this->jm->base64decode($body);
|
||||
$barr = m('weixinqy:index')->sendbody($body, $agentid);
|
||||
m('log')->todolog('企业微信提醒', $barr);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//企业微信异步获取头像
|
||||
public function wxqyfaceAction()
|
||||
{
|
||||
$userid = $this->get('userid');
|
||||
if($userid=='')return;
|
||||
$barr = m('weixinqy:user')->anayface($userid);
|
||||
m('log')->todolog('企业微信提醒', $barr);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//钉钉异步提醒
|
||||
public function ddsendmsgAction()
|
||||
{
|
||||
$body = $this->get('body');
|
||||
if($body=='')return;
|
||||
$body = $this->jm->base64decode($body);
|
||||
$barr = m('dingding:index')->sendbody($body);
|
||||
m('log')->todolog('钉钉提醒', $barr);
|
||||
return $barr;
|
||||
}
|
||||
|
||||
//转pdf完成了设置
|
||||
public function topdfokAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
$type = $this->get('type','html');
|
||||
$status = $this->get('status','1'); //转化状态
|
||||
$frs = m('file')->getone($id);
|
||||
$pdfpath= str_replace('.'.$frs['fileext'].'','.'.$type.'', $frs['filepath']);
|
||||
if(!file_exists($pdfpath))return;
|
||||
if($type=='html'){
|
||||
$cont = file_get_contents($pdfpath);
|
||||
$str1 = '<meta http-equiv=Content-Type content="text/html; charset=gb2312">';
|
||||
$cont = str_replace('</head>', ''.$str1.'</head>', $cont);
|
||||
$this->rock->createtxt($pdfpath, $cont);
|
||||
}
|
||||
m('file')->update("`pdfpath`='$pdfpath'", $id);
|
||||
}
|
||||
|
||||
//发送短信
|
||||
public function sendsmsAction()
|
||||
{
|
||||
$tomobile = $this->get('tomobile');
|
||||
$qiannum = $this->get('qiannum');
|
||||
$tplnum = $this->get('tplnum');
|
||||
$url = $this->jm->base64decode($this->get('url'));
|
||||
$params = json_decode($this->jm->base64decode($this->get('params')), true);
|
||||
return c('xinhuapi')->send($tomobile, $qiannum, $tplnum, $params, $url);
|
||||
}
|
||||
|
||||
//订阅的
|
||||
public function subscribeAction()
|
||||
{
|
||||
$id = $this->get('id');
|
||||
$uid = $this->get('uid');
|
||||
$receid = $this->get('receid');
|
||||
$recename = $this->jm->base64decode($this->get('recename'));
|
||||
$flow = m('flow')->initflow('subscribeinfo');
|
||||
return $flow->subscribe($id, $uid, $receid, $recename);
|
||||
}
|
||||
|
||||
//获取打卡记录
|
||||
public function wxdkjlAction()
|
||||
{
|
||||
$dt1 = $this->get('dt1');
|
||||
$dt2 = $this->get('dt2');
|
||||
$page = (int)$this->get('page','2');
|
||||
return m('weixinqy:daka')->getrecord('', $dt1, $dt2, $page);
|
||||
}
|
||||
|
||||
//发送模版消息
|
||||
public function wxgzhtplsendAction()
|
||||
{
|
||||
$body = $this->jm->base64decode($this->get('body'));
|
||||
$barr = m('wxgzh:index')->sendtplasyn($body);
|
||||
m('log')->todolog('模版消息', $barr);
|
||||
return $barr;
|
||||
}
|
||||
}
|
||||
33
webmain/task/api/deptAction.php
Normal file
33
webmain/task/api/deptAction.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
class deptClassAction extends apiAction
|
||||
{
|
||||
public function dataAction()
|
||||
{
|
||||
$udarr = m('dept')->getdeptuserdata(0);
|
||||
$userarr = $udarr['uarr'];
|
||||
$deptarr = $udarr['darr'];
|
||||
|
||||
$grouparr = m('reim')->getgroup($this->adminid);
|
||||
|
||||
$arr['deptjson'] = json_encode($deptarr);
|
||||
$arr['userjson'] = json_encode($userarr);
|
||||
$arr['groupjson'] = json_encode($grouparr);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* app获取数据
|
||||
*/
|
||||
public function dataappAction()
|
||||
{
|
||||
$udarr = m('dept')->getdeptuserdata(0);
|
||||
$userarr = $udarr['uarr'];
|
||||
$deptarr = $udarr['darr'];
|
||||
$grouparr = m('reim')->getgroup($this->adminid);
|
||||
|
||||
$arr['deptarr'] = $deptarr;
|
||||
$arr['userarr'] = $userarr;
|
||||
$arr['grouparr']= $grouparr;
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
}
|
||||
74
webmain/task/api/fileAction.php
Normal file
74
webmain/task/api/fileAction.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* 文件下载相关接口-用于app
|
||||
*/
|
||||
class fileClassAction extends apiAction
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取文件信息
|
||||
*/
|
||||
public function getfileAction()
|
||||
{
|
||||
$id = (int)$this->post('id',0);
|
||||
$rs = m('file')->getone($id);
|
||||
if(!$rs)$this->showreturn('', '文件不存在1', 201);
|
||||
$path = $rs['filepath'];
|
||||
if(isempt($path) || !file_exists($path))$this->showreturn('', '文件['.$rs['filename'].']不存在', 202);
|
||||
$rs['filetype'] = m('file')->getmime($rs['fileext']);
|
||||
$this->showreturn($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*/
|
||||
public function downAction()
|
||||
{
|
||||
$id = (int)$this->jm->gettoken('id');
|
||||
m('file')->show($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件信息
|
||||
*/
|
||||
public function getfilenewAction()
|
||||
{
|
||||
$id = (int)$this->post('id',0);
|
||||
$rs = m('file')->getone($id);
|
||||
if(!$rs)$this->showreturn('', '文件不存在1', 201);
|
||||
$path = $rs['filepath'];
|
||||
if(isempt($rs['filenum'])){
|
||||
if(substr($path,0,4)!='http' && !file_exists($path))
|
||||
$this->showreturn('', '文件['.$rs['filename'].']不存了', 202);
|
||||
}
|
||||
$rs['filetype'] = m('file')->getmime($rs['fileext']);
|
||||
$rs['downurl'] = '';
|
||||
|
||||
|
||||
$this->showreturn($rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成水印图片
|
||||
*/
|
||||
public function shuiyinAction()
|
||||
{
|
||||
header("Content-type:image/png");
|
||||
$font = 'upload/data/simsun.ttc';
|
||||
if(!file_exists($font))$font = 'C:/Windows/Fonts/simsun.ttc';
|
||||
$w = 110;
|
||||
$im = imagecreatetruecolor($w,$w);
|
||||
$bg = imagecolorallocate($im,255,255,255);
|
||||
imagefill($im,0,0,$bg); //添加背景颜色
|
||||
$str = $this->adminname;
|
||||
//$str = '信呼开发团队'; //改成你要的文字去掉注释
|
||||
$black = imagecolorallocate($im,220,220,220);
|
||||
if(file_exists($font)){
|
||||
imagettftext($im, 14,45, 20, $w-10,$black, $font, $str);
|
||||
}else{
|
||||
imagestring($im,5,5, $w-50,$this->adminuser,$black);
|
||||
}
|
||||
imagepng($im);
|
||||
imagedestroy($im);
|
||||
}
|
||||
}
|
||||
153
webmain/task/api/indexAction.php
Normal file
153
webmain/task/api/indexAction.php
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
class indexClassAction extends apiAction
|
||||
{
|
||||
public function indexAction()
|
||||
{
|
||||
$this->showreturn('','error', 203);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机app读取
|
||||
*/
|
||||
public function indexinitAction()
|
||||
{
|
||||
$dbs = m('reim');
|
||||
$ntime = floatval($this->post('ntime'));
|
||||
$uid = $this->adminid;
|
||||
$arr['loaddt'] = $this->now;
|
||||
$arr['splittime'] = (int)($ntime/1000-time());
|
||||
$arr['reimarr'] = $dbs->gethistory($uid);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* app首页接口截止
|
||||
*/
|
||||
public function indexappAction()
|
||||
{
|
||||
$dbs = m('reim');
|
||||
$ntime = floatval($this->post('ntime'));
|
||||
$uid = $this->adminid;
|
||||
$agent = $dbs->getappagent($uid);
|
||||
$arr['loaddt'] = $this->now;
|
||||
$arr['splittime'] = (int)($ntime/1000-time());
|
||||
$arr['reimarr'] = $dbs->gethistory($uid);
|
||||
$arr['agentarr'] = $agent['rows'];
|
||||
$arr['agentstotal'] = $agent['stotal'];
|
||||
$arr['maxupsize'] = c('upfile')->getmaxzhao();//最大上传大小M
|
||||
$arr['appversion'] = $this->get('appversion');
|
||||
$arr['xinhuver'] = VERSION;
|
||||
$arr['wsconfig'] = $dbs->getreims();
|
||||
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
public function lunxunAction()
|
||||
{
|
||||
$uid = $this->adminid;
|
||||
$loaddt = $this->post('loaddt');
|
||||
//$reimarr = m('reim')->getwdarr($uid, $loaddt);
|
||||
$reimarr = m('reim')->gethistory($uid, $loaddt);
|
||||
$arr['reimarr'] = $reimarr;
|
||||
$arr['loaddt'] = $this->now;
|
||||
m('login')->uplastdt();
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
|
||||
//应用获取数据
|
||||
public function getyydataAction()
|
||||
{
|
||||
$num = $this->post('num');
|
||||
$event = $this->post('event');
|
||||
$page = (int)$this->post('page');
|
||||
$rows = m('agent:'.$num.'')->getdata($this->adminid, $num, $event, $page);
|
||||
|
||||
$this->showreturn($rows);
|
||||
}
|
||||
|
||||
public function yyoptmenuAction()
|
||||
{
|
||||
$num = $this->post('modenum');
|
||||
$sm = $this->post('sm');
|
||||
$optid = (int)$this->post('optmenuid');
|
||||
$zt = (int)$this->post('statusvalue');
|
||||
$mid = (int)$this->post('mid');
|
||||
$msg = m('flow')->opt('optmenu', $num, $mid, $optid, $zt, $sm);
|
||||
if($msg != 'ok')$this->showreturn('', $msg, 201);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
|
||||
public function changetxAction()
|
||||
{
|
||||
$apptx = (int)$this->post('apptx');
|
||||
m('admin')->update("`apptx`='$apptx'", $this->adminid);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
|
||||
public function checkewmAction()
|
||||
{
|
||||
$randkey = $this->get('randkey');
|
||||
$lx = (int)$this->get('lx');
|
||||
$val = $this->adminid;
|
||||
$lxarr = array('已取消','已确认');
|
||||
if($lx==0)$val='-1';
|
||||
c('cache')->set($randkey,$val,60);
|
||||
$this->showreturn($lxarr[$lx]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换公司
|
||||
*/
|
||||
public function changecompanyAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
$db = m('admin');
|
||||
$db->update('comid='.$id.'', '`id`='.$this->adminid.'');
|
||||
$db->getcompanyinfo();
|
||||
return returnsuccess();
|
||||
}
|
||||
public function getcompanyAction()
|
||||
{
|
||||
$carr = m('admin')->getcompanyinfo($this->adminid);
|
||||
$this->showreturn($carr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 华为设置客户端token
|
||||
*/
|
||||
public function updateTokenIpAction()
|
||||
{
|
||||
$hwtoken = $this->get('hwtoken');
|
||||
$pushtoken = $this->get('pushtoken');
|
||||
$ispush = (int)$this->get('ispush','0');
|
||||
$uarr['ispush'] = $ispush;
|
||||
$uarr['pushtoken'] = $pushtoken;
|
||||
$uarr['moddt'] = $this->now;
|
||||
if(!isempt($hwtoken))$uarr['ip'] = $hwtoken;
|
||||
m('login')->update($uarr, "`token`='$this->admintoken'");
|
||||
if($ispush==1)m('reim')->sendpush($this->adminid, 'all', array(
|
||||
'type' => 'onoffline',
|
||||
'online' => 2
|
||||
));
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
public function addlogAction()
|
||||
{
|
||||
$tit = $this->post('title');
|
||||
$cont = $this->post('cont');
|
||||
$web = $this->post('web');
|
||||
$level = (int)$this->post('level','0');
|
||||
m('log')->addlogs($tit, $cont,$level, array(
|
||||
'web' => $web,
|
||||
));
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
public function sgstrs()
|
||||
{
|
||||
}
|
||||
}
|
||||
322
webmain/task/api/indexreimAction.php
Normal file
322
webmain/task/api/indexreimAction.php
Normal file
@@ -0,0 +1,322 @@
|
||||
<?php
|
||||
class indexreimClassAction extends apiAction
|
||||
{
|
||||
/**
|
||||
* PC客户端首页读取
|
||||
*/
|
||||
public function indexinitAction()
|
||||
{
|
||||
$viewobj = m('view');
|
||||
$dbs = m('reim');
|
||||
$dba = m('admin');
|
||||
$gtype = $this->rock->get('gtype');
|
||||
$udarr = m('dept')->getdeptuserdata();
|
||||
$userarr = $udarr['uarr'];
|
||||
$deptarr = $udarr['darr'];
|
||||
|
||||
$grouparr = $dbs->getgroup($this->adminid);
|
||||
$agentarr = $dbs->getagent($this->adminid);
|
||||
$historyarr = $dbs->gethistory($this->adminid);
|
||||
$modearr = array();
|
||||
|
||||
if(isempt($gtype)){
|
||||
$applyarr = m('mode')->getmoderows($this->adminid,'and islu=1');
|
||||
foreach($applyarr as $k=>$rs){
|
||||
if(!$viewobj->isadd($rs, $this->adminid))continue;
|
||||
$modearr[]=array('type'=>$rs['type'],'num'=>$rs['num'],'name'=>$rs['name']);
|
||||
}
|
||||
}
|
||||
|
||||
$arr['deptjson'] = json_encode($deptarr);
|
||||
$arr['userjson'] = json_encode($userarr);
|
||||
$arr['groupjson'] = json_encode($grouparr);
|
||||
$arr['agentjson'] = json_encode($agentarr);
|
||||
$arr['historyjson'] = json_encode($historyarr);
|
||||
$arr['modearr'] = $modearr;
|
||||
$arr['config'] = $dbs->getreims();
|
||||
$arr['loaddt'] = $this->now;
|
||||
$arr['ip'] = $this->ip;
|
||||
$arr['editpass'] = $dba->iseditpass($this->adminid);
|
||||
$arr['companyinfo'] = $dba->getcompanyinfo($this->adminid, 1);
|
||||
$arr['onlinearr'] = $this->onlinearr();
|
||||
$arr['outunum'] = $this->option->getval('outunum'.$this->adminid.'');
|
||||
$arr['outgroupopen']= $this->option->getval('outgroupopen'.$this->adminid.'');
|
||||
if(getconfig('systype')=='demo'){
|
||||
$arr['outgroupopen'] = 'close';
|
||||
$arr['outunum'] = 'y4rwlnabc';
|
||||
}
|
||||
$this->rock->savesession(array('homestyle' => 'rock'));
|
||||
|
||||
|
||||
return returnsuccess($arr);
|
||||
}
|
||||
|
||||
|
||||
//在线情况读取
|
||||
private function onlinearr()
|
||||
{
|
||||
$time = date('Y-m-d H:i:s', time()-6*60);
|
||||
$rows = m('login')->getall("`online`=1 and ((`ispush`=1) or (`cfrom`='reim' and moddt>='$time'))",'uid,ispush,web,cfrom');
|
||||
$onlinearr = array();
|
||||
foreach($rows as $k=>$rs){
|
||||
$uid = $rs['uid'];
|
||||
if(!isset($onlinearr[$uid]))$onlinearr[$uid]=array('uid'=>$uid,'reim'=>0,'mobile'=>0,'web'=>'');
|
||||
if($rs['cfrom']=='reim')$onlinearr[$uid]['reim'] = 1;
|
||||
if($rs['ispush']=='1'){
|
||||
$onlinearr[$uid]['mobile'] = 1;
|
||||
$onlinearr[$uid]['web'] = $rs['web'];
|
||||
}
|
||||
}
|
||||
return $onlinearr;
|
||||
}
|
||||
|
||||
/**
|
||||
* REIM的初始化
|
||||
*/
|
||||
public function reiminitAction()
|
||||
{
|
||||
$dbs = m('reim');
|
||||
$dba = m('admin');
|
||||
$udarr = m('dept')->getdeptuserdata();
|
||||
$userarr = $udarr['uarr'];
|
||||
$deptarr = $udarr['darr'];
|
||||
|
||||
$grouparr = $dbs->getgroup($this->adminid);
|
||||
$historyarr = $dbs->gethistory($this->adminid);
|
||||
$agentarr = $dbs->getagent($this->adminid);
|
||||
|
||||
$arr['deptjson'] = json_encode($deptarr);
|
||||
$arr['userjson'] = json_encode($userarr);
|
||||
$arr['groupjson'] = json_encode($grouparr);
|
||||
$arr['historyjson'] = json_encode($historyarr);
|
||||
$arr['agentjson'] = json_encode($agentarr);
|
||||
$arr['config'] = $dbs->getreims();
|
||||
$arr['loaddt'] = $this->now;
|
||||
$arr['ip'] = $this->ip;
|
||||
$arr['editpass'] = $dba->iseditpass($this->adminid);
|
||||
$arr['companyinfo'] = $dba->getcompanyinfo($this->adminid, 1);
|
||||
|
||||
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话列表记录
|
||||
*/
|
||||
public function gethistoryAction()
|
||||
{
|
||||
$arr = m('reim')->gethistory($this->adminid);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 最新app读取通信地址
|
||||
*/
|
||||
public function reimconfigAction()
|
||||
{
|
||||
$arr['config'] = m('reim')->getreims();
|
||||
$type = $this->option->getval('reimservertype','0');
|
||||
$appwx = $this->option->getval('reimappwxsystem','0');
|
||||
if($type=='0' || $appwx=='0'){//非nodejs版本就不要
|
||||
$arr['config']['wsurl'] = '';
|
||||
$arr['config']['recid'] = '';
|
||||
}
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机网页版读取,最新webapp的
|
||||
*/
|
||||
public function mwebinitAction()
|
||||
{
|
||||
$dbs = m('reim');
|
||||
$dba = m('admin');
|
||||
$agentarr = $dbs->getappagent($this->adminid);
|
||||
$historyarr = $dbs->gethistory($this->adminid);
|
||||
|
||||
$arr['agentjson'] = json_encode($agentarr['rows']);
|
||||
$arr['historyjson'] = json_encode($historyarr);
|
||||
$arr['loaddt'] = $this->now;
|
||||
$arr['loadtime'] = time();
|
||||
if($historyarr)$arr['loadtime'] = strtotime($historyarr[0]['optdt']);
|
||||
$arr['editpass'] = $dba->iseditpass($this->adminid);
|
||||
$arr['companyinfo'] = $dba->getcompanyinfo($this->adminid, 1);
|
||||
|
||||
|
||||
//读取app首页显示图片,从公告和新闻上读取
|
||||
$arr['myhomenum'] = '';
|
||||
if($this->isshowshouye('appsy_yyshow'))$arr['myhomenum'] = $this->option->getval('yinghomeshow_'.$this->adminid.'');//我常用的
|
||||
|
||||
$silderarr = array();
|
||||
if($this->isshowshouye('appsy_ggshow')){
|
||||
$sildergong = m('flow')->initflow('gong')->getflowrows($this->adminid, 'my', 5, " and `appxs`=1");
|
||||
foreach($sildergong as $k=>$rs){
|
||||
if(isempt($rs['fengmian']))continue;
|
||||
$silderarr[] = array(
|
||||
'src' => $this->rock->gethttppath($rs['fengmian']),
|
||||
'title' => $rs['title'],
|
||||
'url' => 'task.php?a=x&num=gong&mid='.$rs['id'].''
|
||||
);
|
||||
}
|
||||
}
|
||||
if($this->isshowshouye('appsy_xwshow','否')){
|
||||
$sildernews = m('flow')->initflow('news')->getflowrows($this->adminid, 'my', 5, " and `appxs`=1");
|
||||
foreach($sildernews as $k=>$rs){
|
||||
if(isempt($rs['fengmian']))continue;
|
||||
$silderarr[] = array(
|
||||
'src' => $this->rock->gethttppath($rs['fengmian']),
|
||||
'title' => $rs['title'],
|
||||
'url' => 'task.php?a=x&num=news&mid='.$rs['id'].''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$arr['silderarr'] = $silderarr;
|
||||
$arr['outunum'] = $this->option->getval('outunum'.$this->adminid.'');
|
||||
$arr['outgroupopen'] = $this->option->getval('outgroupopen'.$this->adminid.'');
|
||||
$arr['tonghuabo'] = getconfig('video_bool') ? '1' : '2';//是否开启音视频
|
||||
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
private function isshowshouye($lx, $mr='是')
|
||||
{
|
||||
$val = $this->option->getval($lx);
|
||||
if(isempt($val))$val=$mr;
|
||||
return $val=='是';
|
||||
}
|
||||
|
||||
public function ldataAction()
|
||||
{
|
||||
$loaddt = $this->rock->jm->base64decode($this->post('loaddt'));
|
||||
if($loaddt && !c('check')->isdatetime($loaddt))$loaddt='';
|
||||
$type = $this->post('type','history');
|
||||
$dbs = m('reim');
|
||||
$json = array();
|
||||
if($type=='history')$json = $dbs->gethistory($this->adminid, $loaddt);
|
||||
if($type=='group')$json = $dbs->getgroup($this->adminid);
|
||||
if($type=='dept')$json = m('dept')->getdata();
|
||||
if($type=='user')$json = m('admin')->getuser();
|
||||
if($type=='agent')$json = $dbs->getagent($this->adminid);
|
||||
if($type=='config')$json = m('reim')->getreims();
|
||||
|
||||
$arr['json'] = json_encode($json);
|
||||
$arr['loaddt'] = $this->now;
|
||||
$arr['ip'] = $this->ip;
|
||||
$arr['type'] = $type;
|
||||
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
|
||||
public function indexupgetAction()
|
||||
{
|
||||
$historyarr = m('reim')->gethistory($this->adminid);
|
||||
$arr['historyjson'] = json_encode($historyarr);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
public function changewxtxAction()
|
||||
{
|
||||
$tx = (int)$this->post('tx','1');
|
||||
m('admin')->update('wxtx='.$tx.'', $this->adminid);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
public function showmyinfoAction()
|
||||
{
|
||||
$dbs = m('admin');
|
||||
$arr = $dbs->getone($this->adminid,'`id`,`deptallname`,`ranking`,`email`,`tel`,`apptx`,`face`,`name`,`user`,`mobile`');
|
||||
if(!$arr)$this->showreturn('','not user', 201);
|
||||
$arr['face'] = $dbs->getface($arr['face']);
|
||||
$arr['admintoken'] = $this->admintoken;
|
||||
$arr['companyinfo'] = $dbs->getcompanyinfo($this->adminid, 1);
|
||||
$arr['companymode'] = ISMORECOM;
|
||||
if(m('reim')->installwx(3)){
|
||||
$bdwx = m('wouser')->getone('`uid`='.$this->adminid.'','nickname,headimgurl');
|
||||
$arr['bdwx'] = $bdwx;
|
||||
}
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
public function wxbdjcAction()
|
||||
{
|
||||
m('wouser')->update('`uid`=0','`uid`='.$this->adminid.'');
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
//同步微信上头像
|
||||
public function tongbufaceAction()
|
||||
{
|
||||
$reim = m('reim');
|
||||
if($reim->installwx(1)){
|
||||
$barr = m('weixinqy:user')->anayface($this->userrs['user'], true);
|
||||
if($barr['errcode'] != 0)$this->showreturn('',$barr['msg'],202);
|
||||
$this->showreturn($barr);
|
||||
}else{
|
||||
$this->showreturn('','没部署企业微信',201);
|
||||
}
|
||||
}
|
||||
|
||||
public function loadinfoAction()
|
||||
{
|
||||
$type = $this->get('type');
|
||||
$receid = $this->get('receid');
|
||||
$arr = array();
|
||||
if($type=='user'){
|
||||
$arr = m('admin')->getuser(0, $receid);
|
||||
}
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
//判断是否有最新历史信息
|
||||
public function loadhitAction()
|
||||
{
|
||||
$time = $this->get('time');
|
||||
$arr['loadtime'] = $time;
|
||||
$optdt = date('Y-m-d H:i:s', $time);
|
||||
$arr['total'] = 0;
|
||||
$historyarr = m('reim')->gethistory($this->adminid, $optdt);
|
||||
$arr['rows'] = $historyarr;
|
||||
if($historyarr)$arr['loadtime'] = strtotime($historyarr[0]['optdt']);
|
||||
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
//设置常应用
|
||||
public function shecyyAction()
|
||||
{
|
||||
$yynum = $this->get('yynum');
|
||||
$myyyid= $this->option->getval('yinghomeshow_'.$this->adminid.'');
|
||||
$yarrs = array();
|
||||
$iscy = 0;
|
||||
if(isempt($myyyid)){
|
||||
$yarrs[]= $yynum;
|
||||
$iscy = 1;
|
||||
}else{
|
||||
$yarrs = explode(',', $myyyid);
|
||||
if(in_array($yynum, $yarrs)){
|
||||
$iscy = 0;
|
||||
foreach($yarrs as $k1=>$v1)if($v1==$yynum)unset($yarrs[$k1]);
|
||||
}else{
|
||||
$iscy = 1;
|
||||
$yarrs[]= $yynum;
|
||||
}
|
||||
}
|
||||
$myyyid = join(',', $yarrs);
|
||||
$this->option->setval('yinghomeshow_'.$this->adminid.'', $myyyid);
|
||||
$msg = '已设置首页显示';
|
||||
if($iscy==0)$msg = '已取消首页显示';
|
||||
$this->showreturn(array(
|
||||
'iscy' => $iscy,
|
||||
'msg' => $msg,
|
||||
));
|
||||
}
|
||||
|
||||
public function openoutqunAction()
|
||||
{
|
||||
$isop = $this->get('isop');
|
||||
$this->option->setval('outgroupopen'.$this->adminid.'', $isop);
|
||||
return returnsuccess();
|
||||
}
|
||||
}
|
||||
54
webmain/task/api/kaoqinAction.php
Normal file
54
webmain/task/api/kaoqinAction.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
class kaoqinClassAction extends apiAction
|
||||
{
|
||||
public function adddkjlAction()
|
||||
{
|
||||
$mac = $this->post('mac');
|
||||
$ip = $this->post('ip');
|
||||
$msg = m('kaoqin')->adddkjl($this->adminid,0,'',$ip,$mac);
|
||||
if($msg!='')$this->showreturn('', $msg, 201);
|
||||
$this->showreturn($this->now);
|
||||
}
|
||||
|
||||
public function getshangAction()
|
||||
{
|
||||
$kq = m('kaoqin');
|
||||
$dt = $this->rock->date;
|
||||
$sbarr = $kq->getsbanay($this->adminid, $dt);
|
||||
$dkarr = $kq->getdkjl($this->adminid, $dt);
|
||||
$barr['sbarr'] = $sbarr;
|
||||
$barr['dkarr'] = $dkarr;
|
||||
|
||||
$this->showreturn($barr);
|
||||
}
|
||||
|
||||
public function getpaibAction()
|
||||
{
|
||||
$barr = array();
|
||||
$month = $this->get('month');
|
||||
$uid = $this->get('uid', $this->adminid);
|
||||
|
||||
$maxjg = c('date')->getmaxdt($month);
|
||||
$kqobj = m('kaoqin');
|
||||
$ztarr = array();
|
||||
for($i=1;$i<=$maxjg;$i++){
|
||||
$oi = ($i<10) ? '0'.$i.'' : $i;
|
||||
$dt = $month.'-'.$oi;
|
||||
$zt = '';
|
||||
$iswork = $kqobj->isworkdt($uid, $dt);
|
||||
if($iswork==1){
|
||||
$zt = $kqobj->getdistid($uid, $dt);
|
||||
if(!in_array($zt, $ztarr))$ztarr[] = $zt;
|
||||
}
|
||||
$barr[$dt] = $zt;
|
||||
}
|
||||
$abc = '其中:';
|
||||
if($ztarr){
|
||||
$rows = m('kqsjgz')->getall('id in('.join(',', $ztarr).')');
|
||||
foreach($rows as $k=>$rs)$abc.='['.$rs['id'].']'.$rs['name'].';';
|
||||
}
|
||||
$barr['abc'] = $abc;
|
||||
|
||||
$this->showreturn($barr);
|
||||
}
|
||||
}
|
||||
271
webmain/task/api/loginAction.php
Normal file
271
webmain/task/api/loginAction.php
Normal file
@@ -0,0 +1,271 @@
|
||||
<?php
|
||||
class loginClassAction extends apiAction
|
||||
{
|
||||
public function checkAction()
|
||||
{
|
||||
$adminuser = str_replace(' ','',$this->rock->jm->base64decode($this->post('user')));
|
||||
$adminpass = $this->rock->jm->base64decode($this->post('pass'));
|
||||
$arr = m('login')->start($adminuser, $adminpass);
|
||||
if(is_array($arr)){
|
||||
|
||||
if(isset($arr['mobile'])){
|
||||
$this->showreturn($arr, $arr['msg'], 205);
|
||||
}
|
||||
|
||||
$arrs = array(
|
||||
'uid' => $arr['uid'],
|
||||
'name' => $arr['name'],
|
||||
'user' => $arr['user'],
|
||||
'ranking' => $arr['ranking'],
|
||||
'deptname' => $arr['deptname'],
|
||||
'deptallname' => $arr['deptallname'],
|
||||
'face' => $arr['face'],
|
||||
'apptx' => $arr['apptx'],
|
||||
'loginyzm' => (int)getconfig('loginyzm','0'),
|
||||
'token' => $arr['token'],
|
||||
'iskq' => (int)m('userinfo')->getmou('iskq', $arr['uid']), //判断是否需要考勤
|
||||
'title' => getconfig('apptitle'),
|
||||
'weblogo' => getconfig('weblogo')
|
||||
);
|
||||
|
||||
$uid = $arr['uid'];
|
||||
$name = $arr['name'];
|
||||
$user = $arr['user'];
|
||||
$token = $arr['token'];
|
||||
m('login')->setsession($uid, $name, $token, $user);
|
||||
$this->showreturn($arrs);
|
||||
}else{
|
||||
$this->showreturn('', $arr, 201);
|
||||
}
|
||||
}
|
||||
|
||||
public function loginexitAction()
|
||||
{
|
||||
m('login')->exitlogin('', $this->token);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
/**
|
||||
* app登录页面初始化
|
||||
*/
|
||||
public function appinitAction()
|
||||
{
|
||||
$arrs = array(
|
||||
'loginyzm' => (int)getconfig('loginyzm','0'),
|
||||
'title' => getconfig('apptitle'),
|
||||
'apptheme' => getconfig('apptheme'),
|
||||
'titleall' => TITLE,
|
||||
'regtype' => getconfig('regtype','0'), //是否可注册1,可注册
|
||||
);
|
||||
|
||||
$this->showreturn($arrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载图片
|
||||
*/
|
||||
public function downimgAction()
|
||||
{
|
||||
$paths= $this->getvals('path');
|
||||
$path = str_replace(URL, '', $paths);
|
||||
$obj = c('upfile');
|
||||
$str = '';
|
||||
$ext = $obj->getext($path);
|
||||
if($obj->isimg($ext) && file_exists($path)){
|
||||
$str = base64_encode(file_get_contents($path));
|
||||
}
|
||||
$this->showreturn(array(
|
||||
'result' => $str,
|
||||
'path' => $paths
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载图片新
|
||||
*/
|
||||
public function downimgnewAction()
|
||||
{
|
||||
$paths= urldecode($this->get('path'));
|
||||
$path = str_replace(URL, '', $paths);
|
||||
$obj = c('upfile');
|
||||
$str = '';
|
||||
$ext = $obj->getext($path);
|
||||
if($obj->isimg($ext) && (file_exists($path) || substr($path,0,4)=='http')){
|
||||
$str = base64_encode(file_get_contents($path));
|
||||
}
|
||||
$this->showreturn(array(
|
||||
'result' => $str,
|
||||
'path' => $paths
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取可上传最大M
|
||||
*/
|
||||
public function getmaxupAction()
|
||||
{
|
||||
$maxup = c('upfile')->getmaxzhao();
|
||||
$this->showreturn(array(
|
||||
'maxup' => $maxup
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 钉钉jssdk签名
|
||||
*/
|
||||
public function ddsignAction()
|
||||
{
|
||||
$bo = m('dingding:signjssdk');
|
||||
$corpId = $bo->readwxset();
|
||||
$agentid= $this->post('agentid');
|
||||
if(isempt($agentid))$agentid = $this->rock->session('wxqyagentid');
|
||||
if(isempt($corpId) || isempt($agentid)){
|
||||
$arr['corpId'] = '';
|
||||
}else{
|
||||
$url = $this->getvals('url');
|
||||
$arr = $bo->getsignsdk($url);
|
||||
$arr['agentId'] = $agentid;
|
||||
}
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取钉钉企业Id
|
||||
*/
|
||||
public function ddqiyeidAction()
|
||||
{
|
||||
$this->showreturn(array(
|
||||
'qiyeid' => $this->option->getval('dingding_qiyeid')
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 钉钉获取登录
|
||||
*/
|
||||
public function dingcheckAction()
|
||||
{
|
||||
$code = $this->post('code');
|
||||
$barr = m('dingding:user')->getuserjssdk($code);
|
||||
if($barr['errcode']!=0){
|
||||
$this->showreturn('', $barr['msg'], 201);
|
||||
}else{
|
||||
$this->showreturn($barr);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化验证
|
||||
public function initsetAction()
|
||||
{
|
||||
$call = $this->get('callback');
|
||||
$barr['title'] = getconfig('reimtitle','REIM');
|
||||
$barr['stype'] = 'new';
|
||||
$barr['version']= VERSION;
|
||||
echo ''.$call.'('.json_encode($barr).')';
|
||||
}
|
||||
|
||||
public function inauthAction()
|
||||
{
|
||||
$call = $this->get('callback');
|
||||
$barr['host'] = HOST;
|
||||
echo ''.$call.'('.json_encode($barr).')';
|
||||
}
|
||||
|
||||
|
||||
public function getewmAction()
|
||||
{
|
||||
$randkey = $this->get('randkey');
|
||||
if(isempt($randkey))return;
|
||||
$dfrom = $this->get('dfrom');
|
||||
$key = md5($randkey);
|
||||
c('cache')->set($key,'-2',70);
|
||||
|
||||
header("Content-type:image/png");
|
||||
$url = ''.getconfig('outurl', URL).'?m=logn&d=we&randkey='.$key.'&dfrom='.$dfrom.'';
|
||||
if(COMPANYNUM)$url.='&dwnum='.COMPANYNUM.'';
|
||||
$img = c('qrcode')->show($url);
|
||||
echo $img;
|
||||
}
|
||||
public function checkewmAction()
|
||||
{
|
||||
$randkey = $this->get('randkey');
|
||||
$key = md5($randkey);
|
||||
$val = c('cache')->get($key);
|
||||
|
||||
$data['val'] = $val;
|
||||
if(isempt($randkey))$this->showreturn($data);
|
||||
if($val>'0'){
|
||||
$dbs = m('admin');
|
||||
$urs = $dbs->getone("`id`='$val' and `status`=1",'`id`,`name`,`user`,`face`,`pass`');
|
||||
if(!$urs){
|
||||
$val = '-1';
|
||||
}else{
|
||||
c('cache')->set('login'.$urs['user'].'', $urs['id'], 60);
|
||||
$data['user'] = $urs['user'];
|
||||
$data['face'] = $dbs->getface($urs['face']);
|
||||
$data['pass'] = md5($urs['pass']);
|
||||
c('cache')->del($key);
|
||||
}
|
||||
}
|
||||
$data['val'] = $val;
|
||||
$this->showreturn($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建二维码
|
||||
*/
|
||||
public function ewmAction()
|
||||
{
|
||||
header("Content-type:image/png");
|
||||
$url = $this->jm->base64decode($this->get('url'));
|
||||
if(substr($url,0,4)!='http')$url =''.$this->rock->getouturl().''.$url.'';
|
||||
$img = c('qrcode')->show($url);
|
||||
echo $img;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安卓检查是否有app更新
|
||||
*/
|
||||
public function appupdateAction()
|
||||
{
|
||||
$nowver = getconfig('app_version');//app的版本
|
||||
$ver = $this->get('ver');
|
||||
$barr['success'] = false;
|
||||
$path = getconfig('app_verpath','images/app.apk');//app文件版本
|
||||
if(!isempt($nowver) && file_exists($path) && $ver<$nowver){
|
||||
$barr['success'] = true;
|
||||
$barr['version'] = $nowver;
|
||||
$barr['size'] = '3.2M';
|
||||
$barr['updateurl'] = ''.URL.''.$path.'';
|
||||
$barr['explain'] = getconfig('app_verremark','完善推送功能');
|
||||
}
|
||||
echo json_encode($barr);
|
||||
}
|
||||
|
||||
/**
|
||||
* reim平台快捷登录到oa
|
||||
*/
|
||||
public function reimplatloginAction()
|
||||
{
|
||||
return m('reimplat:oauth')->login();
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证小程序地址
|
||||
*/
|
||||
public function yzxcyAction()
|
||||
{
|
||||
$openid = $this->get('openid');
|
||||
$mobile = $this->get('mobile');
|
||||
if(!$openid || !$mobile)return returnerror('err');
|
||||
$mobile = $this->jm->base64decode($mobile);
|
||||
$where = "`mobile`='$mobile'";
|
||||
if(m('admin')->rows($where)==0 && m('customer')->rows($where)==0 )return retuenerror('此手机号没在我们系统登记过');
|
||||
$na = getconfig('titleout');
|
||||
if(!$na)$na = TITLE;
|
||||
return returnsuccess(array(
|
||||
'name' => $na,
|
||||
'key' => md5(getconfig('openkey')),
|
||||
'logo' => 'images/logo.png'
|
||||
));
|
||||
}
|
||||
}
|
||||
372
webmain/task/api/reimAction.php
Normal file
372
webmain/task/api/reimAction.php
Normal file
@@ -0,0 +1,372 @@
|
||||
<?php
|
||||
class reimClassAction extends apiAction
|
||||
{
|
||||
/**
|
||||
* 获取聊天记录
|
||||
*/
|
||||
public function getrecordAction()
|
||||
{
|
||||
$uid = $this->adminid;
|
||||
$type = $this->post('type');
|
||||
$gid = (int)$this->post('gid');
|
||||
$minid = (int)$this->post('minid');
|
||||
$lastdt = (int)$this->post('lastdt');
|
||||
$lastdts = '';
|
||||
if($lastdt>0)$lastdts = date('Y-m-d H:i:s', $lastdt);
|
||||
$arr = m('reim')->getrecord($type, $uid, $gid, $minid, $lastdts);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话的信息
|
||||
*/
|
||||
public function getreceinforAction()
|
||||
{
|
||||
$uid = $this->adminid;
|
||||
$type = $this->post('type');
|
||||
$gid = (int)$this->post('gid');
|
||||
$reimdb = m('reim');
|
||||
$arr['receinfor'] = $reimdb->getreceinfor($type, $gid);
|
||||
$reimdb->setallyd($type, $uid, $gid);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发消息
|
||||
*/
|
||||
public function sendinforAction()
|
||||
{
|
||||
$uid = $this->adminid;
|
||||
$type = $this->post('type');
|
||||
$gid = (int)$this->post('gid');
|
||||
$lx = 0;
|
||||
if($this->cfrom=='reim')$lx=1;
|
||||
if($type=='group'){
|
||||
$tos = m('im_groupuser')->rows("`gid`='$gid' and `uid`='$uid'");
|
||||
if($tos==0)$this->showreturn('','您不在此会话中,不允许发送', 201);
|
||||
}
|
||||
|
||||
$cont = $this->post('cont');
|
||||
$cont = $this->jm->base64decode($cont);
|
||||
$cont = str_replace('<br>','[BR]', $cont);
|
||||
$cont = str_replace(array('<','>'),array('<','>'), $cont);
|
||||
$cont = $this->jm->base64encode(str_replace('[BR]','<br>',$cont));
|
||||
|
||||
$arr = m('reim')->sendinfor($type, $uid, $gid, array(
|
||||
'optdt' => $this->now,
|
||||
'cont' => $cont,
|
||||
'fileid'=> (int)$this->post('fileid')
|
||||
), $lx);
|
||||
$arr['sendname'] = $this->adminname;
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 标识已读
|
||||
*/
|
||||
public function yiduAction()
|
||||
{
|
||||
$id = $this->post('id');
|
||||
m('reim')->setyd($id, $this->adminid);
|
||||
$this->showreturn($id);
|
||||
}
|
||||
|
||||
//将会话标识已读
|
||||
public function yiduallAction()
|
||||
{
|
||||
$type = $this->post('type');
|
||||
$gid = (int)$this->post('gid');
|
||||
m('reim')->setallyd($type, $this->adminid, $gid);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建讨论组
|
||||
*/
|
||||
public function createtaolunAction()
|
||||
{
|
||||
$name = $this->post('title');
|
||||
$explain= $this->post('content');
|
||||
$receid = $this->post('receid');
|
||||
if($name==''||$receid=='')$this->showreturn('','not data',201);
|
||||
$arr = m('reim')->creategroup($name, $receid.','.$this->adminid, 1, $explain);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会话上人员
|
||||
*/
|
||||
public function getgroupuserAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$type = $this->post('type');
|
||||
$arr = m('reim')->getgroupuser($gid, $type);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载聊天记录
|
||||
*/
|
||||
public function downrecordAction()
|
||||
{
|
||||
$minid = floatval($this->post('minid','999999999'));
|
||||
$maxid = floatval($this->post('maxid','0'));
|
||||
$arr = m('reim')->downrecord($this->adminid, $maxid, $minid);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除历史会话
|
||||
*/
|
||||
public function delhistoryAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$type = $this->post('type');
|
||||
$arr = m('reim')->delhistory($type,$gid,$this->adminid);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
//邀请人员
|
||||
public function yaoqinguidAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$val = $this->post('val');
|
||||
$ids = m('reim')->adduserchat($gid, $val, true);
|
||||
$msg = 'success'.$ids.'';
|
||||
$this->showreturn($msg);
|
||||
}
|
||||
|
||||
//修改会话名称
|
||||
public function editnameAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$val = $this->post('val');
|
||||
if(isempt($val))return returnerror('不能为空');
|
||||
m('reim')->editname($gid, $val);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
//邀请人员
|
||||
public function yaoqingnameAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$val = $this->post('val');
|
||||
if(isempt($val))return returnerror('不能为空');
|
||||
$urs = m('admin')->geturs($val);
|
||||
if(!$urs)return returnerror('“'.$val.'”不存在');
|
||||
$uids = ''.$urs['id'].'';
|
||||
$ids = m('reim')->adduserchat($gid, $uids, true);
|
||||
$msg = 'success'.$ids.'';
|
||||
$this->showreturn('ok');
|
||||
}
|
||||
|
||||
//退出讨论组
|
||||
public function exitgroupAction()
|
||||
{
|
||||
$aid = (int)$this->post('aid');
|
||||
if($aid==0)$aid = $this->adminid;
|
||||
$gid = (int)$this->post('gid');
|
||||
m('reim')->exitchat($gid, $aid);
|
||||
$this->showreturn('success');
|
||||
}
|
||||
|
||||
public function createlunAction()
|
||||
{
|
||||
$val = $this->getvals('val');
|
||||
$isadd = m('view')->isadd('huihua', $this->adminid);
|
||||
if(!$isadd)return returnerror('无权限创建会话');
|
||||
m('reim')->createchat($val, $this->adminid,$this->adminid, $this->adminname,'', true);
|
||||
$this->showreturn('success');
|
||||
}
|
||||
|
||||
//清除历史记录
|
||||
public function clearrecordAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$type = $this->post('type');
|
||||
$ids = c('check')->onlynumber($this->post('ids'));
|
||||
$day = (int)$this->post('day');
|
||||
$arr = m('reim')->clearrecord($type,$gid,$this->adminid, $ids, $day);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
//上传头像
|
||||
public function changefaceAction()
|
||||
{
|
||||
$fid = (int)$this->post('id');
|
||||
$uid = $this->adminid;
|
||||
$face = m('admin')->changeface($uid, $fid);
|
||||
if(!$face)$this->showreturn('','fail changeface',201);
|
||||
$this->showreturn($face);
|
||||
}
|
||||
|
||||
//下载文件
|
||||
public function downfileAction()
|
||||
{
|
||||
$id = (int)$this->post('id');
|
||||
m('file')->download($id);
|
||||
}
|
||||
|
||||
//修改会话头像
|
||||
public function editfaceAction()
|
||||
{
|
||||
$gid = (int)$this->get('gid');
|
||||
$fileid = (int)$this->get('fileid');
|
||||
if($gid<=0)return returnerror('error');
|
||||
m('reim')->editface($gid, $fileid);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件转发发送给对应人员
|
||||
*/
|
||||
public function forwardAction()
|
||||
{
|
||||
$fid = (int)$this->post('fileid');
|
||||
$tuid= $this->post('tuid');
|
||||
$msg = m('reim')->forward($tuid, 'user', $this->post('cont'), $fid);
|
||||
if($msg!='ok')$this->showreturn('', $msg, 201);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 消息撤回
|
||||
*/
|
||||
public function chehuimessAction()
|
||||
{
|
||||
$gid = (int)$this->post('gid');
|
||||
$type = $this->post('type');
|
||||
$ids = (int)$this->post('ids');
|
||||
$barr = m('reim')->chehuimess($type, $gid, $ids);
|
||||
if(is_array($barr))$this->showreturn($barr);
|
||||
$this->showreturn('', $barr, 201);
|
||||
}
|
||||
|
||||
public function saveoutunumAction()
|
||||
{
|
||||
$unum = $this->get('unum');
|
||||
$num = 'outunum'.$this->adminid.'';
|
||||
$this->option->setval($num, $unum);
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收藏使用
|
||||
*/
|
||||
public function savestarAction()
|
||||
{
|
||||
$content = $this->post('content');
|
||||
$kev = $this->post('kev');
|
||||
$id = (int)$this->post('id','0');
|
||||
$num = 'reimstar_'.$this->adminid.'';
|
||||
$this->option->setval($num,'收藏消息');
|
||||
$pid = $this->option->getpids($num);
|
||||
$snum = ''.$num.'_'.$kev.'';
|
||||
$sid = $this->option->getpids($snum);
|
||||
if($sid>0)$id = $sid;
|
||||
$uarr = array(
|
||||
'value' => $content,
|
||||
'pid' => $pid,
|
||||
'num' => $snum,
|
||||
'optdt' => $this->now,
|
||||
'optid' => $this->adminid,
|
||||
);
|
||||
if($id==0){
|
||||
$id = $this->option->insert($uarr);
|
||||
}else{
|
||||
$this->option->update($uarr, $id);
|
||||
}
|
||||
|
||||
return returnsuccess(array(
|
||||
'id' => $id
|
||||
));
|
||||
}
|
||||
|
||||
public function getstarAction()
|
||||
{
|
||||
$num = 'reimstar_'.$this->adminid.'';
|
||||
$pid = $this->option->getpids($num);
|
||||
$data = $this->option->getall('`pid`='.$pid.'','id,value','optdt desc');
|
||||
return returnsuccess($data);
|
||||
}
|
||||
|
||||
public function delstarAction()
|
||||
{
|
||||
$id = (int)$this->get('id');
|
||||
$this->option->delete('`id`='.$id.' and `optid`='.$this->adminid.'');
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
public function rockkefuAction()
|
||||
{
|
||||
$barr = c('rockkefu')->getdata('openkefu','exists', array(
|
||||
'user' => $this->userrs['user']
|
||||
));
|
||||
$msg = 'err';
|
||||
if($barr['success'])$msg='ok';
|
||||
return returnsuccess($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取消息情况
|
||||
*/
|
||||
public function getxqkkdAction()
|
||||
{
|
||||
$barr = array();
|
||||
$id = (int)$this->get('id');
|
||||
$mrs = m('im_mess')->getone($id);
|
||||
$type = $mrs['type'];
|
||||
$receuid = $mrs['receuid'];
|
||||
$recearr = explode(',', $receuid);
|
||||
//$barr['mrs'] = $mrs;
|
||||
$yiduids = '';
|
||||
$widuids = '';
|
||||
if($type=='user'){
|
||||
if($mrs['zt']==1){
|
||||
$yiduids = $mrs['receid'];
|
||||
}else{
|
||||
$widuids = $mrs['receid'];
|
||||
}
|
||||
}else{
|
||||
$rows = m('im_messzt')->getall('mid='.$id.'');
|
||||
foreach($rows as $k=>$rs)$widuids.=','.$rs['uid'].'';
|
||||
if($widuids){
|
||||
$widuids = substr($widuids, 1);
|
||||
$widuar = explode(',', $widuids);
|
||||
foreach($recearr as $sid)if(!in_array($sid, $widuar))$yiduids.=','.$sid.'';
|
||||
if($yiduids)$yiduids = substr($yiduids, 1);
|
||||
}else{
|
||||
$yiduids = $receuid;
|
||||
}
|
||||
}
|
||||
$ydarr = $wdarr = array();
|
||||
$dbs = m('admin');
|
||||
if($yiduids){
|
||||
$rows = $dbs->getall('`id` in('.$yiduids.')','name,face,id','sort asc');
|
||||
foreach($rows as $k=>$rs){
|
||||
$ydarr[] = array(
|
||||
'name' => $rs['name'],
|
||||
'id' => $rs['id'],
|
||||
'face' => $dbs->getface($rs['face']),
|
||||
);
|
||||
}
|
||||
}
|
||||
if($widuids){
|
||||
$rows = $dbs->getall('`id` in('.$widuids.')','name,face,id','sort asc');
|
||||
foreach($rows as $k=>$rs){
|
||||
$wdarr[] = array(
|
||||
'name' => $rs['name'],
|
||||
'id' => $rs['id'],
|
||||
'face' => $dbs->getface($rs['face']),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$barr['ydarr'] = $ydarr;
|
||||
$barr['wdarr'] = $wdarr;
|
||||
return returnsuccess($barr);
|
||||
}
|
||||
}
|
||||
63
webmain/task/api/reimplatAction.php
Normal file
63
webmain/task/api/reimplatAction.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* 作者:信呼开发团队(雨中磐石)
|
||||
* 官网:http://www.rockoa.com
|
||||
* 软件:信呼OA
|
||||
* REIM即使通信平台回调
|
||||
*/
|
||||
class reimplatClassAction extends apiAction{
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
$this->display= false;
|
||||
}
|
||||
|
||||
//平台上通知过来的数据
|
||||
public function indexAction()
|
||||
{
|
||||
return 'success'; //这个用不到就直接返回了
|
||||
$body = $this->getpostdata();
|
||||
if(!$body)return;
|
||||
$db = m('reimplat:dept');
|
||||
$key = $db->gethkey();
|
||||
$bodystr = $this->jm->strunlook($body, $key);
|
||||
if(!$bodystr)return;
|
||||
|
||||
$data = json_decode($bodystr, true);
|
||||
$msgtype = arrvalue($data,'msgtype');
|
||||
$msgevent= arrvalue($data,'msgevent');
|
||||
|
||||
//用户状态改变停用
|
||||
if($msgtype=='subscribe'){
|
||||
$user = arrvalue($data, 'user');
|
||||
$zt = '0';
|
||||
if($msgevent=='yes')$zt = '1';
|
||||
if($msgevent=='stop')$zt = '2';
|
||||
$db->update('`status`='.$zt.'',"`user`='$user'");
|
||||
}
|
||||
|
||||
//修改手机号
|
||||
if($msgtype=='editmobile'){
|
||||
$user = arrvalue($data, 'user');
|
||||
$mobile = arrvalue($data, 'mobile');
|
||||
$where = "`user`='$user'";
|
||||
$upstr = "`mobile`='$mobile'";
|
||||
$db->update($upstr, $where);
|
||||
$dbs = m('admin');
|
||||
$dbs->update($upstr,$where);
|
||||
$uid = $dbs->getmou('id',$where);
|
||||
m('userinfo')->update($upstr,"`id`='$uid'");
|
||||
}
|
||||
|
||||
//修改密码
|
||||
if($msgtype=='editpass'){
|
||||
$user = arrvalue($data, 'user');
|
||||
$pass = arrvalue($data, 'pass');
|
||||
if($pass && $user){
|
||||
$where = "`user`='$user'";
|
||||
$mima = md5($pass);
|
||||
m('admin')->update("`pass`='$mima',`editpass`=`editpass`+1", $where);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
webmain/task/api/scheduleAction.php
Normal file
18
webmain/task/api/scheduleAction.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* 【文档】记事接口
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (www.rockoa.com)
|
||||
* Date:2016-08-12
|
||||
*/
|
||||
class scheduleClassAction extends apiAction
|
||||
{
|
||||
public function getlistAction()
|
||||
{
|
||||
$startdt = $this->post('startdt');
|
||||
$enddt = $this->post('enddt');
|
||||
$arr = m('schedule')->getlistdata($this->adminid, $startdt, $enddt);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
}
|
||||
167
webmain/task/api/tonghuaAction.php
Normal file
167
webmain/task/api/tonghuaAction.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
class tonghuaClassAction extends apiAction
|
||||
{
|
||||
/**
|
||||
* 通话初始化
|
||||
*/
|
||||
public function thinitAction()
|
||||
{
|
||||
if(!getconfig('video_bool'))return returnerror('系统未开启音视频');
|
||||
$id = (int)$this->get('id');
|
||||
$type = (int)$this->get('type');
|
||||
if($id==$this->adminid)return returnerror('不能和自己通话');
|
||||
$nowtime = strtotime($this->now);
|
||||
|
||||
//判断用户有没有在线
|
||||
$gbarr = m('reim')->pushserver('getonline', array(
|
||||
'onlineid' => $id
|
||||
));
|
||||
if(!$gbarr)return returnerror('没有服务端');
|
||||
if(!$gbarr['success'])return $gbarr;
|
||||
$ondats = json_decode(arrvalue($gbarr,'data'), true);
|
||||
$online = false;
|
||||
if($ondats){
|
||||
if($ondats['pc']==$id)$online = true;
|
||||
if($ondats['app']==$id)$online = true;
|
||||
}
|
||||
|
||||
if(!$online){
|
||||
$to = m('login')->rows('`uid`='.$id.' and `online`=1 and `ispush`=1');
|
||||
if($to==0)return returnerror('对方不在线,无法通话');
|
||||
}
|
||||
|
||||
$barr = c('xinhuapi')->getdata('tonghua','thinit', array('faid'=>$this->adminid,'nowtime'=>$nowtime,'toid'=>$id,'type'=>$type));
|
||||
if(!$barr['success'])return $barr;
|
||||
$data = $barr['data'];
|
||||
$key = $data['channel'];
|
||||
c('cache')->set($key, $data, 60);
|
||||
|
||||
//保存自己通话里面
|
||||
m('im_tonghua')->insert(array(
|
||||
'uid' => $this->adminid,
|
||||
'faid' => $this->adminid,
|
||||
'channel' =>$data['channel'],
|
||||
'type' =>$data['type'],
|
||||
'joinids' =>$id,
|
||||
'adddt' =>$this->now,
|
||||
));
|
||||
|
||||
//异步发送
|
||||
c('rockqueue')->push('tonghua,call', array('key' => $key,'cishu'=>1));
|
||||
|
||||
return $barr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 取消呼叫
|
||||
*/
|
||||
public function cancelAction()
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$state = (int)$this->get('state','3');
|
||||
m('im_tonghua')->update('`state`='.$state.'',"`channel`='$channel'");
|
||||
$barr = c('rockqueue')->push('tonghua,cancel', array('key' => $channel));
|
||||
if(!$barr['success'])return $barr;
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 接电话了(1同意,2拒绝,3取消,4接受者已打开页面,5呼叫超过30秒无人接听)
|
||||
*/
|
||||
public function jieAction()
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$state = (int)$this->get('state','2');
|
||||
$dbs = m('im_tonghua');
|
||||
$onrs = $dbs->getone("`channel`='$channel'");
|
||||
$satype = '';
|
||||
if(!$onrs)$satype = '通话不存在';
|
||||
if($onrs && ($onrs['state']=='3' || $onrs['state']=='5'))$satype = '对方已取消';
|
||||
if(!$satype){
|
||||
$nowtime = strtotime($this->now);
|
||||
$upstsr = '`state`='.$state.'';
|
||||
if($state==1)$upstsr.=",`jiedt`='$this->now'";
|
||||
$dbs->update($upstsr,"`channel`='$channel'");
|
||||
$barr = c('rockqueue')->push('tonghua,jie', array('key'=>$channel,'nowtime'=>$nowtime,'uid'=>$this->adminid,'state'=>$state));
|
||||
if(!$barr['success'])return $barr;
|
||||
}
|
||||
return returnsuccess(array(
|
||||
'satype' => $satype
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 接通
|
||||
*/
|
||||
public function jietongAction()
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$barr = c('xinhuapi')->getdata('tonghua','jietong', array('uid'=>$this->adminid,'channel'=>$channel));
|
||||
if($barr['success']){
|
||||
$bars = $this->jieAction();
|
||||
if(!$bars['success'])return $bars;
|
||||
$datas= $bars['data'];
|
||||
foreach($datas as $k=>$v)$barr['data'][$k] = $v;
|
||||
}
|
||||
return $barr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 结束通话
|
||||
*/
|
||||
public function jiesuAction()
|
||||
{
|
||||
$nowtime = strtotime($this->now);
|
||||
$channel = $this->get('channel');
|
||||
$toid = (int)$this->get('toid');
|
||||
c('rockqueue')->push('tonghua,jiesu', array('uid'=>$this->adminid,'toid'=>$toid,'nowtime'=>$nowtime,'channel'=>$channel));
|
||||
m('im_tonghua')->update("`enddt`='$this->now',`jieid`='$this->adminid'","`channel`='$channel'");
|
||||
return returnsuccess();
|
||||
}
|
||||
|
||||
/**
|
||||
* 接受者打开了界面
|
||||
*/
|
||||
public function receopenAction()
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$where = "`channel`='$channel'";
|
||||
$dbs = m('im_tonghua');
|
||||
$dbs->update('`state`=4', $where);
|
||||
$thrs = $dbs->getone($where);
|
||||
$sytime = time()-strtotime($thrs['adddt']);
|
||||
return returnsuccess(array(
|
||||
'sytime' => $sytime
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 时时读取状态
|
||||
*/
|
||||
public function stateAction()
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$onrs = m('im_tonghua')->getone("`channel`='$channel'");
|
||||
$tayar = array('','tongyi','jujue','cancel','wait','cancel');
|
||||
|
||||
return returnsuccess(array(
|
||||
'state' => arrvalue($tayar, $onrs['state'])
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断通话是不是结束
|
||||
*/
|
||||
public function statethAction()
|
||||
{
|
||||
$channel = $this->get('channel');
|
||||
$onrs = m('im_tonghua')->getone("`channel`='$channel'");
|
||||
$state = 'wu';
|
||||
if($onrs && !isempt($onrs['enddt']))$state = 'jiesu';
|
||||
|
||||
return returnsuccess(array(
|
||||
'state' => $state
|
||||
));
|
||||
}
|
||||
}
|
||||
526
webmain/task/api/uploadAction.php
Normal file
526
webmain/task/api/uploadAction.php
Normal file
@@ -0,0 +1,526 @@
|
||||
<?php
|
||||
class uploadClassAction extends apiAction
|
||||
{
|
||||
/**
|
||||
* 上传文件
|
||||
*/
|
||||
public function upfileAction()
|
||||
{
|
||||
if(!$_FILES)exit('sorry!');
|
||||
$upimg = c('upfile');
|
||||
$maxsize= (int)$this->get('maxsize', $upimg->getmaxzhao());//上传最大M
|
||||
$uptypes= '*';
|
||||
$updir = $this->get('updir');
|
||||
if(isempt($updir)){
|
||||
$updir=date('Y-m');
|
||||
}else{
|
||||
$updir=str_replace(array(' ','.'),'', trim($updir));
|
||||
$updir=str_replace('{month}',date('Y-m'), $updir);
|
||||
$updir=str_replace('{Year}',date('Y'), $updir);
|
||||
$updir=str_replace(array('{','}'),'', $updir);
|
||||
$updir=str_replace(',','|', $updir);
|
||||
}
|
||||
$upimg->initupfile($uptypes, ''.UPDIR.'|'.$updir.'', $maxsize);
|
||||
$upses = $upimg->up('file');
|
||||
if(!is_array($upses))exit($upses);
|
||||
$arr = c('down')->uploadback($upses);
|
||||
$arr['autoup'] = getconfig('qcloudCos_autoup') ? 1 : 0; //是否上传其他平台
|
||||
$this->returnjson($arr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这个是用来在线编辑文档上传的
|
||||
*/
|
||||
public function upfilevbAction()
|
||||
{
|
||||
$fileid = (int)$this->get('fileid','0');
|
||||
if($fileid==0)exit('fileid=0');
|
||||
$data = $this->getpostdata();
|
||||
if(isempt($data))return '没有数据';
|
||||
$fileext= $this->get('fileext');
|
||||
$uptype = '|doc|docx|xls|xlsx|ppt|pptx|';
|
||||
if(!contain($uptype,'|'.$fileext.'|'))$fileext='doc';
|
||||
$fileobj = m('file');
|
||||
$frs = $fileobj->getone($fileid); //记录
|
||||
if(!$frs)exit('文件记录不存在了');
|
||||
|
||||
$frs['oldfilepath'] = $frs['filepath'];
|
||||
$filename = $frs['filename'];
|
||||
if(!contain($filename, '.'.$fileext.'')){
|
||||
$filename = str_replace(array('.doc','.xls','.ppt'), '.'.$fileext.'', $filename);
|
||||
}
|
||||
|
||||
$filepath = ''.UPDIR.'/'.date('Y-m').'/'.date('d_His').''.rand(10,99).'.'.$fileext.'';
|
||||
$this->rock->createtxt($filepath, base64_decode($data));
|
||||
|
||||
$filesize = filesize($filepath);
|
||||
$filesizecn = $this->rock->formatsize($filesize);
|
||||
|
||||
//更新文件
|
||||
$fileobj->update(array(
|
||||
'filename' => $filename,
|
||||
'filepath' => $filepath,
|
||||
'filenum' => '',
|
||||
'filesize' => $filesize,
|
||||
'filesizecn' => $filesizecn,
|
||||
'fileext' => $fileext,
|
||||
'pdfpath' => '',
|
||||
),$fileid);
|
||||
c('cache')->del('filetopdf'.$fileid.'');
|
||||
|
||||
//【弃用】发队列自动上传到信呼文件平台
|
||||
if(getconfig('autoup_toxinhudoc')){
|
||||
//c('rockqueue')->sendfile($fileid);
|
||||
}
|
||||
//上传到腾讯存储
|
||||
if(getconfig('qcloudCos_autoup')){
|
||||
c('rockqueue')->sendfile($fileid);
|
||||
}
|
||||
|
||||
//告诉上传人说编辑了他的附件
|
||||
$mknums = arrvalue($frs,'mknum');
|
||||
if(!isempt($mknums) && $frs['mid']>0){
|
||||
|
||||
$mid = $frs['mid'];
|
||||
$mknumsa = explode('|', $mknums);
|
||||
$modenum = $mknumsa[0];
|
||||
if(isset($mknumsa[1]))$mid = $mknumsa[1];
|
||||
$flow = m('flow')->initflow($modenum, $mid, false);
|
||||
|
||||
$ssid = $flow->addlog(array(
|
||||
'name' => '在线编辑'
|
||||
));
|
||||
|
||||
$ufrs = $frs;
|
||||
$ufrs['filepath'] = $frs['oldfilepath'];
|
||||
unset($ufrs['oldfilepath']);
|
||||
unset($ufrs['id']);
|
||||
$ufrs['mtype'] = 'flow_log';
|
||||
$ufrs['mid'] = $ssid;
|
||||
$ufrs['mknum'] = ''.$modenum.'|'.$mid.'';
|
||||
$ufrs['filename'] = str_replace('.'.$ufrs['fileext'].'','(备份).'.$ufrs['fileext'].'', $ufrs['filename']);
|
||||
$fileobj->insert($ufrs); //记录原来的文件
|
||||
|
||||
//不是我创建就告诉创建人
|
||||
if($this->adminid<>$frs['optid'])
|
||||
$flow->push($frs['optid'],'', ''.$this->adminname.'在线编辑文件“'.$frs['filename'].'”', '文件在线编辑');
|
||||
|
||||
|
||||
$flow->floweditoffice($frs, $ufrs);
|
||||
|
||||
}else if($this->adminid<>$frs['optid']){ //不知道关联哪个模块
|
||||
$flow = m('flow')->initflow('word');
|
||||
$flow->push($frs['optid'],'文档', ''.$this->adminname.'在线编辑文件“'.$frs['filename'].'”', '文件在线编辑',0, array(
|
||||
'wxurl' => ''
|
||||
));
|
||||
}
|
||||
|
||||
$frs['filesize'] = $filesize;
|
||||
$fkey = $this->createtempurl($frs);
|
||||
return 'ok,'.$fkey.'';
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传时初始化看是不是存在文件
|
||||
*/
|
||||
public function initfileAction()
|
||||
{
|
||||
$filesize = c('check')->onlynumber($this->post('filesize'));
|
||||
$fileext = $this->post('fileext');
|
||||
$filename = $this->getvals('filename');
|
||||
$where = "`fileext`='$fileext' and `filesize`='$filesize'";
|
||||
if(!isempt($filename))$where.=" and `filename`='$filename'";
|
||||
$frs = m('file')->getone($where,'*','`id` desc');
|
||||
$bo = false;
|
||||
if($frs){
|
||||
$filepath = $frs['filepath'];
|
||||
if(!isempt($filepath) && file_exists($filepath))$bo=true;
|
||||
}
|
||||
if($bo){
|
||||
$this->showreturn(json_encode($frs));
|
||||
}else{
|
||||
$this->showreturn('','not found', 201);
|
||||
}
|
||||
}
|
||||
|
||||
public function upfileappAction()
|
||||
{
|
||||
if(!$_FILES)$this->showreturn('', '禁止访问', 201);
|
||||
$upimg = c('upfile');
|
||||
$maxsize= (int)$this->get('maxsize', $upimg->getmaxzhao());//上传最大M
|
||||
$uptypes= '*';
|
||||
$upimg->initupfile($uptypes, ''.UPDIR.'|reimchat|'.date('Y-m').'', $maxsize);
|
||||
$upses = $upimg->up('file');
|
||||
if(!is_array($upses))$this->showreturn('', $upses, 202);
|
||||
$arr = c('down')->uploadback($upses);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
public function upcontAction()
|
||||
{
|
||||
$cont = $this->post('content');
|
||||
if(isempt($cont))exit('sorry not cont');
|
||||
$cont = str_replace(' ','', $cont);
|
||||
$cont = $this->rock->jm->base64decode($cont);
|
||||
$arr = c('down')->createimage($cont,'png','截图');
|
||||
$this->returnjson($arr);
|
||||
}
|
||||
|
||||
|
||||
public function getfileAjax()
|
||||
{
|
||||
$cont = '';
|
||||
$path = ''.UPDIR.'/uptxt'.$this->adminid.'.txt';
|
||||
if(file_exists($path)){
|
||||
@$cont = file_get_contents($path);
|
||||
}
|
||||
$data = array();
|
||||
if($cont!=''){
|
||||
$arr = json_decode($cont, true);
|
||||
$msg = $arr['msg'];
|
||||
$data = $arr['data'];
|
||||
@unlink($path);
|
||||
}else{
|
||||
$msg = 'sorry,not infor!';
|
||||
}
|
||||
$this->showreturn($data, $msg);
|
||||
}
|
||||
|
||||
public function getfileAction()
|
||||
{
|
||||
$fileid = (int)$this->post('fileid',0);
|
||||
$rs = m('file')->getone($fileid);
|
||||
$this->showreturn($rs);
|
||||
}
|
||||
|
||||
public function downAction()
|
||||
{
|
||||
$id = (int)$this->jm->gettoken('id');
|
||||
m('file')->show($id);
|
||||
}
|
||||
|
||||
//记录预览记录
|
||||
public function logsAction()
|
||||
{
|
||||
$fileid = (int)$this->post('fileid',0);
|
||||
$type = (int)$this->post('type',0);
|
||||
m('file')->addlogs($fileid, $type);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送编辑权限
|
||||
*/
|
||||
public function rockofficeeditAction()
|
||||
{
|
||||
$fileid = (int)$this->get('id');
|
||||
$lx = (int)$this->get('lx');
|
||||
$frs = m('file')->getone($fileid);
|
||||
if(!$frs)return returnerror('文件不存在了');
|
||||
$filepath = $frs['filepath'];
|
||||
$filepathout = $frs['filepathout'];
|
||||
|
||||
if(substr($filepath,0,4)!='http' && !file_exists($filepath)){
|
||||
if(isempt($filepathout)){
|
||||
return returnerror('文件不存在了1');
|
||||
}else{
|
||||
$filepath = $filepathout;
|
||||
}
|
||||
}
|
||||
|
||||
$uptype = '|doc|docx|xls|xlsx|ppt|pptx|';
|
||||
if(!contain($uptype,'|'.$frs['fileext'].'|'))return returnerror('不是文档类型无法在线编辑');
|
||||
$filename = $frs['filename'];
|
||||
$utes = 'edit';
|
||||
if($lx==1){
|
||||
$filename = '(只读)'.$filename.'';
|
||||
$utes = 'yulan';
|
||||
}
|
||||
|
||||
$arr = array();
|
||||
$arr[0] = URL;
|
||||
$arr[1] = $filename;
|
||||
$arr[2] = $this->createtempurl($frs);
|
||||
$arr[3] = $this->rock->gethttppath($filepath); //下载地址
|
||||
$arr[4] = $fileid;
|
||||
$arr[5] = $this->adminid;
|
||||
$arr[6] = $this->token;
|
||||
$arr[7] = $utes;
|
||||
$arr[8] = $frs['fileext'];
|
||||
|
||||
$str = '';
|
||||
foreach($arr as $s1)$str.=','.$s1.'';
|
||||
|
||||
return returnsuccess(substr($str,1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取预览和下载地址
|
||||
*/
|
||||
public function fileinfoAction()
|
||||
{
|
||||
$fileid = (int)$this->get('id');
|
||||
$type = (int)$this->get('type'); //0预览,1下载,2编辑
|
||||
$ismobile = (int)$this->get('ismobile'); //是否手机端
|
||||
return $this->fileinfoShow($fileid, $type, $ismobile);
|
||||
}
|
||||
|
||||
public function fileinfoShow($fileid, $type, $ismobile)
|
||||
{
|
||||
$fobj = m('file');
|
||||
$frs = $fobj->getone($fileid);
|
||||
$this->frs = $frs;
|
||||
if(!$frs)return returnerror('文件不存在了');
|
||||
$filenum= $frs['filenum'];
|
||||
|
||||
$fileext = $frs['fileext'];
|
||||
$filename = $frs['filename'];
|
||||
$filepath = $frs['filepath'];
|
||||
$filepathout = arrvalue($frs, 'filepathout');
|
||||
|
||||
$data = array();
|
||||
$loadyuan = false;
|
||||
$data['url'] = '';
|
||||
$data['fileext']= $fileext;
|
||||
|
||||
//预览
|
||||
if($type==0){
|
||||
if(!$fobj->isview($fileext))
|
||||
return returnerror('此'.$fileext.'类型文件不支持在线预览');
|
||||
}
|
||||
|
||||
//从文件上传中心最新
|
||||
if(!isempt($filenum)){
|
||||
$dbs = m('admin');
|
||||
$barr = c('rockfile')->getdata('upload','fileinfo', array(
|
||||
'fnum' => $filenum,
|
||||
'lx' => $type,
|
||||
'sysuid' => $this->adminid,
|
||||
'ismobile' => $ismobile,
|
||||
'sysname' => $this->rock->jm->base64encode($this->adminname),
|
||||
'sysface' => $this->rock->jm->base64encode($dbs->getface($dbs->getmou('face',$this->adminid))),
|
||||
));
|
||||
if(!$barr['success']){
|
||||
return $barr;
|
||||
}else{
|
||||
$loadyuan = true;
|
||||
$da = $barr['data'];
|
||||
$data['url'] = $da['url'];
|
||||
if($da['isimg'] && $type==0)$data['url'] = $da['imgurl'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->loadyuan = $loadyuan;
|
||||
//存自己服务器的
|
||||
if(!$loadyuan){
|
||||
if(substr($filepath,0,4)!='http' && isempt($filepathout) && !file_exists($filepath))return returnerror('文件不存在了1');
|
||||
if(c('upfile')->isimg($fileext)){
|
||||
$data['url'] = m('admin')->getface($filepath);
|
||||
}
|
||||
//下载
|
||||
if($type==1){
|
||||
$url = 'api.php?m=upload&id='.$fileid.'&a=down';
|
||||
if($this->rock->web=='wxbro')$url.= '&adminid='.$this->adminid.'&token='.$this->admintoken.'';
|
||||
$data['url'] = $url;
|
||||
}
|
||||
|
||||
//编辑
|
||||
if($type==2){
|
||||
if(getconfig('officebj')=='1'){
|
||||
$data['fileext']='rockedit';
|
||||
$data['url'] = 'index.php?m=public&a=fileedit&id='.$fileid.'';
|
||||
}else{
|
||||
if($ismobile==1)return returnerror('移动端不支持在线编辑');
|
||||
$data['fileext']='rockoffice';
|
||||
$data['url'] = $this->rock->gethttppath($filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data['filename'] = $filename;
|
||||
$url = arrvalue($data, 'url');
|
||||
|
||||
if($url==''){
|
||||
$url = 'index.php?m=public&a=fileviewer&id='.$fileid.'';
|
||||
}
|
||||
|
||||
//用本地插件编辑和预览
|
||||
if($data['fileext']=='rockoffice'){
|
||||
$utes = 'edit';
|
||||
if($type==0){
|
||||
$filename = '(只读)'.$filename.'';
|
||||
$utes = 'yulan';
|
||||
}
|
||||
$arr = array();
|
||||
$arr[0] = URL;
|
||||
$arr[1] = $filename;
|
||||
$arr[2] = $this->createtempurl($frs);
|
||||
$arr[3] = $data['url']; //下载地址
|
||||
$arr[4] = $fileid;
|
||||
$arr[5] = $this->adminid;
|
||||
$arr[6] = $this->token;
|
||||
$arr[7] = $utes;
|
||||
$arr[8] = $fileext;
|
||||
$str = '';
|
||||
foreach($arr as $s1)$str.=','.$s1.'';
|
||||
$url = substr($str, 1);
|
||||
}
|
||||
|
||||
$data['url'] = $url;
|
||||
$data['type'] = $type;
|
||||
$data['id'] = $fileid;
|
||||
$data['isview'] = $fobj->isview($fileext); //是否可直接预览
|
||||
|
||||
return returnsuccess($data);
|
||||
}
|
||||
|
||||
//生成唯一文件名键值
|
||||
private function createtempurl($frs)
|
||||
{
|
||||
$str = ''.md5(URL).'_'.$frs['filesize'].'_'.$frs['id'].'.'.$frs['fileext'].'';
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* app上获取下载地址
|
||||
*/
|
||||
public function appgetfileAction()
|
||||
{
|
||||
$id = (int)$this->post('id',0);
|
||||
$barr = $this->fileinfoShow($id, 1, 1);
|
||||
if(!$barr['success'])return $barr;
|
||||
$frs = $this->frs;
|
||||
$frs['filetype'] = m('file')->getmime($frs['fileext']);
|
||||
$frs['downurl'] = $barr['data']['url'].'&cfrom=app';
|
||||
if(!$this->loadyuan){
|
||||
$frs['downurl']= '';
|
||||
if(substr($frs['filepath'],0,4)=='http'){
|
||||
$frs['downurl'] = $frs['filepath'];
|
||||
}else{
|
||||
if(!file_exists($frs['filepath']) && arrvalue($frs,'filepathout'))$frs['downurl'] = $frs['filepathout'];
|
||||
}
|
||||
}
|
||||
return returnsuccess($frs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑时验证
|
||||
*/
|
||||
public function sendeditAction()
|
||||
{
|
||||
$id = (int)$this->get('id',0);
|
||||
$otype = (int)$this->get('otype',0);
|
||||
return c('rockedit')->sendedit($id, $this->admintoken, $otype);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件信息
|
||||
*/
|
||||
public function afileinfoAction()
|
||||
{
|
||||
$allfid = c('check')->onlynumber($this->get('allfid'));
|
||||
$filearr= array();
|
||||
if($allfid){
|
||||
$fobj = m('file');
|
||||
$frows = $fobj->getall('`id` in('.$allfid.')','filename,id,filesizecn,fileext,optname,thumbpath,thumbplat');
|
||||
foreach($frows as $k1=>$rs1){
|
||||
$rs1['thumbpath'] = $fobj->getthumbpath($rs1);
|
||||
$filearr['f'.$rs1['id'].''] = $rs1;
|
||||
}
|
||||
}
|
||||
return $filearr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件(写入到内容里)
|
||||
*/
|
||||
public function filedaoAction()
|
||||
{
|
||||
$allfid = c('check')->onlynumber($this->get('fileid'));
|
||||
$filearr= array();
|
||||
$str = '';
|
||||
if($allfid){
|
||||
$fobj = m('file');
|
||||
$frows = $fobj->getall('`id` in('.$allfid.')');
|
||||
$urla = getconfig('outurl', URL);
|
||||
foreach($frows as $k1=>$rs1){
|
||||
$str.='<br>';
|
||||
$url = ''.$urla.''.$rs1['filepath'].'';
|
||||
if($sst = arrvalue($rs1,'filepathout'))$url = $sst;
|
||||
|
||||
$flx = $rs1['fileext'];
|
||||
if(!contain($fobj->fileall,','.$flx.','))$flx='wz';
|
||||
$str1 = '';
|
||||
$imurl = ''.URL.'web/images/fileicons/'.$flx.'.gif';
|
||||
$thumbpath = $fobj->getthumbpath($rs1);
|
||||
if($fobj->isimg($flx) && !isempt($thumbpath))$imurl = $thumbpath;
|
||||
|
||||
$str.='<img src="'.$imurl.'" align="absmiddle" height=20 width=20> <a target="_blank" href="'.$url.'">'.$rs1['filename'].'</a>('.$rs1['filesizecn'].')';
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模版文件
|
||||
*/
|
||||
public function getmfileAction()
|
||||
{
|
||||
$data = array();
|
||||
$fenlei = $this->jm->base64decode($this->get('fenlei'));
|
||||
$where = m('admin')->getjoinstr('a.`receid`', $this->adminid, 1);
|
||||
$sql = 'select a.`name`,a.`wtype`,b.`filepath`,b.`id` from `[Q]wordxie` a left join `[Q]file` b on a.`fileid`=b.`id` where a.`fenlei`=\''.$fenlei.'\' and a.`isgk`=1 and ('.$where.')';
|
||||
$rows = $this->db->getall($sql);
|
||||
foreach($rows as $k=>$rs){
|
||||
$data[] = array(
|
||||
'value' => $rs['id'],
|
||||
'name' => $rs['name'],
|
||||
'subname' => $rs['wtype'],
|
||||
);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
public function getmfilvAction()
|
||||
{
|
||||
$fileid = (int)$this->get('fileid','0');
|
||||
$frs = m('file')->getone($fileid);
|
||||
if(!$frs)return returnerror('不存在');
|
||||
|
||||
$lujing = $frs['filepathout'];
|
||||
if(isempt($lujing)){
|
||||
$lujing = $frs['filepath'];
|
||||
if(substr($lujing,0,4)!='http' && !file_exists($lujing))return returnerror('文件不存在了');
|
||||
}
|
||||
$fileext = $frs['fileext'];
|
||||
|
||||
$fname = $this->jm->base64decode($this->get('fname'));
|
||||
$fname = (isempt($fname)) ? $frs['filename'] : ''.$fname.'.'.$fileext.'';
|
||||
|
||||
$filepath = ''.UPDIR.'/'.date('Y-m').'/'.date('d').'_rocktpl'.rand(1000,9999).'_'.$fileid.'.'.$fileext.'';
|
||||
$this->rock->createtxt($filepath, file_get_contents($lujing));
|
||||
|
||||
$uarr = array(
|
||||
'filename' => $fname,
|
||||
'fileext' => $fileext,
|
||||
'filepath' => $filepath,
|
||||
'filesize' => filesize($filepath),
|
||||
'filesizecn' => $this->rock->formatsize(filesize($filepath)),
|
||||
'optid' => $this->adminid,
|
||||
'optname' => $this->adminname,
|
||||
'adddt' => $this->rock->now,
|
||||
'ip' => $this->rock->ip,
|
||||
'web' => $this->rock->web,
|
||||
);
|
||||
$uarr['id'] = m('file')->insert($uarr);
|
||||
|
||||
return returnsuccess($uarr);
|
||||
}
|
||||
}
|
||||
47
webmain/task/api/userAction.php
Normal file
47
webmain/task/api/userAction.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
class userClassAction extends apiAction
|
||||
{
|
||||
public function editpassAction()
|
||||
{
|
||||
if(getconfig('systype')=='demo')$this->showreturn('演示上不要修改');
|
||||
$id = $this->adminid;
|
||||
$oldpass = $this->post('passoldPost');
|
||||
$pasword = $this->post('passwordPost');
|
||||
$msg = '';
|
||||
if($this->isempt($pasword))$msg ='新密码不能为空';
|
||||
if($msg == ''){
|
||||
$oldpassa = $this->db->getmou($this->T('admin'),"`pass`","`id`='$id'");
|
||||
if($oldpassa != md5($oldpass))$msg ='旧密码不正确';
|
||||
if($msg==''){
|
||||
if($oldpassa == md5($pasword))$msg ='新旧密码不能相同';
|
||||
}
|
||||
}
|
||||
if($msg == ''){
|
||||
if(!$this->db->record($this->T('admin'), "`pass`='".md5($pasword)."',`editpass`=`editpass`+1", "`id`='$id'"))$msg = $this->db->error();
|
||||
}
|
||||
if($msg==''){
|
||||
$this->showreturn('success');
|
||||
}else{
|
||||
$this->showreturn('',$msg, 201);
|
||||
}
|
||||
}
|
||||
|
||||
//修改头像
|
||||
public function editfaceAction()
|
||||
{
|
||||
$fid = (int)$this->post('fid');
|
||||
$dbs = m('admin');
|
||||
$face= $dbs->changeface($this->adminid, $fid);
|
||||
if($face)$face = $dbs->getface($face);
|
||||
|
||||
$this->showreturn($face);
|
||||
}
|
||||
|
||||
//设置极光推送的regid
|
||||
public function setjpushidAction()
|
||||
{
|
||||
$id = $this->get('id');
|
||||
m('login')->update("`ip`='$id'", "`token`='$this->token' and `uid`='$this->adminid'");
|
||||
$this->showreturn('ok');
|
||||
}
|
||||
}
|
||||
88
webmain/task/api/weixinAction.php
Normal file
88
webmain/task/api/weixinAction.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
//保存打卡记录等
|
||||
class weixinClassAction extends apiAction{
|
||||
|
||||
/**
|
||||
* 获取jssdk签名
|
||||
*/
|
||||
public function getsignAction()
|
||||
{
|
||||
$num = 'weixin_corpid';
|
||||
$isqywx = false;
|
||||
$appId = $this->option->getval($num);
|
||||
if(isempt($appId) || $this->rock->isqywx){
|
||||
$isqywx = true;
|
||||
$num = 'weixinqy_corpid';
|
||||
}
|
||||
|
||||
if(isempt($this->option->getval($num))){
|
||||
$arr['appId'] = '';
|
||||
}else{
|
||||
$url = $this->getvals('url');
|
||||
if($isqywx){
|
||||
$agentid = $this->rock->post('agentid', $this->getsession('wxqyagentid'));
|
||||
$arr = m('weixinqy:signjssdk')->getsignsdk($url, $agentid);
|
||||
}else{
|
||||
$arr = m('weixin:signjssdk')->getsignsdk($url);
|
||||
}
|
||||
}
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
public function addlocationAction()
|
||||
{
|
||||
$fileid = (int)$this->post('fileid','0');
|
||||
$ispz = (int)$this->post('ispz','0');
|
||||
$imgpath = m('file')->getmou('filepath', $fileid);
|
||||
$now = $this->rock->now;
|
||||
$uid = $this->adminid;
|
||||
$comid = m('admin')->getcompanyid($uid);
|
||||
$type = (int)$this->post('type');
|
||||
if($type==1 && $ispz==1 && isempt($imgpath))return returnerror('请先拍照才能打卡');
|
||||
|
||||
$arr['location_x'] = $this->post('location_x');
|
||||
$arr['location_y'] = $this->post('location_y');
|
||||
$arr['scale'] = (int)$this->post('scale');
|
||||
$arr['precision'] = (int)$this->post('precision');
|
||||
$arr['label'] = $this->getvals('label');
|
||||
$arr['explain'] = $this->getvals('sm');
|
||||
$arr['optdt'] = $now;
|
||||
$arr['uid'] = $uid;
|
||||
$arr['comid'] = $comid;
|
||||
$arr['imgpath'] = $imgpath;
|
||||
m('location')->insert($arr);
|
||||
if($type==1){
|
||||
$dkdt = $now;
|
||||
$ip = $this->rock->ip;
|
||||
$this->db->record('[Q]kqdkjl',array(
|
||||
'dkdt' => $dkdt,
|
||||
'uid' => $uid,
|
||||
'optdt' => $now,
|
||||
'imgpath' => $imgpath,
|
||||
'address' => $arr['label'],
|
||||
'comid' => $comid,
|
||||
'lat'=> $arr['location_x'],
|
||||
'lng'=> $arr['location_y'],
|
||||
'accuracy'=> $arr['precision'],
|
||||
'explain'=> $arr['explain'],
|
||||
'ip' => $ip,
|
||||
'type' => 2
|
||||
));
|
||||
$dt = substr($dkdt, 0, 10);
|
||||
m('kaoqin')->kqanay($uid, $dt);
|
||||
}
|
||||
$this->showreturn(array('now'=>$now));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取媒体文件
|
||||
*/
|
||||
public function getmediaAction()
|
||||
{
|
||||
$media_id = $this->post('media_id');
|
||||
$type = $this->post('type');
|
||||
$barr = m('weixinqy:media')->downmedia($media_id, $type);
|
||||
if($barr['errcode']!=0)return returnerror($barr['msg']);
|
||||
return returnsuccess($barr);
|
||||
}
|
||||
}
|
||||
18
webmain/task/api/worcAction.php
Normal file
18
webmain/task/api/worcAction.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* 【文档】应用的接口
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (www.rockoa.com)
|
||||
* Date:2017-08-08
|
||||
*/
|
||||
class worcClassAction extends apiAction
|
||||
{
|
||||
|
||||
public function getdataAction()
|
||||
{
|
||||
$barr = m('word')->getdata();
|
||||
|
||||
$this->showreturn($barr);
|
||||
}
|
||||
}
|
||||
87
webmain/task/api/wordAction.php
Normal file
87
webmain/task/api/wordAction.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* 【文档】应用的接口
|
||||
* createname:雨中磐石
|
||||
* homeurl:http://www.rockoa.com/
|
||||
* Copyright (c) 2016 rainrock (www.rockoa.com)
|
||||
* Date:2016-08-08
|
||||
*/
|
||||
class wordClassAction extends apiAction
|
||||
{
|
||||
|
||||
|
||||
|
||||
//获取数据
|
||||
public function getdataAction()
|
||||
{
|
||||
$barr = m('word')->getdata();
|
||||
$this->showreturn($barr);
|
||||
}
|
||||
|
||||
|
||||
//保存文件
|
||||
public function savefileAction()
|
||||
{
|
||||
m('word')->savefile();
|
||||
$frs = m('file')->getone($this->post('sid'));
|
||||
$this->showreturn($frs);
|
||||
}
|
||||
|
||||
//创建文件夹
|
||||
public function createfolderAction()
|
||||
{
|
||||
|
||||
$cqid = $this->post('cqid');
|
||||
$typeid = (int)$this->post('typeid','0');
|
||||
$name = $this->post('name');
|
||||
|
||||
$arr = m('word')->createfolder($name, $cqid, $typeid);
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
//从命名
|
||||
public function renameAction()
|
||||
{
|
||||
$id = (int)$this->post('id');
|
||||
$name = $this->getvals('name');
|
||||
$type = $this->post('type');
|
||||
m('word')->update("`name`='$name'", $id);
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
//删除
|
||||
public function delfileAction()
|
||||
{
|
||||
$id = (int)$this->post('id');
|
||||
$barr = m('word')->delword($id);
|
||||
if(!$barr['success']){
|
||||
$this->showreturn('',$barr['msg'],201);
|
||||
}else{
|
||||
$this->showreturn('');
|
||||
}
|
||||
}
|
||||
|
||||
//共享
|
||||
public function shatefileAction()
|
||||
{
|
||||
m('word')->sharefile();
|
||||
$this->showreturn('');
|
||||
}
|
||||
|
||||
public function movegetAction()
|
||||
{
|
||||
return m('word')->getworcfolder();
|
||||
}
|
||||
|
||||
public function movefileAction()
|
||||
{
|
||||
$barr = m('word')->movefile();
|
||||
if(!$barr['success']){
|
||||
$this->showreturn('',$barr['msg'],201);
|
||||
}else{
|
||||
$this->showreturn('');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
22
webmain/task/api/wxgzhAction.php
Normal file
22
webmain/task/api/wxgzhAction.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 微信公众号接口
|
||||
* 来源:信呼开发团队,www.rockoa.com
|
||||
* 禁止抄袭盗版
|
||||
*/
|
||||
class wxgzhClassAction extends apiAction{
|
||||
|
||||
public function getsignAction()
|
||||
{
|
||||
$bo = m('wxgzh:signjssdk');
|
||||
$appid = $bo->readwxset();
|
||||
if(isempt($appid)){
|
||||
$arr['appId'] = '';
|
||||
}else{
|
||||
$url = $this->getvals('url');
|
||||
$arr = $bo->getsignsdk($url);
|
||||
}
|
||||
$this->showreturn($arr);
|
||||
}
|
||||
|
||||
}
|
||||
47
webmain/task/api/yanzmAction.php
Normal file
47
webmain/task/api/yanzmAction.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* 获取验证码接口
|
||||
*/
|
||||
class yanzmClassAction extends apiAction
|
||||
{
|
||||
|
||||
public function initAction()
|
||||
{
|
||||
$this->display= false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码的
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$mobile = $this->rock->jm->uncrypt($this->post('mobile'));
|
||||
if(!c('check')->ismobile($mobile))return returnerror('手机号格式有误');
|
||||
|
||||
$device = $this->post('device');
|
||||
if(isempt($device))return returnerror('无效访问');
|
||||
|
||||
return c('xinhuapi')->getvercode($mobile, $device);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录时候
|
||||
*/
|
||||
public function gloginAction()
|
||||
{
|
||||
$mobile = $this->post('mobile');
|
||||
if(isempt($mobile))return returnerror('手机号不能为空');
|
||||
|
||||
if($this->rock->isjm($mobile))$mobile = $this->jm->uncrypt($mobile);
|
||||
|
||||
if(!c('check')->ismobile($mobile))return returnerror('手机号格式有误');
|
||||
|
||||
$device = $this->post('device');
|
||||
if(isempt($device))return returnerror('无效访问');
|
||||
|
||||
//判断是否有注册
|
||||
if(m('admin')->rows("`mobile`='$mobile' and `status`=1")==0)return returnerror('此手机号不存在/已停用');
|
||||
|
||||
return c('xinhuapi')->getvercode($mobile, $device);
|
||||
}
|
||||
}
|
||||
25
webmain/task/api/yygongAction.php
Normal file
25
webmain/task/api/yygongAction.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
class yygongClassAction extends apiAction
|
||||
{
|
||||
public function saveAction()
|
||||
{
|
||||
$data['title'] = $this->post('title');
|
||||
$data['content'] = $this->post('content');
|
||||
$data['typename'] = $this->post('typename');
|
||||
$data['receid'] = $this->post('receid');
|
||||
$data['recename'] = $this->post('recename');
|
||||
$data['url'] = $this->post('url');
|
||||
$data['optdt'] = $this->now;
|
||||
$data['optid'] = $this->adminid;
|
||||
$data['optname'] = $this->adminname;
|
||||
|
||||
foreach($data as $k=>$v){
|
||||
if($k=='receid')break;
|
||||
if($this->isempt($v))$this->showreturn('', '['.$k.']不能为空', 201);
|
||||
}
|
||||
|
||||
$mid = m('infor')->insert($data);
|
||||
m('flow')->submit('gong', $mid, '发布');
|
||||
$this->showreturn('');
|
||||
}
|
||||
}
|
||||
29
webmain/task/api/yymeetAction.php
Normal file
29
webmain/task/api/yymeetAction.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
class yymeetClassAction extends apiAction
|
||||
{
|
||||
public function saveAction()
|
||||
{
|
||||
$data['title'] = $this->post('title');
|
||||
$data['hyname'] = $this->post('hyname');
|
||||
$data['startdt'] = $this->post('startdt');
|
||||
$data['enddt'] = $this->post('enddt');
|
||||
$data['joinid'] = $this->post('joinid');
|
||||
$data['joinname'] = $this->post('joinname');
|
||||
|
||||
$data['explain'] = $this->post('explain');
|
||||
$data['optdt'] = $this->now;
|
||||
$data['optid'] = $this->adminid;
|
||||
$data['optname'] = $this->adminname;
|
||||
$data['status'] = 1;
|
||||
$data['type'] = 0;
|
||||
$data['applydt'] = $this->date;
|
||||
|
||||
foreach($data as $k=>$v){
|
||||
if($k=='explain')break;
|
||||
if($this->isempt($v))$this->showreturn('', '['.$k.']不能为空', 201);
|
||||
}
|
||||
$mid = m('meet')->insert($data);
|
||||
m('flow')->submit('meet', $mid, '预定');
|
||||
$this->showreturn('');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user