如何开发陪玩系统源码的列表页面,相关实现代码

简介: 接下来我们一起来看看具体的实现代码吧。route.php<?phpusethink\Route;Route::get('test','api/test/index');Route::put('test/:id','api/test/update');Route::delete('test/:id','api/test/delete');Route::resource('test','api/test');Route::get('api/:ver/cat','api/:ver.cat/read');Route::get('api/:ver/index','api/:ver.index/index

在陪玩系统源码开发过程中,需要实现的列表页面还是非常多的,如何保证列表页面的流畅、整洁很重要,接下来我们一起来看看具体的实现代码吧。route.php<?phpusethink\Route;Route::get('test','api/test/index');Route::put('test/:id','api/test/update');Route::delete('test/:id','api/test/delete');Route::resource('test','api/test');Route::get('api/:ver/cat','api/:ver.cat/read');Route::get('api/:ver/index','api/:ver.index/index');Route::resource('api/:ver/news','api/:ver.news');News.php(Model)<?php/CreatedbyPhpStorm.User:tongDate:2017/11/20Time:16:34/namespaceapp\common\model;classNewsextendsBase{publicfunctiongetNews($data=[]){$data['status']=['neq',config('code.status_delete'),];$order=['id'=>'desc'];$result=$this->where($data)->order($order)->paginate();return$result;}publicfunctiongetNewsByCondition($condition=[],$from,$size=5){if(!isset($condition['status'])){$condition['status']=['neq',config('code.status_delete')];}$order=['id'=>'desc'];$result=$this->where($condition)->field($this->getListField())->limit($from,$size)->order($order)->select();return$result;}publicfunctiongetNewsByCountCondition($condition=[]){if(!isset($condition['status'])){$condition['status']=['neq',config('code.status_delete')];}return$this->where($condition)->count();}publicfunctiongetIndexHadNormalNews($num=4){$data=['status'=>1,'is_head_figure'=>1,];$order=['id'=>'desc',];return$this->where($data)->field($this->getListField())->order($order)->limit($num)->select();}publicfunctiongetPositionNormalNews($num=20){$data=['status'=>1,'is_position'=>1,];$order=['id'=>'desc',];return$this->where($data)->field($this->getListField())->order($order)->limit($num)->select();}privatefunctiongetListField(){return['id','catid','image','title','read_count','status','is_position','update_time','create_time',];}}->field($this->getListField())privatefunctiongetListField(){return['id','catid','image','title','read_count','status','is_position','update_time','create_time',];}Common.php<?php/CreatedbyPhpStorm.User:tongDate:2017/11/23Time:11:30/namespaceapp\api\controller;useapp\common\lib\Aes;useapp\common\lib\exception\ApiException;useapp\common\lib\IAuth;useapp\common\lib\Time;usethink\Cache;usethink\Controller;classCommonextendsController{public$headers='';public$page=1;public$size=5;public$from=0;protectedfunction_initialize(){$this->checkRequestAuth();//$this->testAes();}publicfunctioncheckRequestAuth(){$headers=request()->header();if(empty($headers['sign'])){thrownewApiException('sign不存在',400);}if(!in_array($headers['app_type'],config('app.apptypes'))){thrownewApiException('app_type不合法',400);}if(!IAuth::checkSignPass($headers)){thrownewApiException('授权码sign失败',401);}Cache::set($headers['sign'],config('app.app_sign_cache_time'));$headers=$this->headers;}publicfunctiontestAes(){$data=['did'=>'12345dg','version'=>1,'time'=>Time::get13TimeStamp(),];//$str='sRCvj52mZ8G+u2OdHYwmysvczmCw+RrAYWiEaXFI/5A=';//echo(newAes())->decrypt($str);//exit;echoIAuth::setSign($data);exit;}publicfunctiongetDealNews($news=[]){if(empty($news)){return[];}$cats=config('cat.list');foreach($newsas$key=>$new){$news[$key]['catname']=$cats[$new['catid']]?$cats[$new['catid']]:'-

相关文章
|
SQL JavaScript 关系型数据库
MySQL Shell 使用指南
MySQL Shell 是一个强大且灵活的工具,它扩展了 MySQL 客户端的功能,使得数据库管理和运维工作更加便捷高效。
1127 0
|
机器学习/深度学习 自然语言处理 算法
跨模态学习能力再升级,EasyNLP电商文图检索效果刷新SOTA
本⽂简要介绍我们在电商下对CLIP模型的优化,以及上述模型在公开数据集上的评测结果。最后,我们介绍如何在EasyNLP框架中调用上述电商CLIP模型。
|
3月前
|
人工智能 安全 程序员
AI Gateway 分析:OpenRouter vs Higress
本文对比了两种AI网关——OpenRouter与Higress的定位、功能及演进历程。OpenRouter以简化AI模型调用体验为核心,服务于开发者群体;Higress则基于云原生架构,为企业级AI应用提供全面的流量治理与安全管控能力。两者分别代表了AI网关在不同场景下的发展方向。
|
Rust JavaScript Unix
Nodejs 常见版本管理工具(nvm、n、fnm、nvs、nodenv)
Nodejs 常见版本管理工具(nvm、n、fnm、nvs、nodenv)
11681 0
|
小程序 定位技术 API
从新手到行家:支付宝小程序开发的全景攻略
【8月更文挑战第27天】在数字化转型的大潮中,支付宝小程序作为连接商家与消费者的桥梁发挥着重要作用。本文以“美食地图”支付宝小程序为例,从项目概述、开发准备、开发实践、问题解决到最终总结,全面解析支付宝小程序的开发流程。从环境搭建到页面设计,再到业务逻辑实现,最后完成性能优化、测试与发布,详细介绍如何打造一款实用且用户体验优良的小程序。“美食地图”不仅让用户轻松搜索周边美食、查看评价和优惠信息,还能在线预约,极大地提升了便利性和满意度。通过实战案例分享,为开发者提供宝贵的经验参考。
406 0
|
SQL 前端开发 JavaScript
springboot+vue 前后端交互实现(mysql+springboot+vue)
springboot+vue 前后端交互实现(mysql+springboot+vue)
1030 1
|
JavaScript 前端开发 UED
Vue 异步组件
Vue 异步组件
86 0
|
JSON 关系型数据库 MySQL
穿越MySQL版本时光:5.7和8.0的差异全揭秘
穿越MySQL版本时光:5.7和8.0的差异全揭秘
8093 0
|
弹性计算 网络协议 安全
阿里云服务器80端口开启教程(安全组配置)
阿里云服务器80端口开启教程(安全组配置)阿里云服务器端口怎么打开?云服务器ECS端口在安全组中开启,轻量应用服务器端口在防火墙中打开,阿里云服务器网以80端口为例,来详细说下阿里云服务器端口开放图文教程,其他的端口如8080、3306、443、1433也是同样的方法进行开启端口:
2734 0
|
算法 Python
使用Python多进程
使用Python多进程
134 0