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]); } } }