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.

70 lines
1.4 KiB
PHP

<?php
namespace Site\Controller;
use Think\Controller;
/**
* 礼包 控制器
* lwx
*/
class GiftController extends BaseController {
const model_name = 'SiteGift';
public function index($p=1){
if (is_mobile_request()) {
$lists = D(self::model_name)->lists(1);
$this->assign('lists',$lists['data']);
$this->assign('total',$lists['total']);
} else {
parent::page(D(self::model_name)->lists($p,'tab_site_gift.id,tab_site_gift.gift_name,tab_site_gift.giftbag_version,tab_site_gift.novice,tab_site_gift.server_name,tab_site_gift.promote_id',20));
}
$this->display();
}
public function detail($id=0) {
$data = D(self::model_name)->detail($id);
$this->assign('relevant',D(self::model_name)->relevant(['tab_site_gift.id'=>array('neq',$data['id']),'tab_site_game.game_name'=>$data['game_name'],'game_source'=>$data['game_source']]));
$this->assign('data',$data);
$this->display();
}
public function getgift($id=0) {
$gift = D(self::model_name);
$res = $gift->getgift($id);
echo json_encode(['info'=>''.$gift->getError(),'status'=>$res]);
}
public function more($p=2) {
$lists = D(self::model_name)->lists($p);
if ($lists['data']) {
echo json_encode(array('status'=>1,'info'=>'','list'=>$lists['data']));
} else {
echo json_encode(array('status'=>0,'info'=>''));
}
}
}