public function index($language_id = 2)
 {
     $map = array('language_id' => $language_id);
     $result = get_result('location_description', $map);
     $continent = array();
     $country = array();
     $city = array();
     $location_id = array();
     foreach ($result as $row) {
         if ($row['continent'] == '') {
             continue;
         }
         $continent[$row['continent']] = $row['continent'];
         $country[$row['continent']][] = $row['country'];
         $city[$row['country']][] = $row['city'];
         $location_id[$row['city']] = $row['location_id'];
     }
     $new_country = array();
     foreach ($continent as $row) {
         $new_country[$row] = array_unique($country[$row]);
     }
     $data['continent_json'] = json_encode($continent);
     $data['country_json'] = json_encode($new_country);
     $data['city_json'] = json_encode($city);
     $data['location_id'] = json_encode($location_id);
     $this->assign($data);
     $this->display(T('Common@Widget/Location/index'));
 }
 public function index($product_id, $Month = '', $moudel = '')
 {
     if (!$product_id) {
         $product_id = 0;
     }
     $map['product_id'] = $product_id;
     $result = get_result('product_price', $map);
     if ($Month) {
         $Montht = $Month;
     } else {
         $Montht = date('Y-m-d');
     }
     $Monthts = date('t', strtotime($Montht));
     foreach ($result as $k => $row) {
         $data[] = array('id' => $row['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $row['day']), 'name' => date('Y-m-d H:i', $row['day']), 'textColor' => '#0FDECF');
     }
     for ($im = 1; $im <= $Monthts; $im++) {
         $map['day'] = strtotime(date('Y-m-d', $row['day']));
         $description_info = get_info('product_description', $map);
         if ($description_info) {
             $data[] = array('id' => $description_info['id'], 'title' => $row['type1_price'], 'start' => date('Y-m-d', $description_info['day']), 'name' => date('Y-m-d H:i', $description_info['day']), 'textColor' => '#0FDECF');
         } else {
             $data[] = array('id' => '0', 'title' => '设定价格', 'start' => date('Y-m', strtotime($Montht)) . "-" . $im, 'name' => date('Y-m', strtotime($Montht)) . "-" . $im, 'textColor' => '#0FDECF');
         }
     }
     $datas['data'] = json_encode($data);
     $this->assign($map);
     $this->assign($datas);
     $this->display(T('Common@Widget/ProductPrice/index'));
 }
Exemple #3
0
function fetch_comments_unit($unitId)
{
    global $mysqli;
    $sql = 'SELECT Comments.id, (DATE_FORMAT(commentTime,  "%d.%m.%Y %H:%i:%s")) as time,name as user,comment, IFNULL(SUM(isPositive),0) as positive, IFNULL(COUNT(isPositive)-SUM(isPositive),0) as negative, CommentAnswers.answerTo as answerTo,
		IFNULL((SELECT (isPositive-1)+isPositive FROM CommentRating WHERE id=Comments.id AND userId=?),0) as voted
                					FROM Comments
                					    LEFT JOIN UserData
                        					ON Comments.userId=UserData.Id
                        				LEFT JOIN CommentRating
                        					ON Comments.id=CommentRating.id
                        				LEFT JOIN CommentAnswers
                                			ON CommentAnswers.id=Comments.id
                       					WHERE unitId=?
                        				GROUP BY Comments.id';
    $stmt = $mysqli->prepare($sql);
    $stmt->bind_param('ii', $userId, $unitId);
    $stmt->execute();
    $result = array();
    $comment = get_result($stmt);
    while ($stmt->fetch()) {
        $result[] = $comment;
        $comment = get_result($stmt);
    }
    $stmt->fetch();
    $stmt->close();
    return $result;
}
function read_invitations()
{
    global $TABLE_PREFIX, $admintpl, $language, $CURUSER, $STYLEPATH, $btit_settings;
    $scriptname = htmlspecialchars($_SERVER["PHP_SELF"] . "?page=admin&user="******"uid"] . "&code=" . $CURUSER["random"] . "&do=invitations");
    $addparam = "";
    $res = get_result("SELECT COUNT(*) as invites FROM {$TABLE_PREFIX}invitations", true);
    $count = $res[0]["invites"];
    list($pagertop, $pagerbottom, $limit) = pager('15', $count, $scriptname . "&amp;");
    $admintpl->set("inv_pagertop", $pagertop);
    $admintpl->set("inv_pagerbottom", $pagerbottom);
    $results = get_result("SELECT * FROM {$TABLE_PREFIX}invitations ORDER BY id DESC {$limit}", true);
    $invitees = array();
    $i = 0;
    foreach ($results as $id => $data) {
        $res = do_sqlquery("SELECT username FROM {$TABLE_PREFIX}users WHERE id = " . $data["inviter"], true);
        if (mysql_num_rows($res) > 0) {
            $inviter_name = mysql_result($res, 0, 0);
        } else {
            $inviter_name = 'Unknown';
        }
        $invitees[$i]["inviter"] = "<a href=\"index.php?page=userdetails&amp;user="******"inviter"] . "\">" . $inviter_name . "</a>";
        $invitees[$i]["invitee"] = unesc($data["invitee"]);
        $invitees[$i]["hash"] = unesc($data["hash"]);
        $invitees[$i]["time_invited"] = $data["time_invited"];
        $invitees[$i]["delete"] = "<a href=\"index.php?page=admin&amp;user="******"uid"] . "&amp;code=" . $CURUSER["random"] . "&amp;do=invitations&amp;action=delete&amp;id=" . $data["id"] . "\" onclick=\"return confirm('" . AddSlashes($language["DELETE_CONFIRM"]) . "')\">" . image_or_link("{$STYLEPATH}/images/delete.png", "", $language["DELETE"]) . "</a>";
        $i++;
    }
    $admintpl->set("invitees", $invitees);
    $admintpl->set("language", $language);
}
 public function index($currency = '')
 {
     $data['result'] = get_result('currency');
     $data['currency'] = $currency;
     $this->assign($data);
     $this->display(T('Common@Widget/Currency/index'));
 }
 /**
  *帮助中心主页
  *	显示关于N邦的帮助文章
  *流程分析
  *	1、将页面中的菜单查询出来并显示
  *	2、要求是用户在后台添加的时候前台能够自动显示出来菜单并显示到页面中
  **/
 public function index()
 {
     $article_id = I('id');
     /* 获取分类列表 */
     $help_category_cath = array_id_key(get_help_category_cache());
     $category_ids = array();
     foreach ($help_category_cath as $row) {
         $category_ids[] = $row['id'];
     }
     /* 获取分类下的所有文章 */
     $map = null;
     $map['status'] = 1;
     $map['category_id'] = array('in', $category_ids);
     $articles = get_result($this->table, $map);
     /* 获去当前显示的文章 */
     if ($article_id) {
         $map['id'] = $article_id;
         $map['status'] = 1;
         $cur_article = get_info($this->table, $map);
     } else {
         $cur_article = $articles[0];
     }
     $data['help_category_cath'] = $help_category_cath;
     $data['articles'] = $articles;
     $data['cur_article'] = $cur_article;
     $this->assign($data);
     $this->display();
 }
