private function _getOpenReplay($responseId) { $post_string = $GLOBALS["HTTP_RAW_POST_DATA"]; $openReplayInfo = OpenReplayModel::model()->with('open_openPlatForm')->findByPk($responseId); $apiUrl = $openReplayInfo->open_openPlatForm->apiUrl; $token = $openReplayInfo->open_openPlatForm->token; $wechatApi = new WechatApi($token); $url = $wechatApi->buildSignUrl($apiUrl); $result = HttpRequest::sendHttpRequest($url, $post_string, 'POST', array("Content-type: text/xml")); return $result['content'] ? $result['content'] : ''; }
public function actionReplayDelete($id) { $model = OpenReplayModel::model()->findByPk($id); //删除关键字或者menu action switch ($model->type) { case GiftModel::TYPE_KEYWORDS: KeywordsModel::model()->deleteAll('responseId=:responseId and type=:type', array(':responseId' => $id, ':type' => OpenReplayModel::OPEN_TYPE)); break; case GiftModel::TYPE_MENU: MenuactionModel::model()->deleteAll('responseId=:responseId and type=:type', array(':responseId' => $id, ':type' => OpenReplayModel::OPEN_TYPE)); break; } $model->delete(); ShowMessage::success('删除成功', Yii::app()->createUrl('open/replay')); }
/** * 转接回复开关 * @param $id */ public function actionOpenReplayStatus($id) { $status = Yii::app()->request->getParam('status'); $model = OpenReplayModel::model()->findByPk($id); $model->status = in_array($status, array(0, 1)) ? $status : 0; $model->save(); echo json_encode(array('result' => 0)); }