public function editAction()
 {
     $department_id = fpBase('http')->getParam('department_id');
     if (!empty($department_id)) {
         $result = M('department')->find('pid=' . intval($department_id));
         if ($result) {
             exit(json_encode(array('statusCode' => 300, 'message' => '错误选择,选择的部门还有下级,请选择所在部门')));
         }
     }
     $uid = fpBase('http')->getParam('id');
     $user = M('user')->find('id=' . intval($uid));
     if (!empty($user)) {
         $dep = M('department')->getSelect($user['department_id']);
     } else {
         exit(json_encode(array('statusCode' => 300, 'message' => '用户不存在')));
     }
     $password = fpBase('http')->getPost('password');
     if (empty($password)) {
         unset($_POST['password']);
     } else {
         $_POST['password'] = md5($_POST['password']);
     }
     if (fpBase('http')->isPost()) {
         fpBase('cache')->write('user_uid_' . get_cookie('uid'), null);
     }
     $this->assign('dep', $dep);
     parent::editAction();
 }
 public function editAction()
 {
     //所有餐馆
     $restaurant = M('restaurant')->findAll();
     $this->assign('restaurant', $restaurant);
     //分类
     $cat = M('cat')->findAll();
     $this->assign('cat', $cat);
     parent::editAction();
 }
 public function editAction()
 {
     $department_id = fpBase('http')->getParam('id');
     $cat = M('department')->find('id=' . $department_id);
     if (empty($cat)) {
         exit(json_encode(array('statusCode' => 300, 'message' => '选择的部门有误')));
     } else {
         $dep = M('department')->getSelect($cat['pid']);
     }
     $this->assign('dep', $dep);
     parent::editAction();
 }
 public function saveAction()
 {
     if (fpBase('http')->isPost()) {
         $_POST['user_id'] = $this->userInfo['id'];
         $_POST['addtime'] = time();
     } else {
         //获取id
         $id = intval(fpBase('http')->getQuery('id'));
         $fast = M('fast')->find('id=' . $id);
         if (empty($fast)) {
             exit(json_encode(array('statusCode' => 300, 'message' => '请先点菜')));
         } else {
             $fast['restaurant_id'] = M('restaurant')->getName($fast['restaurant_id']);
             $fast['cat_id'] = M('cat')->getName($fast['cat_id']);
         }
         $this->assign('fast', $fast);
     }
     parent::saveAction();
 }