private function qrSceneEvent($bSubItem) { //保存扫描事件 $this->saveScanLog(); $scene = explode('_', $this->wechatMsg['EventKey']); if (count($scene) > 1) { $sceneId = $scene[1]; } else { $sceneId = $scene[0]; } $addResponse = ''; if ($sceneId > 100000) { $addResponse = array(array('Title' => "欢迎使用微信登录Alexander's官网", 'PicUrl' => "http://www.icalex.com/Public/images/2.jpg", 'Url' => "http://www.icalex.com/Mobile/Index/wechatLogin/sense/{$sceneId}/openid/{$this->wechatMsg['FromUserName']}", 'Description' => '请点击《阅读全文》完成登录操作。')); } else { $m = M('Company_qr_type'); $opt = array('ecid' => $this->companyInfo['ecid'], 'scene_id' => $sceneId); $result = $m->where($opt)->find(); if ($result) { switch ($result['type']) { case 'activity': $activity = new \Weixin\Activity\ActivityResponse($this->companyInfo, $this->wechatMsg); $activity->responseScan($result['activityId'], $bSubItem); $addResponse = $activity->getResponse(); break; case 'fwLabel': $label = new \Weixin\Label\LabelResponse($this->companyInfo, $this->wechatMsg); $addResponse = $label->getResponse($result['labelId']); break; case 'product': $product = new \Weixin\Product\ProductResponse($this->companyInfo, $this->wechatMsg); $addResponse = $product->getResponse($result['productId'], 'all'); break; case 'employees': $employee = new \Weixin\Employee\EmployeeResponse($this->companyInfo, $this->wechatMsg); $addResponse = $employee->getResponseWithId($result['employeeId']); break; case 'dealer': $dealer = new \Weixin\Dealer\DealerResponse($this->companyInfo, $this->wechatMsg); $addResponse = $dealer->getResponseWithId($result['dealerId'], 'all'); break; } } } if ($addResponse) { return $addResponse; } }
/** * 防伪验证 * * @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; }