/**
  * 详请
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-02-21 13:47:40
  * @lastmodify      2013-04-26 23:13:01
  *
  * @return void 无返回值
  */
 public function detailAction()
 {
     $blog_id = Filter::int('id', 'get');
     $date = Filter::int('date', 'get');
     if (!$blog_id || !$date) {
         //非法参数
         $log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . "date=({$date}),id=({$blog_id})";
         trigger_error($log);
         $this->_showMessage('error' . $blog_id . $date, null, 404);
     }
     if ($blog_info = $this->_model->find($blog_id)) {
         if (date('Ymd', $blog_info['add_time']) != $date) {
             //日期与id不匹配
             $log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . "date=({$date}),id=({$blog_id})";
             trigger_error($log);
             $this->_showMessage('error' . $blog_id . ',' . $date, null, 404);
         }
         $filename = str_replace(BASE_SITE_URL, WWWROOT, $blog_info['link_url']);
         new_mkdir(dirname($filename));
         $o = $this->getViewTemplate('build_html')->assign('blog_info', $blog_info)->assign(array('web_title' => L('MINIBLOG,DETAIL') . TITLE_SEPARATOR . L('MINIBLOG'), 'comments_html' => $this->_getBlogComments($blog_id)));
         $content = $o->fetch(CONTROLLER_NAME, 'detail', $blog_id);
         //file_put_contents($filename, $content);
         echo $content;
     } else {
         //微博不存在
         $this->_showMessage(L('MINIBLOG,NOT_EXIST'), null, 404);
     }
 }
Beispiel #2
0
 public function insertResult($resultXML, $resultKbn)
 {
     $jkfResult = $resultXML->body->list->jkfResult;
     $this->db->dosql("LOCK TABLES tiny_result,tiny_result_list WRITE");
     //mysql_query("SET AUTOCOMMIT=0");
     $retVal = $this->resultModel->fields("result_seq")->order("result_seq desc")->limit(1)->select();
     if (!isset($retVal) || !isset($retVal[0]["result_seq"])) {
         $retVal[0]["result_seq"] = 0;
     }
     $resultSeq = 1 + Filter::int($retVal[0]["result_seq"]);
     $sqlRet = $this->resultModel->data(array('result_seq' => $resultSeq, 'company_code' => Filter::str($jkfResult->companyCode), 'business_no' => Filter::str($jkfResult->businessNo), 'business_type' => Filter::str($jkfResult->businessType), 'result_kbn' => Filter::str($resultKbn), 'declare_type' => Filter::str($jkfResult->declareType), 'chk_mark' => Filter::str($jkfResult->chkMark), 'notice_date' => Filter::str($jkfResult->noticeDate), 'notice_time' => Filter::str($jkfResult->noticeTime), 'note' => Filter::str($jkfResult->note)))->insert();
     if (!$sqlRet) {
         $jkfResultList = $resultXML->body->list->jkfResult->resultList;
         foreach ($jkfResultList->jkfResultDetail as $detail) {
             $retVal = $this->resultListModel->fields("result_list_seq")->where("result_seq = {$resultSeq}")->order("result_list_seq desc")->find();
             if (!isset($retVal) || !isset($retVal["result_list_seq"])) {
                 $retVal["result_list_seq"] = 0;
             }
             $resultListSeq = 1 + Filter::int($retVal["result_list_seq"]);
             $this->resultListModel->data(array('result_seq' => $resultSeq, 'result_list_seq' => $resultListSeq, 'result_info' => Filter::str($detail->resultInfo)))->insert();
         }
     }
     $this->db->dosql("UNLOCK TABLES");
     //mysql_query('ROLLBACK');
     //mysql_query("END");
     //mysql_query("SET AUTOCOMMIT=1");
 }
Beispiel #3
0
 public function parsePorm($prom)
 {
     $type = $prom['type'];
     $expr = $prom['expression'];
     $result = array('total_amount' => $this->total_amount, 'value' => 0.0);
     switch ($type) {
         case '0':
             $result['total_amount'] = $this->total_amount * $expr / 100;
             $result['note'] = "省" . $this->total_amount * (100 - $expr) / 100 . "(" . $expr / 10 . "折)";
             $result['value'] = floatval($this->total_amount * (100 - $expr) / 100);
             break;
         case '1':
             $result['total_amount'] = $this->total_amount - $expr;
             $result['note'] = "省" . $expr . "(立减" . $expr . ")";
             $result['value'] = floatval($expr);
             break;
         case '2':
             $result['value'] = intval($expr);
             $result['note'] = "送" . $expr . "倍积分";
             break;
         case '3':
             $model = new Model("voucher_template");
             $voucher = $model->where("id=" . Filter::int($expr))->find();
             if ($voucher) {
                 $result['note'] = "面值" . $voucher['value'] . "优惠券";
             } else {
                 $result['note'] = "所送的优惠券已不存在";
             }
             break;
         case '4':
             $result['note'] = "免运费";
             break;
     }
     return $result;
 }
