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.
107 lines
2.7 KiB
PHTML
107 lines
2.7 KiB
PHTML
5 years ago
|
<?php
|
||
|
/**
|
||
|
* Created by PhpStorm.
|
||
|
* User: cy 707670631@qq.com
|
||
|
* Date: 2017/4/27
|
||
|
* Time: 8:21
|
||
|
*/
|
||
|
|
||
|
namespace Open\Controller;
|
||
|
|
||
|
use Open\Model\GiftbagModel;
|
||
|
|
||
|
class GiftController extends CenterController {
|
||
|
|
||
|
public function _initialize()
|
||
|
{
|
||
|
|
||
|
$this->title = "礼包管理";
|
||
|
$this->p_title = "管理中心";
|
||
|
$this->p_url = U('Stats/overview');
|
||
|
parent::_initialize(); // TODO: Change the autogenerated stub
|
||
|
}
|
||
|
public function get_ajax_area_list(){
|
||
|
$area = D('Server');
|
||
|
$map['game_id'] = I('post.game_id',1);
|
||
|
$list = $area->where($map)->select();
|
||
|
$this->ajaxReturn($list);
|
||
|
}
|
||
|
public function index($p=1)
|
||
|
{
|
||
|
if(isset($_REQUEST['game_id'])&&$_REQUEST['game_id']!=""){
|
||
|
$map['game_id']=$_REQUEST['game_id'];
|
||
|
}
|
||
|
if(isset($_REQUEST['systems'])&&$_REQUEST['systems']!=""){
|
||
|
$map['giftbag_version']=$_REQUEST['systems'];
|
||
|
}
|
||
|
if(isset($_REQUEST['apply_status'])&&$_REQUEST['apply_status']!=""&&$_REQUEST['apply_status']!="-1"){
|
||
|
$map['apply_status']=$_REQUEST['apply_status'];
|
||
|
}
|
||
|
if(is_numeric($_REQUEST['status'])&&($_REQUEST['status']==0 || $_REQUEST['status'] == 1)) {
|
||
|
$map['status'] = $_REQUEST['status'];
|
||
|
}
|
||
|
if(isset($_REQUEST['giftbag_name'])&&$_REQUEST['giftbag_name']!=""){
|
||
|
$map['giftbag_name']=array('like','%'.$_REQUEST['giftbag_name'].'%');
|
||
|
}
|
||
|
$model = new GiftbagModel();
|
||
|
$map['developers'] = UID;
|
||
|
$result = $model->getDataLists($map,$p);
|
||
|
$this->showPage($result['count']);
|
||
|
$this->assign("data",$result['data']);
|
||
|
$this->display();
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* 礼包详情
|
||
|
* author:cy 707670631@qq.com
|
||
|
*/
|
||
|
public function giftdetail(){
|
||
|
$id = I('request.id',0);
|
||
|
$model=new GiftbagModel();
|
||
|
if($id>0){
|
||
|
$data=$model->detail($id,UID);
|
||
|
$this->assign('data',$data);
|
||
|
}else{
|
||
|
$this->error("礼包不存在");
|
||
|
}
|
||
|
$this->display();
|
||
|
}
|
||
|
/**
|
||
|
* 删除礼包
|
||
|
* author:cy 707670631
|
||
|
*/
|
||
|
public function del($model = null, $ids=null){
|
||
|
$model=new GiftbagModel();
|
||
|
$result=$model->del($ids);
|
||
|
if($result){
|
||
|
echo json_encode(array('status'=>1,'info'=>'删除成功'));exit;
|
||
|
}else{
|
||
|
echo json_encode(array('status'=>0,'info'=>'删除失败'));exit;
|
||
|
}
|
||
|
}
|
||
|
function giftbag_version(){
|
||
|
$map['id']=$_POST['game_id'];
|
||
|
$data=M('Game','tab_')->where($map)->find();
|
||
|
if(empty($data)){return ' ';}
|
||
|
$this->ajaxReturn($data['sdk_version']);
|
||
|
}
|
||
|
/**
|
||
|
* 添加游戏
|
||
|
* author: xmy 280564871@qq.com
|
||
|
*/
|
||
|
public function add(){
|
||
|
$model = new GiftbagModel();
|
||
|
if(IS_POST){
|
||
|
$result = $model->upDate(UID);
|
||
|
if($result !== false){
|
||
|
$this->success("保存成功",U('index'));
|
||
|
}else{
|
||
|
$this->error("保存失败:".$model->getError());
|
||
|
}
|
||
|
}else{
|
||
|
$this->display();
|
||
|
}
|
||
|
}
|
||
|
}
|