/** * 根据当前版本+release获取升级信息(patch包地址) ,hash值 * 获取升级文件列表 */ public function checkUpgrade() { $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'getUpdateInfo', 'pwversion' => $this->local)); $r = PwApplicationHelper::requestAcloudData($url); $r = WindConvert::convert($r, Wekit::V('charset'), 'utf8'); return is_array($r) ? $r['code'] === '0' ? $r['info'] : $r['msg'] : '无法连接云平台!'; }
/** * 发送短信 * * @return bool */ public function sendMobileMessage($mobile, $content) { $content = Pw::convert($content, 'UTF-8'); $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'sendSms', 'mobile' => $mobile, 'content' => $content)); $info = PwApplicationHelper::requestAcloudData($url); if (!is_array($info)) { return new PwError('APPCENTER:center.connect.fail'); } if ($info['code'] !== '0') { return new PwError($info['msg']); } return true; }
/** * 获取线上补丁列表 * * @return Ambigous <multitype:, boolean, string> */ public function getOnlinePatchList() { $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'getSecurityPatch', 'pwversion' => NEXT_VERSION)); $r = PwApplicationHelper::requestAcloudData($url); if (!is_array($r)) { return '无法连接云平台!'; } if ($r['code'] !== '0') { return $r['msg']; } /* $r['info'] = array( array('id' => '9000001', 'name' => '更新', 'desc' => 'blabla', 'time' => '1323333', 'rule' => array( array('filename' => 'src/wekit.php', 'search' => base64_encode('Jianmin Chen'), 'replace' => base64_encode('Shi Long'), 'count' => '1', 'nums' => array('1')))) ); */ $temp = array(); foreach ($r['info'] as $v) { $v['id'] = $v['name']; $temp[$v['id']] = $v; } return $temp; }
/** * 升级 */ public function upgradeAction() { $id = $this->getInput('app_id'); $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'upgradeApplication', 'appid' => $id)); $info = PwApplicationHelper::requestAcloudData($url); if ($info['code'] !== '0') { $this->showError(array('APPCENTER:update.fail', array($info['msg']))); } else { $this->showMessage('success'); } }
/** * 获取线上应用基本信息,包括应用中心提交应用填写的描述、logo等 * * @return PwError|array */ public function getOnlineInfo() { $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'getAppById', 'appid' => $this->_appId)); $data = PwApplicationHelper::requestAcloudData($url); if ($data['code'] !== '0') { return new PwError('APPCENTER:install.fail', array('{{error}}' => $data['msg'])); } $manifest = array('application' => array('name' => $data['info']['app_name'], 'version' => $data['info']['version'], 'pw-version' => $data['info']['bbs_version'], 'description' => trim($data['info']['description'], '\'"'), 'logo' => $data['info']['icon'], 'author-name' => trim($data['info']['app_author'], '\'"'), 'website' => $data['info']['author_url'], 'charset' => ACloudSysCoreCommon::getGlobal('g_charset'))); return $manifest; }
/** * 卸载 */ public function uninstallAction() { $styleid = $this->getInput('styleid'); /* @var $uninstall PwUninstallApplication */ if ($styleid[0] !== 'L') { $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'uninstallApp', 'appid' => $styleid)); $info = PwApplicationHelper::requestAcloudData($url); if ($info['code'] !== '0') { $this->showError($info['msg']); } else { $this->showMessage('success'); } } else { $uninstall = Wekit::load('APPCENTER:service.srv.PwUninstallApplication'); $r = $uninstall->uninstall($styleid); if ($r === true) { $this->showMessage('success'); } $this->showError($r->getError()); } }
public function loginAlipayAction() { $alipay = $this->getInput('alipay'); Wind::import('APPCENTER:service.srv.helper.PwApplicationHelper'); $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'alipayAuth', 'callback' => WindUrlHelper::createUrl('app/verify/index/verifyAlipay', array('uid' => $this->loginUser->uid)), 'account' => $alipay)); $info = PwApplicationHelper::requestAcloudData($url); if ($info['code'] !== '0') { $this->showError($info['msg']); } $this->setOutput(array('referer' => $info['info']), 'data'); $this->showMessage('success'); }