Esempio n. 1
0
 protected function _goodsleft($smarty)
 {
     //退出登录
     $outlogin_url = url('admin', 'admingoods::outlogin');
     $smarty->assign('outlogin_url', $outlogin_url);
     //上传页面
     $upload_goods_url = url('admin', 'admingoods::index');
     $smarty->assign('upload_goods_url', $upload_goods_url);
     //上传商品地址
     $upload_url = url('admin', 'admingoods::upload');
     $smarty->assign('upload_url', $upload_url);
     //商品管理
     $goods_handle_url = url('admin', 'admingoods::sale');
     $smarty->assign('goods_handle_url', $goods_handle_url);
     //出售中的商品
     $sale_goods_list_url = url('admin', 'admingoods::sale');
     $smarty->assign('sale_goods_list_url', $sale_goods_list_url);
     //仓库中的商品
     $un_sale_goods_list_url = url('admin', 'admingoods::unsale');
     $smarty->assign('un_sale_goods_list_url', $un_sale_goods_list_url);
     //仓库中的商品
     $batch_modify_url = url('admin', 'admingoods::batch');
     $smarty->assign('batch_modify_url', $batch_modify_url);
     //获取分类数据
     $cate_list = CateM::getAllCate();
     $cate_list = CateM::getSonTree($cate_list);
     $smarty->assign('cate_list', $cate_list);
     //分类列表
     $cate_url = url('admin', 'cate::index');
     $smarty->assign('cate_url', $cate_url);
     //用户名
     $username = LuS::get('admin_goods_username');
     $smarty->assign('username', $username);
 }
Esempio n. 2
0
 public function modify($cate_id)
 {
     $msg = array();
     if (!$cate_id) {
         $msg['error'] = '-1';
         $msg['msg'] = '不存在该分类';
         echo json_encode($msg);
         throw new Exception('exit');
     }
     $cate_status = isset($_POST['cate_status']) ? htmlspecialchars($_POST['cate_status']) : 'no';
     //查询信息
     $cate_info = CateM::getCateInfoByCateId($cate_id);
     if ($cate_info) {
         if ($cate_info['cate_status'] == $cate_status) {
             $msg['error'] = '0';
             $msg['msg'] = '修改失败,状态没发生改变';
             echo json_encode($msg);
         } else {
             $data = array();
             $where = array();
             $where['cate_id'] = $cate_id;
             $data['cate_status'] = $cate_status;
             CateM::update($data, $where);
             //获取全部分类
             $cate_list = CateM::getAllCate();
             //获取有序的子孙图
             $cate_list = CateM::getSonTree($cate_list, $cate_id);
             if (!empty($cate_list)) {
                 //把子孙都修改状态
                 foreach ($cate_list as $key => $val) {
                     $data = array();
                     $where = array();
                     $where['fid'] = $cate_id;
                     $where['cate_id'] = $val['cate_id'];
                     $data['cate_status'] = $cate_status;
                     CateM::update($data, $where);
                 }
             }
             $msg['error'] = '1';
             $msg['msg'] = '修改成功';
             echo json_encode($msg);
         }
     } else {
         $msg['error'] = '-3';
         $msg['msg'] = '修改失败,不存在该分类';
         echo json_encode($msg);
     }
     throw new Exception('exit');
 }