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.
55 lines
1.6 KiB
PHTML
55 lines
1.6 KiB
PHTML
2 years ago
|
<?php
|
||
|
namespace Base\Service;
|
||
|
|
||
|
use Base\Model\PromoteModel;
|
||
|
use Base\Model\UserPlayInfoModel;
|
||
|
use Base\Model\UserPlayModel;
|
||
|
use Base\Model\UserModel;
|
||
|
use Think\Model;
|
||
|
|
||
|
class PromoteCoinService {
|
||
|
|
||
|
private $model;
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
$this->model = new PromoteModel();
|
||
|
}
|
||
|
|
||
|
public function addRecord($params)
|
||
|
{
|
||
|
$data = $this->createRecord($params);
|
||
|
$status = M('PromoteCoin', 'tab_')->add($data);
|
||
|
if ($status) {
|
||
|
$id = M()->getLastInsID();
|
||
|
return $id;
|
||
|
} else {
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public function createRecord($params)
|
||
|
{
|
||
|
$sn = '';
|
||
|
if (isset($params['sn'])) {
|
||
|
$sn = $params['sn'];
|
||
|
} else {
|
||
|
$sn = date('YmdHis').strtoupper(substr(md5(json_encode($params) . 'PromoteCoin' . rand(0, 99999)), 8, 16));
|
||
|
}
|
||
|
$data = [];
|
||
|
$data['sn'] = $sn;
|
||
|
$data['promote_id'] = $params['promote_id'];
|
||
|
$data['source_id'] = $params['source_id'];
|
||
|
$data['game_id'] = $params['game_id'];
|
||
|
$data['num'] = $params['num'];
|
||
|
$data['type'] = $params['type'];
|
||
|
$data['banlan_type'] = $params['banlan_type'];
|
||
|
$data['promote_type'] = get_promote_level($params['promote_id']);
|
||
|
$data['create_time'] = time();
|
||
|
$data['op_id'] = isset($params['op_id']) ? $params['op_id'] : 0;
|
||
|
$data['source_type'] = isset($params['source_type']) ? $params['source_type'] : 0;
|
||
|
$data['remark'] = isset($params['remark']) ? $params['remark'] : '';
|
||
|
$data['description'] = isset($params['description']) ? $params['description'] : '';
|
||
|
return $data;
|
||
|
}
|
||
|
}
|