Beispiel #4
0
 /**
  * 列表
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-07 11:09:51
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     if (!in_array($sort, $this->_getDbFields())) {
         $log = __METHOD__ . ': ' . __LINE__ . ',' . L('QUERY,CONTROLLER_NAME,%。,ORDER,COLUMN') . $sort . L('NOT_EXIST');
         C('TRIGGER_ERROR', array($log));
         $this->_model->addLog($log, LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false, L('SERVER_ERROR'));
     }
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //开始时间
     $date_end = Filter::string('date_end', 'get');
     //结束时间
     $template_id = Filter::int('template_id', 'get');
     //
     $column = Filter::string('column', 'get');
     //搜索字段
     $where = array();
     if ('' !== $keyword && in_array($column, array('subject', 'content', 'email'))) {
         $where[$column] = $this->_buildMatchQuery($column, $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['add_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['add_time'][] = array('ELT', $date_end);
     }
     if (isset($where['add_time']) && count($where['add_time']) == 1) {
         $where['add_time'] = $where['add_time'][0];
     }
     if ($template_id) {
         $where['template_id'] = $template_id;
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME') . L('LIST,ERROR'));
     //出错
     $templates = $this->_getCache(false, 'Mail');
     foreach ($data as &$v) {
         $v['template_name'] = isset($templates[$id = $v['template_id']]) ? $templates[$id]['template_name'] : '';
     }
     $this->_ajaxReturn(true, '', $data, $total);
 }
Beispiel #5
0
 public function set_online()
 {
     $id = Req::args("id");
     if (is_array($id)) {
         $id = implode(',', $id);
     }
     $status = Filter::int(Req::args('status'));
     if ($status != 0 && $status != 1) {
         $status = 0;
     }
     $model = new Model('goods');
     $model->data(array('is_online' => $status))->where("id in({$id})")->update();
     $this->redirect("goods_list");
 }
Beispiel #6
0
 /**
  * 列表
  *
  * @author          mrmsl <*****@*****.**>
  * @lastmodify      2013-01-22 10:40:26 by mrmsl
  *
  * @return void 无返回值
  */
 public function listAction()
 {
     $sort = Filter::string('sort', 'get', $this->_pk_field);
     //排序字段
     $sort = in_array($sort, $this->_getDbFields()) ? $sort : $this->_pk_field;
     $order = !empty($_GET['dir']) ? Filter::string('dir', 'get') : Filter::string('order', 'get');
     //排序
     $order = toggle_order($order);
     $keyword = Filter::string('keyword', 'get');
     //关键字
     $date_start = Filter::string('date_start', 'get');
     //注册开始时间
     $date_end = Filter::string('date_end', 'get');
     //注册结束时间
     $log_type = Filter::int('log_type', 'get');
     //日志类型
     $where = $log_type != LOG_TYPE_ALL ? array('log_type' => $log_type) : array();
     if ($keyword !== '') {
         $where['content'] = $this->_buildMatchQuery('content', $keyword, Filter::string('match_mode', 'get'));
     }
     if ($date_start && ($date_start = strtotime($date_start))) {
         $where['log_time'][] = array('EGT', $date_start);
     }
     if ($date_end && ($date_end = strtotime($date_end))) {
         $where['log_time'][] = array('ELT', $date_end);
     }
     if (isset($where['log_time']) && count($where['log_time']) == 1) {
         $where['log_time'] = $where['log_time'][0];
     }
     $total = $this->_model->where($where)->count();
     if ($total === false) {
         //查询出错
         $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_LOG') . L('TOTAL_NUM,ERROR'));
     } elseif ($total == 0) {
         //无记录
         $this->_ajaxReturn(true, '', null, $total);
     }
     $page_info = Filter::page($total);
     $data = $this->_model->where($where)->field('*,INET_NTOA(user_ip) AS user_ip')->limit($page_info['limit'])->order('' . $sort . ' ' . $order)->select();
     $data === false && $this->_sqlErrorExit(L('QUERY,CONTROLLER_NAME_LOG') . L('LIST,ERROR'));
     //出错
     $this->_ajaxReturn(true, '', $data, $total);
 }
Beispiel #7
0
 public function address_save($redirect = null)
 {
     $rules = array('zip:zip:邮政编码格式不正确!', 'addr:required:内容不能为空!', 'accept_name:required:收货人姓名不能为空!,mobile:mobi:手机格式不正确!,phone:phone:电话格式不正确', 'province:[1-9]\\d*:选择地区必需完成', 'city:[1-9]\\d*:选择地区必需完成', 'county:[1-9]\\d*:选择地区必需完成');
     $info = Validator::check($rules);
     if (!is_array($info) && $info == true) {
         Filter::form(array('sql' => 'accept_name|mobile|phone', 'txt' => 'addr', 'int' => 'province|city|county|zip|is_default|id'));
         $is_default = Filter::int(Req::args("is_default"));
         if ($is_default == 1) {
             $this->model->table("address")->where("user_id=" . $this->user['id'])->data(array('is_default' => 0))->update();
         } else {
             Req::args("is_default", "0");
         }
         Req::args("user_id", $this->user['id']);
         $id = Filter::int(Req::args('id'));
         if ($id) {
             $this->model->table("address")->where("id={$id} and user_id=" . $this->user['id'])->update();
         } else {
             $obj = $this->model->table("address")->where('user_id=' . $this->user['id'])->fields("count(*) as total")->find();
             if ($obj && $obj['total'] >= 20) {
                 $this->assign("msg", array("error", '地址最大允许添加20个'));
                 $this->redirect("address_other", false, Req::args());
                 exit;
             } else {
                 $address_id = $this->model->table("address")->insert();
                 $order_status = Session::get("order_status");
                 $order_status['address_id'] = $address_id;
                 Session::set("order_status", $order_status);
             }
         }
         $this->assign("msg", array("success", "地址编辑成功!"));
         Req::args("id", null);
         //$this->redirect("address_other",false);
         if ($redirect == null) {
             echo "<script>parent.location.reload();</script>";
         } else {
             $this->redirect($redirect);
         }
         exit;
     } else {
         $this->assign("msg", array("error", $info['msg']));
         $this->redirect("address_other", false, Req::args());
     }
 }
Beispiel #8
0
 /**
  * 所属地区
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-07-19 11:39:11
  * @lastmodify      2013-01-28 11:23:08 by mrmsl
  *
  * @return void 无返回值
  */
 public function publicAreaAction()
 {
     $area_id = Filter::int('node', 'get');
     $data = $this->_getTreeData($area_id, 'nochecked');
     if (!$area_id) {
         //非加载指定节点
         //增加顶级菜单
         $this->_unshift && array_unshift($data, array('area_id' => 0, 'area_name' => L('TOP_LEVEL_AREA'), 'leaf' => true));
         $parent_id = Filter::int('parent_id', 'get');
         //添加指定地区子级地区,获取指定地区信息by mashanlng on 2012-08-21 13:51:25
         if ($parent_id && ($parent_info = $this->_getCache($parent_id))) {
             $parent_info = array('area_id' => $parent_id, 'area_name' => $parent_info['area_name'], 'node' => $parent_info['node']);
             $this->_ajaxReturn(array('data' => $data, 'parent_data' => $parent_info));
         }
     }
     $this->_ajaxReturn(true, '', $data);
 }
 /**
  * 所属分类
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-03-21 13:58:09
  *
  * @return void 无返回值
  */
 public function publicCategoryAction()
 {
     $data = $this->_getCategory();
     //增加顶级分类
     $this->_unshift && array_unshift($data, array('cate_id' => 0, 'cate_name' => isset($_GET['emptyText']) ? Filter::string('emptyText', 'get') : L('TOP_LEVEL_CATEGORY'), 'leaf' => true));
     $parent_id = Filter::int('parent_id', 'get');
     //添加指定分类子分类,获取指定分类信息by mashanlng on 2012-08-21 13:53:35
     if ($parent_id && ($parent_info = $this->cache($parent_id))) {
         $parent_info = array('cate_id' => $parent_id, 'parent_name' => $parent_info['cate_name']);
         $this->_ajaxReturn(array('data' => $data, 'parent_data' => $parent_info));
     }
     $this->_ajaxReturn(true, '', $data);
 }
