文件
mashangyoujiu/Application/Common/Model/VipMCouponModel.class.php

107 行
3.6 KiB
PHP
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
namespace Common\Model;
use Think\Model;
//[1.1.86]
/**
* 会员领取商户优惠券记录表
* Class GoodsModel
* @package Common\Model
*/
class VipMCouponModel extends Model
{
protected $tableName = 'retail_vipmcoupon';
protected $fields = array(
'id', //int(11) NOT NULL AUTO_INCREMENT,
'vid', //int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
'mcouponid', //int(11) NOT NULL DEFAULT '0' COMMENT '商家优惠券id。',
'starttime', //varchar(13) NOT NULL DEFAULT '' COMMENT '优惠券生效时间。',
'endtime', //varchar(13) NOT NULL DEFAULT '' COMMENT '优惠券过期时间。',
'needmoney', //decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '优惠券使用门槛。',
'reducemoney', //decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '优惠券面额。',
'isuse', //tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否使用:1,未使用。2,已使用,3,已过期(未使用的优惠券过期将改变该字段未3)',
'usetime', //varchar(13) NOT NULL DEFAULT '' COMMENT '使用时间',
'canusestoreids',//text NOT NULL COMMENT '能使用该优惠券的门店 。 以 ‘,’连接',
'merchantid', //int(11) NOT NULL DEFAULT '0' COMMENT '商户id。',
'storeid', //int(11) NOT NULL DEFAULT '0' COMMENT '使用门店的id',
'lessmoney', //decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '使用时抵扣的金额。(部分优惠券金额未完全抵扣完)。',
'addtime', //varchar(13) NOT NULL DEFAULT '' COMMENT '会员获得优惠券的时间。',
'status', //tinyint(3) DEFAULT '2' COMMENT '优惠券状态 1下架 2开启 3删除(不读取)',
'type', //tinyint(1) DEFAULT '1' COMMENT '类型1.普通优惠券2.券包优惠券',
'mcoupon_group_id',//int(10) DEFAULT NULL COMMENT '券包id',
);
/**
* 添加
* @param $data
* @return mixed
*/
public function addOrder($data)
{
$res = $this->add($data);
return $res;
}
/**
* 更新
* @param $map
* @param $save
* @return mixed
*/
public function updateOrder($map, $save)
{
$res = $this->where($map)->save($save);
return $res;
}
/**
* 获取一条
* @param $map
* @param string $field
* @return mixed
*/
public function getFind($map, $field = '*')
{
if (!isset($map['status'])) {
$map['status'] = array('in', '1,2');
}
$res = $this->field($field)->where($map)->find();
return $res;
}
/**
* @param $map
* @param string $field
* @param string $order
* @param string $page
* @return mixed
*/
public function getSelect($map, $field = '*', $order = 'id asc', $page = '')
{
if (!isset($map['status'])) {
$map['status'] = array('in', '1,2');
}
if ($page) {
$res = $this->field($field)->where($map)->order($order)->page($page)->select();
} else {
$res = $this->field($field)->where($map)->order($order)->select();
}
return $res;
}
/**
* 获去数量
* @param $map
* @return mixed
*/
public function getCount($map)
{
if (!isset($map['status'])) {
$map['status'] = array('in', '1,2');
}
$res = $this->where($map)->count();
return $res;
}
}