iwebshop插件的操作
<?php
class Miao extends pluginBase
{
//插件名字
public static function name(){
return "秒杀";
}
//插件介绍
public static function description(){
return "运用此插件吸引顾客,设置限时抢购。";
} //新建数据库
public static function install(){
$miao = new IModel('miao');
if($miao->exists()){
return true;
}
//建立表
$data = array(
"comment" => self::name(),
"column" => array(
"id" => array("type" => "int(11) unsigned",'auto_increment' => 1),
"biao" => array("type" => "varchar(100)","comment" => "标题"),
"forea_time" => array("type" => "varchar(80)","comment"=>"秒杀开始时间"),
"end_time" => array("type" => "varchar(80)","comment"=>"秒杀结束时间"),
"jia" => array("type" => "varchar(20)","comment" => "价格"),
"num" => array("type" => "varchar(20)","comment" => "数量"),
"desc" => array("type" => "text","comment" => "描述"),
"goods_id"=>array("type"=>"int(11) unsigned"),
),
"index" => array("primary" => "id"),
);
$miao->setData($data);
return $miao->createTable();
}
//卸载数据表
public static function uninstall()
{
$ppt = new IModel('miao');
return $ppt->dropTable();
}
//钩子(显示到模块上)
public function reg(){
plugin::reg("onSystemMenuCreate", function () {
Menu::$menu['营销']['营销活动']['/plugins/seckill_list']=$this->name();
});
plugin::reg("onBeforeCreateAction@plugins@seckill_list", function () {
self::controller()->seckill_list = function () {
$this->seckill_list();
};
});
plugin::reg("onBeforeCreateAction@plugins@seckill_edit", function () {
self::controller()->seckill_edit = function () {
$this->seckill_edit();
};
});
plugin::reg("onBeforeCreateAction@plugins@seckilll_edit", function () {
self::controller()->seckilll_edit = function () {
$this->seckilll_edit();
};
});
plugin::reg("onBeforeCreateAction@plugins@seckill_del", function () {
self::controller()->seckill_del = function () {
$this->seckill_del();
};
});
plugin::reg("onBeforeCreateAction@plugins@seckill_upt", function () {
self::controller()->seckill_upt = function () {
$this->seckill_upt();
};
});
}
public function seckill_list(){
$testObj = new IModel("miao");
$arr = $testObj->query();
$this->list = $arr;
$this->redirect('seckill_list',$arr);
}
public function seckill_edit(){
$this->redirect('seckill_edit');
}
public function seckilll_edit(){
$is_close = IReq::get("is_close"); //是否开启 if($is_close==0) {
$goods_id = IReq::get("goods_id"); //商品id
$biao = IReq::get("title"); //标题
$forea_time = IReq::get("start_time"); //开始时间
$end_time = IReq::get("end_time"); //结束时间
$desc = IReq::get("intro"); //介绍
$jia = IReq::get("regiment_price"); //秒杀价格
$num = IReq::get("num"); //秒杀价格
$arr = array(
"biao" => $biao,
"forea_time" => $forea_time,
"end_time" => $end_time,
"desc" => $desc,
"jia" => $jia,
"goods_id" => $goods_id,
"num" => $num
);
$testObj = new IModel("miao");
$testObj->setData($arr);
$testObj->add();
$this->seckill_list();
}
}
public function seckill_del(){
$id = IReq::get("id");
$testObj = new IModel("miao");
$testObj->del("id=$id");
$this->seckill_list();
}
public function seckill_upt(){
$testObj = new IModel("miao");
$id = IFilter::act(IReq::get("id"), 'int');
$arr = $testObj->query("id=$id");
$this->list = $arr;
$this->redirect('seckill_edit');
}
}
iwebshop插件的操作的更多相关文章
- 在CHROME里安装 VIMIUM 插件, 方便操作
VIMIUM 插件使用方法 VIMIUM 命令列表 网页导航 j, :向下滚动网页 k, :向上滚动网页 h : 向左滚动 l : 向右滚动 gg : 滚动到网页头部 G : 滚动到网页底部 :向上翻 ...
- Eclipse添加git插件及操作
注册账号新建仓库 在Github已经注册成功自己的账号 新建一个仓库 创建成功后记住url: 安装Git插件 首先像安装Pydev一样 点击help的Install New Software 点击Ad ...
- FitVids,一个轻视频插件,操作简单
最近在找一个视频插件,偶尔看见一个口碑啥的都不错的插件,FitsVids. fitvids.js 是个轻量级,易于使用的 jQuery 插件,用来在网页上播放指定宽度的嵌入视频.Fitvides.js ...
- Blender插件之操作器(Operator)实战
前言 在Blender中, 操作器(Operator)是它的核心. 用户通过各种操作器来创建和操作场景中的物体. 操作器对象继承自 class bpy.types.Operator(bpy_struc ...
- 自制jQuery焦点图切换简易插件
首页经常是需要一个焦点图切换的效果,最近做的项目也正好需要,所以在网上搜索,后面查到了一个半成品的插件,这里我自己修改了一下. js文件夹下面有两个文件夹jquery.jslide.js与jquery ...
- 使用webstorm操作git
0. 前言 在上一篇文章中,讲述了使用webstorm去调试node程序,最近研究了一下如何使用webstorm去操作git. 对于git的使用,大家的使用方式均有不同,最王道的方式非命令行莫属,基于 ...
- jQuery扩展插件和拓展函数的写法
<script type="text/JavaScript"> //jQuery插件的写法(需要传入操作对象) ;(function ...
- 如何开发 Sublime Text 2 的插件
Sublime Text 2是一个高度可定制的文本编辑器,一直以来对希望有一个快速强大现代的编辑工具的的程序员保持着持续的吸引力.现在,我们将创建自己的一个Sublime plugin,实现用Nett ...
- Rest Client(Rest接口调试工具,有保存功配置功能) chrome浏览器插件
Rest Client(Rest接口调试工具,有保存功配置功能) chrome浏览器插件 下载地址 插件的操作很简单,下面是一些简单的实例. 1.安装 在谷歌应用商城搜索postman,如下图1-1所 ...
随机推荐
- cmake的命令execute_process
execute_process(COMMAND <cmd1> [args1...]] [COMMAND <cmd2> [args2...] [...]] [WORKING_DI ...
- iOS Paros 连接在同一WIFI下的网络抓包
图文详解: 说说网络抓包,几天前的事了,想抓个包看看 某爱网(全名自己脑补)的数据,就上网找了一下抓包,以前经常抓接口,时间长了忘了.那时候也不是用苹果手机抓取的,前几天试着抓了一下,今天不适合敲代码 ...
- TypeScript和JavaScript哪种语言更先进
TypeScript和JavaScript哪种语言更先进 近两年来最火爆的技术栈毫无争议的是JavaScript,随着ES6的普及,不管是从前端的浏览器来看,还是后端的NodeJS场景,JavaScr ...
- C语言一维数组转换为二维数组
一维转二维代码示例: #include <stdio.h> #include <stdlib.h> #define ROW 3 #define COL 2 int main(i ...
- 关于下载SAE日志签名认证的方法——PHP版
之前需要下载SAE上的日志存入数据库,因此研究了下SAE的签名认证和日志下载.这个链接是SAE官方给出的API文档.https://www.sinacloud.com/doc/api.html#qia ...
- Weex系列二、显示图片
上次我们创建了一个简单的Weex的demo. 一.常用的类 WXSDKEngine:SDK开放的绝大多数接口都在此有声明. WXLog: 用来打印日志. WXDebugTool: weex提供的对外调 ...
- React 国际化
前言 React 做国际化,我推荐使用 React-intl , 这个库提供了 React 组件和Api两种方式来格式化日期,数字和字符串等.知道这个库了,那让我们开始使用它 组件用法 为了和Reac ...
- JavaWeb验证码的使用
在Java Web开发中,我们经常需要使用到验证码功能,一般情况下,我们可以将产生的验证码保存到服务器端中的session中,这种方式中,是使用服务器来保证验证码的功能.另外,我们也可以采用js产生验 ...
- 如何通过注解Bean类来封装SQL插入语句
整体思路是酱紫的: 给bean上注解说明该bean对应着数据库中哪张表,给每个bean的属性都注解说明各自对应着这张表的哪个字段. 通过类反射获取表名,通过逐个反射每个属性的getter方法,获取注解 ...
- CentOS 7 yum搭建 LAMP
CentOS 7 搭建LAMP环境 1. Apache 安装 Apache 的软件包名称叫做httpd,因此安装Apache,使用以下命令 [root@localhost ~]# yum -y ins ...