public function weixinModify()
 {
     $id = intval(I('get.id'));
     if (empty($id)) {
         $this->error('访问错误');
     }
     $a = new Account();
     $account = $a->getAccount($id, Account::ACCOUNT_WEIXIN);
     if (empty($account)) {
         $this->error('访问错误');
     }
     if (IS_POST) {
         if (I('post.method') == 'generate') {
             $rec = array();
             $rec['token'] = util_random(32);
             $rec['aeskey'] = util_random(43);
             $a->table('__PLATFORM_WEIXIN__')->data($rec)->where("`id`='{$id}'")->save();
             exit(json_encode($rec));
         }
         $rec = array();
         $rec['level'] = intval(I('post.level'));
         if ($rec['level'] != '0') {
             $rec['appid'] = I('post.appid');
             $rec['secret'] = I('post.secret');
             if (empty($rec) || empty($rec['secret'])) {
                 $this->error('您当前选择的公众号类型必须输入AppId和Secret');
             }
             $access = WeiXin::getAccessToken($rec['appid'], $rec['secret']);
             if (is_error($access)) {
                 $this->error('您输入的AppId和Secret经验证是无效的, 请检查. 错误详情: ' . $access['message']);
             }
             $_POST['access_token'] = $access['token'];
             $_POST['access_expire'] = $access['expire'];
         }
         $ret = $a->modify(Account::ACCOUNT_WEIXIN, $id);
         if (is_error($ret)) {
             $this->error($ret['message']);
         }
         $this->success('保存成功');
         exit;
     }
     $this->assign('entity', $account);
     $this->display('weixin-form');
 }