<?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插件的操作的更多相关文章

  1. 在CHROME里安装 VIMIUM 插件, 方便操作

    VIMIUM 插件使用方法 VIMIUM 命令列表 网页导航 j, :向下滚动网页 k, :向上滚动网页 h : 向左滚动 l : 向右滚动 gg : 滚动到网页头部 G : 滚动到网页底部 :向上翻 ...

  2. Eclipse添加git插件及操作

    注册账号新建仓库 在Github已经注册成功自己的账号 新建一个仓库 创建成功后记住url: 安装Git插件 首先像安装Pydev一样 点击help的Install New Software 点击Ad ...

  3. FitVids,一个轻视频插件,操作简单

    最近在找一个视频插件,偶尔看见一个口碑啥的都不错的插件,FitsVids. fitvids.js 是个轻量级,易于使用的 jQuery 插件,用来在网页上播放指定宽度的嵌入视频.Fitvides.js ...

  4. Blender插件之操作器(Operator)实战

    前言 在Blender中, 操作器(Operator)是它的核心. 用户通过各种操作器来创建和操作场景中的物体. 操作器对象继承自 class bpy.types.Operator(bpy_struc ...

  5. 自制jQuery焦点图切换简易插件

    首页经常是需要一个焦点图切换的效果,最近做的项目也正好需要,所以在网上搜索,后面查到了一个半成品的插件,这里我自己修改了一下. js文件夹下面有两个文件夹jquery.jslide.js与jquery ...

  6. 使用webstorm操作git

    0. 前言 在上一篇文章中,讲述了使用webstorm去调试node程序,最近研究了一下如何使用webstorm去操作git. 对于git的使用,大家的使用方式均有不同,最王道的方式非命令行莫属,基于 ...

  7. jQuery扩展插件和拓展函数的写法

    <script type="text/JavaScript">            //jQuery插件的写法(需要传入操作对象)        ;(function ...

  8. 如何开发 Sublime Text 2 的插件

    Sublime Text 2是一个高度可定制的文本编辑器,一直以来对希望有一个快速强大现代的编辑工具的的程序员保持着持续的吸引力.现在,我们将创建自己的一个Sublime plugin,实现用Nett ...

  9. Rest Client(Rest接口调试工具,有保存功配置功能) chrome浏览器插件

    Rest Client(Rest接口调试工具,有保存功配置功能) chrome浏览器插件 下载地址 插件的操作很简单,下面是一些简单的实例. 1.安装 在谷歌应用商城搜索postman,如下图1-1所 ...

随机推荐

  1. CentOS7 设置局域网固定IP

    题记: 在局域网内PC通常都是采用自动获取IP的方式从路由器拿到局域网IP的,每次PC启动后分配到的局域网IP都不一定相同.但是出于某些特殊的需求,例如要在局域网内做端口映射,需要将PC设置成使用固定 ...

  2. 读书笔记 effective c++ Item 14 对资源管理类的拷贝行为要谨慎

    1. 自己实现一个资源管理类 Item 13中介绍了 “资源获取之时也是初始化之时(RAII)”的概念,这个概念被当作资源管理类的“脊柱“,也描述了auto_ptr和tr1::shared_ptr是如 ...

  3. wikioi 3132 高精度乘法(FFT)

    第一次学FFT,先膜拜一下法法塔大神ORZ 关于FFT的话,有一篇博文特别赞http://z55250825.blog.163.com/blog/static/15023080920143127465 ...

  4. WP8.1程序开发中,如何加载本地文件资源或安装在程序包中的资源。

    Web 要访问来自 Web 的文件,你可以使用标准的绝对 HTTP URI: <img src="http://www.contoso.com/images/logo.png" ...

  5. JAVA三大特性之二——继承

    很多人在学习了JAVA以后,都会了解这个概念,而且继承也会在以后的开发中经常用到,但对于JAVA的继承特性,很多人都了解的不够深入,不够完整,当然这其中包括我,所以我就想抽点时间来整理一下JAVA继承 ...

  6. progID

    ProgID程序员给CLSID指定的容易记住的名字ProgID命名约定:<Program>.<Component>.<Version>AppID:将某个APPID( ...

  7. H5微场景宽、高度自适应办法

    最近在做一些手机端微场景,发现处理各种手机屏幕分辨率是个很让人头疼的事情,最终找到了一个处理效果比较满意的方案.各位客观请往下看: 如果有过做微场景经历的客官们应该都了解,在代码中给一个元素的宽高设成 ...

  8. 设置debian的静态IP

    欲设置的信息: IP地址:198.9.146.131 子网掩码:255.255.255.0 网关:198.9.146.254 DNS:198.9.9.1 198.9.9.2 首先编辑/etc/netw ...

  9. 3433: [Usaco2014 Jan]Recording the Moolympics

    3433: [Usaco2014 Jan]Recording the Moolympics Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 137  S ...

  10. CAAnimation动画--(旋转/缩放/移动/闪烁)

    p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Menlo; color: #1d9421 } p.p2 { margin: 0.0px 0. ...