Beispiel #10
0
 /**
  * 导航功能菜单
  *
  * @author          mrmsl <*****@*****.**>
  * @lastmodify      2013-01-22 10:48:51 by mrmsl
  *
  * @return void 无返回值
  */
 public function publicTreeAction()
 {
     $data = $this->_getTree();
     //增加顶级菜单
     $this->_unshift && array_unshift($data, array('menu_id' => 0, 'menu_name' => isset($_GET['emptyText']) ? Filter::string('emptyText', 'get') : L('TOP_LEVEL_MENU'), 'leaf' => true));
     $parent_id = Filter::int('parent_id', 'get');
     //添加指定菜单子菜单,获取指定菜单信息by mashanlng on 2012-08-21 13:53:35
     if ($parent_id && ($parent_info = $this->_getCache($parent_id))) {
         $parent_info = array('menu_id' => $parent_id, 'controller' => $parent_info['controller'], 'parent_name' => $parent_info['menu_name'], '_priv_id' => join(',', array_keys($parent_info['priv'])), 'priv' => join(',', $parent_info['priv']));
         $this->_ajaxReturn(array('data' => $data, 'parent_data' => $parent_info));
     }
     $this->_ajaxReturn(true, '', $data);
 }
Beispiel #11
0
 public function email_message_validator()
 {
     $rules = array('title:required:消息标题不能为空!', 'content:required:消息内容不能为空!');
     $info = Validator::check($rules);
     if (Req::args('status') == null) {
         Req::args('status', "0");
     }
     $status = Filter::int(Req::args('status'));
     $trigger = Filter::int(Req::args('trigger'));
     $id = Filter::int(Req::args('id'));
     if ($info == true) {
         $model = new Model('email_message');
         $objs = $model->where('`trigger`=' . $trigger . ' and status=1')->findAll();
         if (count($objs) > 1) {
             return array('name' => null, 'msg' => '同一触发条件只能存在一条激活的信息模板!');
         } else {
             if (count($objs) == 1) {
                 if ($id != $objs[0]['id'] && $status == 1) {
                     return array('name' => null, 'msg' => '同一触发条件只能存在一条激活的信息模板!');
                 }
             }
         }
     }
     return $info;
 }
 /**
  * 查看某一条留言评论
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-01 11:00:03
  *
  * @return void 无返回值
  */
 public function viewAction()
 {
     $comment_id = Filter::int($this->_pk_field, 'get');
     $add_time = Filter::int('add_time', 'get');
     $field = '*,INET_NTOA(user_ip) AS user_ip';
     if (!$comment_id && !$add_time) {
         //非法参数
         $log = L('CN_CHAKAN,CONTROLLER_NAME,%.,INVALID_PARAM') . "{$this->_pk_field}({$comment_id}),add_time({$add_time})";
         $msg = L('INVALID_PARAM');
     } elseif (!($comment_info = $this->_model->field($field)->where(array($this->_pk_field => $comment_id, 'add_time' => $add_time))->select())) {
         //不存在
         $log = L('CN_CHAKAN,CONTROLLER_NAME') . ".{$this->_pk_field}({$comment_id}),add_time({$add_time})" . L('NOT_EXIST');
         $msg = L('CONTROLLER_NAME,NOT_EXIST');
     }
     if (!empty($msg)) {
         //错误
         $log = get_method_line(__METHOD__, __LINE__, LOG_INVALID_PARAM) . $log;
         trigger_error($log, E_USER_ERROR);
         $this->_ajaxReturn(false, $msg);
     }
     $store = array($this->_pk_field => $comment_id, 'add_time' => $add_time, 'content' => '');
     $info = $comment_info[0];
     if (COMMENT_REPLY_TYPE_REPLIED == $info['admin_reply_type']) {
         //
         $reply_content = $this->_model->where('admin_reply_type=' . COMMENT_REPLY_TYPE_ADMIN . ' AND real_parent_id=' . $info[$this->_pk_field])->getField('content');
         $store['content'] = $reply_content;
     }
     if ($parent_id = $info['parent_id']) {
         $node_arr = explode(',', $info['node']);
         $comment_info = $this->_model->field($field)->where("type={$info['type']} AND (node LIKE '{$node_arr[0]},%' OR {$this->_pk_field} = {$node_arr[0]}) AND comment_id<={$comment_id}")->select();
     }
     $this->_ajaxReturn(true, $store, Tree::array2tree($comment_info, $this->_pk_field));
 }
Beispiel #13
0
 /**
  * Converts the type of values like "true", "false", "null" or "123".
  *
  * @param string $value
  * @param int    $options
  * @return mixed
  */
 public static function convert($value, $options = self::VAR_STRING)
 {
     $options = (int) $options;
     if ($options & self::VAR_STRING && !empty($value)) {
         return trim(Filter::stripQuotes($value));
     }
     if ($options & self::VAR_FLOAT) {
         return Filter::float($value, 12);
     }
     if ($options & self::VAR_INT) {
         return Filter::int($value);
     }
     if ($options & self::VAR_BOOL || $options & self::VAR_NULL) {
         if (null === $value || 'null' === strtolower(trim($value))) {
             return null;
         }
         return Filter::bool($value);
     }
     return (string) $value;
 }
