You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.7 KiB
PHTML

<?php
namespace Admin\Controller;
use Org\Util\Date;
use Sdk\Controller\AgeController;
use User\Api\MemberApi as MemberApi;
use Org\WeixinSDK\Weixin;
class TestOrderController extends ThinkController
{
public function lists($p = 0) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$arraypage = $page;
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
$map['1'] = "1";
if (!empty($_REQUEST['server_type'])) {
$map['server_type'] = $_REQUEST['server_type'];
}
if (!empty($_REQUEST['order_type'])) {
$map['order_type'] = $_REQUEST['order_type'];
}
if (!empty($_REQUEST['order_no'])) {
$map['order_no'] = $_REQUEST['order_no'];
}
if (!empty($_REQUEST['user_account'])) {
$map['user_account'] = $_REQUEST['user_account'];
}
if (!empty($_REQUEST['pay_way'])) {
$map['pay_way'] = $_REQUEST['pay_way'];
}
if(!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])){
$timestart = strtotime($_REQUEST['timestart']);
$timeend = strtotime($_REQUEST['timeend'])+86399;
$map['pay_time'] = array("between",array($timestart,$timeend));
}else if(!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) {
$timestart = strtotime($_REQUEST['timestart']);
$map['pay_time'] = array("EGT",$timestart);
}else if (!empty($_REQUEST['timeend']) && empty($_REQUEST['timestart'])) {
$timeend = strtotime($_REQUEST['timeend'])+86399;
$map['pay_time'] = array("ELT",$timeend);
}
$order_list = M('test_order', 'tab_')->where($map)->select();
$sum_order_amount = M('test_order', 'tab_')->where($map)->field('sum(order_amount) as sum_order_amount')->find();
$sum_pay_amount = M('test_order', 'tab_')->where($map)->field('sum(pay_amount) as sum_order_amount')->find();
$this->assign('datas', $order_list);
$this->assign('sum_order_amount', $sum_order_amount);
$this->assign('sum_pay_amount', $sum_pay_amount);
$this->display();
}
public function addOrder(){
$this->display();
}
public function saveOrder() {
$data = $_GET;
// dump($data);die();
$data['add_time'] = time();
$data['pay_time'] = strtotime($data['pay_time']);
$data['game_name'] = get_gamename($data['game_id']);
$isSuccess = M('test_order','tab_')->add($data);
if ($isSuccess) {
$this->ajaxReturn(['status'=>1]);
} else {
$this->ajaxReturn(['status'=>0]);
}
}
}