model = new User(); } #[Route('POST,GET','recharge')] public function recharge($ids) { if($this->request->isPost()){ $module_type=$this->request->post('row.module_type'); $change_type=$this->request->post('row.recharge_type'); $change=$this->request->post('row.change/d'); $remark=$this->request->post('row.remark'); $order_no=time().rand(1000,9999); switch ($module_type){ case 'score': UserLog::addScoreLog($ids,$change_type,$change,$order_no,$remark); break; case 'balance': UserLog::addBalanceLog($ids,$change_type,$change,$order_no,$remark); break; } $this->success(); }else{ $user=User::find($ids); $this->assign('moduletype',UserLog::TYPE); $this->assign('user',$user); return $this->fetch(); } } #[Route('GET','test')] public function test() { return $this->fetch(); } #[Route('GET,JSON','detail')] public function detail($ids) { if($this->request->isAjax()){ $this->model=new UserLog(); $where=[]; $where[]=['type','=',$this->request->get('type')]; $where[]=['user_id','=',$ids]; [$where, $order, $limit, $with] = $this->buildparams($where); $list = $this->model ->where($where) ->order($order) ->paginate($limit); $result = ['total' => $list->total(), 'rows' => $list->items()]; return json($result); }else{ $user=User::find($ids); $this->assign('moduletype',UserLog::TYPE); $this->assign('user',$user); return $this->fetch(); } } }