Beispiel #14
0
 /**
  * 详请
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-02-21 15:26:00
  * @lastmodify      2013-04-23 14:32:00 by mrmsl
  *
  * @return void 无返回值
  */
 public function detailAction()
 {
     $blog_id = Filter::int('id', 'get');
     $date = Filter::int('date', 'get');
     if (!$blog_id || !$date) {
         //非法参数
         $this->triggerError(__METHOD__ . ': ' . __LINE__ . ',' . "date=({$date}),id=({$blog_id})");
         $this->_showMessage('error' . $blog_id . $date, null, 404);
     }
     if ($blog_info = $this->_model->find($blog_id)) {
         if (date('Ymd', $blog_info['add_time']) != $date) {
             //日期与id不匹配
             $this->triggerError(__METHOD__ . ': ' . __LINE__ . ',' . "date=({$date}),id=({$blog_id})");
             $this->_showMessage('error' . $blog_id . ',' . $date, null, 404);
         }
         if (!$blog_info['is_issue'] || $blog_info['is_delete']) {
             //未发布或已删除
             $this->triggerError(__METHOD__ . ': ' . __LINE__ . ',' . "is_delete=({$blog_info['is_delete']}),is_issue=({$blog_info['is_issue']})");
             $this->_showMessage('error' . $blog_info['is_issue'] . ',' . $blog_info['is_delete'], null, 404);
         }
         $filename = str_replace(BASE_SITE_URL, WWWROOT, $blog_info['link_url']);
         new_mkdir(dirname($filename));
         $o = $this->getViewTemplate('build_html')->assign($this->_getNextAndPrevBlog($blog_id))->assign('blog_info', $blog_info)->assign(array('web_title' => $blog_info['title'] . TITLE_SEPARATOR . $this->nav($blog_info['cate_id'], 'cate_name', 'Category', TITLE_SEPARATOR) . TITLE_SEPARATOR . L('CN_WANGWEN'), 'seo_keywords' => $blog_info['seo_keyword'], 'seo_description' => $blog_info['seo_description'], 'tags' => $this->tags($blog_info['seo_keyword']), 'relative_blog' => $this->_getRelativeBlog($blog_id, $blog_info['seo_keyword']), 'comments_html' => $this->_getBlogComments($blog_id)));
         $content = $o->fetch(CONTROLLER_NAME, 'detail', $blog_id);
         //file_put_contents($filename, $content);
         echo $content;
     } else {
         //博客不存在
         $this->_showMessage(L('BLOG,NOT_EXIST'), null, 404);
     }
 }
Beispiel #15
0
 /**
  * 移动所属分类
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-03-31 19:27:28
  *
  * @return void 无返回值
  */
 function moveAction()
 {
     $field = 'cate_id';
     //定段
     $cate_id = Filter::int($field);
     //所属分类id
     $msg = L('MOVE');
     //提示
     $log_msg = $msg . L('CONTROLLER_NAME_BLOG,FAILURE');
     //错误日志
     $error_msg = $msg . L('FAILURE');
     //错误提示信息
     if ($cate_id) {
         //分类id
         $cate_info = $this->_getCache($cate_id, 'Category');
         if (!$cate_info) {
             //分类不存在
             $this->_model->addLog($log_msg . '<br />' . L("INVALID_PARAM,%:,BELONG_TO_CATEGORY,%{$field}({$cate_id}),NOT_EXIST"), LOG_TYPE_INVALID_PARAM);
             $this->_ajaxReturn(false, $error_msg);
         }
         $cate_name = $cate_info['cate_name'];
     } else {
         //非法参数
         $this->_model->addLog($log_msg . '<br />' . L("INVALID_PARAM,%: {$field},IS_EMPTY"), LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false, $error_msg);
     }
     $this->_setField($field, $cate_id, $msg, L('TO') . $cate_name);
 }
Beispiel #16
0
 public function address_del()
 {
     $id = Filter::int(Req::args("id"));
     $this->model->table("address")->where("id={$id} and user_id=" . $this->user['id'])->delete();
     $this->redirect("address");
 }
Beispiel #17
0
 /**
  * Smart convert any string to int
  *
  * @param string $value
  * @return int
  *
  * @deprecated See JBZoo\Utils\Filter
  */
 public static function int($value)
 {
     return Filter::int($value);
 }
Beispiel #18
0
 public function order_getlist()
 {
     $order_no = Filter::int(Req::args('order_no'));
     $order_inst = Order::getOrderWithDetailByNo($order_no);
     //        echo  JSON::encode($retData,JSON_UNESCAPED_SLASHES);
     echo json_encode($order_inst, JSON_UNESCAPED_SLASHES);
 }
 /**
  * 是否生成js
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-25 21:58:34
  *
  * @return void 无返回值
  */
 function toJsAction()
 {
     $field = 'to_js';
     //字段
     $to_js = Filter::int($field) ? 1 : 0;
     //1:生成;0:不生成
     $msg = $to_js ? '' : L('NO');
     $this->_setField($field, $to_js, $msg . L('TO_JS'));
 }
