App/Lib/Action/Admin/SpecialtyAction.class.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php


class SpecialtyAction extends  CommonAction {
	
     public function index() {
		if ($this->isAjax ()) {
			$Form = D ( 'SpecialtyView' );
			import ( "ORG.Util.Page" );
			if (!empty($_REQUEST['query']))
				$where = $_REQUEST ['qtype'] . " LIKE '%" . $_REQUEST ['query'] . "%'";
			$count = $Form->where($where)->count ();
			$Page  = new Page ( $count, $_REQUEST['rp']);
			$Page->firstRow = $_REQUEST['rp'] * ($_REQUEST['page'] - 1);
			$list  = $Form->where($where)->order ( 'id DESC' )->limit ( $Page->firstRow . ',' . $Page->listRows )->select ();
			$json  = array (
					'page'  => $_REQUEST['page'],
					'total' => $count,
					'rows'  => array ()
			);
			foreach ( $list as $key => $value )
				$json ['rows'] [] = array (
						'id' => $list [$key] ['id'],
						'cell' => array (
								'id'         => $list [$key] ['id'],
								'k'          => $key + 1, // 序号
								'name'       => $list [$key] ['name'],
								'department' => $list [$key] ['department'],

						)
				);
			echo json_encode ( $json );
		} else {
			$this->toTemplate ( 'Specialty:index', '专业管理  > 所有专业 >' );
		}
	}

	public function insert() {
		if ($this->isPost()) {
			$Form = D ( 'Specialty' );
			$Form->startTrans ();
			if ($vo = $Form->create ()) {
				if ($_POST['addWatermark'] == 1) {
					$this->addWatermark(BASE_PATH .$_POST['thumb']);
				}
				$list = $Form->add ();
				if ($list) {
					$Form->commit ();
					$this->success ();
				} else {
					$Form->rollback ();
					$this->error ( '数据写入错误!' );
				}
			} else
				$this->error ( $Form->getError () );
		} else {
			R('Admin/Department/getAllDepartment');
			$this->toTemplate ( 'Specialty:add', '专业管理  > 添加专业 >' );
		}
	}
后面还有 55 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。