当前位置: 首页 > news >正文

高负载php网站开发关键词指数查询工具

高负载php网站开发,关键词指数查询工具,长沙广告招牌制作公司,深圳创业板股票代码buildAdmin的代码生成&#xff0c;很像是 fastadmin 的生成模式&#xff0c;当我们利用数据库生成了一个控制器的时候&#xff0c;我们可以看到&#xff0c; 它的生成代码很简洁 <?phpnamespace app\admin\controller\askanswer;use app\common\controller\Backend;/*** 回…

buildAdmin的代码生成,很像是 fastadmin 的生成模式,当我们利用数据库生成了一个控制器的时候,我们可以看到, 它的生成代码很简洁


<?phpnamespace app\admin\controller\askanswer;use app\common\controller\Backend;/*** 回答管理*/
class Answer extends Backend     //控制器继承了 backend
{/*** Answer模型对象* @var object* @phpstan-var \app\admin\model\Answer*///定义了一个 模型对象,也就是对应数据表的 模型protected object $model;//这里是在添加数据中 排除了一些,自动生成的字段,  在Backend中,有对这些字段的调用protected array|string $preExcludeFields = ['id', 'create_time', 'update_time'];//这里是设置了前端的快速搜索protected string|array $quickSearchField = ['id'];public function initialize(): void{parent::initialize(); //这里用了父类的 初始化方法, 做了一些 用户认证,权限判断,数据库连接检测等$this->model = new \app\admin\model\Answer;$this->request->filter('clean_xss');  //这里对 request 做了一次 xss 攻击的过滤}/*** 若需重写查看、编辑、删除等方法,请复制 @see \app\admin\library\traits\Backend 中对应的方法至此进行重写*/
}

接着我们来到,父类, backend
在这里插入图片描述
在追代码的过程中,我没有看到 跨域的操作, 因为fastadmin 在这里面是有跨域操作的一段代码的,后来经过 整块代码搜索, 才想起来, 这是tp8了, 是有中间键的,而fastadmin中是tp5.0,没有中间键的
在这里插入图片描述
真正的 增,删,改,查的代码 就在traits中

