public function handle_request_internal() { // 修改微信号,并点亮微信号展示, 生成微信二维码--> 数据库保存 $brokerId = $this->_params['brokerId']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //修改微信号 点亮 $wechatName = $this->_params['wechatName']; $ret = $this->upLoadQrImage($wechatName); if (!$ret) { throw new Exception_Chat_UpLoadQrImageFailed(); } // 获取经纪人店铺 $shop = Model_Weshop_Shop::getBrokerShop($brokerId); $shop->wechatName = $wechatName; $shop->isLighten = 1; $shop->qrHostId = $ret['image']['host']; $shop->qrHash = $ret['image']['hash']; $res = $shop->save(); if ($res) { Bll_Mobile_ChatInfoBll::ModifyBrokerWechatNameNotice($brokerId); //通知用户端 } //生成二维码 return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '恭喜你,已点亮微信号展示')); }
public function handle_request_internal() { $result = array('status' => 'error', 'message' => ''); // 修改微信号,并点亮微信号展示, 生成微信二维码--> 数据库保存 $brokerId = $this->_params['brokerId']; $wechatName = $this->_params['wechatName']; $qrUrl = $this->_params['qrUrl']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { $result['message'] = '该经纪人不存在'; return $result; } /* 此逻辑业务不需要了 if ($brokerInfo->payType != 9999) { $result['message'] = '本特权只限套餐经纪人'; return $result; }*/ // 验证$qrUrl是否合法 if (!strstr($qrUrl, 'weixin.qq.com')) { return Util_MobileAPI::error(Const_APIStatus::E_LIGHTEN_WECAHT_QRUEL_ERROR); } //修改微信号 点亮 $content = $this->_getQrCodeContent($qrUrl); $ret = $this->_requestUploadApi($content, 'png'); if (!$ret || $ret['status'] != 'ok') { throw new Exception_Chat_UpLoadQrImageFailed(); } // 获取经纪人店铺 $shop = Model_Weshop_Shop::getBrokerShop($brokerId); $shop->wechatName = $wechatName; $shop->isLighten = 1; $shop->qrHostId = $ret['image']['host']; $shop->qrHash = $ret['image']['hash']; $res = $shop->save(); if ($res) { Bll_Mobile_ChatInfoBll::ModifyBrokerWechatNameNotice($brokerId); //通知用户端 } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '恭喜你,已点亮微信号展示')); }