params['page'] ? $this->params['page'] : 1; $total = $zym_1->count( ); $pager = new Doo( ( )->APP_URL."index.php/admin/appkey/index", $total, 20, 10 ); $pager->paginate( $page ); $limit = $pager->limit; $this->data['infos'] = $zym_1->find( array( "limit" => $limit, "desc" => "id" ) ); $this->data['pager'] = $pager; $this->data( "appkey/index", $this->data ); } public function create( ) { $zym_1 = new MilAppkey( ); $action = ( )->APP_URL."index.php/admin/appkey/create"; $FORM = new DooForm( array( "method" => "post", "action" => $action, "elements" => array( "app_key" => array( "text", array( "label" => "APPKEY:", "attributes" => array( "class" => "text-input small-input" ), "field-wrapper" => "p", "validators" => array( array( "required", "请输入APPKEY" ), array( "minlength", 1, "请输入APPKEY" ), array( "dbNotExist", $zym_1->_table, "app_key", "APPKEY重复" ) ) ) ), "app_secret" => array( "text", array( "required" => TRUE, "label" => "APP SECRET: ", "attributes" => array( "class" => "text-input small-input" ), "field-wrapper" => "p", "validators" => array( array( "required", "请输入APP SECRET" ), array( "minlength", 1, "请输入APP SECRET" ) ) ) ), "submit" => array( "submit", array( "label" => "提交" ) ) ) ) ); if ( $this->isPost( ) && $_POST( $_POST ) ) { $zym_1->app_key = trim( $_POST['app_key'] ); $zym_1->app_secret = trim( $_POST['app_secret'] ); if ( $zym_1->insert( ) ) { ( )( ":) 添加成功!", ( )->APP_URL."index.php/admin/appkey/index" ); } else { $this->showMsg( ":( 添加失败!", "-1" ); } } $this->view( )->form = $FORM->render( ); $this->data( "appkey/create", $this->data, TRUE ); } public function update( ) { $id = isset( $_GET['id'] ) ? intval( $_GET['id'] ) : 0; if ( $id ) { $this->showMsg( "未指定ID!", "-1" ); } $model = new MilAppkey( ); $model->id; $INFO = $model->getOne( array( "where" => "`id`='".$id."'" ) ); if ( $INFO ) { $this->showMsg( "信息不存在!", "-1" ); } else { $this->data['info'] = $INFO; } $action = ( )->APP_URL."index.php/admin/appkey/update?id=".$id; $FORM = new DooForm( array( "method" => "post", "action" => $action, "elements" => array( "app_key" => array( "text", array( "label" => "APPKEY:", "value" => $INFO->app_key, "attributes" => array( "class" => "text-input small-input" ), "field-wrapper" => "p", "validators" => array( array( "required", "请输入APPKEY" ), array( "minlength", 1, "请输入APPKEY" ), array( "maxlength", 10, "APPKEY长度最多10位" ) ) ) ), "app_secret" => array( "text", array( "required" => TRUE, "value" => $INFO->app_secret, "label" => "APP SECRET: ", "attributes" => array( "class" => "text-input small-input" ), "field-wrapper" => "p", "validators" => array( array( "required", "请输入APP SECRET" ), array( "minlength", 1, "请输入APP SECRET" ) ) ) ), "submit" => array( "submit", array( "label" => "提交" ) ) ) ) ); if ( $this->isPost( ) && $_POST( $_POST ) ) { $INFO->app_key = trim( $_POST['app_key'] ); $INFO->app_secret = trim( $_POST['app_secret'] ); if ( $INFO->app_key( array( "where" => "`id`<>'".$id."' AND `app_key`='{$INFO->app_key}'" ) ) ) { $this->showMsg( "APPKEY重复!", "-1" ); } if ( $INFO->update( ) ) { ( )( "修改成功!", ( )->APP_URL."index.php/admin/appkey/index" ); } else { $this->showMsg( "修改失败!", "-1" ); } } $this->view( )->form = $FORM->render( ); $this->data( "appkey/update", $this->data, TRUE ); } public function delete( ) { $ids = isset( $_GET['ids'] ) ? $_GET['ids'] : 0; if ( $ids ) { $this->showMsg( "未指定ID!", "-1" ); } $zym_1 = new MilAppkey( ); if ( is_array( $ids ) ) { $zym_2 = implode( ",", $ids ); $zym_1->delete( array( "where" => "`id` IN (".$zym_2.")" ) ); } else { $id = intval( $ids ); $zym_1->delete( array( "where" => "`id`='".$id."'" ) ); } $this->showMsg( "删除成功!", "-1" ); } } ?>