Esempio n. 1
0
 public function userlog()
 {
     $this->moduleTag = 'userlog';
     $type = input_string($this->input->get('type'), array('all', 'C', 'I', 'D', 'U'), 'all');
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, FALSE, 15);
     $starttime = input_empty($this->input->get('starttime'), '');
     $endtime = input_empty($this->input->get('endtime'), '');
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime, 'type' => $type);
     $rs = $this->model->get_backend_logs($search, $page, $perpage);
     $data = $rs['list'];
     $users = array();
     if ($data) {
         foreach ($data as $key => $val) {
             $ids[] = $val['user_id'];
         }
         $ids = implode(',', array_unique($ids));
         $users = $this->model->get_user_name_by_user_ids($ids);
     }
     $total = $rs['total'];
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('data' => $data, 'users' => $users, 'pageInfo' => $pageInfo, 'starttime' => $starttime, 'endtime' => $endtime, 'type' => $type);
 }
Esempio n. 2
0
 public function index()
 {
     $class = input_string($this->input->get('class'), array('banner', 'group', 'talent', 'product', 'jianren'), 'banner');
     switch ($class) {
         case 'banner':
             $this->moduleTag = 're_banner';
             break;
         case 'group':
             $this->moduleTag = 're_group';
             break;
         case 'product':
             $this->moduleTag = 're_product';
             break;
         case 'jianren':
             $this->moduleTag = 're_jianren';
             break;
     }
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 1, FALSE, 15);
     $rs = $this->model->get_config($class, $page, $perpage);
     //查询列表
     $data = $rs['list'];
     $total = $rs['total'];
     if ($class == 'banner') {
         foreach ($data as $key => $val) {
             $data[$key]['up_time'] = intval((time() - $val['create_time']) / 86400) . '天';
         }
     }
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / $perpage, 'url' => makePageUrl($page));
     $this->viewData = array('frontUrl' => $this->config->item('front_url'), 'data' => $data, 'pageInfo' => $pageInfo, 'class' => $class);
 }
Esempio n. 3
0
 /**
  * 收藏店铺
  **/
 public function innlike()
 {
     $user_id = $this->get_user_id(TRUE);
     $inn_id = input_int($this->input->get('sid'), 1, FALSE, FALSE, '4001');
     $act = input_string($this->input->get('act'), array('like', 'unlike'), FALSE, '4001');
     $inn = $this->model->get_inn_info_by_ids($inn_id);
     if (!$inn) {
         response_code('2010');
     }
     if ($act == 'like') {
         $is_like = $this->model->check_inn_fav($inn_id, $user_id);
         if ($is_like) {
             response_code('2012');
         }
     } else {
         $is_like = $this->model->check_inn_fav($inn_id, $user_id);
         if (!$is_like) {
             response_code('2011');
         }
     }
     $inn_info = array('dest_id' => $inn[$inn_id]['dest_id'], 'local_id' => $inn[$inn_id]['local_id']);
     if ($this->model->inn_fav($act, $inn_id, $user_id, $inn_info)) {
         response_code('1');
     }
     response_code('-1');
 }
Esempio n. 4
0
 /**
  * 第三方登录
  * get
  */
 public function thirdpart()
 {
     $third = input_string($this->input->get('to'), array('sina', 'qq'), FALSE, '1001');
     if ($this->get_user_id()) {
         jsBack('您已经成功登录!');
     }
     $arr = array('state' => md5(uniqid(rand(), TRUE)), 'url' => $this->input->get('url'));
     //CSRF protection
     $this->web_user->set_userdata($arr);
     switch ($third) {
         case 'qq':
             $appid = $this->config->item('qq_appid');
             $callback = base_url() . 'login/qq_call?url=' . $this->input->get('url');
             $scope = 'get_user_info';
             $login_url = "https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=" . $appid . "&redirect_uri=" . urlencode($callback) . "&state=" . $arr['state'] . "&scope=" . $scope;
             break;
         case 'sina':
             $appkey = $this->config->item('wb_key');
             $callback = base_url() . 'login/wb_call?url=' . $this->input->get('url');
             $scope = $this->config->item('wb_scope');
             $login_url = "https://api.weibo.com/oauth2/authorize?response_type=code&client_id=" . $appkey . "&redirect_uri=" . urlencode($callback) . "&state=" . $arr['state'] . "&scope=" . $scope;
             break;
     }
     header("Location:{$login_url}");
     exit;
 }