Exemple #7
0
function ca_mois($mois, $annee, $jour, $pourc = 100, $port = 1)
{
    global $cnx;
    if ($jour != "%") {
        $jour = sprintf("%02d", $jour);
    }
    if ($mois != "%") {
        $mois = sprintf("%02d", $mois);
    }
    if ($annee != "%") {
        $annee = sprintf("%04d", $annee);
    }
    $date = "{$annee}-{$mois}-{$jour}";
    $query = "select * from " . Commande::TABLE . " where statut >= " . Commande::PAYE . " and statut <> " . Commande::ANNULE . " and datefact like '{$date}'";
    $resul = $cnx->query($query);
    $list = array();
    while ($resul && ($row = $cnx->fetch_object($resul))) {
        $list[] = $row->id;
    }
    if (count($list) == 0) {
        $list = '0';
    } else {
        $list = implode(',', $list);
    }
    $ca = round(get_result("SELECT sum(quantite*prixu) as camois FROM " . Venteprod::TABLE . " where commande in ({$list})"), 2);
    $ca += get_result("SELECT sum(port) as port FROM " . Commande::TABLE . " where id in ({$list})");
    $ca -= get_result("SELECT sum(remise) as remise FROM " . Commande::TABLE . " where id in ({$list})");
    if (!$port) {
        $ca -= get_result("SELECT sum(port) as port FROM " . Commande::TABLE . " where id in ({$list})");
    }
    return round($ca * $pourc / 100, 2);
}
 /**
  *我的脚印
  *	显示店铺经营的一些数据统计
  *		1、店铺中交易成功的金额
  *		2、翻译的字数统计
  *		3、口译小时数统计
  *		4、音频翻译分钟数统计
  **/
 public function index()
 {
     $apptype = (!empty(I('post.apptype')) and I('post.apptype') == C('APP_KEY')) ? true : false;
     //手机app接口密钥
     if ($apptype) {
         $app_key = trim(I("post.key"));
         //md5加密的登录时间
         $member_id = I("post.home_member_id");
         $this->isLoginExpire($app_key, $member_id);
         //判断登录过期
     } else {
         $member_id = session('home_member_id');
     }
     //查询出来属于这个店铺的订单的数据
     //$map['member_id'] = $member_id;
     $map = array('member_id' => $member_id, 'status' => array(in, array(3, 6, 7)));
     $shop_order_data = get_result($this->table, $map);
     //处理数据
     $shop_data = $this->shop_data($shop_order_data);
     if ($apptype) {
         $this->ajaxReturn($shop_data);
     }
     $this->assign($shop_data);
     $this->display();
 }
