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.

74 lines
2.6 KiB
PHTML

2 years ago
<?php
// +----------------------------------------------------------------------
// | 徐州梦创信息科技有限公司—专业的游戏运营,推广解决方案.
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.vlcms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: kefu@vlcms.com QQ97471547
// +----------------------------------------------------------------------
namespace Admin\Event;
use Think\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class AppEvent extends Controller {
/**
*修改游戏原包
*/
public function update_source($id = null,$file_name){
$id || $this->error('id不能为空');
$model = D('App');
$plist=A("Plist");
$data = $model->create();
$url=$data['file_url'];
$data['file_size'] = round($data['file_size']/pow(1024,2),2)."MB";
$data['file_url'] = $data['file_url']."/".$data['file_name'];
$data['id'] = $id;
$data['op_id'] = UID;
$data['op_account'] = session("user_auth.username");
$data['create_time'] = NOW_TIME; $remark = str_replace(array("\r\n", "\r", "\n"), "@@@", $_POST['remark']); $data['remark'] = json_encode(explode('@@@',$remark));
//if($data['file_name']==$file_name){
// $this->error('修改失败',U('App/lists'));
//}else{
if($id==4||$id==6){
$tt=$plist->create_plist_app($data['version'],$id,$data['bao_name'],$data['file_url']);
$data['plist_url']=$tt;
}
$res = $model->save($data);
if($res){
//@unlink($url."/".$file_name);
$this->update_package_status($id);
$this->success('修改成功',U('App/lists'));
}else{
$this->error('修改失败',U('App/lists'));
}
// }
}
/**
* 更新原包后,重新打包
* @param [type] $app_id [description]
* @return [type] [description]
*/
protected function update_package_status($app_id){
$model = M('app_apply','tab_');
$map['app_id'] = $app_id;
$map['enable_status']=1;
$map['status']=1;
$data['enable_status']=2;
$data['dow_url']='';
$model->where($map)->save($data);
}
protected function update_game_size($param=null){
$model = D('Game');
$data['game_size'] = $param['file_size'];
$res=$model->where($map)->save($data);
}
}