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.

38 lines
1.1 KiB
PHP

<?php
namespace Base\Service;
use Base\Model\PromoteModel;
use Base\Model\ApplyModel;
class PromoteCoinRecordService {
private $model;
public function __construct()
{
}
public function addRecord($params) {
$data = $this->createRecord($params);
return M('PromoteCoinRecord', 'tab_')->add($data);
}
public function createRecord($params) {
$sn = date('YmdHis').strtoupper(substr(md5(json_encode($params) . 'PromoteCoinRecord' . rand(0, 99999)), 8, 16));
$data = [
'sn' => $sn,
'type' => $params['type'],
'sub_type' => $params['sub_type'],
'ref_id' => $params['ref_id'],
'target_id' => $params['target_id'],
'target_type' => $params['target_type'],
'coin' => $params['coin'],
'balance_coin' => $params['balance_coin'],
'create_time' => isset($params['create_time']) ? $params['create_time'] : time(),
'description' => $params['description'],
'remark' => isset($params['remark']) ? $params['remark'] : '',
];
return $data;
}
}