Exemple #9
0
 public function view()
 {
     if (!isset($_SESSION["autorised"])) {
         header('Location: ' . $_SESSION['base_url'] . '/home');
     }
     include_once "/../models/model_test.php";
     $result = get_result(-1, $_SESSION['user_id']);
     include_once "/../pages/result.php";
 }
 public function completedProjectDetailofUser($userid, $from, $to)
 {
     global $dblink;
     $v = $dblink->prepare("SELECT * FROM project WHERE userid=? AND status='1' ORDER BY id DESC LIMIT ?,?");
     $v->bind_param("iii", $userid, $from, $to);
     $v->execute();
     $data = get_result($v);
     return $data;
 }
 public function search($emailid)
 {
     global $dblink;
     $v = $dblink->prepare("SELECT * FROM user WHERE email=? or username=?");
     $v->bind_param("ss", $emailid, $emailid);
     $v->execute();
     $result = get_result($v);
     return $result;
 }
 private function getUserInfo($id)
 {
     global $dblink;
     $v = $dblink->prepare("SELECT * FROM user WHERE id=?");
     $v->bind_param("i", $id);
     $v->execute();
     $result = get_result($v);
     return $result;
 }
 public function index($action, $parameter = array(), $language_id = '')
 {
     $data['result'] = get_result('language');
     $data['action'] = $action;
     $data['parameter'] = $parameter;
     $data['language_id'] = $language_id;
     $this->assign($data);
     $this->display(T('Common@Widget/Language/index'));
 }
Exemple #14
0
 public function listBidsforUser($userid, $from, $to)
 {
     global $dblink;
     $v = $dblink->prepare("SELECT * FROM project_bid WHERE userid=? ORDER BY ID DESC LIMIT ?,?");
     $v->bind_param("iii", $userid, $from, $to);
     $v->execute();
     $result = get_result($v);
     return $result;
 }
 public function listar($cod_situacao = null)
 {
     $query = $this->query();
     if (!is_null($cod_situacao)) {
         $query .= " WHERE cod_situacao = '" . do_escape($cod_situacao) . "' ";
     }
     $query .= " ORDER BY nome ";
     return get_result($query);
 }