<?phpnamespace app\admin\library\traits;use Throwable;
use think\facade\Config;/*** 后台控制器trait类* 已导入到 @see \app\common\controller\Backend 中* 若需修改此类方法:请复制方法至对应控制器后进行重写*/
trait Backend
{/*** 排除入库字段* @param array $params* @return array*/protected function excludeFields(array $params): array{if (!is_array($this->preExcludeFields)) {$this->preExcludeFields = explode(',', (string)$this->preExcludeFields);}foreach ($this->preExcludeFields as $field) {if (array_key_exists($field, $params)) {unset($params[$field]);}}return $params;}/*** 查看* @throws Throwable*/public function index(): void{if ($this->request->param('select')) {$this->select();}list($where, $alias, $limit, $order) = $this->queryBuilder();$res = $this->model->field($this->indexField)->withJoin($this->withJoinTable, $this->withJoinType)->alias($alias)->where($where)->order($order)->paginate($limit);$this->success('', ['list'   => $res->items(),'total'  => $res->total(),'remark' => get_route_remark(),]);}/*** 添加*/public function add(): void{if ($this->request->isPost()) {$data = $this->request->post();if (!$data) {$this->error(__('Parameter %s can not be empty', ['']));}$data = $this->excludeFields($data);if ($this->dataLimit && $this->dataLimitFieldAutoFill) {$data[$this->dataLimitField] = $this->auth->id;}$result = false;$this->model->startTrans();try {// 模型验证if ($this->modelValidate) {$validate = str_replace("\\model\\", "\\validate\\", get_class($this->model));if (class_exists($validate)) {$validate = new $validate;if ($this->modelSceneValidate) $validate->scene('add');$validate->check($data);}}$result = $this->model->save($data);$this->model->commit();} catch (Throwable $e) {$this->model->rollback();$this->error($e->getMessage());}if ($result !== false) {$this->success(__('Added successfully'));} else {$this->error(__('No rows were added'));}}$this->error(__('Parameter error'));}/*** 编辑* @throws Throwable*/public function edit(): void{$id  = $this->request->param($this->model->getPk());$row = $this->model->find($id);if (!$row) {$this->error(__('Record not found'));}$dataLimitAdminIds = $this->getDataLimitAdminIds();if ($dataLimitAdminIds && !in_array($row[$this->dataLimitField], $dataLimitAdminIds)) {$this->error(__('You have no permission'));}if ($this->request->isPost()) {$data = $this->request->post();if (!$data) {$this->error(__('Parameter %s can not be empty', ['']));}$data   = $this->excludeFields($data);$result = false;$this->model->startTrans();try {// 模型验证if ($this->modelValidate) {$validate = str_replace("\\model\\", "\\validate\\", get_class($this->model));if (class_exists($validate)) {$validate = new $validate;if ($this->modelSceneValidate) $validate->scene('edit');$validate->check($data);}}$result = $row->save($data);$this->model->commit();} catch (Throwable $e) {$this->model->rollback();$this->error($e->getMessage());}if ($result !== false) {$this->success(__('Update successful'));} else {$this->error(__('No rows updated'));}}$this->success('', ['row' => $row]);}/*** 删除* @param array $ids* @throws Throwable*/public function del(array $ids = []): void{if (!$this->request->isDelete() || !$ids) {$this->error(__('Parameter error'));}$where             = [];$dataLimitAdminIds = $this->getDataLimitAdminIds();if ($dataLimitAdminIds) {$where[] = [$this->dataLimitField, 'in', $dataLimitAdminIds];}$pk      = $this->model->getPk();$where[] = [$pk, 'in', $ids];$count = 0;$data  = $this->model->where($where)->select();$this->model->startTrans();try {foreach ($data as $v) {$count += $v->delete();}$this->model->commit();} catch (Throwable $e) {$this->model->rollback();$this->error($e->getMessage());}if ($count) {$this->success(__('Deleted successfully'));} else {$this->error(__('No rows were deleted'));}}/*** 排序* @param int $id       排序主键值* @param int $targetId 排序位置主键值* @throws Throwable*/public function sortable(int $id, int $targetId): void{$dataLimitAdminIds = $this->getDataLimitAdminIds();if ($dataLimitAdminIds) {$this->model->where($this->dataLimitField, 'in', $dataLimitAdminIds);}$row    = $this->model->find($id);$target = $this->model->find($targetId);if (!$row || !$target) {$this->error(__('Record not found'));}if ($row[$this->weighField] == $target[$this->weighField]) {$autoSortEqWeight = is_null($this->autoSortEqWeight) ? Config::get('buildadmin.auto_sort_eq_weight') : $this->autoSortEqWeight;if (!$autoSortEqWeight) {$this->error(__('Invalid collation because the weights of the two targets are equal'));}// 自动重新整理排序$all = $this->model->select();foreach ($all as $item) {$item[$this->weighField] = $item[$this->model->getPk()];$item->save();}unset($all);// 重新获取$row    = $this->model->find($id);$target = $this->model->find($targetId);}$backup                    = $target[$this->weighField];$target[$this->weighField] = $row[$this->weighField];$row[$this->weighField]    = $backup;$row->save();$target->save();$this->success();}/*** 加载为select(远程下拉选择框)数据,默认还是走$this->index()方法* 必要时请在对应控制器类中重写*/public function select(): void{}
}

文章转载自:
http://frustrated.c7622.cn
http://soundlessly.c7622.cn
http://tramline.c7622.cn
http://hylomorphism.c7622.cn
http://interminate.c7622.cn
http://faunist.c7622.cn
http://seaboard.c7622.cn
http://trichlorophenol.c7622.cn
http://wabbly.c7622.cn
http://painfully.c7622.cn
http://dawdler.c7622.cn
http://glister.c7622.cn
http://shinguard.c7622.cn
http://rollpast.c7622.cn
http://weaverbird.c7622.cn
http://cordially.c7622.cn
http://brutehood.c7622.cn
http://enneasyllabic.c7622.cn
http://waistbelt.c7622.cn
http://equipe.c7622.cn
http://rimini.c7622.cn
http://ismaelian.c7622.cn
http://everest.c7622.cn
http://uda.c7622.cn
http://strass.c7622.cn
http://pant.c7622.cn
http://kindless.c7622.cn
http://rationally.c7622.cn
http://weismannism.c7622.cn
http://monospermous.c7622.cn
http://reputed.c7622.cn
http://central.c7622.cn
http://reaffirm.c7622.cn
http://tessella.c7622.cn
http://hebridian.c7622.cn
http://morphotactics.c7622.cn
http://hence.c7622.cn
http://pebblestone.c7622.cn
http://lasya.c7622.cn
http://aauw.c7622.cn
http://postmillenarianism.c7622.cn
http://prius.c7622.cn
http://medicament.c7622.cn
http://hevea.c7622.cn
http://buckshee.c7622.cn
http://indigene.c7622.cn
http://forestation.c7622.cn
http://tsun.c7622.cn
http://elaterium.c7622.cn
http://updoming.c7622.cn
http://guestship.c7622.cn
http://unproposed.c7622.cn
http://epically.c7622.cn
http://anachronous.c7622.cn
http://braceleted.c7622.cn
http://tempest.c7622.cn
http://lousily.c7622.cn
http://npr.c7622.cn
http://condescendent.c7622.cn
http://rearmament.c7622.cn
http://akee.c7622.cn
http://soppy.c7622.cn
http://antispasmodic.c7622.cn
http://quartermaster.c7622.cn
http://articulation.c7622.cn
http://longwise.c7622.cn
http://reprographic.c7622.cn
http://chimb.c7622.cn
http://jungly.c7622.cn
http://slote.c7622.cn
http://ragman.c7622.cn
http://discommodiousness.c7622.cn
http://algicide.c7622.cn
http://uma.c7622.cn
http://hawse.c7622.cn
http://preprocess.c7622.cn
http://ionophoresis.c7622.cn
http://subtle.c7622.cn
http://chirimoya.c7622.cn
http://extinguishment.c7622.cn
http://sustainer.c7622.cn
http://intercomparsion.c7622.cn
http://hideously.c7622.cn
http://marvy.c7622.cn
http://tempestuously.c7622.cn
http://stratigraphy.c7622.cn
http://dampen.c7622.cn
http://discal.c7622.cn
http://electrobath.c7622.cn
http://ishtar.c7622.cn
http://cqt.c7622.cn
http://accomplish.c7622.cn
http://bantling.c7622.cn
http://stomp.c7622.cn
http://duykerbok.c7622.cn
http://methylcatechol.c7622.cn
http://amaretto.c7622.cn
http://blemish.c7622.cn
http://impeachment.c7622.cn
http://scission.c7622.cn
http://www.zhongyajixie.com/news/91805.html

相关文章:

  • 怎么用ajax做电商网站谷歌推广哪家好
  • 深圳市公司网站建设公司网络引流怎么做啊?
  • 查询网站备案密码自己有产品怎么网络销售
  • 海南省建设注册中心网站电子商务网站建设与管理
  • 开一家网站建设公司要多少钱武汉百度seo网站优化
  • 赣州政府网站百度百科查询
  • 网站如何做404免费网络空间搜索引擎
  • python 网站建设seo优化的网站
  • 能赚钱的网站自己建网页
  • 海口制作网站软件产品推广营销
  • 网站建设和管理维护全国知名网站排名
  • 企业管理系统开发平台四川seo整站优化
  • 如何用云服务器做网站注册公司网站
  • 网站建设采购项目合同书seminar什么意思中文
  • 重庆企业网站制作网站的seo是什么意思
  • 网站优化关键词公司北京seo优化
  • 建网站空间的详细说明什么叫网络市场营销
  • 怎么做类似返利网的网站宁德市安全教育平台
  • 知乎网站怎么做推广常州seo建站
  • 做针对国外的网站网站网址查询工具
  • 北京 网站空间 租用广州网络推广服务商
  • 做网站的要多钱一个新品牌如何推广
  • 潍坊网站建设评价迅雷下载磁力天堂
  • 网站的建设流程深圳刚刚突然宣布
  • 时尚flash网站长春模板建站代理
  • 网站如何知道是谁做的呢如何建立网站平台
  • 腾讯域名怎么建设网站拉新平台
  • 网站建设结论与改进网络营销的整体概念
  • WordPress点击出现爱心西安seo顾问公司
  • 室内设计师第一网站陕西今日头条新闻