Ejemplo n.º 1
0
 public function queryAction()
 {
     list($page, $sidx, $limit, $sord, $start) = getRequestParams();
     $model = $this->getModel();
     $user_id = is_user_login();
     $condition = array("user_id" => $user_id);
     $search = I("_search");
     if (!empty($search)) {
         $condition = array_merge($condition, getOneSearchParams());
     }
     $ret = $model->relation(true)->where($condition)->order("{$sidx} {$sord}")->limit("{$start},{$limit}")->select();
     $count = $model->where($condition)->count();
     if ($count > 0 && $limit > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     $channels = M("Channel")->where(array("brand_id" => get_brand_id()))->select();
     $response = array("page" => $page, "total" => $total_pages, "records" => $count, "rows" => $ret);
     $this->ajaxReturn($response);
 }
Ejemplo n.º 2
0
 public function payHistoryQueryAction()
 {
     list($page, $sidx, $limit, $sord, $start) = getRequestParams();
     $filters = I("filters", '', '');
     $brand_id = get_brand_id();
     $condition = array("brand_id" => $brand_id, "type" => 3);
     $search = I("_search");
     if (!empty($search)) {
         $condition = array_merge($condition, getOneSearchParams());
     }
     $model = D("Review");
     $count = $model->where($condition)->count();
     $ret = $model->relation(true)->where($condition)->order("{$sidx} {$sord},id desc")->limit("{$start},{$limit}")->select();
     foreach ($ret as $key => $value) {
         $contract = json_decode($value['extension'], true);
         $original = !empty($value['original_extension']) ? json_decode($value['original_extension'], true) : null;
         $ret[$key]['extension'] = $contract;
         $ret[$key]['original_extension'] = $original;
     }
     if ($count > 0 && $limit > 0) {
         $total_pages = ceil($count / $limit);
     } else {
         $total_pages = 0;
     }
     $response = array("page" => $page, "total" => $total_pages, "records" => $count, "rows" => $ret);
     $this->ajaxReturn($response);
 }