Exemple #16
0
function main_menu()
{
    global $TABLE_PREFIX, $CURUSER, $tpl;
    $blocks = get_result('SELECT content FROM ' . $TABLE_PREFIX . 'blocks WHERE position="t" AND status=1 AND ' . $CURUSER['id_level'] . '>=minclassview  AND ' . $CURUSER['id_level'] . '<=maxclassview ' . ($FORUMLINK == '' || $FORUMLINK == 'internal' || substr($FORUMLINK, 0, 3) == 'smf' || $FORUMLINK == 'ipb' ? '' : ' AND content!="forum"') . ' ORDER BY sortid', true, $CACHE_DURATION);
    $return = '';
    foreach ($blocks as $entry) {
        $return .= get_content(realpath(dirname(__FILE__) . '/..') . '/blocks/' . $entry['content'] . '_block.php');
    }
    return set_block('', 'justify', $return);
}
Exemple #17
0
function user_with_color($username, $prefix = NULL, $suffix = NULL)
{
    global $TABLE_PREFIX;
    if (isset($prefix) && isset($suffix)) {
        return unesc($prefix . $username . $suffix);
    } else {
        // get cached version for the user (prefix and suffix)
        $rps = get_result("SELECT prefixcolor,suffixcolor FROM {$TABLE_PREFIX}users u INNER JOIN {$TABLE_PREFIX}users_level ul ON u.id_level=ul.id WHERE u.username="******"", false, 0);
        return unesc($rps[0]['prefixcolor'] . $username . $rps[0]['suffixcolor']);
    }
}
 public function listar()
 {
     $query = $this->query() . $this->groupby();
     //echo $query;
     $retorno = array();
     $cidades = get_result($query);
     foreach ($cidades as $cidade) {
         $retorno[] = $this->atualizar($cidade);
     }
     return $retorno;
 }
 public function ability()
 {
     $map['type'] = '2';
     $pid = I('pid') ? I('pid') : 0;
     $map['pid'] = $pid;
     $map['status'] = array('gt', '-1');
     $result = get_result($this->table, $map);
     $data['result'] = $result;
     $this->assign($data);
     $this->display('index');
 }
 public function catData($id)
 {
     global $dblink;
     $v = $dblink->prepare("SELECT * FROM category WHERE id=?");
     $v->bind_param("i", $id);
     $v->execute();
     $result = get_result($v);
     foreach ($result as $value) {
         return $value;
     }
 }
 public function listOutboxMessage($userid, $from, $to)
 {
     // Function to list Message outbox
     global $dblink;
     $v = $dblink->prepare("SELECT * FROM message WHERE msg_from=? ORDER BY time DESC LIMIT ?,?");
     $v->bind_param("iii", $userid, $from, $to);
     $v->execute();
     $v->store_result();
     $data = get_result($v);
     return $data;
 }
Exemple #22
0
function action_log($table_name, $table_id = 0, $action_filed = 'id,title')
{
    $url = strtolower(MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME);
    if (is_numeric($table_id)) {
        $map['id'] = $table_id;
    } else {
        $map['id'] = array('in', $table_id);
    }
    $result = get_result($table_name, $map, $action_filed);
    $_POST = array('member_id' => session('member_id'), 'username' => session('username'), 'url' => $url, 'table_name' => $table_name, 'table_id' => $table_id, 'description' => json_encode($result), 'ip' => get_client_ip());
    update_data('action_log');
}
 /**
  *店铺日程管理
  *	显示店铺的时间设置,店家在自己的后台能够设置自己的时间日程
  *流程分析
  *	1、分解任务
  **/
 public function index()
 {
     $map['shop_id'] = session('home_shop_id');
     $shop_time = get_result($this->shop_time, $map, '', 'time,week asc');
     //dump($shop_time);
     if (IS_POST) {
         //生成第一条数据
         $shop_time = I('brand');
         //将日程信息从数据库中查询出来
         $shop_time_id = get_result($this->shop_time, array('shop_id' => session('home_shop_id')), '', 'time,week asc');
         $shop_sql_array = array();
         foreach ($shop_time as $k => $v) {
             $shop_sql_array[$k]['id'] = $shop_time_id[$k]['id'];
             $shop_sql_array[$k]['time'] = $v;
         }
         //根据数组组合sql语句最好是一句
         $shop_time_sql = '';
         foreach ($shop_sql_array as $k => $v) {
             $shop_time_sql .= "update `sr_shop_time` set `type`=" . $v['time'] . " where `id`=" . $v['id'] . ";";
         }
         //执行sql语句
         $Model = M();
         $result = $Model->execute($shop_time_sql);
         if (is_numeric($result)) {
             $this->success('修改成功!', U('User/Schedule/index'));
         } else {
             $this->error('修改失败!', U('User/Schedule/index'));
         }
     } else {
         //将店铺的日程按照一天中的三个时间段组织起来
         $shop_date_programme = array();
         if (empty($shop_time)) {
             createSchedule(session('home_shop_id'));
             $shop_time = get_result($this->shop_time, $map, '', 'time,week asc');
         }
         foreach ($shop_time as $k => $v) {
             if ($v['time'] == 1) {
                 $shop_date_programme[1][] = $v;
             } else {
                 if ($v['time'] == 2) {
                     $shop_date_programme[2][] = $v;
                 } else {
                     if ($v['time'] == 3) {
                         $shop_date_programme[3][] = $v;
                     }
                 }
             }
         }
         $data['shop_date_programme'] = $shop_date_programme;
         $this->assign($data);
         $this->display();
     }
 }
