public function index()
 {
     //检查当前公众号信息
     $data = M('Wxuser')->where(array('token' => $_SESSION['token']))->find();
     $init = strlen($data['appid']) > 0 && strlen($data['appsecret']) > 0;
     $this->assign('diymen', $init);
     $this->assign('userid', $data['id']);
     //获取系统业务
     $this->assign('services', ServiceHelper::getServices($this->token));
     $info = M('Wxuser')->where(array('token' => $this->token))->find();
     $this->assign('address', $info['address']);
     //当前菜单
     $classTrees = $this->getMenuData();
     $this->assign('class', json_encode($classTrees));
     $this->display();
 }
 public function edit()
 {
     $img_id = $this->_get('id', 'intval');
     $uid = session('uid');
     $token = session('token');
     $ismul = $this->_get('ismul', 'intval');
     //判断是否单图文多图文
     $db = D('img');
     $getkwd['id'] = $img_id;
     $keyword = $db->where($getkwd)->getField('keyword');
     $where['uid'] = $uid;
     $where['token'] = $token;
     $where['function'] = 'kefu';
     $where['keyword'] = $keyword;
     $where['status'] = 1;
     $img_info = $db->where($where)->order('sorts  desc')->select();
     $itemnum = count($img_info);
     for ($i = 0; $i < $itemnum; $i++) {
         if (empty($img_info[$i]['linktype'])) {
             if (!empty($img_info[$i]['url'])) {
                 $img_info[$i]['linktype'] = 'normal';
             } else {
                 $img_info[$i]['linktype'] = 'info';
             }
         }
     }
     $this->assign('info', $img_info[0]);
     $this->assign('itemnum', $itemnum);
     $this->assign('info2', $img_info);
     $this->assign('ismul', $ismul);
     $data = array();
     foreach ($img_info as $key => $value) {
         $data['item_' . $key] = $value;
     }
     if ($data) {
         $this->assign('db_json', json_encode($data));
     } else {
         $this->assign('db_json', null);
     }
     $this->assign('services', ServiceHelper::getServices($token));
     $this->display();
 }