init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Model;
|
||||
|
||||
use Think\Model;
|
||||
//[1.1.95]
|
||||
class IntegralOrderModel extends Model
|
||||
{
|
||||
protected $tableName = 'retail_integral_order';
|
||||
protected $fields = array(
|
||||
'id', //int(11) NOT NULL AUTO_INCREMENT,
|
||||
'vid', //int(11) DEFAULT NULL,
|
||||
'type', //tinyint(1) DEFAULT '0' COMMENT '积分类型: 1签到获取 2余额消费获取 3使用积分 4后台充值 5后台扣除 6完善资料获取 7积分购买商品',
|
||||
'integral', //int(11) NOT NULL COMMENT '积分',
|
||||
'addtime', //varchar(11) DEFAULT NULL COMMENT '添加时间',
|
||||
'storeid', //int(11) DEFAULT NULL,
|
||||
'remark', //text COMMENT '备注',
|
||||
'billid', //int(11) DEFAULT '0' COMMENT '会员支付 关联retail_bill表id 。 用于会员卡退款。 ',
|
||||
'isrefund', //tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否已经扣除积分。1,没有,2,已扣除。',
|
||||
'refund_integral', //int(11) DEFAULT '0' COMMENT '会员退款时用到的积分扣除',
|
||||
);
|
||||
|
||||
/*
|
||||
* 查询
|
||||
* */
|
||||
public function getFind($map)
|
||||
{
|
||||
$res = $this->where($map)->find();
|
||||
return $res;
|
||||
}
|
||||
|
||||
/*
|
||||
* 查询
|
||||
* */
|
||||
public function getSelect($map, $field, $order)
|
||||
{
|
||||
if (!$field) {
|
||||
$field = '*';
|
||||
}
|
||||
if (!$order) {
|
||||
$order = 'id asc';
|
||||
}
|
||||
$res = $this->where($map)->field($field)->order($order)->select();
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getSum($map, $sum)
|
||||
{
|
||||
$res = $this->where($map)->sum($sum);
|
||||
return $res ? $res : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* 添加记录
|
||||
* */
|
||||
public function addOrder($item)
|
||||
{
|
||||
$res = $this->add($item);
|
||||
return $res;
|
||||
}
|
||||
/**
|
||||
* 更新
|
||||
* @param $map
|
||||
* @param $save
|
||||
* @return mixed
|
||||
*/
|
||||
public function updateOrder($map, $save)
|
||||
{
|
||||
$res = $this->where($map)->save($save);
|
||||
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;
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户