| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- // +----------------------------------------------------------------------
- // | Fanwe 方维直播系统
- // +----------------------------------------------------------------------
- // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: 云淡风轻(1956838968@qq.com)
- // +----------------------------------------------------------------------
- class EduDealDeleteAction extends CommonAction{
-
- public function index(){
- if (trim($_REQUEST['name']) != '') {
- $map['name'] = array('like', '%' . trim($_REQUEST['name']) . '%');
- }
- $user_id = intval($_REQUEST['user_id']);
- if ($user_id) {
- $map['user_id'] = array('eq', $user_id);
- }
- $create_time_2=empty($_REQUEST['create_time_2'])?to_date(get_gmtime(),'Y-m-d'):strim($_REQUEST['create_time_2']);
- $create_time_2=to_timespan($create_time_2)+24*3600;
- if(trim($_REQUEST['create_time_1'])!='')
- {
- $map["create_time"] = array('between',array(to_timespan($_REQUEST['create_time_1']),$create_time_2));
- }
- $map['is_delete']=1;
- if (method_exists($this, '_filter')) {
- $this->_filter($map);
- }
- $name = 'EduDeal';
- $model = M($name);
- if (!empty ($model)) {
- $this->_list($model, $map);
- }
- $this->display();
- }
- public function restore() {
- //彻底删除指定记录
- $ajax = intval($_REQUEST['ajax']);
- $id = $_REQUEST ['id'];
- if (isset ( $id )) {
- $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
- $rel_data = M('EduDeal')->where($condition)->findAll();
- foreach($rel_data as $data)
- {
- $info[] = $data['name'];
- }
- if($info) $info = implode(",",$info);
- $list = M('EduDeal')->where ( $condition )->setField("is_delete",0);
- if ($list!==false) {
- save_log($info."恢复成功",1);
- $this->success ("恢复成功",$ajax);
- } else {
- save_log($info."恢复出错",0);
- $this->error ("恢复出错",$ajax);
- }
- } else {
- $this->error (l("INVALID_OPERATION"),$ajax);
- }
- }
-
- public function foreverdelete() {
- //彻底删除指定记录
- $ajax = intval($_REQUEST['ajax']);
- $id = $_REQUEST ['id'];
- if (isset ( $id )) {
- $condition = array ('id' => array ('in', explode ( ',', $id ) ) );
- $link_condition = array ('deal_id' => array ('in', explode ( ',', $id ) ) );
- $rel_data = M('EduDeal')->where($condition)->findAll();
- foreach($rel_data as $data)
- {
- $info[] = $data['name'];
- }
- if($info) $info = implode(",",$info);
- $list = M('EduDeal')->where ( $condition )->delete();
- if ($list!==false) {
- M("EduDealOrder")->where($link_condition)->delete();
- M("EduDealPayLog")->where($link_condition)->delete();
- save_log($info.l("FOREVER_DELETE_SUCCESS"),1);
- $this->success (l("FOREVER_DELETE_SUCCESS"),$ajax);
- } else {
- save_log($info.l("FOREVER_DELETE_FAILED"),0);
- $this->error (l("FOREVER_DELETE_FAILED"),$ajax);
- }
- } else {
- $this->error (l("INVALID_OPERATION"),$ajax);
- }
- }
- }
- ?>
|