Beispiel #20
0
 /**
  * 保存值
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2012-08-29 13:47:39
  * @lastmodify      2013-01-22 10:30:42 by mrmsl
  *
  * @return void 无返回值
  */
 public function publicSaveValueAction()
 {
     $error = L('SAVE,FAILURE');
     //保存失败错误
     $menu_id = Filter::int('_menu_id');
     //菜单id
     $menu = $this->_getCache(0, 'Menu');
     //菜单数据
     if (!isset($menu[$menu_id])) {
         //菜单不存在
         $this->_model->addLog(L("SAVE,CONTROLLER_NAME_FIELD,VALUE,FAILURE,%:(,MENU,%menu_id={$menu_id}}),NOT_EXIST"), LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false, $error);
     }
     $menu_info = $menu[$menu_id];
     //菜单信息
     $controller = $menu_info['controller'];
     //控制器
     $action = $menu_info['action'];
     //操作方法
     $this->_checkAdminPriv($controller, $action);
     //权限判断 by mashanlin on 2012-08-30 11:06:25
     $menu = $this->nav($menu_id, 'menu_name', 'Menu');
     //菜单名
     $info = L('CONTROLLER_NAME_FIELD,VALUE') . "({$menu})";
     //信息
     if (empty($_POST)) {
         //非法数据
         $this->_model->addLog(L('SAVE') . $info . L('FAILURE,%:,INVALID,DATA'), LOG_TYPE_INVALID_PARAM);
         $this->_ajaxReturn(false, $error);
     }
     /*$field_arr  = $this->_model->alias('f')
       ->field('f.input_name,f.field_id,f.field_name,input_value,f.validate_rule,f.auto_operation')
       ->join(TB_MENU . ' AS m ON f.menu_id=m.menu_id')
       ->where("m.menu_id={$menu_id} AND f.is_enable=1")
       ->key_column($this->_pk_field)->select();*/
     //走缓存 by mrmsl on 2012-09-05 14:05:14
     $field_arr = array_filter($this->_getCache(), create_function('$v', 'return $v["menu_id"] == ' . $menu_id . ' && $v["is_enable"];'));
     if (empty($field_arr)) {
         //查询出错或表单域为空
         if ($field_arr === false) {
             //查询出错
             $this->_sqlErrorExit(L('GET') . $menu . L('CONTROLLER_NAME_FIELD,FAILURE'), $error);
         } else {
             $this->_model->addLog(L('SAVE') . $info . L('FAILURE,%:,CONTROLLER_NAME_FIELD,IS_EMPTY'), LOG_TYPE_INVALID_PARAM);
         }
         $this->_ajaxReturn(false, $error);
     }
     $this->_model->saveValueCheckCreate($field_arr);
     //设置自动验证
     $checked = $this->_model->checkCreate('_validateSaveValue');
     //执行自动验证
     $checked !== true && $this->_ajaxReturn(false, $checked);
     //未通过验证
     $this->_model->autoOperation($_POST, Model::MODEL_BOTH);
     //自动填充 by mrmsl on 2012-09-07 13:07:57
     $log = '';
     //管理日志
     $pk_field = $this->_pk_field;
     //主键
     foreach ($field_arr as $field_id => $item) {
         $input_name = $item['input_name'];
         if (isset($_POST[$input_name])) {
             $old_value = $item['input_value'];
             //原值
             $new_value = $_POST[$input_name];
             //新值
             if ($old_value != $new_value) {
                 //值不相等
                 $this->_model->save(array($pk_field => $field_id, 'input_value' => $new_value));
                 //更新
                 $log .= ", {$input_name}: {$old_value} => {$new_value}";
                 //管理日志
             }
         }
     }
     $this->_setCache();
     //重新生成缓存
     //回调 by mrmsl on 2012-09-22 15:34:53
     method_exists($this, $callback = '_saveValueCallback' . ucfirst($controller)) && $this->{$callback}($menu_info);
     $this->_model->addLog(L('SAVE') . $info . L('SUCCESS') . ($log ? $log : ''), LOG_TYPE_ADMIN_OPERATE);
     $this->_ajaxReturn(true, L('SAVE,SUCCESS'));
 }
Beispiel #21
0
 public function tags_update()
 {
     $id = Filter::int(Req::args('id'));
     $status = Req::args('status');
     $sort = Req::args('sort');
     $model = new Model('tags');
     if ($status != null) {
         if ($status != 0 && $status != 1) {
             $status = 0;
         }
         $model->data(array('is_hot' => $status))->where("id={$id}")->update();
     }
     if ($sort != null) {
         $sort = Filter::int($sort);
         $model->data(array('sort' => $sort))->where("id={$id}")->update();
     }
     echo JSON::encode(array('status' => 'success'));
 }
