function about(Request $request, Response $response) { $this->v->set_tplname('mod_default_about'); $this->nav_flag1 = 'about'; if ($request->is_hashreq()) { } else { } $response->send($this->v); }
public function detail(Request $request, Response $response) { if ($request->is_hashreq()) { $aid = $request->arg(2); $info = Activity_Model::getActivityByAid($aid); //模板 if ($info['tpl'] == 0) { $this->v->set_tplname('mod_activity_detail'); $this->v->assign('nav_no', 4); } elseif ($info['tpl'] == 1) { $this->v->set_tplname('mod_activity_1'); $this->v->assign('nav_no', 0); } $is_voted = 0; $user = Member::getUser(); if (Member::isLogined()) { $is_voted = Activity_Model::isJoin($aid, $user['uid'], 'vote'); } $this->v->assign('info', $info); $this->v->assign('is_voted', $is_voted); //关联信息 $relation = ''; $type_id = 'music'; $music = Activity_Model::getRelated($aid, $type_id); import('Node/Node_Model'); foreach ($music as &$val) { $val['love'] = Node_Model::actionRecord($val['nid'], $user['uid'], 'love'); } $cur_dir = dirname(__FILE__); $music_tpl = $cur_dir . '/tpl/mod_activity_detail_music.tpl.htm'; if ($music) { ob_start(); include $music_tpl; $relation = ob_get_contents(); ob_end_clean(); } $this->v->assign('relation', $relation); } $response->send($this->v); }
/** * default action 'index' * @param Request $request * @param Response $response */ public function index(Request $request, Response $response) { if (Common_Model::admin_logined()) { $admin = D()->get_one("SELECT * FROM {admin_user} WHERE admin_uid=%d", $_SESSION['logined_uid']); $v = new PageView('mod_user_index'); $v->assign('admin', $admin); $v->assign('nav', $this->_nav); if ($request->is_hashreq()) { $srvinfo = array('PHP_OS' => PHP_OS, 'PHP_VERSION' => PHP_VERSION, 'SERVER_SOFTWARE' => $_SERVER['SERVER_SOFTWARE'], 'SYS_VERSION' => C('env.version'), 'SYS_TIME' => date('Y-m-d H:i:s'), 'SYS_TIMEZONE' => date_default_timezone_get(), 'DB_VERSION' => 'MySQL', 'DB_TIME' => date('Y-m-d H:i:s'), 'PHP_EXECTIME' => 0, 'PHP_UPLOAD' => '', 'CLIENT_IP' => $request->ip(), 'CLIENT_UA' => get_client_platform() . ' - ' . get_client_browser()); // DB info $dbinfo = D()->get_one("SELECT VERSION() AS db_ver, UNIX_TIMESTAMP() AS db_time"); $srvinfo['DB_VERSION'] = 'MySQL ' . $dbinfo['db_ver']; $srvinfo['DB_TIME'] = date('Y-m-d H:i:s', $dbinfo['db_time']); // PHP detail $srvinfo['PHP_EXECTIME'] = ini_get('max_execution_time') . ' 秒'; $srvinfo['PHP_UPLOAD'] = @ini_get('file_uploads') ? '最大 ' . ini_get('upload_max_filesize') : '<font color="red">禁止上传</font>'; $v->assign('srvinfo', $srvinfo); } $response->send($v); } else { $response->redirect('/login'); } }
/** * 获取未晋级选手列表 * * @param Request $request * @param Response $response */ function nopassed(Request $request, Response $response) { $this->v->set_tplname('mod_match_nopassed'); $this->nav_flag1 = 'match_nopassed'; $match_id = $request->arg(1); $this->v->assign('the_nid', $match_id); if ($request->is_hashreq()) { $errmsg = ''; //获取Node信息 $ninfo = Node::getInfo($match_id); if (empty($ninfo)) { $errmsg = "比赛不存在(nid={$match_id})"; } else { //参赛者列表 $limit = 20; $isajax = $request->get('isajax', 0); $page = $request->get('p', 1); $start = ($page - 1) * $limit; $totalnum = 0; $maxpage = 1; //检查周排名信息 //$see_weekinfo = Match_Model::getRankWeekInfo($match_id); $see_weekinfo = []; //获取“未晋级”参赛这列表 $player_pass_list = Match_Model::getPlayerList($match_id, '5000-', $start, $limit, $totalnum, $maxpage); $player_pass_list = Match_Model::parsePlayerList($player_pass_list, $see_weekinfo, true); $this->v->assign('player_pass_list', $player_pass_list); $this->v->assign('totalnum', $totalnum); $this->v->assign('maxpage', $maxpage); $this->v->assign('curpage', $page); if ($isajax) { $this->v->filter_output_part(); } } $this->v->assign('errmsg', $errmsg); } else { } $response->send($this->v); }
public function collect(Request $request, Response $response) { $this->v->set_tplname('mod_user_collect'); if ($request->is_hashreq()) { $collect_list = Goods::getUserCollectList(); $this->v->assign('collect_list', $collect_list); $this->v->assign('collect_num', count($collect_list)); } $response->send($this->v); }
/** * 订单确认 * * @param Request $request * @param Response $response */ public function order_submit(Request $request, Response $response) { if ($request->is_post()) { $ret = ['flag' => 'FAIL', 'msg' => '订单提交失败']; $uid = $GLOBALS['user']->uid; if (!$uid) { $ret['msg'] = '未登录, 请先在微信登录'; $response->sendJSON($ret); } $player_id = $request->post('player_id', 0); $goods_type = $request->post('goods_type', 'flower'); $goods_amount = $request->post('amount', 0); $pay_id = 2; //2是微信支付,见ec payment表 // 检查数据 // 参赛者 if (!Node::playerExisted($player_id)) { $ret['msg'] = "参赛者不存在(player_id={$player_id})"; $response->sendJSON($ret); } // 数量 $goods_amount = intval($goods_amount); if (!$goods_amount) { $ret['msg'] = 'flower' == $goods_type ? '送花数量不能为空' : '送吻数量不能为空'; $response->sendJSON($ret); } $order_amount = $goods_amount; // 支付信息 $pay_info = Goods::getPaymentInfo($pay_id); if (empty($pay_info)) { $ret['msg'] = '该支付方式暂不可用,请重新选择'; $response->sendJSON($ret); } $order_sn = Fn::gen_order_no(); $order = ['order_sn' => $order_sn, 'user_id' => $uid, 'order_status' => OS_UNCONFIRMED, 'pay_status' => PS_UNPAYED, 'pay_id' => $pay_info['pay_id'], 'pay_name' => $pay_info['pay_name'], 'player_id' => $player_id, 'goods_type' => $goods_type, 'goods_amount' => $goods_amount, 'order_amount' => $order_amount, 'money_paid' => 0, 'add_time' => simphp_time()]; $order_id = D()->insert("order_info", $order); if ($order_id) { //订单表生成成功 $order['order_id'] = $order_id; $true_amount = $order_amount; // 处理表 pay_log Trade_Model::insertPayLog($order_id, $order_sn, $true_amount, PAY_ORDER); $jsApiParams = ''; if (2 == $pay_info['pay_id']) { //微信支付 $jsApiParams = Wxpay::unifiedOrder($order, $GLOBALS['user']->openid); } $ret = ['flag' => 'SUC', 'msg' => '订单提交成功', 'order_id' => $order_id, 'order_sn' => $order_sn, 'js_api_params' => json_decode($jsApiParams)]; $response->sendJSON($ret); } else { $ret['msg'] = '订单生成失败,请返回购物车重新添加'; $response->sendJSON($ret); } } else { $this->v->set_tplname('mod_trade_order_submit'); $this->nav_flag1 = 'order'; $this->nav_flag2 = 'order_submit'; $this->nav_no = 0; if ($request->is_hashreq()) { } else { } $response->send($this->v); } }
/** * action 'daily' * * @param Request $request * @param Response $response */ public function daily(Request $request, Response $response) { $this->v->set_tplname('mod_pay_daily'); $this->v->assign('nav_second', 'daily'); if ($request->is_hashreq()) { $searchinfo = ['start_date' => '', 'end_date' => '']; $searchinfo['start_date'] = $request->get('sdate', ''); $searchinfo['end_date'] = $request->get('edate', ''); if (strlen($searchinfo['start_date']) != 10) { //format: 'YYYY-MM-DD' $searchinfo['start_date'] = ''; } if (strlen($searchinfo['end_date']) != 10) { //format: 'YYYY-MM-DD' $searchinfo['end_date'] = ''; } if (!empty($searchinfo['start_date']) && !empty($searchinfo['end_date']) && $searchinfo['start_date'] > $searchinfo['end_date']) { //交换 $t = $searchinfo['start_date']; $searchinfo['start_date'] = $searchinfo['end_date']; $searchinfo['end_date'] = $t; } $searchstr = 'sdate=' . $searchinfo['start_date'] . '&edate=' . $searchinfo['end_date']; $this->v->assign('searchinfo', $searchinfo); $this->v->assign('searchstr', $searchstr); //BEGIN list order $orderinfo = $this->v->set_listorder('datetime', 'desc'); $extraurl = $searchstr . '&'; $extraurl .= $orderinfo[2]; $this->v->assign('extraurl', $extraurl); $this->v->assign('qparturl', '#/pay/daily'); //END list order // 查数据之前先更新数据 Pay_Model::updateDailyPay(); // Record List $limit = 30; $recordList = Pay_Model::getDailyPayList($orderinfo[0], $orderinfo[1], $limit, $searchinfo, $statinfo); $recordNum = count($recordList); $totalNum = $GLOBALS['pager_totalrecord_arr'][0]; // 获取最大单日充值数 $maxpay = Pay_Model::getMaxDayPay(); if ($recordNum) { foreach ($recordList as &$it) { $it['amount_len'] = 0; $it['weekno'] = Fn::to_weekno(date('w', strtotime($it['datetime'] . DAY_BEGIN))); //$it['weekno'] = date('w',strtotime($it['datetime'].DAY_BEGIN)); if ($maxpay) { $it['amount_len'] = round($it['amount'] * 100 * 3 / $maxpay); } } //$statinfo['totalpay_len'] = round($statinfo['total_pay']*100*2/$maxpay); } $this->v->assign('recordList', $recordList)->assign('recordNum', $recordNum)->assign('totalNum', $totalNum)->assign('statinfo', $statinfo)->assign('today', date('Y-m-d')); } $response->send($this->v); }
/** * render a template */ public function render($tpl_name = null) { if (Request::is_hashreq()) { return parent::render($this->tpl_content); } return parent::render($this->tpl_base); }
/** * @param string $url, can be "back" as shortcut for the refer url. * @param int $status "302" by default, and can be set as "301" * @throws Exception when set wrong status code. */ public static function redirect($url, $status = 302) { if (!in_array($status, array(302, 301))) { throw new Exception('Can not redirect with status: ' . $status); } if ($url == 'back') { $url = isset($_SERVER['HTTP_REFERER']) ? trim($_SERVER['HTTP_REFERER']) : '/'; } if (!$url) { $url = '/'; } if (Request::is_hashreq()) { $hash = '#' . $url; $jscontent = "<script>F.hashRedirect('{$hash}')</script>"; self::sendJSON(self::hashContent($jscontent)); } @header(self::status($status)); @header('Location: ' . $url); exit; }