You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Sdk\Model;
|
|
|
|
|
use Think\Model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ValueDetailLogModel extends Model {
|
|
|
|
|
|
|
|
|
|
const BALANCE = "balance"; // 余额明细 平台币
|
|
|
|
|
const BANDBI = "bangbi"; // 绑币明细
|
|
|
|
|
|
|
|
|
|
protected $_validate = array(
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/* 自动完成规则 */
|
|
|
|
|
protected $_auto = array(
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构造函数
|
|
|
|
|
* @param string $name 模型名称
|
|
|
|
|
* @param string $tablePrefix 表前缀
|
|
|
|
|
* @param mixed $connection 数据库连接信息
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($name = '', $tablePrefix = '', $connection = '') {
|
|
|
|
|
/* 设置默认的表前缀 */
|
|
|
|
|
$this->tablePrefix ='tab_';
|
|
|
|
|
/* 执行构造方法 */
|
|
|
|
|
parent::__construct($name, $tablePrefix, $connection);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 新增数值变动记录
|
|
|
|
|
public function addLog($uid, $orderNumber, $before, $value, $after, $type, $remark='', $payType=1) {
|
|
|
|
|
// 判断 pay_type = 0 是否存在 存在就删除掉
|
|
|
|
|
$this->delete(array(
|
|
|
|
|
'user_id' => $uid,
|
|
|
|
|
'pay_type' => 0
|
|
|
|
|
));
|
|
|
|
|
$this->add(array(
|
|
|
|
|
'order_number' => $orderNumber,
|
|
|
|
|
'user_id' => $uid,
|
|
|
|
|
'before_value' => $before,
|
|
|
|
|
'value' => $value,
|
|
|
|
|
'after_value' => $after,
|
|
|
|
|
'create_time' => time(),
|
|
|
|
|
'type' => $type,
|
|
|
|
|
'remark' => $remark,
|
|
|
|
|
'pay_type' => $payType // 1为spend(消费),2为deposit(充值),3为转账 0为初始
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|