Exemple #24
0
function readGoldSettings()
{
    global $TABLE_PREFIX, $settings;
    $res = get_result("SELECT * FROM {$TABLE_PREFIX}gold  WHERE id='1'", true);
    $count = 0;
    foreach ($res as $key => $value) {
        $settings[$count]["gold_picture"] = unesc("<img src='../gold/" . $value["gold_picture"] . "' border='0' alt='gold'/>\r\n             \t\t\t\t\t\t\t\t\t\t  <br/>Choose new picture (max size 100px x 100px):<br/><input type='file' name='gold_picture'/>");
        $settings[$count]["level"] = createUsersLevelCombo(unesc($value["level"]));
        $settings[$count]["silver_picture"] = unesc("<img src='../gold/" . $value["silver_picture"] . "' border='0'  alt='silver'/>\r\n             \t\t\t\t\t\t\t\t\t\t\t<br/>Choose new picture (max size 100px x 100px):<br/><input type='file' name='silver_picture'/>");
        $settings[$count]["gold_description"] = unesc("<textarea name='gold_description' style='width:250px; height:120px; border:1px solid #999999;'>" . $value["gold_description"] . "</textarea>");
        $settings[$count]["silver_description"] = unesc("<textarea name='silver_description' style='width:250px; height:120px; border:1px solid #999999;'>" . $value["silver_description"] . "</textarea>");
        $settings[$count]["classic_description"] = unesc("<textarea name='classic_description' style='width:250px; height:120px; border:1px solid #999999;'>" . $value["classic_description"] . "</textarea>");
        $count++;
    }
}
 /**
  * 改变用户积分
  * 配置操作行为必须和标签名称一致
  * $data  
  * uid 当前用户id 
  * uname  当前用户名
  * ruleId 规则id号
  * field  用户更新的积分 或者 金币字段
  * isdate 是否启用时间限制
  */
 private function _score($_data)
 {
     if (empty($_data['uid']) || empty($_data['ruleId']) || empty($_data['field'])) {
         return false;
     }
     if (!isset($_data['isdate'])) {
         $_data['isdate'] = false;
     }
     //获取积分
     $res = M('score_rule')->where(array('id' => $_data['ruleId']))->find();
     if ($res['type'] == 1) {
         $type = 'score';
     } else {
         if ($res['type'] == 2) {
             $type = '_score';
         } else {
             if ($res['type'] == 3) {
                 $type = 'coin';
             } else {
                 if ($res['type'] == 4) {
                     $type = '_coin';
                 }
             }
         }
     }
     if (empty($res) || $res['score'] == 0) {
         return false;
     }
     //检测次数限
     if ($_data['isLimit'] && $this->_check_num($_data['uid'], $_data['action'], $_data['isdate'])) {
         return false;
     } else {
         //更新用户积分
         $result = M('member')->where(array('id' => $_data['uid']))->setInc($_data['field'], $res['score']);
         $now_score = M('member')->where('id=' . $_data['uid'])->getField('score');
         $level_info = get_result('member_level', array('status' => 1, 'score' => array('elt', $now_score)), 'id', 'score desc');
         if ($level_info) {
             M('member')->where(array('id=' . $_data['uid']))->setField('level', $level_info[0]['id']);
         }
         if ($result) {
             $data = array('uid' => $_data['uid'], 'table_name' => $_data['tablename'], 'table_id' => $_data['tableid'], 'uname' => $_data['uname'], 'type' => $type, 'action' => $_data['action'], 'rule_id' => $res['id'], 'score' => $res['score'], 'msg' => $res['title'], 'create_time' => time());
             $score_log_mod = D('score_log');
             $score_log_mod->add($data);
         }
         return true;
     }
 }
 /**
  * 查看订单详情
  * @author						李东
  * @date						2015-06-23
  */
 public function detail()
 {
     $order_id = I('get.id');
     if (!$order_id) {
         $this->error('错误操作');
     }
     $map['order_id'] = $order_id;
     $order_info = get_info(D($this->model), $map);
     $map = array();
     $map['order_id'] = $order_id;
     $order_result = get_result('order_history', $map);
     // 		print_r($order_info);
     // 		exit;
     $data['info'] = $order_info;
     $data['result'] = $order_result;
     $this->assign($data);
     $this->display();
 }