Beispiel #22
0
 function async_callback()
 {
     //从URL中获取支付方式
     $payment_id = Filter::int(Req::get('payment_id'));
     $payment = new Payment($payment_id);
     $paymentPlugin = $payment->getPaymentPlugin();
     if (!is_object($paymentPlugin)) {
         echo "fail";
     }
     //初始化参数
     $money = '';
     $message = '支付失败';
     $orderNo = '';
     //执行接口回调函数
     $callbackData = Req::args();
     //array_merge($_POST,$_GET);
     unset($callbackData['con']);
     unset($callbackData['act']);
     unset($callbackData['payment_id']);
     $return = $paymentPlugin->callback($callbackData, $payment_id, $money, $message, $orderNo);
     //支付成功
     if ($return == 1) {
         //充值方式
         if (stripos($orderNo, 'recharge_') !== false) {
             $tradenoArray = explode('_', $orderNo);
             $recharge_no = isset($tradenoArray[1]) ? $tradenoArray[1] : 0;
             if (Order::recharge($recharge_no, $payment_id, $callbackData)) {
                 $paymentPlugin->asyncStop();
                 exit;
             }
         } else {
             $order_id = Order::updateStatus($orderNo, $payment_id, $callbackData);
             if ($order_id) {
                 $paymentPlugin->asyncStop();
                 exit;
             }
         }
     }
 }
    # Dados referentes aos dodos do Login
    $data_login['login'] = Request::in_post('login');
    $data_login['password'] = Hash::make(Password_generator::generate());
    $data_login['status'] = 1;
    $data_login['perfil'] = 2;
    $data_login['data_cadastro'] = Date('d/m/Y');
    if (Filter::is_empty_array($data)) {
        Session::flash('error', 'Todos os campos são obrigatórios');
        return Redirect::to_view('empresas_externas.cadastrar');
    }
    if (!Filter::is_email($data_login['login'])) {
        Session::flash('error', 'Por favor, digite um Email valido');
        return Redirect::to_view('empresas_externas.cadastrar');
    }
    # Realiza o pre-cadastro da Empresa
    if ($empresa_utilizadora->save($data)) {
        $empresa_from_db = $empresa_utilizadora->where('cnpj', '=', $data['cnpj']);
        # Busca o id da empresa
        $id_empresa_from_db = null;
        foreach ($empresa_from_db as $itens) {
            $id_empresa_from_db = $itens->id;
        }
        # Vincula o id da empresa ao Usuário
        $data_login['vinculo_empresa'] = Filter::int($id_empresa_from_db);
        # Realiza o cadastro do Usuário
        if ($model_login->save($data_login)) {
            Session::flash('success', 'Empresa Cadastrada com Sucesso');
            return Redirect::to_view('empresas_externas.cadastrar');
        }
    }
}
Beispiel #24
0
 /**
  * 生成短信验证码接口
  * AJAX
  * apikey 为云片分配的apikey
  * text 为短信内容
  * mobile 为接受短信的手机号
  */
 public function send_auth_code()
 {
     $info = array('status' => false, 'msg' => '验证码发送失败!');
     // $apikey = "06ec231c5d876ffe119b38013662f661";   // todo  短信接口部署时,需修改这里的APIKEY
     $phoneNumber = Filter::int(Req::args("mobile"));
     $config_inst = Config::getInstance();
     $config = $config_inst->get("sms");
     $apikey = $config['api_key'];
     $authChars = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
     //验证码生成
     $authCode = '';
     for ($i = 0; $i < 4; $i++) {
         $authCode .= substr($authChars, mt_rand(0, strlen($authChars) - 1), 1);
     }
     $authCode = strtolower($authCode);
     // 变成小写
     // $text = "【全品电台】您的验证码是".$authCode;
     $text = "【全品电台】感谢您的注册,您的验证码是 {$authCode} 。有效期为3分钟,请尽快验证";
     //$text = "【云片网】您的验证码是".$authCode;
     Tiny::log(__FILE__ . '--' . __LINE__ . '--' . $phoneNumber . "--" . $authCode . "--" . $text);
     //验证码与手机号码绑定
     $model = $this->model->table("auth_code");
     $obj = $model->where('phone_number=' . $phoneNumber)->find();
     $time = date('Y-m-d H:i:s', strtotime("+3 minutes"));
     if ($obj == null) {
         $data['phone_number'] = $phoneNumber;
         $data['auth_code'] = $authCode;
         $data['start_time'] = date('Y-m-d H:i:s');
         $data['end_time'] = $time;
         $auth_code_id = $this->model->table("auth_code")->data($data)->insert();
         if ($auth_code_id) {
             //发送验证码,发送成功
             //Tiny::log("auth_code 表 ID--".$auth_code_id);
             // todo SKM 要发短信验证码时,把下面注释去掉
             $sms = new Sms();
             $ret = $sms->send_sms($apikey, $text, $phoneNumber);
             // todo SKM SMS服务正式提供后,把下面一行代码注释掉
             //$ret = array('code' => 0, 'msg' => 'OK');
             if (isset($ret['code']) && $ret['code'] == 0) {
                 $info['status'] = true;
                 //$info['msg'] = "发送验证码成功!短信API接口返回:".$ret['msg'];
                 $info['msg'] = "发送验证码成功!";
             } else {
                 $info['status'] = false;
                 //$info['msg'] = "发送验证码失败!短信API接口返回:".$ret['msg'];
                 Tiny::log(__FILE__ . '-' . __LINE__ . '-' . "短信接口发送失败:" . var_export($ret, true));
                 $info['msg'] = "发送验证码失败!";
             }
             echo JSON::encode($info);
         } else {
             // 插入失败
             Tiny::log(__FILE__ . '-' . __LINE__ . '-' . "插入失败:auth_code--" . $auth_code_id);
             echo JSON::encode($info);
         }
     } else {
         // 1分钟内不能发送2次验证码
         $expired_time = strtotime("+3 minutes", intval($obj['start_time']));
         if ($expired_time > strtotime(date('y-m-d h:i:s'))) {
             $info['status'] = false;
             $info['msg'] = "两次验证码发送间隔不能少于60秒!";
             echo JSON::encode($info);
         } else {
             // 已经存在验证码,更新验证码, 从新发送到手机上
             $obj['auth_code'] = $authCode;
             $obj['start_time'] = date('Y-m-d H:i:s');
             $obj['end_time'] = $time;
             $model->data($obj)->update();
             // 重新发送
             $sms = new Sms();
             $ret = $sms->send_sms($apikey, $text, $phoneNumber);
             //$ret = array('code' => 0, 'msg' => 'OK');
             $info['status'] = true;
             $info['msg'] = "发送验证码成功!";
             echo JSON::encode($info);
         }
     }
 }
Beispiel #25
0
 /**
  * 获取具体信息
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-07-08 22:36:29
  *
  * @return void 无返回值
  */
 function infoAction()
 {
     $info = $this->_model->alias('s')->join(' JOIN ' . TB_MENU . ' AS m ON s.menu_id=m.menu_id')->field('s.*,m.menu_name')->where(array('short_id' => Filter::int($this->_pk_field, 'get'), 'admin_id' => $this->_admin_info['admin_id']))->find();
     $this->_ajaxReturn(true, '', $info);
 }
