where($map)->page($page, $limit)->order('id asc')->select(); $count = M('goodscode')->where($map)->count(); } else { $data = M('goodscode')->page($page, $limit)->order('id asc')->select(); $count = S('goodscodecount'); if (!$count) { $count = M('goodscode')->count(); S('goodscodecount', $count, 6400); } } foreach ($data as &$v) { $v['specification'] = $v['specification'] ? $v['specification'] : "--"; $v['unit'] = $v['unit'] ? $v['unit'] : "--"; $v['origin'] = $v['origin'] ? $v['origin'] : "--"; } return ['code' => 0, 'msg' => '', 'count' => $count, 'data' => $data]; } }