public function edit() { if (IS_POST) { if ($this->db->edit()) { View::success('操作成功', 'index'); } else { View::error($this->db->getError()); } } else { //商品分类 $cate = new \Admin\Model\ShopCate(); $cateData = $cate->getAll(); View::with('cateData', $cateData); //商品品牌 $brand = new \Admin\Model\ShopBrand(); $brandData = $brand->getAll(); View::with('brandData', $brandData); //获取图集信息 $pics = new \Admin\Model\Pics(); $picsData = $pics->getAll(); View::with('picsData', $picsData); //商品类型列表 $type = new \Admin\Model\ShopType(); $typeData = $type->getAll(); View::with('typeData', $typeData); //商品属性列表 $attr = new \Admin\Model\GoodsAttr(); $attrData = $attr->getAll(Q('goods_id')); View::with('attrData', $attrData); //读取商品信息 $field = $this->db->getOne(); View::with('field', $field)->make(); } }
/** * [logout 退出登录] * @return [type] [description] */ public function logout() { session_start(); session_unset(); session_destroy(); //myRedis::delete(); View::success('退出成功', 'http://' . __HOST__ . '/admin/login/'); }
public function edit() { if (IS_POST) { if ($this->db->edit()) { View::success('操作成功', 'index'); } else { View::error($this->db->getError()); } } else { $field = $this->db->getOne(); View::with('field', $field)->make(); } }
public function add() { if (IS_POST) { // p($_POST);exit; if ($this->db->store()) { View::success('发表成功', 'index'); } else { View::error($this->db->getError()); } } else { $cat = $this->category->getAll(); View::with('cat', $cat)->make(); } }
public function edit() { if (IS_POST) { if ($this->db->edit()) { View::success('操作成功', 'index'); } else { View::error($this->db->getError()); } } else { //分配品牌分类 $cate = new \Admin\Model\ShopCate(); $cateData = $cate->getAll(); $field = $this->db->getOne(); View::with('field', $field)->with('cateData', $cateData)->make(); } }
public function edit() { if (IS_POST) { p($_POST['thumb']); if ($this->db->update()) { View::success('修改成功', 'index'); } else { View::error($this->db->getError()); } } $id = Q('id', 0, 'intval'); $data = $this->db->where('id', $id)->first(); p($data); $data2 = new \Sadmin2\Model\Category(); $data2 = $data2->getAll(); View::with('data', $data)->with('data2', $data2)->make(); }
public function edit() { if (IS_POST) { if ($this->db->update()) { View::success('修改成功', 'index'); } else { View::error($this->db->getError()); } } else { //读取栏目数据 $category = new \Admin\Model\Category(); $cat = $category->getAll(); //原文章的数据 $field = Db::table('article')->where('id', $_GET['id'])->first(); View::with('cat', $cat)->with('field', $field); View::make(); } }
public function edit() { if (IS_POST) { if ($this->db->edit()) { View::success('操作成功', 'index'); } else { View::error($this->db->getError()); } } else { //搜索页规格分类 $type = new \Admin\Model\ShopType(); $typeData = $type->getAll(); View::with('typeData', $typeData); $data = $this->db->getAll(); $field = $this->db->getOne(); View::with('data', $data)->with('field', $field)->make(); } }
/** * [category_reldel 删除分类] * @return [type] [description] */ public function category_reldel($slug) { $cate = Category::where(['id' => $slug])->firstOrFail(); $cate->delete(); View::success('彻底删除成功', 'http://' . __HOST__ . '/admin/category/recycle/'); die; }
public function backup() { $cache = F('_backup_'); foreach ($cache['table'] as $table => $config) { $sql = "<?php if(!defined('HDPHP_PATH'))EXIT;\n"; do { $data = Db::table($table, true)->limit($config['first'], 20)->get(); $cache['table'][$table]['first'] = $config['first'] + 20; //表中无数据 if (empty($data)) { unset($cache['table'][$table]); F('_backup_', $cache); View::success("{$table} 备份完成", __URL__, $cache['config']['time']); } else { foreach ($data as $d) { $field = $value = array(); foreach ($d as $f => $v) { $field[] = $f; $value[] = is_numeric($v) ? $v : "'" . addslashes($v) . "'"; } //表名 $sql .= "Db::execute(\"REPLACE INTO {$table} (`" . implode("`,`", $field) . "`)\n\t\t\t\t\t\tVALUES(" . implode(",", $value) . ")\");\n"; } } //检测本次备份是否超出分卷大小 if (strlen($sql) > $cache['config']['size']) { $cache['table'][$table]['fileId'] += 1; //写入备份 $file = $cache['config']['dir'] . '/' . $table . '_' . $config['fileId'] . '.php'; F('_backup_', $cache); file_put_contents($file, $sql); View::success("{$table} 第{$cache['table'][$table]['fileId']}卷备份完成", __URL__, $cache['config']['time']); } } while (true); } F('_backup_', '[del]'); touch($cache['config']['dir'] . '/lock.php'); View::success('完成所有数据备份...', $cache['config']['url'], 1); }
protected function success($message = '操作成功', $url = null, $time = 1) { View::success($message, $url, $time); }
public function del_link($slug) { $link = Link::where(['id' => $slug])->firstOrFail(); $link->delete(); View::success('彻底删除成功', 'http://' . __HOST__ . '/admin/link/'); die; }
/** * [category_reldel 删除分类] * @return [type] [description] */ public function article_reldel($slug) { $arc = Article::where(['id' => $slug])->firstOrFail(); $arc->delete(); View::success('彻底删除成功', 'http://' . __HOST__ . '/admin/article/recycle/'); die; }