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

96 行
2.5 KiB
PHP
可执行文件

<?php
namespace Common\Model;
use Think\Model;
//[1.1.86]
/**
* 会员卡动态码表
* Class MerchantPayAuthModel
* @package Common\Model
*/
class VipDynamicCodeModel extends Model
{
protected $tableName = 'vip_dynamic_code';
protected $fields = array(
'id', //int(11) NOT NULL AUTO_INCREMENT,
'merchantid', //int(11) DEFAULT NULL COMMENT '商户id',
'vid', //int(11) DEFAULT NULL COMMENT '会员id',
'code', //varchar(50) DEFAULT NULL COMMENT '动态码',
'add_time', //varchar(20) DEFAULT NULL COMMENT '生效时间',
'failure_time', //varchar(20) DEFAULT NULL COMMENT '失效时间',
'status', //tinyint(1) DEFAULT '0' COMMENT '0未使用 1待使用 2已使用',
'use_time', //varchar(20) DEFAULT NULL COMMENT '使用时间',
'state', //tinyint(1) DEFAULT '0' COMMENT '0正常 1删除',
'use_storeid', //int(11) DEFAULT NULL COMMENT '使用门店id',
'use_cashierid',//int(11) 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)
{
$map['state'] = 0;
$res = $this->where($map)->save($save);
return $res;
}
/**
* 获取一条
* @param $map
* @param string $field
* @return mixed
*/
public function getFind($map, $field = '*')
{
$map['state'] = 0;
$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 = '')
{
$map['state'] = 0;
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)
{
$map['state'] = 0;
$res = $this->where($map)->count();
return $res;
}
}