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.
42 lines
973 B
PHTML
42 lines
973 B
PHTML
5 years ago
|
<?php
|
||
|
namespace Base\Model;
|
||
|
|
||
|
use Think\Model;
|
||
|
|
||
|
/**
|
||
|
* @author ELF<360197197@qq.com>
|
||
|
*/
|
||
|
class PromoteCoinRecordModel extends Model
|
||
|
{
|
||
|
const TYPE_RECHARGE = 1;
|
||
|
const TYPE_CONSUME = 2;
|
||
|
|
||
|
protected $tablePrefix = 'tab_';
|
||
|
|
||
|
public static $subTypes = [
|
||
|
1 => '平台充值',
|
||
|
2 => '线下转账',
|
||
|
3 => '转账充值',
|
||
|
4 => '转账消费',
|
||
|
];
|
||
|
|
||
|
public function addRecord($params)
|
||
|
{
|
||
|
$data = [
|
||
|
'sn' => '',
|
||
|
'type' => 1,
|
||
|
'sub_type' => 1,
|
||
|
'promote_id' => $fromPromoteId,
|
||
|
'ref_id' => $refId,
|
||
|
'target_type' => $toPromote['id'],
|
||
|
'coin' => $num,
|
||
|
'balance_coin' => $fromPromote['balance_coin'] + $num,
|
||
|
'create_time' => time(),
|
||
|
'description' => '平台币转账',
|
||
|
'remark' => $remark,
|
||
|
];
|
||
|
$data = $this->create($data);
|
||
|
$res = $this->add($data);
|
||
|
return $res;
|
||
|
}
|
||
|
}
|