Ejemplo n.º 1
0
 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']);
     }
 }
Ejemplo n.º 2
0
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'];
Ejemplo n.º 3
0
 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();
         $activity = $a->getOne($id);
         /**Activity:2.根据活动ID查询活动内容及设置等**/
         if (empty($activity)) {
             $this->error('访问错误');
         }
         $filters = array();
         $filters['activity'] = $id;
         $filters['nickname'] = $_GPC['nickname'];
         $pindex = intval($_GPC['page']);
         $pindex = max($pindex, 1);
         $psize = 20;
         $total = 0;
         $ds = $a->getRecords($filters, $pindex, $psize, $total);
         /**Activity:4.分页活动列表**/
         $pager = pagination($total, $pindex, $psize);
         include $this->template('redactivity_records');
     }
     if ($foo == 'delete') {
         $id = $_GPC['id'];
         $id = intval($id);
         $a = new Activity();
         $ret = $a->remove($id);
         /**Activity:5.删除活动**/
         if (is_error($ret)) {
             message($ret['message']);
         } else {
             message('操作成功', $this->createWebUrl('redactivity'));
         }
     }
     if ($foo == 'list') {
         $a = new Activity();
         $ds = $a->getAll(array());
         /**Activity:6.查询所有活动**/
         if (is_array($ds)) {
             foreach ($ds as &$row) {
                 $url = $this->createMobileUrl('redactivity', array('actid' => $row['actid']));
                 $row['surl'] = $url;
                 $url = substr($url, 2);
                 $url = $_W['siteroot'] . 'app/' . $url;
                 $row['url'] = $url;
                 $row['count'] = $a->calcCount($row['actid']);
                 /**Activity:7.查询活动礼品信息:总数量、已发放、还剩余。**/
             }
             unset($row);
         }
         include $this->template('redactivity_list');
     }
 }
Ejemplo n.º 4
0
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');
}