/** * 添加、修改公众号 */ public function actionModify($id) { $id = (int) $id; $GhMenu = new GhMenu(); $this->data = $GhMenu->select('m.*,a.gh_name')->from('gh_menu m')->join('gh_manage a', 'm.gid=a.gid')->where(array('m.mid' => $id))->getAll(); $GhManage = new GhManage(); $this->wxdata = $GhManage->select('gid,gh_name')->where('userid=' . $this->userinfo['userid'])->notin('gid NOT IN(SELECT gid FROM gh_menu)')->getAll(); }
/** * 提交信息 */ public function actionModified() { $data = $this->Common->getFilter($_POST); $id = (int) $data['gid']; unset($data['gid']); $md5 = md5($data['gh_id']); $data['gh_key'] = substr($md5, 16); $data['gh_token'] = substr($md5, 8, 8); $data['gh_enaeskey'] = $md5 . substr($md5, 21); $GhManage = new GhManage(); if ($id == 0) { $data['userid'] = $this->userinfo['userid']; $GhManage->insert('gh_manage', $data); } else { $GhManage->update($data, array('gid' => $id)); } $this->jumpBox('成功!', Wave::app()->homeUrl . 'wx', 1); }
/** * 默认函数 */ public function actionIndex() { $data = WaveCommon::getFilter($_GET); $GhManage = new GhManage(); $WxModel = new WxModel(); $array = $GhManage->getOne('*', array('gh_key' => $data['key'])); if ($array) { $this->token = $array['gh_token']; $this->enaeskey = $array['gh_enaeskey']; $this->appid = $array['gh_appid']; $this->appsecret = $array['gh_appsecret']; } $echoStr = isset($_GET["echostr"]) ? $_GET["echostr"] : 'no echoStr'; $WxModel->recordLog($echoStr); if ($this->checkSignature()) { $WxModel->recordLog($echoStr); echo $echoStr; die; } die; $this->responseMsg(); }