示例#1
0
 /**
  * @param ShakeAroundClient $shakeAroundClient
  * @param Page $Page 、、自己构建的page实体
  * @param null $wxId 、、用来申请页面的微信id号,本地主键id
  * @return mixed
  * @throws \Exception
  */
 public function applyPageOnline(ShakeAroundClient $shakeAroundClient, Page $Page, $appid = null, $appsecret = null)
 {
     $accessToken = $shakeAroundClient->applyAccessToken($appid, $appsecret);
     if ($accessToken == NULL) {
         throw new \Exception("weixin get token error");
     }
     $Page->icon_url = $this->converToUrlOnline($shakeAroundClient, $Page->icon_url, $appid, $appsecret);
     $ret = $shakeAroundClient->addPage($Page, $accessToken);
     if ($ret->errcode != 0) {
         throw new \Exception($ret->errmsg);
     }
     return $ret->data->page_id;
 }