本文整理汇总了PHP中Device::getOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Device::getOne方法的具体用法?PHP Device::getOne怎么用?PHP Device::getOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Device
的用法示例。
在下文中一共展示了Device::getOne方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: message
$ret = $c->create($r);
if (is_error($ret)) {
message($ret['message']);
} else {
message('成功同步设备', $this->createWebUrl('devices'));
}
} else {
exit('设备无效或未激活');
}
}
include $this->template('device-download');
}
if ($foo == 'modify') {
$id = $_GPC['id'];
$g = new Device();
$entity = $g->getOne($id);
if (empty($entity)) {
message('访问错误');
}
if ($_W['ispost']) {
$a = new Api();
$title = $_GPC['title'];
$re = $a->setDeviceTitle($entity['device_id'], $title);
if (is_error($re)) {
message($re['message']);
} else {
$c = new Device();
$entity['title'] = $title;
$ret = $c->modify($id, $entity);
if (is_error($ret)) {
message($ret['message']);
示例2: intval
}
if ($foo == 'devices') {
$id = $_GPC['id'];
$id = intval($id);
$a = new Activity();
$activity = $a->getOne($id);
if (empty($activity)) {
$this->error('访问错误');
}
$d = new Device();
if ($_W['ispost']) {
$api = new Api();
$devices = $_GPC['device'];
if ($_GPC['type'] == 'bind') {
foreach ($devices as $did) {
$device = $d->getOne($did);
if (!empty($device)) {
$ret = $api->setDevicePages($device['device_id'], array(intval($activity['page'])));
$d->touchActivity($did, $id);
}
}
}
if ($_GPC['type'] == 'unbind') {
foreach ($devices as $did) {
$device = $d->getOne($did);
if (!empty($device)) {
$ret = $api->setDevicePages($device['device_id'], array(intval($activity['page'])), false);
$d->touchActivity($did, 0);
}
}
}
示例3: mediaUpload
$url = "https://api.weixin.qq.com/shakearound/page/delete?access_token={$token}";
$pars = array();
$pars['page_ids'][0] = intval($id);
$resp = ihttp_post($url, json_encode($pars));
if (is_error($resp)) {
return $resp;
}
$ret = @json_decode($resp['content'], true);
if (is_array($ret) && $ret['errcode'] == '0') {
return true;
}
return error(-1, $resp['content']);
}
/**
* 上传图片素材
* @param $file string 要上传的文件
* @return string
*/
public function mediaUpload($file)
{
$file = IA_ROOT . '/attachment/' . $file;
$token = $this->getAccessToken();
$url = "https://api.weixin.qq.com/shakearound/material/add?access_token={$token}";
$body = array();
if (function_exists('curl_file_create')) {
$body['media'] = curl_file_create($file);
} else {
$body['media'] = '@' . $file;
}
$resp = @ihttp_request($url, $body);
if (is_error($resp)) {
return $resp;