Esempio n. 5
0
 public function get()
 {
     $page = input_int($this->input->get('page'), 1, FALSE, FALSE, '1015');
     //分页
     $perpage = input_int($this->input->get('perpage'), 1, FALSE, FALSE, '1016');
     //分页
     $state = input_string($this->input->get('state'), array('A', 'P', 'S', 'R', 'C', 'N', 'U', 'O'), FALSE, '3003');
     //排序方法 默认创建时间最新
     if ($state == 'O') {
         $state = '';
     }
     $orders = $this->model->get_orders_by_inn_id($this->token['inn_id'], $page, $perpage, $state);
     response_data($orders);
 }
Esempio n. 6
0
 public function index()
 {
     $this->moduleTag = 'coupon';
     $state = "all";
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $perpage = input_int($this->input->get('perpage'), 0, FALSE, 15);
     $starttime = input_empty($this->input->get('starttime'), '');
     $endtime = input_empty($this->input->get('endtime'), '');
     $status = input_string($this->input->get('status'), array('all', 'N', 'Y', 'Z'), 'all');
     $keyword = trim($this->input->get('keyword'));
     if ($starttime) {
         $starttime = strtotime($starttime);
     }
     if ($endtime) {
         $endtime = strtotime($endtime) + 86399;
     }
     $search = array('starttime' => $starttime, 'endtime' => $endtime, 'keyword' => $keyword, 'status' => $status);
     $rs = $this->model->get_coupon($search, $page, $perpage);
     $total = $rs['total'];
     $data = $rs['list'];
     $pageInfo = array('total' => $total, 'perpage' => $perpage, 'curpage' => $page, 'totalpage' => $total / 15, 'url' => makePageUrl($page));
     $this->viewData = array('data' => $data, 'pageInfo' => $pageInfo, 'starttime' => $starttime, 'endtime' => $endtime, 'state' => $state, 'status' => $status);
 }
