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.

39 lines
1.2 KiB
PHP

<?php
namespace Base\Service;
use Base\Model\PromoteModel;
use Base\Model\ApplyModel;
class ApplyService {
private $model;
public function __construct()
{
$this->model = new ApplyModel();
}
public function cancelGame($gameId, $promoteId) {
$ids = [$promoteId];
$list = M('promote', 'tab_')->field('id')->where('parent_id=' . $promoteId . ' or grand_id=' . $promoteId)->select();
$ids = array_merge($ids, array_column($list, 'id'));
$save['offline_status'] = 1;
M('apply', 'tab_')->where(['game_id' => $gameId, 'promote_id' => ['in', $ids]])->save($save);
}
public function updateAfterPack($apply, $packageUrl, $plistUrl)
{
$data = [];
$data['id'] = $apply['id'];
$data['pack_url'] = $packageUrl;
$data['dow_url'] = '/index.php?s=/Home/Down/down_file/game_id/' . $apply['game_id'] . '/promote_id/' . $apply['promote_id'];
$data['dow_status'] = 1;
$data['enable_status'] = 1;
$data['dispose_id'] = 0;
$data['dispose_time'] = time();
$data['plist_url'] = $plistUrl;
return M('Apply', 'tab_')->save($data);
}
}