<?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. cordova调用本地SQLite数据库的方法

    第一篇技术博客,写下来和大家分享今天所学,其次自己也巩固一下. 整个下午的时间用来钻研如何用cordova调用移动端本地SQLite数据库.首先我并不是用eclipse来编程的,而是用cordova建 ...

  2. swift 可选类型笔记

    晚上十一点半了,看书累了,原本想睡了的,想了想,还是把刚看的总结一下,把这篇笔记写了吧.广州下雨,真特么的冷..好了,废话不说了,说正题说说Swift可选类型. 先定义一个变量: var string ...

  3. 面向UI编程:ui.js 1.1 使用观察者模式完成组件之间数据流转,彻底分离组件之间的耦合,完成组件的高内聚

    开头想明确一些概念,因为有些概念不明确会导致很多问题,比如你写这个框架为什么不去解决啥啥啥的问题,哎,心累. 什么是框架? 百度的解释:框架(Framework)是整个或部分系统的可重用设计,表现为一 ...

  4. js字符串转日期,js字符串解析成日期,js日期解析, Date.parse小时是8点,Date.parse时间多了8小时

    js字符串转日期,js字符串解析成日期,js日期解析, Date.parse小时是8点,Date.parse时间多了8小时 >>>>>>>>>&g ...

  5. mysql优化---订单查询优化:异步分页处理

    订单分页查询: 老的代码是顺序执行查询数据和计算总记录数,但是如果条件复杂的话(比如关联子表)查询的时间要超过20s种 public static PagedList<Map<String ...

  6. js五种设计模式

    1.js工厂模式 var lev=function(){ return "嘿哈"; }; function Parent(){ var Child = new object(); ...

  7. STM32中断优先级理解

    STM32优先级理解 学习并使用STM32已经有一段时间了,记得先前一直不太理解STM32优先级中怎么设定抢占优先级和响应优先级,后来也是看了以为网友的博客才明白了STM32的优先级的设定到底是这么回 ...

  8. 将Error异常日志从普通日志中剥离

    开发过程中经常需要调试和线上环境查看异常日志的需求,但普通消息与异常消息混在一起实在是非常难得找,上则NM的文档够你头痛,所以就将Error级别的日志抽离出来. 本示例采用log4net来配置: 1. ...

  9. Linux 下查看CPU的使用情况

    1.top使用权限:所有使用者使用方式:top [-] [d delay] [q] [c] [S] [s] [i] [n] [b]说明:即时显示process的动态d :改变显示的更新速度,或是在交谈 ...

  10. 一种基于路网图层的GPS轨迹优化方案

    文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 GPS数据正常情况下有20M左右的偏移,在遇到高楼和桥梁等情况 ...