dealPage($p); $data = $this->alias("gb") ->field("gb.id,gb.game_id,gb.game_name,gb.status,gb.create_time,gb.end_time,gb.apply_status,gb.giftbag_version,gb.giftbag_name,gb.novice_num") ->where($map) ->order($order) ->page($page,$row) ->select(); $count = $this->alias("g")->where($map)->count(); $result['data'] = $data; $result['count'] = $count; return $result; } /** * [获取单个礼包信息] * @return [mixed] [description] * author cy 707670631 */ public function detail($gift_id,$user_id){ $map['id']=$gift_id; $map['developers']=$user_id; $data=$this ->where($map) ->find(); return $data; } /** * [删除礼包] * @return [mixed] [description] * author cy 707670631 */ public function del($ids){ $map['id']=array('in',$ids); $res=$this->where($map)->delete(); if($res){ return true; }else{ return false; } } /** * 游戏信息保存、更新 * @return bool|mixed * author: xmy 280564871@qq.com */ public function upDate($user_id,$game_id=""){ $data = $this->create(); if(!$data){ return false; } $file = file_get_contents($_FILES['file']['tmp_name']); $txt = R('File/uploadFile',array('flag'=>true)); if ($txt['status']) { $data['giftbag_url'] = $txt['path']; $data['giftbag_filename'] = $txt['name']; $data['giftbag_fileid']=$txt['id']; } $file1 = array_filter(explode(',',preg_replace('/[\\r\\n]/',',',$file))); $data['novice'] = implode(',',$file1); $data['game_name']=get_game_name($data['game_id']); $data['novice_num']=count($file1); $data['developers']=UID; $data['start_time']=strtotime($data['start_time']); $data['end_time']=strtotime($data['end_time']); $data['apply_status'] = 1; if(empty($data['id'])){ //新增数据 $id = $this->add($data); //添加基础内容 if(!$id){ $this->error = '新增基础内容出错!'; return false; } } else { //更新数据 $status = $this->save(); //更新基础内容 if(false === $status){ $this->error = '更新基础内容出错!'; return false; } } return $data; } }