Beispiel #26
0
 public function addProduct($goods, $num = 1)
 {
     $product_id = NULL;
     $goods_id = NULL;
     $ship_id = NULL;
     if (isset($goods['product_id'])) {
         $product_id = $goods['product_id'];
     } else {
         $ret["msg"] = "添加商品失败,没有货品ID";
         $ret["status"] = false;
         return $ret;
         //Tiny::log(__FILE__ . __LINE__ . "------product---id----$goods_id---" . var_export($item, true));
     }
     $item = array();
     $prom_series = array();
     $prom_goods = array();
     $products_inst = new Products();
     $ret = $products_inst->getProduct($product_id);
     // 获取商品信息 item = product
     if (isset($ret['status']) && $ret['status'] == 1) {
         $item = $ret['data'];
     }
     if (!empty($item) && isset($item["goods_id"])) {
         $goods_id = $item["goods_id"];
     } else {
         $ret["msg"] = "添加商品失败,没有商品ID";
         $ret["status"] = false;
         return $ret;
     }
     if (isset($item["ship_id"]) && $item["ship_id"] > 0) {
         $ship_id = $item["ship_id"];
         // 默认所有的ship_id必须有
     } else {
         $ret["msg"] = "添加商品失败,该商品没有ship_id";
         $ret["status"] = false;
         return $ret;
     }
     $goods_info = array("ship_id" => $ship_id, "goods_id" => $goods_id, "product_id" => $product_id);
     if ($this->hasProducts($goods_info)) {
         $this->increaseProductsNum($goods_info, $num);
         $ret["msg"] = "添加商品成功!";
         $ret["status"] = true;
         return $ret;
     }
     //每个商品税种
     $tax_type_percent = 0;
     $tax_amount = 0;
     if (isset($item['tax_type_percent']) && $item['tax_type_percent'] >= 0) {
         $tax_type_percent = $item['tax_type_percent'];
         $tax_amount = $item['sell_price'] * $item['tax_type_percent'];
         // 税金暂时用销售价格计税  不按促销价格计税
     }
     $order_type = array("flash_sale" => false, "prom_goods" => false, "prom_series" => false, "bundling" => false);
     $prom_inst = new Prom();
     if (!empty($item)) {
         if ($num > $item['store_nums']) {
             $num = $item['store_nums'];
             //$this->modify_num($item, $num);
         }
         if ($num <= 0) {
             $this->delProducts($item);
         } else {
             $item['goods_nums'] = $num;
             //1 先判断限时抢购
             $flash_sale = array();
             $ret = $prom_inst->get_flash_sale($goods_info);
             if ($ret["status"] == 1 && isset($ret["data"])) {
                 $flash_sale = $ret["data"];
             }
             //Tiny::log(__FILE__ . __LINE__ . "------flash_sale-----" . var_export($flash_sale, true));
             if (!empty($flash_sale)) {
                 //$this->assign("flash_sale",$flash_sale);
                 $order_type["flash_sale"] = true;
                 $amount = sprintf("%01.2f", $flash_sale['price'] * $num);
                 $sell_total = $item['sell_price'] * $num;
                 $flash_sale['note'] = '抢购';
                 $products_item = array('product_id' => $item['id'], 'goods_id' => $item['goods_id'], 'goods_no' => $item['goods_no'], 'name' => $item['name'], 'img' => $item['img'], 'num' => $num, 'max_nums' => $item['store_nums'], 'store_nums' => $item['store_nums'], 'price' => $item['sell_price'], 'prom_id' => $item['prom_id'], 'real_price' => $flash_sale['price'], 'sell_price' => $item['sell_price'], 'spec' => unserialize($item['spec']), 'amount' => $amount, 'prom' => $flash_sale['note'], 'weight' => $flash_sale['weight'], 'point' => $flash_sale['point'], 'sell_total' => $sell_total, 'tax_type_percent' => $tax_type_percent, 'tax_amount' => $tax_amount, 'tax_code' => $item['tax_code'], "flash_sale" => $flash_sale, "order_type" => $order_type, 'origin_country' => $item['origin_country']);
             } else {
                 $amount = sprintf("%01.2f", $item['sell_price'] * $num);
                 // 普通商品不参加促销的情况下
                 $products_item = array('product_id' => $item['id'], 'goods_id' => $item['goods_id'], 'goods_no' => $item['goods_no'], 'name' => $item['name'], 'img' => $item['img'], 'num' => $num, 'max_nums' => $item['store_nums'], 'store_nums' => $item['store_nums'], 'price' => $item['sell_price'], 'prom_id' => $item['prom_id'], 'real_price' => $item['sell_price'], 'sell_price' => $item['sell_price'], 'spec' => unserialize($item['spec']), 'amount' => $amount, 'tax_type_percent' => $tax_type_percent, 'tax_amount' => $tax_amount, 'tax_code' => $item['tax_code'], 'prom' => "不参与促销", 'weight' => $item['weight'], 'point' => $item['point'] * $num, 'sell_total' => $amount, "order_type" => $order_type, 'origin_country' => $item['origin_country']);
                 //2 判断商品促销(单品)
                 $prom_goods = $prom_inst->get_prom_goods($item);
                 if (!empty($prom_goods)) {
                     $order_type["prom_goods"] = true;
                     $prom_goods['parse'] = $prom_inst->do_prom_goods($item, $prom_goods);
                     //$prom_goods = $prom_inst->do_prom_goods($item, $prom_goods_item);
                     if (Filter::int($prom_goods['expression']) == 0) {
                         $prom_goods['parse']['note'] = "";
                     }
                     if (isset($prom_goods['parse']['note']) && $prom_goods['parse']['note'] != '') {
                         $prom_goods['parse']['note'] = '商品优惠:' . $prom_goods['parse']['note'];
                     }
                     $amount = sprintf("%01.2f", $prom_goods['parse']['real_price'] * $num);
                     $sell_total = $item['sell_price'] * $num;
                     $products_item = array('product_id' => $item['id'], 'goods_id' => $item['goods_id'], 'goods_no' => $item['goods_no'], 'name' => $item['name'], 'img' => $item['img'], 'num' => $num, 'max_nums' => $item['store_nums'], 'store_nums' => $item['store_nums'], 'price' => $item['sell_price'], 'prom_id' => $item['prom_id'], 'real_price' => $prom_goods['parse']['real_price'], 'sell_price' => $item['sell_price'], 'spec' => unserialize($item['spec']), 'amount' => $amount, 'tax_type_percent' => $tax_type_percent, 'tax_amount' => $tax_amount, 'tax_code' => $item['tax_code'], 'prom' => $prom_goods['parse']['note'], 'weight' => $item['weight'], 'point' => $item['point'] * $num, 'sell_total' => $sell_total, "prom_goods" => $prom_goods, "flash_sale" => $flash_sale, "order_type" => $order_type, 'origin_country' => $item['origin_country']);
                 }
                 //3 系列促销
                 //商品促销与系列促销叠加运算
                 //$prom_series = $prom_inst->prom_series($item, $prom_goods);
                 $note = isset($prom_goods['note']) ? $prom_goods['note'] : "";
                 $prom_series = $prom_inst->get_prom_series($item);
                 if (!empty($prom_series)) {
                     $prom_series['parse'] = $prom_inst->do_prom_series($item, $prom_goods, $prom_series);
                     $order_type["prom_series"] = true;
                     if (Filter::int($prom_series['expression']) == 0) {
                         $prom_series['parse']['note'] = "";
                     }
                     if (isset($prom_series['parse']['note']) && $prom_series['parse']['note'] != '') {
                         $note .= '; 系列优惠:' . $prom_series['parse']['note'];
                     }
                     $amount = sprintf("%01.2f", $prom_series['parse']['real_price'] * $num);
                     $sell_total = $item['sell_price'] * $num;
                     //合并商品与系统促销
                     // 送积分
                     $multiple = 0;
                     if (isset($prom_series['multiple']) && $prom_series['multiple'] >= 0) {
                         $multiple = $prom_series['multiple'];
                     }
                     $prom_goods['series'] = $prom_series;
                     $products_item = array('product_id' => $item['id'], 'goods_id' => $item['goods_id'], 'goods_no' => $item['goods_no'], 'name' => $item['name'], 'img' => $item['img'], 'num' => $num, 'max_nums' => $item['store_nums'], 'store_nums' => $item['store_nums'], 'price' => $item['sell_price'], 'prom_id' => $item['prom_id'], 'real_price' => $prom_series['parse']['real_price'], 'sell_price' => $item['sell_price'], 'spec' => unserialize($item['spec']), 'amount' => $amount, 'tax_type_percent' => $tax_type_percent, 'tax_amount' => $tax_amount, 'tax_code' => $item['tax_code'], 'prom' => $note, 'weight' => $item['weight'], 'point' => $item['point'] * $multiple, 'sell_total' => $sell_total, "prom_goods" => $prom_goods, "prom_series" => $prom_series, "flash_sale" => $flash_sale, "order_type" => $order_type, 'origin_country' => $item['origin_country']);
                 }
             }
             // 商品 货品
             $this->items[$ship_id]['products'][$goods_id][$product_id] = $products_item;
             //Tiny::log(__FILE__.__LINE__."-------products item--------".var_export($products_item, true));
         }
     }
     $ship_inst = new Ship();
     $ship = $ship_inst->get_ship($item["ship_id"]);
     $this->items[$item["ship_id"]]['ship_name'] = $ship['ship_name'];
 }
