function savepsw() { $objData = array('psw' => $this->_post('psw', '')); //内容规则检查 T('content/validate'); $validate = array(array('psw', 'min_length', '密码长度必须大于4位', 4)); if (!validate::check($validate, $objData)) { $this->JsonReturn(validate::getError()); } if ($objData['psw'] != $this->_post('repsw')) { $this->JsonReturn('两次密码不一致,请检查'); } if ($objData['psw']) { $psw = D('admin')->setUserPassword($objData['psw']); if ($psw != steadmin::$adminInfo['psw']) { D('steadmin')->update(array('psw' => $psw), array('user_id' => steadmin::$adminInfo['user_id'])); D('steadmin')->setUserLogin(array('user_id' => steadmin::$adminInfo['user_id'], 'psw' => $psw), 0, false); //===记录操作日志==== parent::saveSySLog(2, array(), 0, array('user_id' => steadmin::$adminInfo['user_id']), '修改密码-编辑'); //===记录操作日志==== $this->JsonReturn('操作成功', null, 1); } } $this->JsonReturn('密码未变更', null, 0); }
function ajaxlogin() { if (!formCheck()) { $this->JsonReturn('表单提交有误,请刷新页面再试'); } //接受参数 $user = $this->_post('user'); $pass = $this->_post('password'); $refer = urldecode($this->_post('refer')); $remember = $this->_postid('remember', 0); if (!$user || !$pass) { $this->JsonReturn('账号或密码为空', null, 0); } $rs = D('steadmin')->where(array('username' => $user, 'psw' => D('steadmin')->setUserPassword($pass), 'status' => 1))->find(); //===记录操作日志==== parent::saveSySLog(5, array('username' => $user), 0, array(), '后台登陆'); //===记录操作日志==== if ($rs) { if (!$rs['effective'] || $rs['effective'] && $rs['effective'] - TIME > 0) { //帐号无期限或者有期限并且还未过期 if (in_array($rs['groupid'], array(3, 4))) { $this->JsonReturn('抱歉,您的组别无法登陆'); } //修改登录信息 D('steadmin')->setUserLogin($rs, $remember); formClear(); $this->JsonReturn('ok', array('user_id' => $rs['user_id'], 'refer' => $refer), 1); } else { $this->JsonReturn('抱歉,你的帐号已过期,暂时无法登陆', null, 0); } } else { //===记录操作日志==== parent::saveSySLog(5, array('username' => $user, 'psw' => $pass), 0, array(), '后台登陆-失败'); //===记录操作日志==== $this->JsonReturn('帐号不存在或者密码错误', null, 0); } }
public function edit_worker_save() { parent::_authUser(array(1, 2, 9)); $id = $this->_postid('order_id', 0); $type = $this->_postid('type', 1); $workerUid = $this->_postid('worker_uid', 0); if (!$id) { $this->JsonReturn('参数丢失'); } $rs = M('ste_order')->where(array('order_id' => $id))->find(); if (!$rs) { $this->JsonReturn('订单不存在'); } if (parent::_checkIsPresident()) { //社长 if ($rs['service_id'] != steadmin::$adminInfo['service_id']) { $this->JsonReturn('没有操作权限!'); } } elseif (!parent::_checkIsAdmin()) { $this->JsonReturn('没有操作权限'); } //判断当前订单是否可以修改 if (!in_array($rs['status'], array(3, 4, 5, 6))) { $this->JsonReturn('该订单当前状态不可编辑'); } $field = ''; switch ($type) { case 1: if ($workerUid == $rs['deployment_uid']) { $this->JsonReturn('配货员未变更'); } $field = 'deployment_uid'; $msgId = 1; $oldUid = $rs['deployment_uid']; break; case 2: if ($workerUid == $rs['worker_uid']) { $this->JsonReturn('小管家未变更'); } $field = 'worker_uid'; $msgId = 2; $oldUid = $rs['worker_uid']; break; } if (!$field) { $this->JsonReturn('参数有误'); } //更新数据 $info = M('ste_order')->update(array($field => $workerUid), array('order_id' => $id)); if (!$info) { $this->JsonReturn('编辑失败'); } $res = array(); //通知小管家 $res['deployment'] = $this->_sendQIYENotice($rs, $msgId, $workerUid); $res['deployment_old'] = $this->_sendQIYENotice($rs, 4, $oldUid); //===记录操作日志==== parent::saveSySLog(2, array('field' => $field, 'user_id' => $workerUid, 'old_user_id' => $oldUid), $id, array(), '订单管理-更换小管家'); //===记录操作日志==== //返回结果 $this->JsonReturn('ok', $res, 1); }
public function deal() { parent::_authUser(array(1, 5, 7, 9)); $id = $this->_postid('id', 0); $act = $this->_postid('act', 0); $action = $this->_post('action', ''); if (!$id) { showError('参数丢失'); } $rs = M('ste_shop')->where(array('shop_id' => $id, 'city_id' => steadmin::$adminInfo['city_id']))->find(); if (!$rs) { showError('店铺不存在'); } if (!parent::_checkUser($rs['user_id'], $id) && (parent::_checkIsPresident() && $rs['service_id'] != steadmin::$adminInfo['service_id'])) { showError('编辑权限不足'); } if ($action) { if (in_array($action, array('up', 'down'))) { if ($action == 'up') { $count = M('ste_goods')->update(array('status' => 1), array('status' => 0, 'shop_id' => $id)); } else { $count = M('ste_goods')->update(array('status' => 0), array('status' => 1, 'shop_id' => $id)); } //===记录操作日志==== parent::saveSySLog(4, array('status' => $action, 'table' => 'goods'), $id, array('shop_id' => $id), '店铺管理-更新店铺商品状态'); //===记录操作日志==== $this->JsonReturn('ok', $count, 1); } else { $this->JsonReturn('参数错误'); } } else { if (!isset($this->steSetting['shop_status'][$act])) { showError('参数错误'); } M('ste_shop')->update(array('status' => $act), array('shop_id' => $id)); //===记录操作日志==== parent::saveSySLog(4, array('status' => $act), $id, array('shop_id' => $id), '店铺管理-处理状态'); //===记录操作日志==== $this->JsonReturn('ok', $this->steSetting['shop_status'][$act], 1); } }
function delete() { $id = $this->_postid('id'); if (!$id) { showError('参数丢失'); } if (!parent::_checkIsAdmin()) { showError('没有编辑权限'); } D('serviceLog')->delete(array('fid' => $id)); //===记录操作日志==== parent::saveSySLog(3, array(), $id, array('id' => $id), '客服日报-删除'); //===记录操作日志==== $this->JsonReturn('ok', null, 1); }
function delete() { $id = $this->_postid('id'); if (!$id) { showError('参数丢失'); } M('ste_goods_cate')->update(array('is_del' => 1, 'is_show' => 0), array('id' => $id, 'city_id' => steadmin::$adminInfo['city_id'])); $this->reset(); $this->setGoodsCateCache(); //===记录操作日志==== parent::saveSySLog(3, array('is_del' => 1, 'is_show' => 0), $id, array('id' => $id), '商品类目-删除'); //===记录操作日志==== $this->JsonReturn('ok', null, 1); }
function deal() { $id = $this->_postid('id', 0); $act = $this->_postid('act', 0); if (!$id) { showError('参数丢失'); } if (!isset($this->steSetting['work_status'][$act])) { showError('参数错误'); } D('steadmin')->setUserWorkerStatus($id, $act); //===记录操作日志==== parent::saveSySLog(4, array('work_status' => $act), $id, array('user_id' => $id), '帐号管理-处理状态'); //===记录操作日志==== $this->JsonReturn('ok', $this->steSetting['work_status'][$act], 1); }
public function deal() { $id = $this->_postid('id', 0); $act = $this->_postid('act', 0); if (!$id) { showError('参数丢失'); } if (!isset($this->setOrderStatus[$act])) { $this->JsonReturn('参数错误'); } $rs = M('ste_order')->where(array('order_id' => $id))->find(); if (!$rs) { $this->JsonReturn('订单不存在'); } if (parent::_checkIsPresident()) { //社长 if ($rs['service_id'] != steadmin::$adminInfo['service_id']) { showError('没有操作权限!'); } } elseif (!parent::_checkIsAdmin()) { showError('没有操作权限'); } M('ste_order')->update(array('status' => $act), array('order_id' => $id)); //===记录操作日志==== parent::saveSySLog(4, array('status' => $act), $id, array('order_id' => $id), '订单管理-处理状态'); //===记录操作日志==== $this->JsonReturn('ok', $this->setOrderStatus[$act], 1); }
public function batch() { parent::_checkLogin(); parent::_authUser(array(1, 2, 5, 7, 8)); $gids = $this->_post('gid'); if (!$gids || !is_array($gids)) { $this->JsonReturn('请先选择需要操作的商品'); } $objData = array(); $list = array('original_price', 'price_pre', 'price', 'storage_counts', 'start_times', 'end_times', 'px', 'cate_id', 'order_counts'); foreach ($list as $val) { $objData[$val] = $this->_post($val, ''); } //内容规则检查 T('content/validate'); $validate = array(); if ($objData['price']) { $validate[] = array('price', 'currency', '商品价格不正确'); } else { unset($objData['price']); } if ($objData['storage_counts']) { $validate[] = array('storage_counts', 'int', '库存不正确'); } else { unset($objData['storage_counts']); } if ($objData['original_price']) { $validate[] = array('original_price', 'currency', '商品原始价格不正确'); } else { unset($objData['original_price']); } if ($objData['start_times']) { $objData['start_times'] = inTime($objData['start_times']); } else { unset($objData['start_times']); } if ($objData['end_times']) { $objData['end_times'] = inTime($objData['end_times']); } else { unset($objData['end_times']); } if (!$objData['cate_id']) { unset($objData['cate_id']); } if (!$objData['price_pre']) { unset($objData['price_pre']); } if ($objData['px'] !== '') { $objData['px'] = intval($objData['px']); } else { unset($objData['px']); } if ($objData['order_counts'] !== '') { $objData['order_counts'] = intval($objData['order_counts']); } else { unset($objData['order_counts']); } if (!$objData) { $this->JsonReturn('必须有修改项!'); } if ($validate && !validate::check($validate, $objData)) { $this->JsonReturn(validate::getError()); } //补充数据 $objData['refresh_time'] = TIME; // z($objData); //取出所以商品,并对商品做权限判断 $rs = M('ste_goods')->field('user_id,gid,shop_id')->where(array('gid' => $gids))->findAll(false); if (!$rs) { $this->JsonReturn('没有找到符合条件的商品'); } $ids = array(); foreach ($rs as $val) { if (!parent::_checkUser($val['user_id'], $val['shop_id'])) { $this->JsonReturn('操作错误,没有编辑权限'); } else { $ids[] = $val['gid']; } } if ($ids) { $total = M('ste_goods')->update($objData, array('gid' => $ids)); //===记录操作日志==== parent::saveSySLog(4, $objData, $ids, array('gid' => $ids), '商品管理-批量设置'); //===记录操作日志==== $this->JsonReturn('ok', $total, 1); } else { $this->JsonReturn('没有找到符合条件的商品'); } }