init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Model;
|
||||
|
||||
use Think\Model;
|
||||
|
||||
//[1.1.86]
|
||||
class SkuListModel extends Model
|
||||
{
|
||||
protected $tableName = 'retail_sku_list';
|
||||
protected $fields = array(
|
||||
'id', //int(11) NOT NULL AUTO_INCREMENT,
|
||||
'attr_id', //int(11) DEFAULT NULL COMMENT '所属属性id',
|
||||
'merchantid', //int(11) DEFAULT NULL COMMENT '商户id',
|
||||
'storeid', //int(11) DEFAULT NULL COMMENT '门店id(门店添加时写)',
|
||||
'name', //varchar(255) DEFAULT NULL,
|
||||
'addtime', //varchar(20) DEFAULT NULL COMMENT '添加时间',
|
||||
'status', //tinyint(1) DEFAULT '1' COMMENT '0不启用 1启用',
|
||||
'state', //tinyint(1) DEFAULT '0' COMMENT '0正常 1删除',
|
||||
'type', //tinyint(1) DEFAULT '1' COMMENT '1常用 2不常用',
|
||||
);
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @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 $fields
|
||||
* @param $bol
|
||||
* @return mixed
|
||||
*/
|
||||
public function getFind($map, $fields = '*')
|
||||
{
|
||||
$map['state'] = 0;
|
||||
$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)
|
||||
{
|
||||
$map['state'] = 0;
|
||||
$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 = '')
|
||||
{
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 某字段增加
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户