*/ 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); } }