Files
xinhu/webmain/task/api/reimplatAction.php
2022-08-14 16:47:40 +08:00

63 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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);
}
}
}
}