private function companyMenuResponse() { $menu_cache = 'weixin_menu' . $this->companyInfo['ecid'] . $this->wechatMsg['EventKey']; $response = ''; $table = 'Company_menu'; $m = M($table); $condition['key'] = $this->wechatMsg['EventKey']; $result = $m->where($condition)->find(); if ($result != '') { $reply['type'] = $result['responseType']; switch ($reply['type']) { case WechatConst::RESPONSE_TYPE_TEXT: $reply['content'] = $result['responseText']; $response = $this->getWechatResponse($reply); break; case WechatConst::RESPONSE_TYPE_NEWS: $reply['materialID'] = $result['responseMaterialId']; $response = $this->getWechatResponse($reply); break; case WechatConst::RESPONSE_TYPE_INFORMATION: $response = $this->getNewsResponse($result['informKeyword']); break; case WechatConst::RESPONSE_TYPE_CHECK_PRIZE: $activityId = $result['informKeyword']; $response = $this->getCheckPrizeResponse($activityId); break; case WechatConst::RESPONSE_TYPE_SERVICE: $response = $this->getServiceResponse($this->companyInfo['ecid']); break; case WechatConst::RESPONSE_TYPE_MALL: $response = $this->getMallResponse($result['mall_keyword']); break; case WechatConst::RESPONSE_TYPE_VIP: $response = $this->getVipResponse($result['vip_keyword']); break; case WechatConst::RESPONSE_TYPE_ACTIVITY: $activity = new \Weixin\Activity\ActivityResponse($this->companyInfo, $this->wechatMsg); $response = $activity->getActivityResponse($result['activityId']); default: break; } } if ($response) { return $response; } }
/** * 防伪验证 * * @return Array */ private function fwCheck($fwCode) { $options = array('ecid' => $this->companyInfo['ecid'], 'api_user' => $this->companyInfo['mxt_api'], 'api_psw' => $this->companyInfo['mxt_psw'], 'OpenId' => $this->wechatMsg['FromUserName'], 'fwCode' => $fwCode, 'type' => 'wechat', 'isJewelryCheck' => $this->isJewelryCheckCompany()); $mxt = new MxtClient($options); $result = $mxt->FwCheck($fwCode); $fwParams = $mxt->getFwParams(); $addResponse = ''; if (!$mxt->getJewelryCheck() && $fwParams['CheckCount'] >= 0) { $activity = new \Weixin\Activity\ActivityResponse($this->companyInfo, $this->wechatMsg); if ($activity->hasActivity()) { if ($activity->hasFwLucky($fwParams)) { $addResponse = $activity->getResponse(); } if ($addResponse == '') { if ($activity->hasGeneralActivity()) { $addResponse = $activity->getResponse(); } } } } if ($addResponse) { $result['content'] = array_merge($result['content'], $addResponse); } //查询是否需要添加产品广告 return $result; }