public function login($usrnm, $usrpw, $rmb) { $info = collectinfo(__METHOD__, '$usrnm,$usrpw', array($usrnm, $usrpw)); if (isset($usrnm) == false) { return createarrerr('error_code', 'usrnm不能为空', $info); } if (isset($usrpw) == false) { return createarrerr('error_code', 'usrpw不能为空', $info); } $usr = D('Usr'); $arr_usro = $usr->getusrobyusrnm($usrnm, 1); $usro = $arr_usro['data']; if ($usro) { if ($usro['usrpw'] == md5($usrpw)) { $rslt = 1; session('usridss', $usro['usrid']); if ($rmb == 'y') { cookie('usridck', $usro['usrid']); } $msg = '登录成功'; } else { $rslt = 0; $msg = '密码不正确'; } } else { $rslt = 0; $msg = '用户名不正确'; } $arr['rslt'] = $rslt; return createarrok('ok', $arr, $msg, $info); }
public function delete($usrrlid) { $info = collectinfo(__METHOD__, '$usrrlid', array($usrrlid)); if (isset($usrrlid) === false) { return createarrerr('error_code', 'usrrlid 不能为空', $info); } //防止NULL $usrrl = M('usrrl'); $usrrl->where('usrrlid=' . $usrrlid)->delete(); return createarrok('ok', $data, '', $info); }
public function getmo($bdid) { $info = collectinfo(__METHOD__, '$bdid', array($bdid)); if (isset($bdid) === false) { return createarrerr('error_code', 'bdid 不能为空', $info); } //防止NULL $bd = M('bd'); $bdo = $bd->where('bdid=' . $bdid)->find(); return createarrok('ok', $bdo, '', $info); }
public function getmo($id) { $info = collectinfo(__METHOD__, '$id', array($id)); if (isset($id) === false) { return createarrerr('error_code', 'id 不能为空', $info); } //防止NULL $sys = M('sys'); $syso = $sys->where('sysid=' . $id)->find(); return createarrok('ok', $syso, '', $info); }
public function getmo($grpid) { $info = collectinfo(__METHOD__, '$grpid', array($grpid)); if (isset($grpid) === false) { return createarrerr('error_code', 'grpid 不能为空', $info); } //防止NULL $grp = M('grp'); $grpo = $grp->where('grpid=' . $grpid)->find(); return createarrok('ok', $grpo, '', $info); }
public function test($para1, $para2) { $info = collectinfo(__METHOD__, '$para1,$para2', array($para1, $para2)); if (isset($usrnm) === false) { return createarrerr('error_code', 'usrnm不能为空', $info); } if ($usrnm === '') { return createarrerr('error_code', 'usrnm不能为空', $info); } return createarrerr('error_code', '', $info); return createarrok('ok', $data, '', $info); }
public function checkqr($tmpuid) { $info = collectinfo(__METHOD__, '$openid,$tmpuid', array($openid, $tmpuid)); if (isset($tmpuid) === false) { return createarrerr('error_code', 'tmpuid 不能为空', $info); } $qr = M('qr'); $qro = $qr->where("tmpuid='" . $tmpuid . "'")->find(); $isscan = $qro['isscan']; if ($isscan == 1) { session('openid', $qro['openid']); } return createarrok('ok', $isscan, '', $info); }
public function delete($lbid) { $info = collectinfo(__METHOD__, '$lbid', array($lbid)); if (isset($lbid) === false) { return createarrerr('error_code', 'lbid 不能为空', $info); } //防止NULL $lb = M('lb'); $md = D('Md'); $lb->where('lbid=' . $lbid)->delete(); //把相关的md都删咯 $md->deletebylbid($lbid); return createarrok('ok', $data, '', $info); }
public function delete($mdid) { $info = collectinfo(__METHOD__, '$mdid', array($mdid)); if (isset($mdid) === false) { return createarrerr('error_code', 'mdid 不能为空', $info); } //防止NULL $md = M('md'); $ath = D('Ath'); $md->where('mdid=' . $mdid)->delete(); //删除依赖 $ath->deletebymdid($mdid); return createarrok('ok', $data, '', $info); }
public function delete($rlid) { $info = collectinfo(__METHOD__, '$rlid', array($rlid)); if (isset($rlid) === false) { return createarrerr('error_code', 'rlid 不能为空', $info); } //防止NULL $rl = M('rl'); $usrrl = D('Usrrl'); $ath = D('Ath'); $rl->where('rlid=' . $rlid)->delete(); //删除角色会导致usrrl相应的数据删除 $usrrl->deletebyrlid($rlid); //删除rl势必造成ath中的相应权限删除 $ath->deletebyrlid($rlid); return createarrok('ok', $data, '', $info); }
public function addatccnt($origincnt, $atcid) { $info = collectinfo(__METHOD__, '$origincnt,$atcid', array($origincnt, $atcid)); if (isset($origincnt) === false) { return createarrerr('error_code', 'origincnt 不能为空', $info); } //防止NULL if (isset($atcid) === false) { return createarrerr('error_code', 'atcid 不能为空', $info); } //防止NULL $atc = M('atc'); $nwcnt = $origincnt + 1; $dt = array('atccnt' => $nwcnt); $atc->where('atcid=' . $atcid)->setField($dt); return createarrok('ok', $nwcnt, '', $info); }
public function getusrrlnms($usrid) { $info = collectinfo(__METHOD__, '$para1,$para2', array($para1, $para2)); if (isset($usrid) === false) { return createarrerr('error_code', 'usrid不能为空', $info); } $usr = D('Usr'); $arr_usro = $usr->getusrobyusrid($usrid); $usro = $arr_usro['data']; if ($usro['usrmk'] == 1) { $str = '超级管理员'; } else { $usrrl = M('usrrl'); $rlls = $usrrl->join('tb_rl ON f_usrrl_rlid=rlid')->where('usrid=' . $usrid)->select(); $str = ''; foreach ($rlls as $rlv) { $str = $str . $rlv['rlnm'] . ' '; } } return createarrok('ok', $str, '', $info); }
public function mdfusrpw($usrid, $usrpw) { $info = collectinfo(__METHOD__, '$usrid,$usrpw', array($usrid, $usrpw)); if (isset($usrid) === false) { return createarrerr('error_code', 'usrid 不能为空', $info); } //防止NULL if (isset($usrpw) === false) { return createarrerr('error_code', 'usrpw 不能为空', $info); } //防止NULL $usr = M('usr'); $dt = array('usrpw' => md5($usrpw)); $usr->where('usrid=' . $usrid)->setField($dt); return createarrok('ok', $data, '', $info); }
public function getmdobymdmk($mdmk) { $info = collectinfo(__METHOD__, '$mdmk', array($mdmk)); if (isset($mdmk) === false) { return createarrerr('error_code', 'mdmk不能为空', $info); } $md = M('md'); $mdo = $md->where("mdmk='" . $mdmk . "'")->find(); return createarrok('ok', $mdo, '', $info); }
public function mdf($get, $aaid) { $info = collectinfo(__METHOD__, '$get,$aaid', array($get, $aaid)); if (isset($get) === false) { return createarrerr('error_code', 'get 不能为空', $info); } //防止NULL if (isset($aaid) === false) { return createarrerr('error_code', 'aaid 不能为空', $info); } //防止NULL $aa = M('aa'); $aa->where('aaid=' . $aaid)->setField($get); return createarrok('ok', $data, '', $info); }
public function getls($para, $mdmk, $jn, $fld, $cdt, $spccdt, $odr, $lmt, $hide_fld, $hide_cdt, $spccdtls, $odrls, $defaultls, $transmean) { $info = collectinfo(__METHOD__, '$para,$mdmk,$jn,$fld,$cdt,$spccdt,$odr,$lmt,$hide_fld,$hide_cdt,$spccdtls,$odrls,$defaultls,$transmean', array($para, $mdmk, $jn, $fld, $cdt, $spccdt, $odr, $lmt, $hide_fld, $hide_cdt, $spccdtls, $odrls, $defaultls, $transmean)); if (isset($para) === false) { return createarrerr('error_code', 'para 不能为空', $info); } if (isset($mdmk) === false) { return createarrerr('error_code', 'mdmk 不能为空', $info); } if (isset($jn) === false) { return createarrerr('error_code', 'jn 不能为空', $info); } if (isset($fld) === false) { return createarrerr('error_code', 'fld 不能为空', $info); } if (isset($cdt) === false) { return createarrerr('error_code', 'cdt 不能为空', $info); } if (isset($spccdt) === false) { return createarrerr('error_code', 'spccdt 不能为空', $info); } if (isset($odr) === false) { return createarrerr('error_code', 'odr 不能为空', $info); } if (isset($lmt) === false) { return createarrerr('error_code', 'lmt 不能为空', $info); } if (isset($hide_fld) === false) { return createarrerr('error_code', 'hide_fld 不能为空', $info); } if (isset($hide_cdt) === false) { return createarrerr('error_code', 'hide_cdt 不能为空', $info); } $this->assign('para', $para); $this->assign('mdmk', $mdmk); $this->assign('fld', $fld); $this->assign('cdt', $cdt); $this->assign('odr', $odr); $this->assign('spccdt', $spccdt); $this->assign('lmt', $lmt); $this->assign('hide_fld', $hide_fld); $this->assign('hide_cdt', $hide_cdt); $this->assign('spccdtls', $spccdtls); $this->assign('odrls', $odrls); $this->assign('lowmdmk', strtolower($mdmk)); $this->assign('defaultls', $defaultls); $this->assign('transmean', $transmean); //先搞定针对哪个数据 $mdmk = strtolower($mdmk); $m = M($mdmk); foreach ($jn as $jnv) { $m->join($jnv); } $fld_str = ''; $thls = array(); for ($i = 0; $i < count($fld); $i++) { if (!in_array($fld[$i], $hide_fld)) { array_push($thls, $para[$fld[$i]]); } if ($i == 0) { $fld_str = $fld[$i]; } else { $fld_str = $fld_str . ',' . $fld[$i]; } } $m->field($fld_str); $this->assign('thls', $thls); $cdt_str = '1=1'; //对于cdt无论是有还是没有都必须从para中剃掉hide的属性,然后剩下的统一判断是否需要给ls if ($defaultls == 1) { foreach ($para as $k => $v) { if (!in_array($k, $hide_cdt) && strstr($k, '_')) { $tmp = explode('_', $k); $tmp = explode('id', $tmp[2]); $tmp = $tmp[0]; $tmp = M($tmp); $this->assign($k, $tmp->select()); } } } foreach ($cdt as $cdtvk => $cdtvv) { if (strstr($cdtvk, '_')) { $thiscdt = $cdtvk . '=' . $cdtvv; } else { if (isset($transmean[$cdtvk])) { $thiscdt = $cdtvk . '=' . $cdtvv; } else { $thiscdt = $cdtvk . " LIKE '%" . $cdtvv . "%'"; } } $cdt_str = $cdt_str . ' AND ' . $thiscdt; } //为防止没有spccdt依然会产生()因此如果没有就干脆不搞了,当然没有spccdtls 自然也不会设置spccdt 自然也不会有下面的数据了 if ($spccdt) { foreach ($spccdt as $spccdtv) { $cdt_str = $cdt_str . ' AND (' . $spccdtls[$spccdtv][0] . ') '; } } $m->where($cdt_str); //此时已经可以确定多少条了 $m_forcount = clone $m; $count = $m_forcount->count(); //分页 import('ORG.Util.Page'); $page = new Page($count, $lmt); //后台管理页面默认一页显示N条记录 $page->setConfig('prev', "« 上一页"); //上一页 $page->setConfig('next', '下一页 »'); //下一页 $page->setConfig('first', '« 首页'); //第一页 $page->setConfig('last', '末页 »'); //最后一页 $page->setConfig('theme', '共%totalPage%页/%totalRow%%header% %first% %upPage% %linkPage% %downPage% %end%'); //设置分页回调方法 $show = $page->show(); $show = str_replace("<a>", " <a>", $show); $show = str_replace("</a>", "</a> ", $show); $show = str_replace("<span>", " <span>", $show); $show = str_replace("</span>", "</span> ", $show); $this->assign('page', $show); //为防止没有odr依然会产生()因此如果没有就干脆不搞了,当然没有odrls 自然也不会设置odr 自然也不会有下面的数据了 if ($odr) { $odr_str = ''; $i = 0; foreach ($odr as $odrvk => $odrvv) { if ($i != 0) { $odr_str = $odr_str . ','; } $odr_str = $odr_str . $odrvk . ' ' . $odrvv; $i++; } $m->order($odr_str); } $this->assign('pagestart', $page->firstRow); $m->limit($page->firstRow . ',' . $page->listRows); $mls = $m->select(); // //处理page管理 // $sum=$m_clone->count();//共多少条 // $pagenum=floor($sum/$lmt)+1;//共多少页 // $nowpage=$pagestart/$lmt; //当前第几页 // if($nowpage==0){$prev='no';$first='no';}else{$prev=$nowpage-1;$first=0;} // if($nowpage==$pagenum-1){$next='no';$last='no';}else{$next=$nowpage+1;$last=$pagenum-1;} // $page['sum']=$sum;$page['pagenum']=$pagenum;$page['nowpage']=$nowpage;$page['prev']=$prev;$page['next']=$next;$page['first']=$first;$page['last']=$last;$page['lmt']=$lmt; // $this->assign('page',$page);//不管是ajax不用还是 首次查询要用,我都assign了 return createarrok('ok', $mls, '', $info); }
public function dodelete($all) { $info = collectinfo(__METHOD__, '$all', array($all)); if (isset($all) === false) { return createarrerr('error_code', 'all 不能为空', $info); } //防止NULL $mdmk = $all['mdmk']; $id = $_GET['id']; $lowmdmk = strtolower($mdmk); $m = M($lowmdmk); $mid = $lowmdmk . 'id'; $m->where($mid . '=' . $id)->delete(); return createarrok('ok', $data, '', $info); }
public function paixu($pid, $lowmdmk) { $info = collectinfo(__METHOD__, '$pid,$lowmdmk', array($pid, $lowmdmk)); if (isset($pid) === false) { return createarrerr('error_code', 'pid 不能为空', $info); } //防止NULL if (isset($lowmdmk) === false) { return createarrerr('error_code', 'lowmdmk 不能为空', $info); } //防止NULL $m = M($lowmdmk); $mls = $m->where($lowmdmk . 'pid=' . $pid)->order($lowmdmk . 'odr ASC')->select(); for ($i = 0; $i < count($mls); $i++) { $dt = array($lowmdmk . 'odr' => $i + 1); $id = $mls[$i][$lowmdmk . 'id']; $m->where($lowmdmk . 'id=' . $id)->setField($dt); } return createarrok('ok', $data, '', $info); }