Exemple #27
0
function send_pm($sender, $recepient, $subject, $msg)
{
    global $FORUMLINK, $TABLE_PREFIX, $db_prefix, $CACHE_DURATION;
    if ($FORUMLINK == 'smf') {
        # smf forum
        # get smf_fid of recepient
        $recepient = get_result('SELECT smf_fid FROM ' . $TABLE_PREFIX . 'users WHERE id=' . $recepient . ' LIMIT 1;', true, $CACHE_DURATION);
        if (!isset($recepient[0])) {
            return false;
        }
        # valid user
        $recepient = $recepient[0]['smf_fid'];
        if ($recepient == 0) {
            return false;
        }
        # valid smf_fid
        # get smf_fid of sender
        # if sender id is invalid or 0, use System
        $sender = $sender == 0 ? 0 : get_result('SELECT smf_fid, username FROM ' . $TABLE_PREFIX . 'users WHERE id=' . $sender . ' LIMIT 1;', true, $CACHE_DURATION);
        if (!isset($sender[0])) {
            $sender = array();
            $sender['smf_fid'] = 0;
            $sender['username'] = '******';
        } else {
            $sender = $sender[0];
        }
        # insert message
        quickQuery('INSERT INTO ' . $db_prefix . 'personal_messages (ID_MEMBER_FROM, fromName, msgtime, subject, body) VALUES (' . $sender['smf_fid'] . ', ' . sqlesc($sender['username']) . ', UNIX_TIMESTAMP(), ' . $subject . ', ' . $msg . ');');
        # get id of message
        $pm_id = mysql_insert_id();
        # insert recepient for message
        quickQuery('INSERT INTO ' . $db_prefix . 'pm_recipients (ID_PM, ID_MEMBER) VALUES (' . $pm_id . ', ' . $recepient . ');');
        # notify recepient
        quickQuery('UPDATE ' . $db_prefix . 'members SET instantMessages=instantMessages+1, unreadMessages=unreadMessages+1 WHERE ID_MEMBER=' . $recepient . ' LIMIT 1;');
        return true;
    } else {
        # internal PM system
        # insert pm
        quickQuery('INSERT INTO ' . $TABLE_PREFIX . 'messages (sender, receiver, added, subject, msg) VALUES (' . $sender . ', ' . $recepient . ', UNIX_TIMESTAMP(), ' . $subject . ', ' . $msg . ')');
        return true;
    }
    return false;
}
 /**
  *系统公告
  *	也就是系统中的帮助中心
  *@author 刘浩 <372980503>
  *@time 2015-7-8
  **/
 public function notice()
 {
     //接收新闻信息
     $notice_id = I('id');
     $map['id'] = $news_id;
     $notice_info = get_info($this->table, $map);
     $data['news_detail'] = $notice_info;
     //将推荐的公告查询出来
     $map_notice['status'] = array('GT', 0);
     $map_notice['type'] = 'notice';
     $map_notice['recommend'] = 1;
     //被推荐的公告
     //查询出来
     $notice_result = get_result($this->table, $map_notice);
     //增加阅读次数
     $data['notice'] = $notice_result;
     $this->assign($data);
     $this->display();
 }
 public function del()
 {
     //1、根据点击删除传递过来的ID获取相关数据
     $ids = I('ids');
     $map['id'] = array("in", $ids);
     $result = get_result($this->table, $map);
     //2、获取评论内容中的图片并删除
     foreach ($result as $key => $value) {
         //删除内容中的图片
         delStrImgs($value['content']);
         //3、统计评论删除后新闻的评论数量
         $_POST['id'] = $value['product_id'];
         $_POST['comment'] = count_data($this->table, array("product_id" => $value['product_id']));
         update_data("article");
     }
     //4、删除数据表中的数据
     delete_data($this->table, $map);
     $this->success("删除成功");
 }
 public function edit()
 {
     if (IS_POST) {
         $this->update();
     } else {
         $id = intval(I('id'));
         $map['id'] = $id;
         $data['info'] = M($this->table)->where($map)->find();
         //将帮助分类的类别显示出来
         $map['status'] = array("GT", 0);
         //将正常的显示出来
         $map['type'] = 3;
         $help_category = get_result('category', $map);
         //将帮助信息数据组织成树形
         $help_category = list_to_tree($help_category);
         $data['help_category'] = $help_category;
         $this->assign($data);
         $this->display('operate');
     }
 }