Commit a30f467e by 冷斌

fix bug

parent 81ce0c01
......@@ -14,7 +14,7 @@ class GiftController extends AdminbaseController {
/* $gift_sort=M("gift_sort")->getField("id,sortname");
$gift_sort[0]="默认分类";
$this->assign('gift_sort', $gift_sort); */
$gift_model=M("gift");
$count=$gift_model->count();
$page = $this->page($count, 20);
......@@ -28,14 +28,14 @@ class GiftController extends AdminbaseController {
$this->assign('mark', $this->mark);
$this->assign('swftype', $this->swftype);
$this->assign("page", $page->show('Admin'));
$this->display();
}
function del(){
$id=intval($_GET['id']);
if($id){
$result=M("gift")->delete($id);
$result=M("gift")->delete($id);
if($result){
$action="删除礼物:{$id}";
setAdminLog($action);
......@@ -43,21 +43,21 @@ class GiftController extends AdminbaseController {
$this->success('删除成功');
}else{
$this->error('删除失败');
}
}else{
}
}else{
$this->error('数据传入失败!');
}
$this->display();
}
}
$this->display();
}
//排序
public function listorders() {
public function listorders() {
$ids = $_POST['listorders'];
foreach ($ids as $key => $r) {
$data['orderno'] = $r;
M("gift")->where(array('id' => $key))->save($data);
}
$status = true;
if ($status) {
$action="更新礼物排序";
......@@ -67,17 +67,17 @@ class GiftController extends AdminbaseController {
} else {
$this->error("排序更新失败!");
}
}
}
function add(){
// $gift_sort=M("gift_sort")->getField("id,sortname");
// $this->assign('gift_sort', $gift_sort);
$this->display();
}
// $this->assign('gift_sort', $gift_sort);
$this->display();
}
function add_post(){
if(IS_POST){
if(IS_POST){
$gift=M("gift");
$gift->create();
$gift->addtime=time();
......@@ -95,7 +95,7 @@ class GiftController extends AdminbaseController {
'exts' => array('svga'),
'autoSub' => false,
);
$upload = new \Think\Upload($config);//
$upload = new \Think\Upload($config);//
$info=$upload->upload();
//开始上传
if ($info) {
......@@ -107,17 +107,17 @@ class GiftController extends AdminbaseController {
}else{
$url=C("TMPL_PARSE_STRING.__UPLOAD__").$savepath.$first['savename'];
}
$gift->swf=$url;
} else {
//上传失败,返回错误
//上传失败,返回错误
$this->error($upload->getError());
}
}
}
}
$result=$gift->add();
$result=$gift->add();
if($result){
$action="添加礼物:{$result}";
setAdminLog($action);
......@@ -126,24 +126,24 @@ class GiftController extends AdminbaseController {
}else{
$this->error('添加失败');
}
}
}
}
}
function edit(){
$id=intval($_GET['id']);
if($id){
$gift=M("gift")->find($id);
$this->assign('gift', $gift);
}else{
$this->assign('gift', $gift);
}else{
$this->error('数据传入失败!');
}
$this->display();
}
$this->display();
}
function edit_post(){
if(IS_POST){
if(IS_POST){
$gift=M("gift");
$gift->create();
$type=I('type');
$swftype=I('swftype');
if($type==1 && $swftype==1){
......@@ -158,7 +158,7 @@ class GiftController extends AdminbaseController {
'exts' => array('svga'),
'autoSub' => false,
);
$upload = new \Think\Upload($config);//
$upload = new \Think\Upload($config);//
$info=$upload->upload();
//开始上传
if ($info) {
......@@ -170,17 +170,17 @@ class GiftController extends AdminbaseController {
}else{
$url=C("TMPL_PARSE_STRING.__UPLOAD__").$savepath.$first['savename'];
}
$gift->swf=$url;
} else {
//上传失败,返回错误
//上传失败,返回错误
$this->error($upload->getError());
}
}
}
}
$result=$gift->save();
$result=$gift->save();
if($result!==false){
$action="修改礼物:{$_POST['id']}";
setAdminLog($action);
......@@ -189,27 +189,27 @@ class GiftController extends AdminbaseController {
}else{
$this->error('修改失败');
}
}
}
}
function resetcache(){
$key='getGiftList';
$rs=M('gift')
->field("id,type,mark,giftname,needcoin,gifticon")
->field("id,type,mark,giftname,needcoin,gifticon,swf")
->order("orderno asc,addtime desc")
->select();
foreach($rs as $k=>$v){
$rs[$k]['gifticon']=get_upload_path($v['gifticon']);
}
}
if($rs){
setcaches($key,$rs);
}
}
return 1;
}
function sort_index(){
$gift_sort=M("gift_sort");
$count=$gift_sort->count();
$page = $this->page($count, 20);
......@@ -220,35 +220,35 @@ class GiftController extends AdminbaseController {
->select();
$this->assign('lists', $lists);
$this->assign("page", $page->show('Admin'));
$this->display();
}
}
function sort_del(){
$id=intval($_GET['id']);
if($id){
$result=M("gift_sort")->delete($id);
$result=M("gift_sort")->delete($id);
if($result){
$action="删除礼物分类:{$id}";
setAdminLog($action);
$this->success('删除成功');
}else{
$this->error('删除失败');
}
}else{
}
}else{
$this->error('数据传入失败!');
}
$this->display();
}
}
$this->display();
}
//排序
public function sort_listorders() {
public function sort_listorders() {
$ids = $_POST['listorders'];
foreach ($ids as $key => $r) {
$data['orderno'] = $r;
M("gift_sort")->where(array('id' => $key))->save($data);
}
$status = true;
if ($status) {
$action="更新礼物分类排序";
......@@ -257,24 +257,24 @@ class GiftController extends AdminbaseController {
} else {
$this->error("排序更新失败!");
}
}
}
function sort_add(){
$this->display();
}
}
function do_sort_add(){
if(IS_POST){
if(IS_POST){
if($_POST['sortname']==''){
$this->error('分类名称不能为空');
}
$gift_sort=M("gift_sort");
$gift_sort->create();
$gift_sort->addtime=time();
$result=$gift_sort->add();
$result=$gift_sort->add();
if($result){
$action="添加礼物分类:{$result}";
setAdminLog($action);
......@@ -282,24 +282,24 @@ class GiftController extends AdminbaseController {
}else{
$this->error('添加失败');
}
}
}
}
}
function sort_edit(){
$id=intval($_GET['id']);
if($id){
$sort =M("gift_sort")->find($id);
$this->assign('sort', $sort);
}else{
$this->assign('sort', $sort);
}else{
$this->error('数据传入失败!');
}
}
$this->display();
}
}
function do_sort_edit(){
if(IS_POST){
if(IS_POST){
$gift_sort=M("gift_sort");
$gift_sort->create();
$result=$gift_sort->save();
$result=$gift_sort->save();
if($result){
$action="编辑礼物分类:{$_POST['id']}";
setAdminLog($action);
......@@ -307,9 +307,9 @@ class GiftController extends AdminbaseController {
}else{
$this->error('修改失败');
}
}
}
}
// 推荐此礼物为周星榜
function recomm(){
$id=intval($_GET['id']); // 礼物ID
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment