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

138 行
2.9 KiB
PHP
可执行文件

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

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

<?php
namespace Common\Model;
use Think\Model;
//[1.1.93]
/**
* 门店购买商品时显示的标签
* Class GroupLabelModel
* @package Common\Model
*/
class StoreLabelModel extends Model
{
protected $tableName = 'retail_store_label';
protected $fields = array(
'id',//int(11) NOT NULL AUTO_INCREMENT,
'store_id',//int(11) NOT NULL COMMENT '门店id',
'merchant_id',//int(11) NOT NULL COMMENT '商户id',
'label_name',//varchar(20) NOT NULL COMMENT '标签名称',
'status',//int(1) NOT NULL DEFAULT '1' COMMENT '1: 开启 2:关闭',
'img_id',//varchar(255) 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 $fields
* @param $bol
* @return mixed
*/
public function getFind($map, $fields = '*')
{
$res = $this->field($fields)->where($map)->find();
return $res;
}
/**
* 获取某字段
* @param $map
* @param string $fields
* @param $bol
* @return mixed
*/
public function getFindField($map, $fields = 'id', $bol = false)
{
$res = $this->where($map)->getField($fields, $bol);
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 ($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)
{
$res = $this->where($map)->count();
return $res;
}
/**
* 某字段增加
* @param $map
* @param $key
* @param $val
* @return mixed
*/
public function toSetInc($map, $key, $val)
{
$res = $this->where($map)->setInc($key, $val);
return $res;
}
/**
* 某字段减少
* @param $map
* @param $key
* @param $val
* @return mixed
*/
public function toSetDec($map, $key, $val)
{
$res = $this->where($map)->setDec($key, $val);
return $res;
}
/**
* 某字段删除
* @param $map
*/
public function toDelete($map)
{
$res = $this->where($map)->delete();
return $res;
}
}