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() { $brokerId = $this->_params['brokerId']; $wechatName = isset($this->_params['wechatName']) ? trim($this->_params['wechatName']) : ''; $introduce = trim($this->_params['introduce']); $shopImage = isset($this->_params['shopImage']) ? json_decode($this->_params['shopImage'], true) : array(); // 判断经纪人是否存在 $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$broker) { throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId); } // 获取经纪人店铺 $shop = Model_Weshop_Shop::getBrokerShop($brokerId); // 更新店铺信息 if ($wechatName) { $shop->wechatName = $wechatName; } $shop->introduce = $introduce; if (isset($shopImage['host']) && isset($shopImage['hash'])) { $shop->imageHostId = intval($shopImage['host']); $shop->imageHash = $shopImage['hash']; } $shop->save(); // 拼装返回数据 $data = array('message' => '保存成功'); return API_Result::create()->ok()->data($data)->toArray(); }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $brokerIds = explode(',', $this->_params['brokerIds']); //批量返回经纪人的微信号,和微信号二维码图片url $brokerWechatNameInfos = array(); $wechatNameInfos = Model_Weshop_Shop::getBrokerWechatNameInfo($brokerIds); foreach ($wechatNameInfos as $wechatNameInfo) { $row = array(); $row['brokerId'] = $wechatNameInfo['brokerId']; $row['wechatName'] = $wechatNameInfo['wechatName']; $row['wechatNameUrl'] = $wechatNameInfo->getQrImageUrl(); $row['hostId'] = $wechatNameInfo['qrHostId']; $row['imageId'] = $wechatNameInfo['qrHash']; $brokerWechatNameInfos[] = $row; } return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('brokerWechatNameInfos' => $brokerWechatNameInfos)); }
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' => '恭喜你,已点亮微信号展示')); }
public function handle_request_internal() { header("Access-Control-Allow-Origin: *"); $brokerId = $this->_params['brokerId']; // 判断经纪人是否存在 $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$broker) { throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId); } // 获取经纪人微信店铺 $shop = Model_Weshop_Shop::getBrokerShop($brokerId); // 拼装店铺信息 $data = array(); $data['previewUrl'] = $shop->getPreviewUrl(); $data['trueName'] = $broker->trueName; $data['wechatName'] = $shop->wechatName; $data['userMobile'] = $broker->userMobile; $data['userPhotoUrl'] = $broker->getUserPhotoUrl(); $data['introduce'] = $shop->getIntroduce(); $data['shopImage'] = array('url' => $shop->getImageUrl(), 'host' => $shop->imageHostId, 'hash' => $shop->imageHash); //是否点亮微信 修改微信时点亮 $data['isLighten'] = $shop->isLighten; return API_Result::create()->ok()->data($data)->toArray(); }