Beispiel #27
0
 /**
  * 编辑菜单,获取管理员权限
  *
  * @author          mrmsl
  * @date            2012-06-21 17:50:03
  * @lastmodify      2013-01-22 11:00:35 by mrmsl
  *
  * @return void 无返回值
  */
 public function publicPrivAction()
 {
     $data = $this->cache();
     $menu_id = Filter::int('menu_id', 'get');
     $menu_info = $this->cache($menu_id, 'Menu');
     $menu_priv = $menu_id && $menu_info && $menu_info['priv'] ? array_keys($menu_info['priv']) : false;
     $tree = array();
     foreach ($data as $role_id => $item) {
         $tree[] = array('id' => $role_id, 'text' => $item['role_name'], 'leaf' => true, 'iconCls' => 'icon-none', 'checked' => $role_id == ADMIN_ROLE_ID || $menu_priv && in_array($role_id, $menu_priv));
     }
     $this->_ajaxReturn(true, '', $tree);
 }
Beispiel #28
0
 public function fare_use()
 {
     $id = Filter::int(Req::args('id'));
     if ($id) {
         $model = new Model("fare");
         $model->data(array('is_default' => 0))->update();
         $model->data(array('is_default' => 1))->where("id={$id}")->update();
     }
     $this->redirect("fare_list");
 }
Beispiel #29
0
 public function withdraw_act()
 {
     $id = Filter::int(Req::args('id'));
     $status = intval(Req::args('status'));
     $re_note = Filter::text(Req::args('re_note'));
     $model = new Model('withdraw as wd');
     $obj = $model->fields("wd.*,cu.balance")->join("left join customer as cu on wd.user_id = cu.user_id")->where("wd.id={$id} and wd.status=0")->find();
     if ($obj) {
         if ($obj['amount'] <= $obj['balance']) {
             $model->table('withdraw')->data(array('status' => $status, 're_note' => $re_note))->where("id={$id}")->update();
             if ($status == 1) {
                 $model->table('customer')->data(array('balance' => "`balance`-" . $obj['amount']))->where('user_id=' . $obj['user_id'])->update();
                 Log::balance(0 - $obj['amount'], $obj['user_id'], '提现到' . $obj['type_name'] . ',账号:' . $obj['account'], 3, $this->manager['id']);
             }
             echo "<script>parent.close_dialog();</script>";
         } else {
             echo "<script>alert('提现金额大于了余额。')</script>";
         }
         //扣除账户里的余额
     }
 }
 /**
  * combo store数据
  *
  * @author          mrmsl <*****@*****.**>
  * @date            2013-06-20 10:56:55
  *
  * @return void 无返回值
  */
 private function _combo()
 {
     $module_id = Filter::int('module_id', 'get');
     $parent_id = Filter::int('parent_id', 'get');
     $cache = $this->cache();
     if ($module_id) {
         if (in_array($module_id, $this->_exclude_delete_id)) {
             $cache = array();
         } else {
             unset($cache[$module_id]);
         }
     } elseif (isset($_GET['add'])) {
         //添加模块,干掉二级模块,仅一级模块可增加子模块
         $cache_copy = array();
         foreach ($this->_exclude_delete_id as $item) {
             $cache_copy[$item] = $cache[$item];
         }
         $cache = $cache_copy;
     }
     $data = $cache;
     //增加顶级菜单
     $this->_unshift && array_unshift($data, array('module_id' => 0, 'parent_id' => -1, 'module_name' => isset($_GET['emptyText']) ? Filter::string('emptyText', 'get') : L('PARENT_LANGUAGEMODULES'), 'leaf' => true));
     C('array2tree_unset_checked', true);
     $data = Tree::array2tree($data, $this->_pk_field);
     //添加子模块,获取模块信息
     if ($parent_id && isset($cache[$parent_id]) && ($parent_info = $cache[$parent_id])) {
         $parent_info = array('module_id' => $parent_id, 'parent_name' => $parent_info['module_name']);
         $this->_ajaxReturn(array('data' => $data, 'parent_data' => $parent_info));
     }
     $this->_ajaxReturn(true, '', $data);
 }