** * 设置默认值 */
(po *PageOptions, totalpages int)
| 295 | * 设置默认值 |
| 296 | */ |
| 297 | func setDefault(po *PageOptions, totalpages int) *PageOptions { |
| 298 | if len(po.FirstPageText) <= 0 { |
| 299 | po.FirstPageText = "«" |
| 300 | } |
| 301 | if len(po.LastPageText) <= 0 { |
| 302 | po.LastPageText = "»" |
| 303 | } |
| 304 | if len(po.PrePageText) <= 0 { |
| 305 | po.PrePageText = "‹" |
| 306 | } |
| 307 | if len(po.NextPageText) <= 0 { |
| 308 | po.NextPageText = "›" |
| 309 | } |
| 310 | if po.CurrentPage >= totalpages { |
| 311 | po.CurrentPage = totalpages |
| 312 | } |
| 313 | if po.CurrentPage <= 1 { |
| 314 | po.CurrentPage = 1 |
| 315 | } |
| 316 | if po.LinkItemCount == 0 { |
| 317 | po.LinkItemCount = 10 |
| 318 | } |
| 319 | if po.PageSize == 0 { |
| 320 | po.PageSize = 20 |
| 321 | } |
| 322 | if len(po.ParamName) <= 0 { |
| 323 | po.ParamName = "pno" |
| 324 | } |
| 325 | return po |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | *判断首页尾页 上一页下一页是否能用 |
no outgoing calls
no test coverage detected