本文整理汇总了PHP中Activity::getOne方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::getOne方法的具体用法?PHP Activity::getOne怎么用?PHP Activity::getOne使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::getOne方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pay
public function pay($tid)
{
$trade = $this->getOne($tid);
if (!empty($trade) && $trade['status'] == 'created') {
$this->touch($tid, 'paid');
require_once MB_ROOT . '/source/Activity.class.php';
$a = new Activity();
$activity = $a->getOne($trade['activity']);
$this->pool($trade['activity'], $activity['tag']['price']);
}
}
示例2: array
require_once MB_ROOT . '/source/Activity.class.php';
require_once MB_ROOT . '/source/Game.class.php';
if (false) {
$debug = array();
$debug['tid'] = '1';
$debug['result'] = 'success';
$debug['from'] = 'return';
$debug['type'] = 'wechat';
$this->payResult($debug);
exit;
}
$user = $this->auth();
$id = $_GPC['actid'];
$id = intval($id);
$a = new Activity();
$activity = $a->getOne($id);
if (empty($activity) || $activity['type'] != 'game') {
exit('访问错误');
}
$g = new Game();
$order = array();
$order['activity'] = $activity['actid'];
$order['uid'] = $user['uid'];
$tid = $g->create($order);
if (is_error($tid)) {
exit('访问错误');
}
$trade = array();
$trade['tid'] = $tid;
$trade['title'] = "购买{$activity['tag']['label']} x1";
$trade['fee'] = $activity['tag']['price'];
示例3: doWebRedActivity
public function doWebRedActivity()
{
global $_W, $_GPC;
if (!$_W['ispost']) {
$this->doWebAuth();
checklogin();
}
$modulePublic = '../addons/wwx_fxxt/style/static/';
$foo = $_GPC['foo'];
$foos = array('list', 'create', 'modify', 'delete', 'records');
$foo = in_array($foo, $foos) ? $foo : 'list';
require_once WWX_FXXT_ROOT . '/class/Activity.class.php';
if ($foo == 'create') {
if ($_W['ispost']) {
$input = $_GPC;
$input['rules'] = htmlspecialchars_decode($input['rules']);
$input['start'] = strtotime($input['time']['start'] . ':00');
$input['end'] = strtotime($input['time']['end'] . ':59');
$input['share'] = serialize($input['share']);
$input['limit'] = serialize($input['limit']);
if ($input['type'] == 'game') {
$input['tag'] = serialize($input['game']);
} elseif ($input['type'] == 'shared') {
$input['tag'] = serialize($input['shared']);
} else {
$input['tag'] = serialize($input['tag']);
}
$gifts = array();
foreach ($input['gifts']['id'] as $k => $v) {
$gifts[] = array('gift' => $v, 'quantity' => $input['gifts']['quantity'][$k], 'rate' => $input['gifts']['rate'][$k]);
}
$a = new Activity();
$ret = $a->create($input, $gifts);
/**Activity:1.保存活动**/
if (is_error($ret)) {
message($ret['message']);
} else {
message("成功创建活动", $this->createWebUrl('redactivity'));
}
}
$activity = array();
$time = array();
$time['start'] = date('Y-m-d 00:00');
$time['end'] = date('Y-m-d 15:00');
$activity['gifts'] = array();
$activity['type'] = 'shared';
load()->func('tpl');
include $this->template('redactivity_form');
}
if ($foo == 'modify') {
$id = $_GPC['id'];
$id = intval($id);
$a = new Activity();
$activity = $a->getOne($id);
/**Activity:2.根据活动ID查询活动内容及设置等**/
if (empty($activity)) {
$this->error('访问错误');
}
if ($_W['ispost']) {
$input = $_GPC;
$input['rules'] = htmlspecialchars_decode($input['rules']);
$input['start'] = strtotime($input['time']['start'] . ':00');
$input['end'] = strtotime($input['time']['end'] . ':59');
$input['share'] = serialize($input['share']);
$input['limit'] = serialize($input['limit']);
if ($input['type'] == 'game') {
$input['tag'] = serialize($input['game']);
} elseif ($input['type'] == 'shared') {
$input['tag'] = serialize($input['shared']);
} else {
$input['tag'] = serialize($input['tag']);
}
$gifts = array();
foreach ($input['gifts']['id'] as $k => $v) {
$gifts[] = array('gift' => $v, 'quantity' => $input['gifts']['quantity'][$k], 'rate' => $input['gifts']['rate'][$k]);
}
$a = new Activity();
$ret = $a->modify($id, $input, $gifts);
/**Activity:3.根据活动ID编辑活动内容及设置等**/
if (is_error($ret)) {
message($ret['message']);
} else {
message("成功编辑活动", $this->createWebUrl('redactivity'));
}
}
$time = array();
$time['start'] = date('Y-m-d H:i', $activity['start']);
$time['end'] = date('Y-m-d H:i', $activity['end']);
if ($activity['type'] == 'game') {
$game = $activity['tag'];
} elseif ($activity['type'] == 'shared') {
$shared = $activity['tag'];
}
load()->func('tpl');
include $this->template('redactivity_form');
}
if ($foo == 'records') {
$id = $_GPC['id'];
$id = intval($id);
$a = new Activity();
//.........这里部分代码省略.........
示例4: Device
if ($foo == 'delete') {
$id = $_GPC['id'];
$c = new Device();
$c->remove($id);
message('成功删除设备信息', $this->createWebUrl('devices', array('id' => $id)));
}
if ($foo == 'list') {
$c = new Device();
$filters = array();
$filters['title'] = $_GPC['title'];
$filters['uuid'] = $_GPC['uuid'];
$filters['major'] = $_GPC['major'];
$filters['minor'] = $_GPC['minor'];
$filters['audit_status'] = $_GPC['audit_status'];
$filters['audit_comment'] = $_GPC['audit_comment'];
$filters['status'] = $_GPC['status'];
$pindex = intval($_GPC['page']);
$pindex = max($pindex, 1);
$psize = 5;
$total = 0;
$ds = $c->getAll($filters, $pindex, $psize, $total);
if (!empty($ds)) {
$a = new Activity();
foreach ($ds as &$row) {
$row['activity'] = $a->getOne($row['activity']);
}
unset($row);
}
$pager = pagination($total, $pindex, $psize);
include $this->template('device-list');
}