Esempio n. 7
0
 /**
  * 处理上传
  * 
  * @param array $sourceArr 要上传的文件信息数组
  * @param string $to 上传文件存放的文件夹,相对
  * @param array $data 要插入或修改的数据数组信息
  * @param array $thumb 缩略图信息,只需要设置宽度和高度即可
  * @return bool 成否与否 
  */
 public function index()
 {
     $this->check_token();
     $type = input_string($this->input->get('type'), array('userheadimg', 'innheadimg', 'product'), FALSE, '5002');
     $thumbs = array();
     switch ($type) {
         case 'innheadimg':
             $thumbs[] = array('width' => 100, 'height' => 100, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'inn/header/';
             break;
         case 'userheadimg':
             $thumbs[] = array('width' => 100, 'height' => 100, 'thumb_marker' => 's', 'maintain_ratio' => FALSE);
             $link = 'user/headimg/';
             break;
         case 'product':
             $thumbs[] = array('width' => 640, 'height' => 440, 'thumb_marker' => 'm', 'maintain_ratio' => TRUE);
             $thumbs[] = array('width' => 160, 'height' => 110, 'thumb_marker' => 's', 'maintain_ratio' => TRUE);
             $link = 'uploads/';
             break;
     }
     $rs = $this->getUploadedNames($link);
     if ($rs['code'] != '1') {
         response_msg('4000');
     }
     if ($thumbs) {
         $this->load->library('image_lib');
         foreach ($thumbs as $key => $thumb) {
             $thumb = array_merge($this->thumbConfig, $thumb);
             log_message('error', json_encode($thumb));
             $thumb['source_image'] = $this->config->item('uploaded_img_path') . $link . $rs['msg'];
             log_message('error', $thumb['source_image']);
             $this->image_lib->initialize($thumb);
             $this->image_lib->resize();
         }
     }
     response_data($link . $rs['msg']);
 }
Esempio n. 8
0
 /**
  * 对商品收藏的操作 
  * 添加删除
  */
 public function favor_product()
 {
     $act = input_string($this->input->get('act'), array('add', 'del'), FALSE, FALSE, '1014');
     $product_id = input_int($this->input->get('classid'), 1, FALSE, FALSE, '1009');
     $is_fav = $this->model->check_fav('product', $product_id, $this->token['user_id']);
     $this->_LoadModel('product');
     if ($act == 'add') {
         $product = $this->product_model->get_product_by_id($product_id);
         if (!$product) {
             response_msg('2009');
         }
         if ($is_fav) {
             response_msg('1012');
         }
     } else {
         if (!$is_fav) {
             response_msg('1013');
         }
         $product['del_id'] = $is_fav;
     }
     $this->product_model->update_fav($act, $product_id);
     $this->model->modify_user_fav($act, 'product', $this->token['user_id'], $product);
     response_msg('1');
 }
Esempio n. 9
0
 /**
  * 处理退款申请
  * ajax POST
  */
 public function orderRefund()
 {
     $this->check_finance_auth_in_controller();
     $action = input_string($this->input->post('action'), array('rejected', 'settled'), 'rejected');
     $sanction = $this->input->post('sanction', TRUE);
     $refund_id = input_int($this->input->post('refund_id'), 1, FALSE, FALSE, '请求错误!');
     switch ($action) {
         case 'rejected':
             //关闭入口
             show_404();
         case 'settled':
             $refund = $this->model->get_order_refund_by_id($refund_id);
             break;
     }
     if (!$refund || $refund['state'] != 'applying') {
         response_msg("请求错误!");
     }
     $done = array('user_id' => $this->get_user_id(), 'sanction' => $sanction);
     $rs = $this->model->settled_order_refund($refund, $done);
     response_code($rs ? '1' : '-1');
 }
Esempio n. 10
0
 /**
  * 且游订单
  */
 public function qieyou()
 {
     $this->controllerTag = 'qieyou';
     $this->moduleTag = 'qieyouList';
     $starttime = input_int($this->input->get('st'), 1000000000, 2000000000, 0);
     $endtime = input_int($this->input->get('ed'), 1000000000, 2000000000, 0);
     $state = input_string($this->input->get('state'), array('all', 'paid', 'finished', 'refund', 'refunded', 'unpaid', 'cancel', 'waiting'), 'all');
     $page = input_int($this->input->get('page'), 1, FALSE, 1);
     $cid = input_int($this->input->get('cid'), 1, FALSE, 0);
     $dest_id = input_int($this->input->get('tid'), 1, FALSE, 0);
     $local_id = input_int($this->input->get('lid'), 1, FALSE, 0);
     $inn_id = $this->get_user_inn_id();
     $per_page = 20;
     $orders = array('list' => array(), 'total' => 0);
     $orderstate = array('all' => 0, 'unpaid' => 1, 'paid' => 2, 'finished' => 3, 'refunded' => 4, 'cancel' => 5, 'refund' => 6, 'waiting' => 7);
     $search = array('key' => 'qieyou', 'key_id' => $inn_id, 'sid' => '', 'cid' => $cid, 'state' => $orderstate[$state], 'st' => $starttime, 'ed' => $endtime);
     $key = $this->input->get('key');
     $keyword = $this->input->get('keyword');
     $search_keyword = array('key' => $key, 'keyword' => $keyword);
     $orders = $this->model->get_orders($search, $page, $per_page, $search_keyword);
     /**************页面载入相关信息处理**************/
     $total = $orders['total'];
     $order_products = array();
     $orderlist = array();
     if ($total) {
         $orderview = $this->orderview($orders);
         $orderlist = $orderview['orders'];
         $order_products = $orderview['order_products'];
     }
     $pageInfo = array('total' => $total, 'perpage' => $per_page, 'curpage' => $page, 'totalpage' => $total / $per_page, 'url' => makePageUrl());
     $this->viewData = array('orders' => $orderlist, 'order_products' => $order_products, 'pageInfo' => $pageInfo, 'state' => $state, 'cid' => $cid, 'starttime' => $starttime, 'endtime' => $endtime);
 }
Esempio n. 11
0
 /**
  * 会员管理  删除用户 允许加入 拒绝加入
  **/
 public function modifyMember()
 {
     $user_id = $this->get_user_id(TRUE);
     $group_id = input_int($this->input->post('group'), 1000, FALSE, FALSE, '6001');
     $member_id = input_int($this->input->post('member'), 1000, FALSE, FALSE, '4003');
     $act = input_string($this->input->post('act'), array('delmember', 'allow', 'ignore'), FALSE, '4001');
     $group = $this->check_user_group_auth($user_id, $group_id);
     $member = $this->model->get_user_member_info($member_id);
     if (!$member || $member['group_id'] != $group_id) {
         response_code('6006');
     }
     $rs = FALSE;
     switch ($act) {
         case 'delmember':
             if ($member['is_admin'] && $user_id != $group['create_by']) {
                 response_code('6005');
             }
             if ($member['user_id'] == $group['create_by']) {
                 response_code('6005');
             }
             $rs = $this->model->delete_group_member($member);
             //删除成员
             break;
         case 'setadmin':
             //	$rs = $this->model->delete_group_member($member);	//删除成员
             break;
         case 'unsetadmin':
             //	$rs = $this->model->delete_group_member($member);	//删除成员
             break;
         case 'setgroupown':
             if ($user_id != $group['create_by']) {
                 response_code('6005');
             }
             if ($member['user_id'] == $group['create_by']) {
                 response_code('6005');
             }
             break;
         case 'allow':
             if (!$member['waiting']) {
                 response_code('6007');
             }
             $rs = $this->model->allow_group_member($member, $user_id);
             //允许加入部落
             if ($rs) {
                 // 修改已发消息
                 $this->load->model('message_model');
                 $msg_detail['waiting'] = 0;
                 $msg_detail['member_id'] = $member['member_id'];
                 $msg_detail['set_user_name'] = $this->get_current_data('nick_name');
                 $this->message_model->update_message_detail($msg_detail);
             }
             break;
         case 'ignore':
             if (!$member['waiting']) {
                 response_code('6007');
             }
             $rs = $this->model->ignore_group_member($member);
             //删除请求
             if ($rs) {
                 // 修改已发消息
                 $this->load->model('message_model');
                 $msg_detail['waiting'] = 2;
                 $msg_detail['member_id'] = $member['member_id'];
                 $msg_detail['set_user_name'] = $this->get_user_name();
                 $this->message_model->update_message_detail($msg_detail);
             }
             break;
     }
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
Esempio n. 12
0
 /**
  * 删除我的帖子  我的回帖   type:forum 话题 post 回帖
  **/
 public function delMyForum()
 {
     $user_id = $this->get_user_id(TRUE);
     $type = input_string($this->input->post('type'), array('forum', 'post'), FALSE, '4001');
     $type_id = input_int($this->input->post('typeid'), 1, FALSE, FALSE, '4001');
     switch ($type) {
         case 'forum':
             $forum = $this->model->get_user_forum_by_id($type_id);
             if (!$forum || $forum['is_delete']) {
                 response_code('6004');
             }
             if ($forum['create_user'] != $user_id) {
                 response_code('6005');
             }
             $rs = $this->model->delete_forum_by_id($forum);
             break;
         case 'post':
             $post = $this->model->get_user_post_by_id($type_id);
             if (!$post || $post['is_delete']) {
                 response_code('6025');
             }
             if ($post['create_user'] != $user_id) {
                 response_code('6005');
             }
             $rs = $this->model->delete_post_by_id($post);
             break;
     }
     if ($rs) {
         response_code('1');
     }
     response_code('4000');
 }
Esempio n. 13
0
 private function check_userInfo($actiontype = 'add')
 {
     $userInfo['real_name'] = check_empty(trimall(strip_tags($this->input->post('real_name'))), FALSE, '1010');
     $userInfo['state'] = input_string($this->input->post('state'), array('active', 'suspend'), 'active');
     if ($actiontype == 'add') {
         $userInfo['user_name'] = input_mobilenum($this->input->post('user_name'), '1004');
         $real_user_pass = substr($userInfo['user_name'], -6);
         $userInfo['salt'] = getRandChar(4);
         $userInfo['user_pass'] = md5(md5($real_user_pass) . $userInfo['salt']);
     } else {
         //修改个人信息
         $userInfo['nick_name'] = check_empty(trimall(strip_tags($this->input->post('nick_name'))), FALSE, '1010');
         $userInfo['user_mobile'] = input_mobilenum($this->input->post('user_mobile'), '1004');
     }
     return $userInfo;
 }
Esempio n. 14
0
 /**
  * 收藏商品
  **/
 public function itemlike()
 {
     $user_id = $this->get_user_id(TRUE);
     $product_id = input_int($this->input->get('item_id'), 1, FALSE, FALSE, '2001');
     $act = input_string($this->input->get('act'), array('like', 'unlike'), FALSE, '4001');
     $product = $this->model->get_product_by_product_id($product_id);
     if (!$product) {
         response_code('2001');
     }
     if ($act == 'like') {
         $is_like = $this->model->check_product_fav($product_id, $user_id);
         if ($is_like) {
             response_code('2014');
         }
     } else {
         $is_like = $this->model->check_product_fav($product_id, $user_id);
         if (!$is_like) {
             response_code('2013');
         }
     }
     if ($this->model->product_fav($act, $product, $user_id)) {
         response_code('1');
     }
     response_code('-1');
 }
Esempio n. 15
0
 private function check_forum()
 {
     $info['title'] = check_empty(strip_tags($this->input->post('title')));
     $info['content'] = check_empty(strip_tags($this->input->post('content')));
     $user_name = $this->input->post('user_name');
     $users = $this->model->get_userinfo($user_name);
     if (!$users) {
         response_code('1003');
     }
     $info['user_id'] = $users['user_id'];
     $info['group_id'] = input_int($this->input->post('group_id'), 1000, FAlSE, 0);
     if (!$this->model->get_group($info['group_id'])) {
         response_code('1034');
     }
     $info['type'] = input_string($this->input->post('type'), array('tour', 'jianren', 'wenda'), FALSE, '4001');
     $tags = check_empty(trimall(strip_tags($this->input->post('tags'))), '');
     if ($tags) {
         $info['tags'] = array();
         $tags = explode(',', $tags);
         foreach ($tags as $key => $row) {
             if (!$row) {
                 continue;
             }
             if (mb_strlen($row) > 6) {
                 response_json('6033', '标签:"' . $row . '" 字数过长');
             }
             $info['tags'][] = $row;
         }
         if (count($info['tags']) > 3) {
             response_code('6032');
         }
         $info['tags'] = implode(',', $info['tags']);
     } else {
         $info['tags'] = '';
     }
     $create_time = strtotime($this->input->post('create_time'));
     $info['create_time'] = $create_time > $_SERVER['REQUEST_TIME'] ? $_SERVER['REQUEST_TIME'] : ($create_time ? $create_time : $_SERVER['REQUEST_TIME']);
     $info['city'] = '丽江市';
     if ($this->input->post('address') != "") {
         $address_arr = array('丽江市古城区束河古镇龙泉路束河完小东60米' => '100.213112,26.9271', '100.215646,26.928155', '丽江市古城区束河古镇泉居委会中和路中和村32号' => '100.212796,26.92867', '丽江市束河东康八组拐柳巷(近飞花触水)' => '100.209386,26.927245', '丽江古城区束河古镇悦榕路(近束河古镇中心位置)' => '100.219511,26.931215', '丽江束河古镇北门停车场(束河古镇,近四方街)' => '100.215071,26.931239', '云南省丽江束河古镇龙泉行政文明二社24号' => '100.213463,26.930885', '束河古镇仁里村8号九鼎龙潭西北侧' => '100.212726,26.932672', '云南省丽江市城西北7公里束河村古街旁' => '100.210235,26.931054', '云南省丽江市玉龙纳西族自治县15公里处' => '100.232102,27.115041', '丽江市白沙乡北部玉水寨旅游风景区内' => '100.207576,27.003324', '丽江香格里拉大道延伸段' => '100.225606,26.914328', '云南省丽江市古城区长水路85' => '100.240785,26.871959', '丽江义尚街文明巷81号' => '100.250337,26.879137');
         $address_position = explode(',', $address_arr[$this->input->post('address')]);
         $info['lat'] = $address_position[0];
         $info['lon'] = $address_position[1];
     }
     $info['img'] = $this->input->post('img');
     return $info;
 }
Esempio n. 16
0
 /**
  * 用户发帖
  **/
 public function postForum()
 {
     $user_id = $this->get_user_id(TRUE);
     $type = input_string($this->input->post('type'), array('tour', 'jianren', 'wenda'), FALSE, '4001');
     $group_id = input_int($this->input->post('group'), 1000, FAlSE, 0);
     $member = array();
     $data = $this->check_forum_post($type);
     if ($group_id) {
         $member = $this->model->get_user_group_by_group($group_id, $user_id);
         if (!$member || $member['waiting']) {
             response_code('6011');
         }
         $data['forum']['group_id'] = $group_id;
     }
     $forum_id = $this->model->user_post_forum($type, $data, $user_id, $member);
     if ($forum_id) {
         response_json('1', '发帖成功');
     }
     response_code('4000');
 }
Esempio n. 17
0
 private function check_user_info_value()
 {
     $nickname = $this->input->post('nickname', TRUE);
     $headimg = $this->input->post('headimg', TRUE);
     $signature = $this->input->post('signature', TRUE);
     $birthday = $this->input->post('birthday', TRUE);
     $sex = $this->input->post('sex', TRUE);
     $user = array();
     if ($nickname) {
         $user['nick_name'] = check_empty(trimall(strip_tags($nickname)), FALSE, '1023');
     }
     if ($headimg) {
         $user['headimg'] = check_empty(trimall(strip_tags($headimg)), FALSE, '1024');
     }
     if ($signature) {
         $user['signature'] = check_empty(trimall(strip_tags($signature)), FALSE, '1025');
     }
     if ($birthday) {
         $birthday = check_birthday($birthday);
         if (!$birthday) {
             response_code('1022');
         }
         $user['birthday'] = $birthday;
     }
     if ($sex) {
         $user['sex'] = input_string($sex, array('F', 'M'), FALSE, '1021');
     }
     return $user;
 }
Esempio n. 18
0
File: inn.php Progetto: qiuai/qieyou
 /**
  * 商户子账户管理
  * 访问权限:innholder only
  */
 public function submanage()
 {
     $action = input_string($this->input->get('act'), array('add', 'del', 'wake', 'stop'), FALSE, '4001');
     $innInfo = $this->model->get_inn_info_by_inn_id($this->token['inn_id'], FALSE);
     if ($this->token['user_id'] != $innInfo['innholder_id']) {
         response_msg('1018');
     }
     if (in_array($action, array('del', 'wake', 'stop'))) {
         $user_id = input_int($this->input->get('uid'), 1, FALSE, FALSE, '1019');
         $data = $this->model->get_sub_detail_by_user_id($this->token['inn_id'], $user_id);
         if (!$data) {
             response_msg('1020');
         }
         $rs = $this->model->modify_inn_sub_by_user_id($action, $this->token['inn_id'], $user_id);
         if ($rs) {
             response_msg('1');
         }
         response_msg('4000');
     }
     response_msg('1');
 }
Esempio n. 19
0
 /**
  * 修改商品状态
  */
 public function changeState()
 {
     $product = $this->check_edit_product_permission();
     $state = input_string($this->input->post('state'), array('N', 'D', 'Y'), FALSE, '3003');
     if ($state == $product['state']) {
         response_msg('1');
     }
     $rs = $this->model->updata_state_by_product_id($product['product_id'], $state);
     response_msg($rs ? '1' : '4000');
 }
Esempio n. 20
0
 /**
  * 快速上架/下架/删除
  * ajax POST
  */
 public function changeState()
 {
     $product_id = input_int($this->input->post('pid'), 1, FALSE, FALSE, '2015');
     $state = input_string($this->input->post('state'), array('T', 'Y', 'N', 'D'), FALSE, '2001');
     $product = $this->check_product($product_id);
     if (!$product) {
         $this->jsonAjax('-1', '商品信息不正确,或您没有修改该商品的权限!');
     }
     if ($product['state'] != $state) {
         $done = array('state' => $state, 'user_id' => $this->get_user_id());
         if ($state == 'Y' && $product['purchase_price'] != 0) {
             $done['state'] = 'T';
         }
         if (!$this->model->quick_change_product_state($product, $done)) {
             response_code('2002');
         }
     }
     response_code('1');
 }