99 行
2.3 KiB
PHP
可执行文件
99 行
2.3 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Common\Model;
|
|
|
|
use Think\Model;
|
|
|
|
//[1.1.86]
|
|
class OtherPayModel extends Model
|
|
{
|
|
protected $tableName = 'retail_other_pay';
|
|
protected $fields = array(
|
|
'id', //int(11) NOT NULL AUTO_INCREMENT,
|
|
'name', //varchar(255) DEFAULT '' COMMENT '名称',
|
|
'merchant_id', //int(11) DEFAULT '0' COMMENT '商户id',
|
|
'status', //tinyint(1) DEFAULT '1' COMMENT '0关闭 1启用',
|
|
'state', //tinyint(1) DEFAULT '1' COMMENT '1正常 0删除',
|
|
'add_time', //varchar(20) DEFAULT NULL COMMENT '添加时间',
|
|
);
|
|
|
|
/**
|
|
* 添加
|
|
* @param $data
|
|
* @return mixed
|
|
*/
|
|
public function addOtherPay($data)
|
|
{
|
|
$res = $this->add($data);
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* 更新
|
|
* @param $map
|
|
* @param $save
|
|
* @return mixed
|
|
*/
|
|
public function updateOtherPay($map, $save)
|
|
{
|
|
$map['state'] = 1;
|
|
$res = $this->where($map)->save($save);
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* 删除
|
|
* @param $map
|
|
* @return mixed
|
|
*/
|
|
public function delOtherPay($map)
|
|
{
|
|
$map['state'] = 1;
|
|
$res = $this->where($map)->save(array('state' => 0, 'status' => 0));
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* 获取一条
|
|
* @param $map
|
|
* @param string $field
|
|
* @return mixed
|
|
*/
|
|
public function getFind($map, $field = '*')
|
|
{
|
|
$map['state'] = 1;
|
|
$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'] = 1;
|
|
if ($page) {
|
|
$res = $this->field($field)->where($map)->page($page)->select();
|
|
} else {
|
|
$res = $this->field($field)->where($map)->select();
|
|
}
|
|
return $res;
|
|
}
|
|
|
|
/**
|
|
* 过去数量
|
|
* @param $map
|
|
* @return mixed
|
|
*/
|
|
public function getCount($map)
|
|
{
|
|
$map['state'] = 1;
|
|
$res = $this->where($map)->count();
|
|
return $res;
|
|
}
|
|
|
|
} |