コード例 #1
0
 /**
  * 发起反馈
  */
 public function create()
 {
     if (IS_POST) {
         $data['seller_id'] = $this->mid;
         $data['module'] = MODULE_NAME;
         $data['content'] = str_rp(trim($_POST['content']));
         $data['contact'] = str_rp(trim($_POST['contact']));
         $data['addtime'] = NOW_TIME;
         $data['has_reply'] = 0;
         //图片上传
         if (!empty($_FILES['pic']['size'])) {
             $img = 'feedback_' . re_md5(NOW_TIME . nonce_str());
             $param = array('savePath' => MODULE_NAME . '/feedback/', 'subName' => '', 'files' => $_FILES['pic'], 'saveName' => $img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['pic'] = $up_return;
             }
         }
         $res = $this->model->add($data);
         if ($res) {
             $this->success('谢谢您的意见及建议.', U('detail', array('id' => $res)));
         } else {
             $this->error('非常抱歉,您的意见及建议没有提交成功.');
         }
     } elseif (IS_GET) {
         $this->h3_title = '发起反馈';
         $this->display();
     }
 }
コード例 #2
0
ファイル: AdvController.class.php プロジェクト: noikiy/ypx
 public function adv_edit()
 {
     if (IS_POST) {
         $ap_id = intval($_POST['ap_id']);
         if ($ap_id) {
             $data = array('title' => str_rp(trim($_POST['ap_name'])), 'url' => str_rp(trim($_POST['ap_link'])), 'intro' => str_rp(trim($_POST['default_content'])), 'type' => intval($_POST['type']), 'addtime' => NOW_TIME, 'ap_width' => intval($_POST['ap_width']), 'ap_height' => intval($_POST['ap_height']), 'sort' => intval($_POST['sort']));
             if (!empty($_FILES['default_pic']['name'])) {
                 $param = array('savePath' => 'member/' . isLogin() . '/', 'subName' => 'Banner', 'files' => $_FILES['default_pic'], 'saveName' => 'gg_' . $ap_id, 'saveExt' => '');
                 $up_return = upload_one($param);
                 if ($up_return == 'error') {
                     $this->error('图片上传失败');
                     exit;
                 } else {
                     $data['img'] = $up_return;
                 }
             }
             $this->model->where(array('id' => $ap_id, 'uid' => isLogin()))->save($data);
             $this->success("操作成功", U('advposition'));
             exit;
         }
     } else {
         $id = intval($_GET['ap_id']);
         $vo = $this->model->where(array('id' => $id, 'uid' => isLogin()))->find();
         $this->assign('vo', $vo);
         $this->display('adv_position_edit');
     }
 }
コード例 #3
0
 /**
  * 基本资料
  */
 public function index()
 {
     $where['member_id'] = $this->mid;
     if (IS_POST) {
         //图片上传
         if (!empty($_FILES['avatar']['size'])) {
             $arc_img = 'mid_avatar_' . $this->mid;
             $param = array('savePath' => 'member/', 'subName' => '', 'files' => $_FILES['avatar'], 'saveName' => $arc_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['avatar'] = $up_return;
             }
         }
         //TODO:验证码
         $data['nickname'] = str_rp(trim($_POST['nickname']));
         $data['gender'] = intval($_POST['gender']);
         $data['age'] = intval($_POST['age']);
         $data['mobile'] = str_rp(trimall($_POST['mobile']));
         $data['email'] = I('post.email', '', 'email');
         $res = M('Member')->where($where)->save($data);
     }
     $info = M('Member')->where($where)->find();
     $this->info = $info;
     $this->display();
 }
コード例 #4
0
ファイル: EmailController.class.php プロジェクト: noikiy/oa
 public function send()
 {
     if (IS_POST) {
         if (empty($_POST)) {
             $this->error('非法操作');
         }
         $add_time_from = trim($_POST['add_time_from']) ? strtotime(trim($_POST['add_time_from'])) : 0;
         $add_time_to = trim($_POST['add_time_to']) ? strtotime(trim($_POST['add_time_to'])) : 0;
         $email = array('email_title' => trim($_POST['article_title']), 'email_user_id' => isLogin(), 'email_from_time' => $add_time_from, 'email_to_time' => $add_time_to, 'email_time' => NOW_TIME, 'email_status' => intval($_POST['article_show']), 'email_content' => trim($_POST['article_content']));
         if (!empty(intval($_POST['email_id']))) {
             $id = intval($_POST['email_id']);
             $this->modE->where(array('email_id' => $id))->save($email);
         } else {
             $id = $this->modE->add($email);
         }
         if ($id) {
             if (!empty($_FILES)) {
                 $filename = 'epic_' . $id;
                 $param = array('savePath' => 'email/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename, 'saveExt' => '');
                 $path = upload_one($param);
                 if ($path != 'error') {
                     $res = $this->modE->where(array('email_id' => $id))->setField('email_file', $path);
                 } else {
                     $this->modE->where(array('email_id' => $id))->delete();
                     $this->error('附件上传失败');
                     die;
                 }
             }
             $user = $_POST['user'];
             foreach ($user as $key => $val) {
                 $dataList[$key] = array('email_id' => $id, 'user_id' => $val, 'user_status' => 0);
             }
             M('EmailStatus')->addAll($dataList);
             $this->success('邮件发送成功', U('delivery'));
         }
     } else {
         $id = intval($_GET['id']);
         if (!empty($id)) {
             $info = $this->modE->where(array('email_id' => $id))->find();
             $this->info = $info;
             $this->title = '编辑任务';
         } else {
             $this->title = '添加任务';
         }
         $this->depart = M('AuthGroup')->where(array('status' => 1))->field(array('id', 'title'))->select();
         $user = D('AdminView')->where(array('admin_id' => array('neq', isLogin())))->field(array('admin_id', 'admin_name', 'title'))->group('uid')->select();
         $this->user = $user;
         $this->display();
     }
 }
コード例 #5
0
 public function curd()
 {
     if (IS_POST) {
         $data['member_name'] = str_rp(trim($_POST['member_name']));
         $data['nickname'] = str_rp(trim($_POST['nickname']));
         $data['email'] = str_rp(trim($_POST['email']));
         $data['mobile'] = str_rp(trim($_POST['mobile']));
         $data['qq'] = str_rp(trim($_POST['qq']));
         $data['predeposit'] = floatval($_POST['predeposit']);
         $data['frozen'] = floatval($_POST['frozen']);
         $data['score'] = intval($_POST['score']);
         $data['point'] = intval($_POST['point']);
         $data['member_status'] = intval($_POST['member_status']);
         $member_id = intval($_POST['member_id']);
         //图片上传
         if ($_FILES['id_card']['size']) {
             $arc_img = 'idcard_' . $member_id;
             $param = array('savePath' => 'id_card/', 'subName' => '', 'files' => $_FILES['id_card'], 'saveName' => $arc_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['id_card'] = $up_return;
             }
         }
         if ($member_id) {
             $res = $this->model->where(array('member_id' => $member_id))->save($data);
             if ($res) {
                 $this->success('修改会员资料成功');
             } else {
                 $this->error('修改会员资料失败');
             }
         } else {
             $this->error('非法操作');
         }
     } elseif (IS_GET) {
         $where['member_id'] = intval($_GET['id']);
         $info = $this->model->relation(true)->where($where)->find();
         $this->title = '会员信息-' . get_member_nickname($info['member_id']);
         $this->assign('info', $info);
         $this->display();
     }
 }
コード例 #6
0
ファイル: MemberController.class.php プロジェクト: noikiy/ypx
 public function member_edit()
 {
     if (IS_POST) {
         $more_address = serialize($_POST['more_address']);
         $old_pwd = M('Member')->where(array('uid' => isLogin(), 'status' => 1))->getField('password');
         if (empty($_POST['password'])) {
             $this->error('密码不能为空');
         }
         if ($old_pwd == $_POST['password']) {
             $password = $_POST['password'];
         } else {
             $password = re_md5($_POST['password']);
         }
         $data = array('password' => $password, 'long_name' => str_rp(trim($_POST['long_name'])), 'nickname' => str_rp(trim($_POST['nickname'])), 'contact_phone' => str_rp(trim($_POST['contact_phone'])), 'contact_name' => str_rp(trim($_POST['contact_name'])), 'school_phone' => str_rp(trim($_POST['school_phone'])), 'school_address' => str_rp(trim($_POST['school_address'])), 'more_address' => serialize($_POST['more_address']), 'qq' => str_rp(trim($_POST['qq'])), 'email' => str_rp(trim($_POST['email'])), 'fax' => str_rp(trim($_POST['fax'])), 'school_desc' => str_replace('\'', ''', $_POST['school_desc']));
         unset($lastpath);
         unset($up_return);
         unset($filename);
         if (!empty($_FILES['avatar']['size'])) {
             $lastpath = M('Member')->where(array('uid' => isLogin()))->getField('avatar');
             $filename = 'avatar_' . nonce_str(8, 1, 1, 1);
             $param = array('savePath' => 'member/', 'subName' => isLogin(), 'exts' => '', 'files' => $_FILES['avatar'], 'saveName' => $filename, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return) {
                 @unlink(BasePath . '/Uploads/' . $lastpath);
                 $data['avatar'] = $up_return;
             } else {
                 $this->error('上传头像失败');
             }
         }
         $res = M('Member')->where(array('uid' => isLogin()))->save($data);
         if ($res) {
             $this->success('操作成功', U('member'));
         } else {
             $this->error('操作失败');
         }
     } else {
         $info = M('Member')->where(array('uid' => isLogin()))->find();
         $info['more_address'] = unserialize($info['more_address']);
         $info['numAdd'] = count($info['more_address']);
         $this->vo = $info;
         $this->display();
     }
 }
コード例 #7
0
ファイル: ShopController.class.php プロジェクト: noikiy/sryy
 public function curdShop()
 {
     if (IS_POST) {
         $id = intval($_POST['id']);
         $latlng = explode(',', $_POST['latLng']);
         $data = array('store_name' => str_rp($_POST['store_name']), 'store_tel' => str_rp($_POST['store_tel']), 'store_address' => str_rp($_POST['address']), 'store_lat' => str_rp(trim($latlng[0])), 'store_lng' => str_rp(trim($latlng[1])), 'store_num' => str_rp(trim($_POST['store_num'])), 'store_status' => intval($_POST['store_status']), 'store_intro' => str_rp(trim($_POST['store_intro'])));
         if ($id) {
             $res = $this->ba_mod->where(array('store_id' => $id))->save($data);
         } else {
             $id = $this->ba_mod->add($data);
         }
         if ($_FILES['article_pic']['size'] > 0) {
             $filename = 'store_' . $id;
             $param = array('savePath' => 'store/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename);
             $path = upload_one($param);
             if ($path != 'error') {
                 $id = $this->ba_mod->where(array('store_id' => $id))->setField('store_pic', $path);
             } else {
                 $this->ba_mod->where(array('store_id' => $res))->delete();
                 $this->error('文件上传失败');
                 die;
             }
         }
         if ($id) {
             $this->success('操作成功', U('shoplist'));
         } else {
             $this->error('操作失败');
         }
     } elseif (IS_GET) {
         $id = intval($_GET['id']);
         if ($id) {
             $this->info = $this->ba_mod->where(array('store_id' => $id))->find();
         }
         $this->title = '添加店铺';
         $this->display();
     } elseif (IS_AJAX) {
         $id = intval($_POST['id']);
         if ($id) {
             $res = $this->ba_mod->where(array('store_id' => $id))->delete();
             echo $res;
         }
     }
 }
コード例 #8
0
ファイル: HonorController.class.php プロジェクト: noikiy/sryy
 public function curdhonor()
 {
     if (IS_AJAX) {
         $id = intval($_POST['id']);
         if ($id) {
             $res = $this->ba_mod->where(array('id' => $id))->delete();
             echo $res;
         }
     } elseif (IS_GET) {
         $id = intval($_GET['id']);
         if ($id) {
             $this->info = $this->ba_mod->where(array('id' => $id))->find();
         }
         $this->title = 'honor管理';
         $this->display();
     } elseif (IS_POST) {
         $id = intval($_POST['id']);
         $data = array('title' => str_rp($_POST['title']), 'viewcount' => intval($_POST['viewcount']), 'sort' => intval($_POST['sort']), 'status' => intval($_POST['status']), 'addtime' => NOW_TIME, 'content' => str_replace('\'', ''', $_POST['content']));
         if ($id) {
             $res = $this->ba_mod->where(array('id' => $id))->save($data);
         } else {
             $id = $this->ba_mod->add($data);
         }
         if ($_FILES['article_pic']['size'] > 0) {
             $param = array('savePath' => 'honor/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => 'honor_' . $id, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->ba_mod->where(array('id' => $id))->delete();
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $res = $this->ba_mod->where(array('id' => $id))->setField('pic', $up_return);
             }
         }
         if ($res) {
             $this->success('操作成功', U('honorlist'));
         } else {
             $this->error('操作失败');
         }
     }
 }
コード例 #9
0
 public function curdBanner()
 {
     if (IS_AJAX) {
         $id = intval($_POST['id']);
         if ($id) {
             $res = $this->ba_mod->where(array('id' => $id))->delete();
             echo $res;
         }
     } elseif (IS_GET) {
         $id = intval($_GET['id']);
         if ($id) {
             $this->info = $this->ba_mod->where(array('id' => $id))->find();
         }
         $this->title = 'Banner管理';
         $this->display();
     } elseif (IS_POST) {
         $id = intval($_POST['id']);
         $data = array('title' => str_rp($_POST['title']), 'url' => str_rp($_POST['url']), 'intro' => str_rp($_POST['intro']), 'type' => intval($_POST['type']), 'sort' => intval($_POST['sort']), 'status' => intval($_POST['status']));
         if ($id) {
             $res = $this->ba_mod->where(array('id' => $id))->save($data);
         } else {
             $id = $this->ba_mod->add($data);
         }
         if ($_FILES['article_pic']['size'] > 0) {
             $param = array('savePath' => 'banner/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => 'banner_' . $id, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->ba_mod->where(array('id' => $id))->delete();
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $res = $this->ba_mod->where(array('id' => $id))->setField('img', $up_return);
             }
         }
         if ($res) {
             $this->success('操作成功', U('bannerlist'));
         } else {
             $this->error('操作失败');
         }
     }
 }
コード例 #10
0
 public function goods_edit()
 {
     $goods_id = intval($_REQUEST['goods_id']);
     if (IS_POST) {
         $data = array();
         $data['gc_id'] = intval($_POST['gc_id']);
         $data['brand_id'] = intval($_POST['brand_id']);
         $data['goods_name'] = str_rp(trim($_POST['goods_name']));
         $data['goods_code'] = str_rp(trim($_POST['goods_code']));
         $data['goods_type'] = str_rp(trim($_POST['goods_type']));
         $data['goods_type_id'] = get_goods_type_id($data['gc_id']);
         $data['goods_city_id'] = intval(trim($_POST['goods_city_id']));
         $data['goods_key'] = str_rp(trim($_POST['goods_key']));
         $data['goods_desc'] = str_rp(trim($_POST['goods_desc']));
         $data['goods_url'] = str_rp(trim($_POST['goods_url']));
         $data['goods_storage'] = intval($_POST['goods_storage']);
         $data['goods_serial'] = str_rp(trim($_POST['goods_serial']));
         $data['store_name'] = str_rp(trim($_POST['store_name']));
         $data['goods_price'] = price_format($_POST['goods_price']);
         $data['goods_mktprice'] = price_format($_POST['goods_mktprice']);
         $data['member_price'] = price_format($_POST['member_price']);
         $data['goods_point'] = intval($_POST['goods_point']);
         $data['goods_sort'] = intval($_POST['goods_sort']);
         $data['goods_body'] = str_replace('\'', ''', $_POST['goods_body']);
         $data['goods_status'] = intval($_POST['goods_status']);
         $data['add_time'] = NOW_TIME;
         $data['display_technique'] = str_rp($_POST['display_technique'], 1);
         $data['bulb_brand'] = str_rp($_POST['bulb_brand'], 1);
         $data['bulb_wattage'] = str_rp($_POST['bulb_wattage'], 1);
         $data['bulb_code'] = str_rp($_POST['bulb_code'], 1);
         $data['factory_code'] = str_rp($_POST['factory_code'], 1);
         $data['factory_brand'] = str_rp($_POST['factory_brand'], 1);
         //图片上传
         if (!empty($_FILES['goods_pic']['name'])) {
             $goods_img = 'g_' . $data['add_time'];
             $gd = $this->model->where('goods_id=' . $goods_id)->find();
             if ($gd['goods_pic']) {
                 $old_pic = BasePath . '/Uploads/' . $gd['goods_pic'];
                 unlink($old_pic);
             }
             $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES['goods_pic'], 'saveName' => $goods_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['goods_pic'] = $up_return;
             }
         }
         $return = $this->model->where('goods_id=' . $goods_id)->save($data);
         if ($return) {
             //search处理
             $search['url'] = U('Goods/detail', array('goods_id' => $goods_id));
             $search['title'] = $data['goods_name'];
             $search['keywords'] = $data['goods_key'];
             $search['description'] = $data['goods_desc'];
             $search['img'] = $up_return;
             //规格处理
             $GoodsSpec = M('GoodsSpec');
             $spec_val = $_POST['s_value'];
             if (is_array($spec_val) && !empty($spec_val)) {
                 $GoodsSpec->where('goods_id=' . $goods_id)->delete($data);
                 // 删除原来的规格
                 foreach ($spec_val as $k => $val) {
                     $val['sort'] = intval($val['sort']);
                     $val['name'] = trim($val['name']);
                     if ($val['name']) {
                         /**
                          * 新增规格值
                          */
                         $val_add = array();
                         $val_add['goods_id'] = $goods_id;
                         $val_add['spec_name'] = trim($val['name']);
                         $val_add['spec_goods_price'] = price_format(trim($val['price']));
                         $val_add['spec_goods_sort'] = intval($val['sort']);
                         $return = $GoodsSpec->add($val_add);
                         $search['keywords'] .= ',' . $val_add['spec_name'];
                         unset($val_add);
                     }
                 }
                 $search_id = $this->model->where(array('goods_id' => $goods_id))->getField('search_id');
                 if (empty($search_id)) {
                     $search_id = '';
                 }
                 $search_id = addSearch($search['url'], $search['title'], $search['keywords'], $search['description'], $search_id, $search['img']);
                 $this->model->where(array('goods_id' => $goods_id))->setField('search_id', $search_id);
                 //更新商品列表默认规格信息
                 $df_spec = M('GoodsSpec')->where('goods_id=' . $goods_id)->order('spec_goods_price asc')->find();
                 if (is_array($df_spec) && !empty($df_spec)) {
                     $spec_data = array();
                     $spec_data['spec_id'] = $df_spec['spec_id'];
                     $spec_data['spec_name'] = $df_spec['spec_name'];
                 }
             } else {
                 $spec_data = array();
                 $spec_data['spec_id'] = 0;
                 $spec_data['spec_name'] = '';
                 $this->model->where('goods_id=' . $goods_id)->save($spec_data);
                 $GoodsSpec->where('goods_id=' . $goods_id)->delete($data);
                 // 删除原来的规格
             }
             //商品多图片处理
             $GoodsPic = M('GoodsPic');
             $pic_val = $_POST['s_pic1'];
             if (is_array($pic_val) && !empty($pic_val)) {
                 $pic_data = array();
                 $n = 1;
                 foreach ($pic_val as $p => $pv) {
                     $pic_data['p_sort'] = intval($pv['sort']);
                     $pic_data['goods_id'] = $goods_id;
                     $pic_name = 's_pic1_' . $p;
                     if ($_FILES[$pic_name]['size'] > 0) {
                         $goods_img = 'm1_' . $goods_id . '_' . $n . '_' . NOW_TIME;
                         $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES[$pic_name], 'saveName' => $goods_img, 'saveExt' => '');
                         $up_return = upload_one($param);
                         if ($up_return == 'error') {
                             $this->error('图片上传失败');
                             exit;
                         } else {
                             $pic_data['pic'] = $up_return;
                             $pic_data['pic_status'] = 1;
                         }
                         $GoodsPic->add($pic_data);
                     }
                     $n++;
                 }
             }
             unset($pic_val);
             //图片处理END
             $pic_val = $_POST['s_pic2'];
             if (is_array($pic_val) && !empty($pic_val)) {
                 $pic_data = array();
                 $n = 1;
                 foreach ($pic_val as $p => $pv) {
                     $pic_data['p_sort'] = intval($pv['sort']);
                     $pic_data['goods_id'] = $goods_id;
                     $pic_name = 's_pic2_' . $p;
                     if ($_FILES[$pic_name]['size'] > 0) {
                         $goods_img = 's2_' . $goods_id . '_' . $n . '_' . NOW_TIME;
                         $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES[$pic_name], 'saveName' => $goods_img, 'saveExt' => '');
                         $up_return = upload_one($param);
                         if ($up_return == 'error') {
                             $this->error('图片上传失败');
                             exit;
                         } else {
                             $pic_data['pic'] = $up_return;
                             $pic_data['pic_status'] = 2;
                         }
                         $GoodsPic->add($pic_data);
                     }
                     $n++;
                 }
             }
             unset($pic_val);
             //图片处理END
             $this->success('操作成功', U('goods'));
             exit;
         } else {
             $this->error('操作失败');
         }
     } else {
         /**
          * 父类列表
          */
         $class_list = getTreeClassList(3);
         if (is_array($class_list)) {
             foreach ($class_list as $k => $v) {
                 $class_list[$k]['gc_name'] = str_repeat(" ", $v['deep'] * 2) . '├ ' . $v['gc_name'];
             }
         }
         $brand_list = $this->goodsBrandModel->where(array('brand_status' => 1))->order('brand_sort desc')->select();
         $rs = $this->model->relation(true)->where('goods_id=' . $goods_id)->find();
         $this->assign('rs', $rs);
         //规格
         $spec_list = M('GoodsSpec')->where('goods_id=' . $goods_id)->order('spec_goods_sort asc')->select();
         //多图片
         $pic1_list = M('GoodsPic')->where(array('goods_id' => $goods_id, 'pic_status' => 1))->order('p_sort asc')->select();
         $pic2_list = M('GoodsPic')->where(array('goods_id' => $goods_id, 'pic_status' => 2))->order('p_sort asc')->select();
         //常用城市
         $this->city_list = D('District')->where('usetype=1')->order('d_sort desc')->select();
         $this->assign('spec_list', $spec_list);
         $this->assign('spec_list_i', count($spec_list) + 1);
         $this->assign('pic1_list', $pic1_list);
         $this->assign('pic1_list_i', count($pic1_list) + 1);
         $this->assign('pic2_list', $pic2_list);
         $this->assign('pic2_list_i', count($pic2_list) + 1);
         $this->assign('brand_list', $brand_list);
         $this->assign('class_list', $class_list);
         $this->assign('title', '商品编辑');
         $this->display();
     }
 }
コード例 #11
0
ファイル: GiftController.class.php プロジェクト: noikiy/oa
 public function gift_edit()
 {
     if (IS_POST) {
         $sg_id = intval($_POST['sg_id']);
         $data = array();
         $data['sg_name'] = trim($_POST['sg_name']);
         $data['sg_code'] = trim($_POST['sg_code']);
         $data['sg_intro'] = str_replace('\'', ''', $_POST['sg_intro']);
         $data['sg_point'] = intval($_POST['sg_point']);
         $data['sg_price'] = price_format(trim($_POST['sg_price']));
         $data['sg_num'] = intval($_POST['sg_num']);
         $data['sg_limit_num'] = intval($_POST['sg_limit_num']);
         $data['sg_member_degree'] = intval($_POST['sg_member_degree']);
         $data['sg_recommend'] = intval($_POST['sg_recommend']);
         $data['sg_sale'] = intval($_POST['sg_sale']);
         //$data['sg_add_time'] = NOW_TIME;
         $data['sg_last_change_time'] = NOW_TIME;
         if (!empty($_FILES['sg_pic']['name'])) {
             $param = array('savePath' => 'gift/', 'subName' => '', 'files' => $_FILES['sg_pic'], 'saveName' => 'gf_' . $sg_id, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['sg_pic'] = $up_return;
             }
         }
         $this->model->where('sg_id=' . $sg_id)->save($data);
         $this->success("操作成功", U('gift_manage'));
         exit;
     } else {
         $sg_id = intval($_GET['sg_id']);
         $vo = $this->model->where('sg_id=' . $sg_id)->find();
         //会员等级
         $member_degree = M('MemberDegree')->select();
         $this->assign('member_degree', $member_degree);
         $this->assign('vo', $vo);
         $this->display();
     }
 }
コード例 #12
0
ファイル: SpecController.class.php プロジェクト: noikiy/oa
 public function spec_edit()
 {
     $SpecValue = M('SpecValue');
     if (IS_POST) {
         /**
          * 更新规格值表
          */
         $string_value = '';
         $spec_val = $_POST['s_value'];
         if (is_array($spec_val) && !empty($spec_val)) {
             // 要删除的规格值id
             $del_array = array();
             if (!empty($_POST['s_del'])) {
                 $del_array = $_POST['s_del'];
             }
             foreach ($spec_val as $k => $val) {
                 $val['name'] = trim($val['name']);
                 $val['sort'] = intval($val['sort']);
                 if (isset($val['form_submit']) && $val['form_submit'] == 'ok' && !in_array($k, $del_array)) {
                     if ($_POST['s_dtype'] == 'text') {
                         /**
                          * 判断原有图片是否存在,如存在删除
                          */
                         if (isset($val['image']) && $val['image'] != '') {
                             /**
                              * 删除图片
                              */
                             @unlink(C('SiteUrl') . '/Uploads/' . $val['image']);
                         }
                         $val['image'] = '';
                     } else {
                         if ($_POST['s_dtype'] == 'image') {
                             //图片模式
                             /**
                              * 图片上传
                              */
                             if (!empty($_FILES['s_value_' . $k]['name'])) {
                                 if (isset($val['image']) && $val['image'] != '') {
                                     /**
                                      * 删除图片
                                      */
                                     @unlink(C('SiteUrl') . '/Uploads/' . $val['image']);
                                 }
                                 $spc_img_name = 'spc_' . NOW_TIME . $k;
                                 $param = array('savePath' => 'spec/', 'subName' => '', 'files' => $_FILES['s_value_' . $k], 'saveName' => $spc_img_name, 'saveExt' => '');
                                 $up_return = upload_one($param);
                                 if ($up_return == 'error') {
                                     $this->error('图片上传失败');
                                 } else {
                                     $val['image'] = $up_return;
                                 }
                             }
                         }
                     }
                     /**
                      * 更新规格值
                      */
                     $spc_data = array();
                     $spc_data['sp_value_name'] = $val['name'];
                     $spc_data['sp_value_image'] = $val['image'];
                     $spc_data['sp_value_sort'] = $val['sort'];
                     $spc_map = array();
                     $spc_map['sp_value_id'] = array('eq', $k);
                     $spc_map['sp_id'] = array('eq', intval($_POST['s_id']));
                     $return = $SpecValue->where($spc_map)->save($spc_data);
                     if (!$return) {
                         $this->error('规格信息更新失败');
                     }
                     $string_value .= $val['name'] . ',';
                     unset($spc_data);
                     unset($spc_map);
                 } else {
                     if (isset($val['form_submit']) && $val['form_submit'] == '' && !in_array($k, $del_array)) {
                         //原有规格未修改
                         if ($_POST['s_dtype'] == 'text') {
                             /**
                              * 判断原有图片是否存在,如存在删除
                              */
                             if (isset($val['image']) && $val['image'] != '') {
                                 /**
                                  * 删除图片
                                  */
                                 @unlink(C('SiteUrl') . '/Uploads/' . $val['image']);
                                 /**
                                  * 更新规格值
                                  */
                                 $spc_map = array();
                                 $spc_map['sp_value_id'] = array('eq', $k);
                                 $spc_map['sp_id'] = array('eq', intval($_POST['s_id']));
                                 $return = $SpecValue->where($spc_map)->setField('sp_value_image', '');
                                 if (!$return) {
                                     $this->error('规格信息更新失败');
                                 }
                                 unset($spc_map);
                             }
                             $val['image'] = '';
                         }
                         $string_value .= $val['name'] . ',';
                     } else {
                         if (!in_array($k, $del_array)) {
                             //新添加规格值
                             /**
                              * 图片上传
                              */
                             $val['image'] = '';
                             if ($_POST['s_dtype'] == 'image') {
                                 /**
                                  * 图片上传
                                  */
                                 if (!empty($_FILES['s_value_' . $k]['name'])) {
                                     $spc_img_name = 'spc_' . NOW_TIME . $k;
                                     $param = array('savePath' => 'spec/', 'subName' => '', 'files' => $_FILES['s_value_' . $k], 'saveName' => $spc_img_name, 'saveExt' => '');
                                     $up_return = upload_one($param);
                                     if ($up_return == 'error') {
                                         $this->error('图片上传失败');
                                     } else {
                                         $val['image'] = $up_return;
                                     }
                                 }
                             }
                             /**
                              * 新增规格值
                              */
                             $val_add = array();
                             $val_add['sp_value_name'] = trim($val['name']);
                             $val_add['sp_id'] = intval($_POST['s_id']);
                             $val_add['sp_value_image'] = $val['image'];
                             $val_add['sp_value_sort'] = trim($val['sort']);
                             $return = $SpecValue->add($val_add);
                             unset($val_add);
                             if (!$return) {
                                 $this->error('规格添加失败');
                             }
                             $string_value .= $val['name'] . ',';
                         }
                     }
                 }
             }
             // 删除规格值表
             if (!empty($_POST['s_del'])) {
                 $del_id = implode(',', $_POST['s_del']);
                 $del_map = array();
                 $del_map['sp_value_id'] = array('in', $del_id);
                 $SpecValue->where($del_map)->delete();
                 foreach ($_POST['s_del'] as $val) {
                     if (!empty($_POST['s_value'][$val]['image'])) {
                         /**
                          * 删除图片
                          */
                         @unlink(C('SiteUrl') . '/Uploads/' . $_POST['s_value'][$val]['image']);
                     }
                 }
                 unset($del_map);
             }
         }
         /**
          * 更新规格表
          */
         $param_spc = array();
         $param_spc['sp_name'] = trim($_POST['s_name']);
         $param_spc['sp_format'] = $_POST['s_dtype'];
         $param_spc['sp_value'] = rtrim($string_value, ',');
         $param_spc['sp_sort'] = intval($_POST['s_sort']);
         $return = M('Spec')->where('sp_id=' . intval($_POST['s_id']))->save($param_spc);
         if ($return) {
             $this->success('操作成功', U('spec'));
         } else {
             $this->error('操作失败!');
         }
     } else {
         //读取规格列表信息
         $sp_id = intval($_GET['sp_id']);
         if ($sp_id) {
             $spec_list = $this->model->where('sp_id=' . $sp_id)->find();
             $sp_value = $SpecValue->where('sp_id=' . $sp_id)->order('sp_value_sort asc')->select();
             $this->assign('sp_list', $spec_list);
             $this->assign('sp_value', $sp_value);
             $this->display();
         } else {
             $this->error('请求失败!');
         }
     }
 }
コード例 #13
0
ファイル: AuthController.class.php プロジェクト: noikiy/oa
 public function curdAdmin()
 {
     if (IS_POST) {
         $admin_id = intval($_POST['admin_id']);
         if (empty($admin_id)) {
             $data = array('admin_name' => trim($_POST['name']), 'admin_pwd' => re_md5(trim($_POST['password'])));
             $admin_id = M('admin')->add($data);
             if (!empty($_FILES)) {
                 $filename = 'sign_' . $admin_id;
                 $param = array('savePath' => 'signature/', 'subName' => '', 'files' => $_FILES['sign_pic'], 'saveName' => $filename, 'saveExt' => '', 'replace' => true);
                 $path = upload_one($param);
                 M('admin')->where(array('admin_id' => $admin_id))->setField('admin_signature', $path);
             }
             $group = $_POST['group'];
             if (is_array($group) && !empty($group)) {
                 foreach ($group as $key => $val) {
                     $access = array('uid' => $admin_id, 'group_id' => $val);
                     M('AuthGroupAccess')->add($access);
                 }
             }
             addLog('新增管理员ID-[' . $admin_id . ']');
             $this->success('添加管理员成功', U('Auth/adminList'));
         } else {
             $data = array('admin_name' => trim($_POST['name']), 'admin_pwd' => re_md5(trim($_POST['password'])));
             M('admin')->where(array('admin_id' => $admin_id))->save($data);
             M('AuthGroupAccess')->where(array('uid' => $admin_id))->delete();
             if (!empty($_FILES)) {
                 $filename = 'sign_' . $admin_id;
                 $param = array('savePath' => 'signature/', 'subName' => '', 'files' => $_FILES['sign_pic'], 'saveName' => $filename, 'saveExt' => '', 'replace' => true);
                 $path = upload_one($param);
                 $image = new \Think\Image();
                 $image->open('./Uploads/' . $path);
                 $image->thumb(150, 150)->save('./Uploads/' . $path);
                 M('admin')->where(array('admin_id' => $admin_id))->setField('admin_signature', $path);
             }
             $group = $_POST['group'];
             if (is_array($group) && !empty($group)) {
                 foreach ($group as $key => $val) {
                     $access = array('uid' => $admin_id, 'group_id' => $val);
                     M('AuthGroupAccess')->add($access);
                 }
             }
             addLog('编辑管理员ID-[' . $admin_id . ']');
             $this->success('编辑管理员成功', U('Auth/adminList'));
         }
     } else {
         if ($_GET['admin_id']) {
             $type = trim($_GET['type']);
             $admin_id = intval($_GET['admin_id']);
             if ($type == 'edit') {
                 $this->title = "编辑管理员";
                 $mod = D('admin');
                 $this->info = $mod->where(array('admin_id' => $admin_id))->field(array('admin_id', 'admin_name'))->find();
                 $group = M('AuthGroup')->select();
                 $acc = M('AuthGroupAccess')->where(array('uid' => $admin_id))->field(array('group_id'))->select();
                 if (is_array($acc) && !empty($acc)) {
                     foreach ($acc as $key => $val) {
                         $access[] = $val['group_id'];
                     }
                     foreach ($group as $key => $val) {
                         if (in_array($val['id'], $access)) {
                             $group[$key]['checked'] = 1;
                         }
                     }
                 }
                 $this->group = $group;
                 $this->display();
             } elseif ($type == 'del') {
                 if ($admin_id == isLogin()) {
                     $this->error('您不能删除自己的账号');
                 } else {
                     $result = $this->model->where(array('admin_id' => $admin_id))->delete();
                     if ($result) {
                         M('AuthGroupAccess')->where(array('uid' => $admin_id))->delete();
                         addLog('删除管理员ID-[' . $admin_id . ']');
                         $this->success('删除账号成功');
                     } else {
                         $this->error('删除账号失败');
                     }
                 }
             } else {
                 $this->error('非法操作');
             }
         } else {
             $this->title = "添加管理员";
             $this->group = M('AuthGroup')->select();
             $this->display();
         }
     }
 }
コード例 #14
0
ファイル: AdvController.class.php プロジェクト: noikiy/sryy
 public function adv_edit()
 {
     if (IS_POST) {
         $ap_id = intval($_POST['ap_id']);
         if ($ap_id) {
             $data = array();
             $data['ap_name'] = trim($_POST['ap_name']);
             $data['ap_code'] = trim($_POST['ap_code']);
             $data['ap_intro'] = trim($_POST['ap_intro']);
             $data['ap_link'] = trim($_POST['ap_link']);
             $data['ap_price'] = price_format($_POST['ap_price']);
             $data['ap_class'] = intval($_POST['ap_class']);
             $data['is_use'] = intval($_POST['is_use']);
             $data['ap_width'] = intval($_POST['ap_width']);
             $data['ap_height'] = intval($_POST['ap_height']);
             $data['default_content'] = trim($_POST['default_content']);
             if (!empty($_FILES['default_pic']['name'])) {
                 $param = array('savePath' => 'adv/', 'subName' => '', 'files' => $_FILES['default_pic'], 'saveName' => 'gg_' . $ap_id, 'saveExt' => '');
                 $up_return = upload_one($param);
                 if ($up_return == 'error') {
                     $this->error('图片上传失败');
                     exit;
                 } else {
                     $data['ap_pic'] = $up_return;
                 }
             }
             $this->model->where('ap_id=' . $ap_id)->save($data);
             $this->success("操作成功", U('adv_position'));
             exit;
         }
     } else {
         $ap_id = intval($_GET['ap_id']);
         $vo = $this->model->where('ap_id=' . $ap_id)->find();
         $this->assign('vo', $vo);
         $this->display('adv_position_edit');
     }
 }
コード例 #15
0
 public function photo_edit()
 {
     if (IS_POST) {
         $id = intval($_POST['id']);
         $data = array('title' => str_rp(trim($_POST['title'])), 'cate_id' => intval($_POST['ac_id']), 'status' => intval($_POST['status']), 'asort' => intval($_POST['article_sort']), 'read_count' => intval($_POST['read_count']), 'des' => str_rp(trim($_POST['des'])), 'content' => str_rp(trim($_POST['content'])));
         //图片上传
         if (!empty($_FILES['article_pic']['name'])) {
             $filename = 'photoImg_' . $id;
             $param = array('savePath' => 'artic/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $filename, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['img'] = $up_return;
             }
         }
         D('Photo')->where('id=' . $id)->save($data);
         $this->success('操作成功', U('photo'));
         exit;
     } else {
         $id = intval($_GET['id']);
         if ($id) {
             $vo = D('Photo')->relation(true)->where('id=' . $id)->find();
             $this->assign('vo', $vo);
             $this->display('photo_edit');
         }
     }
 }
コード例 #16
0
 public function agent_edit()
 {
     $id = intval($_REQUEST['id']);
     if (IS_POST) {
         $data = array();
         $data['nick_name'] = trim($_POST['nick_name']);
         $data['true_name'] = trim($_POST['true_name']);
         $data['level_name'] = trim($_POST['level_name']);
         $data['address'] = trim($_POST['address']);
         $data['wexin_id'] = trim($_POST['wexin_id']);
         $data['agent_sort'] = intval($_POST['agent_sort']);
         $data['agent_time'] = NOW_TIME;
         $agent_pic = 'ap_' . $data['agent_time'];
         $agent_ewm = 'ewm_' . $data['agent_time'];
         //图片上传
         if (!empty($_FILES['agent_pic']['name'])) {
             $param = array('savePath' => 'agent/', 'subName' => '', 'files' => $_FILES['agent_pic'], 'saveName' => $agent_pic, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['agent_pic'] = $up_return;
             }
         }
         if (!empty($_FILES['agent_ewm']['name'])) {
             $param = array('savePath' => 'agent/', 'subName' => '', 'files' => $_FILES['agent_ewm'], 'saveName' => $agent_ewm, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['agent_ewm'] = $up_return;
             }
         }
         $return = $this->model->where('id=' . $id)->save($data);
         if ($return) {
             $this->success('操作成功', U('agent'));
             exit;
         } else {
             $this->error('操作失败');
         }
     } else {
         $rs = $this->model->where('id=' . $id)->find();
         $this->assign('rs', $rs);
         $this->display();
     }
 }
コード例 #17
0
 public function base_information()
 {
     $Setting = M('Setting');
     if (IS_POST) {
         $data = array();
         if (!empty($_FILES['site_logo']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['site_logo'], 'saveName' => 'site_logo', 'saveExt' => '');
             //$up_return = upload_one($param);
             $up_return = upload_one_thumb($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['site_logo'] = $up_return;
             }
         }
         if (!empty($_FILES['member_logo']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['member_logo'], 'saveName' => 'member_logo', 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['member_logo'] = $up_return;
             }
         }
         if (!empty($_FILES['seller_logo']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['seller_logo'], 'saveName' => 'seller_logo', 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['seller_logo'] = $up_return;
             }
         }
         if (!empty($_FILES['weixin_qrcode']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['weixin_qrcode'], 'saveName' => 'weixin_qrcode', 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['weixin_qrcode'] = $up_return;
             }
         }
         $data['site_name'] = str_rp(trim($_POST['site_name']));
         $data['weixin_account'] = str_rp(trim($_POST['weixin_account']));
         $data['site_qq'] = str_rp(trim($_POST['site_qq']));
         $data['site_tel'] = str_rp(trim($_POST['site_tel']));
         $data['site_tel_400'] = str_rp(trim($_POST['site_tel_400']));
         $data['sms_api_account'] = str_rp(trim($_POST['sms_api_account']));
         $data['sms_api_password'] = str_rp(trim($_POST['sms_api_password']));
         $data['smtp_server'] = str_rp(trim($_POST['smtp_server']));
         $data['smtp_username'] = str_rp(trim($_POST['smtp_username']));
         $data['smtp_password'] = str_rp(trim($_POST['smtp_password']));
         $data['cancel_task_punish'] = floatval($_POST['cancel_task_punish']);
         $data['gain_purchase_cost'] = floatval($_POST['gain_purchase_cost']);
         $data['self_bargain_cost'] = floatval($_POST['self_bargain_cost']);
         $data['plan_cost'] = floatval($_POST['plan_cost']);
         $data['tax_rate'] = intval($_POST['tax_rate']);
         $data['website_bonus'] = intval($_POST['website_bonus']);
         $data['min_pass_score'] = intval($_POST['min_pass_score']);
         $data['arbitrate_time'] = intval($_POST['arbitrate_time']);
         $data['weixin_adv_notice'] = str_rp(trim($_POST['weixin_adv_notice']));
         $data['weixin_notice'] = str_rp(trim($_POST['weixin_notice']));
         $data['site_address'] = str_rp(trim($_POST['site_address']));
         $data['icp_number'] = str_rp(trim($_POST['icp_number']));
         $data['statistics_code'] = str_replace('\'', ''', $_POST['statistics_code']);
         //htmlspecialchars(trim($_POST['statistics_code']));
         $data['time_zone'] = str_rp(trim($_POST['time_zone']));
         $data['site_status'] = str_rp($_POST['site_status']);
         $data['closed_reason'] = str_replace('\'', ''', $_POST['closed_reason']);
         $data['site_footer'] = str_replace('\'', ''', $_POST['site_footer']);
         $data['subdomain_status'] = $_POST['subdomain_status'] ? $_POST['subdomain_status'] : 0;
         $data['subdomain_refuse'] = str_rp(trim($_POST['subdomain_refuse']));
         $data['sina_weibo'] = str_rp(trim($_POST['sina_weibo']));
         $data['tencent_weibo'] = str_rp(trim($_POST['tencent_weibo']));
         $data['mobile_web_href'] = trim($_POST['mobile_web_href']);
         $data['gome_web_href'] = trim($_POST['gome_web_href']);
         $data['jd_web_href'] = trim($_POST['jd_web_href']);
         $data['taobao_web_href'] = trim($_POST['taobao_web_href']);
         $data['distributor_discount'] = str_rp(trim($_POST['distributor_discount']));
         foreach ($data as $key => $val) {
             $val = is_array($val) ? serialize($val) : $val;
             $Setting->where(array('name' => $key))->save(array('value' => $val));
         }
         //写入缓存
         $params = array();
         $list = $Setting->getField('name,value');
         foreach ($list as $key => $val) {
             $params[$key] = unserialize($val) ? unserialize($val) : $val;
         }
         F('setting', $params);
         $this->success("设置成功");
         exit;
     } else {
         if (F('setting') === false) {
             $params = array();
             $list = $Setting->getField('name,value');
             foreach ($list as $key => $val) {
                 $params[$key] = unserialize($val) ? unserialize($val) : $val;
             }
             F('setting', $params);
             $vo = $params;
         } else {
             $vo = F('setting');
         }
         $this->assign('vo', $vo);
         $this->display();
     }
 }
コード例 #18
0
 public function curd()
 {
     if (IS_AJAX) {
         echo '错误!';
     } elseif (IS_POST) {
         $id = intval($_POST['notice_id']);
         $data['notice_title'] = str_rp(trim($_POST['notice_title']));
         $data['notice_type'] = intval($_POST['notice_type']);
         $data['notice_url'] = str_rp(trim($_POST['notice_url']));
         $data['notice_title'] = str_rp(trim($_POST['notice_title']));
         $data['notice_keyword'] = str_rp(trim($_POST['notice_keyword']));
         $data['notice_desc'] = str_rp(trim($_POST['notice_desc']));
         $data['notice_sort'] = intval($_POST['notice_sort']);
         $data['notice_status'] = intval($_POST['notice_status']);
         $data['notice_content'] = str_replace('\'', ''', $_POST['notice_content']);
         $data['notice_time'] = NOW_TIME;
         $arc_img = 'sa_' . $data['notice_time'];
         //图片上传
         if ($_FILES['notice_pic']['size']) {
             if ($id) {
                 //删除图片
                 $notice_pic = $this->model->where(array('notice_id' => $id))->getField('notice_pic');
                 if ($notice_pic) {
                     @unlink(BasePath . '/Uploads/' . $notice_pic);
                 }
             }
             $param = array('savePath' => 'notice/', 'subName' => '', 'files' => $_FILES['notice_pic'], 'saveName' => $arc_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['notice_pic'] = $up_return;
             }
         }
         if ($id) {
             $res = $this->model->where(array('notice_id' => $id))->save($data);
         } else {
             $res = $this->model->add($data);
             $id = $res;
         }
         if ($res) {
             //search处理
             $search['url'] = U('Notice/detail', array('id' => $id));
             $search['title'] = $data['notice_title'];
             $search['keywords'] = $data['notice_keywordword'];
             $search['description'] = $data['notice_desc'];
             $search['img'] = $up_return;
             $search_id = $this->model->where(array('notice_id' => $id))->getField('search_id');
             if (empty($search_id)) {
                 $search_id = '';
             }
             $search_id = addSearch($search['url'], $search['title'], $search['keywords'], $search['description'], $search_id, $search['img']);
             $this->model->where(array('notice_id' => $id))->setField('search_id', $search_id);
             $this->success('操作成功', U('index'));
         } else {
             $this->error('操作失败');
         }
     } elseif (IS_GET) {
         $id = intval($_GET['id']);
         $info = $this->model->where(array('notice_id' => $id))->find();
         $this->assign('info', $info);
         $this->display();
     }
 }
コード例 #19
0
ファイル: GoodsController.class.php プロジェクト: noikiy/sryy
 public function goods_edit()
 {
     $goods_id = intval($_REQUEST['goods_id']);
     if (IS_POST) {
         $data = array();
         $data['gc_id'] = intval($_POST['gc_id']);
         $data['goods_name'] = str_rp(trim($_POST['goods_name']));
         $data['goods_desc'] = str_rp(trim($_POST['goods_desc']));
         $data['goods_url'] = str_rp(trim($_POST['goods_url']));
         $data['goods_storage'] = intval($_POST['goods_storage']);
         $data['goods_serial'] = str_rp(trim($_POST['goods_serial']));
         $data['goods_price'] = price_format(trim($_POST['goods_store_price']));
         $data['goods_sort'] = intval($_POST['goods_sort']);
         $data['goods_body'] = str_replace('\'', ''', $_POST['goods_body']);
         $data['add_time'] = NOW_TIME;
         //图片上传
         if (!empty($_FILES['goods_pic']['name'])) {
             $goods_img = 'g_' . $data['add_time'];
             $gd = $this->model->where('goods_id=' . $goods_id)->find();
             if ($gd['goods_pic']) {
                 $old_pic = BasePath . '/Uploads/' . $gd['goods_pic'];
                 unlink($old_pic);
             }
             $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES['goods_pic'], 'saveName' => $goods_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['goods_pic'] = $up_return;
             }
         }
         /*			$img1 = trim($_POST['img1']);
         			$img2 = trim($_POST['img2']);
         			$img3 = trim($_POST['img3']);
         			$img4 = trim($_POST['img4']);
         			$data['goods_pic'] = $img1;
         			$goods_pic_more = '';
         			if($img2)$goods_pic_more .= $img2.',';
         			if($img3)$goods_pic_more .= $img3.',';
         			if($img4)$goods_pic_more .= $img4.',';
         			if($goods_pic_more)$goods_pic_more = substr($goods_pic_more,0,-1);
         			$data['goods_pic_more'] = $goods_pic_more;*/
         $return = $this->model->where('goods_id=' . $goods_id)->save($data);
         if ($return) {
             $this->success('操作成功', U('goods'));
             exit;
         } else {
             $this->error('操作失败');
         }
     } else {
         /**
          * 父类列表
          */
         $class_list = getTreeClassList(3);
         if (is_array($class_list)) {
             foreach ($class_list as $k => $v) {
                 $class_list[$k]['gc_name'] = str_repeat(" ", $v['deep'] * 2) . '├ ' . $v['gc_name'];
             }
         }
         $rs = $this->model->where('goods_id=' . $goods_id)->find();
         /*$img_more_arr = explode(',',$rs['goods_pic_more']);	
         		$rs['img2'] = $img_more_arr[0];
         		$rs['img3'] = $img_more_arr[1];
         		$rs['img4'] = $img_more_arr[2];
         		$rs['gd_mr'] = 'common/gd_mr.gif';
         		*/
         $this->assign('rs', $rs);
         //规格
         $spec_list = D('Spec')->relation('SpecValue')->where('sp_show=1')->order('sp_sort asc')->select();
         //相册
         $ac_list = M('AlbumClass')->order('aclass_sort asc')->select();
         $pc_list = M('AlbumPic')->where('aclass_id=1')->order('upload_time asc')->select();
         $this->assign('ac_list', $ac_list);
         $this->assign('pc_list', $pc_list);
         $this->assign('spec_list', $spec_list);
         $this->assign('class_list', $class_list);
         $this->display();
     }
 }
コード例 #20
0
ファイル: SharingController.class.php プロジェクト: noikiy/oa
 public function share()
 {
     if (IS_POST) {
         if (empty($_POST)) {
             $this->error('非法操作');
         }
         $share = array('share_title' => trim($_POST['article_title']), 'share_user_id' => isLogin(), 'share_time' => NOW_TIME, 'share_status' => 1, 'share_remark' => trim($_POST['share_remark']));
         if (!empty(intval($_POST['share_id']))) {
             $id = intval($_POST['share_id']);
             $this->modS->where(array('share_id' => $id))->save($share);
         } else {
             $id = $this->modS->add($share);
         }
         if ($id) {
             if (!empty($_FILES)) {
                 $param = array('savePath' => 'share/', 'subName' => isLogin(), 'exts' => '', 'files' => $_FILES['article_pic'], 'saveName' => '', 'saveExt' => '');
                 $path = upload_one($param);
                 if ($path != 'error') {
                     $res = $this->modS->where(array('share_id' => $id))->setField('share_file', $path);
                 } else {
                     $this->modS->where(array('share_id' => $id))->delete();
                     $this->error('文件上传失败');
                     die;
                 }
             }
             $user = $_POST['user'];
             foreach ($user as $key => $val) {
                 $dataList[$key] = array('share_id' => $id, 'user_id' => $val);
             }
             M('ShareStatus')->addAll($dataList);
             $this->success('共享文件成功', U('shareList'));
         }
     } else {
         /* $id = intval($_GET['id']);
         			if (!empty($id)) {
         				$info = $this->modE->where(array('email_id'=>$id))->find();
         				$this->info = $info;
         				$this->title = '编辑任务';;
         			}else {
         				$this->title = '添加任务';
         			} */
         $this->depart = M('AuthGroup')->where(array('status' => 1))->field(array('id', 'title'))->select();
         $user = D('AdminView')->where(array('admin_id' => array('neq', isLogin())))->field(array('admin_id', 'admin_name', 'title'))->group('uid')->select();
         $this->user = $user;
         $this->title = '共享文件';
         $this->display();
     }
 }
コード例 #21
0
 public function goods_edit()
 {
     $goods_id = intval($_REQUEST['goods_id']);
     if (IS_POST) {
         $data = array();
         $data['gc_id'] = intval($_POST['gc_id']);
         $data['goods_name'] = str_rp(trim($_POST['goods_name']));
         $data['goods_key'] = str_rp(trim($_POST['goods_key']));
         $data['goods_desc'] = str_rp(trim($_POST['goods_desc']));
         $data['goods_url'] = str_rp(trim($_POST['goods_url']));
         $data['goods_storage'] = intval($_POST['goods_storage']);
         $data['goods_serial'] = str_rp(trim($_POST['goods_serial']));
         $data['goods_price'] = price_format(trim($_POST['goods_price']));
         $data['goods_sort'] = intval($_POST['goods_sort']);
         $data['goods_body'] = str_replace('\'', ''', $_POST['goods_body']);
         $data['add_time'] = NOW_TIME;
         if (!empty($_POST['tag']) && is_array($_POST['tag'])) {
             $tag = '|';
             foreach ($_POST['tag'] as $key => $val) {
                 $tag .= $val . '|';
             }
             $data['tag'] = $tag;
         } else {
             $data['tag'] = '';
         }
         $data['goods_status'] = intval($_POST['goods_status']);
         $data['show_index'] = intval($_POST['show_index']);
         $data['goods_profile'] = serialize(array_filter($_POST['more_address']));
         //图片上传
         if (!empty($_FILES['goods_pic']['name'])) {
             $goods_img = 'g_' . $data['add_time'];
             $gd = $this->model->where('goods_id=' . $goods_id)->find();
             if ($gd['goods_pic']) {
                 $old_pic = BasePath . '/Uploads/' . $gd['goods_pic'];
                 unlink($old_pic);
             }
             $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES['goods_pic'], 'saveName' => $goods_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['goods_pic'] = $up_return;
             }
         }
         $return = $this->model->where('goods_id=' . $goods_id)->save($data);
         if ($return) {
             //规格处理
             $GoodsSpec = M('GoodsSpec');
             $spec_val = $_POST['s_value'];
             if (is_array($spec_val) && !empty($spec_val)) {
                 $GoodsSpec->where('goods_id=' . $goods_id)->delete($data);
                 // 删除原来的规格
                 foreach ($spec_val as $k => $val) {
                     $val['sort'] = intval($val['sort']);
                     $val['name'] = trim($val['name']);
                     $val['price'] = trim($val['price']);
                     if ($val['name'] && $val['price']) {
                         /**
                          * 新增规格值
                          */
                         $val_add = array();
                         $val_add['goods_id'] = $goods_id;
                         $val_add['spec_name'] = trim($val['name']);
                         $val_add['spec_goods_price'] = price_format(trim($val['price']));
                         $val_add['spec_goods_sort'] = intval($val['sort']);
                         $return = $GoodsSpec->add($val_add);
                         unset($val_add);
                     }
                 }
                 //更新商品列表默认规格信息
                 $df_spec = M('GoodsSpec')->where('goods_id=' . $goods_id)->order('spec_goods_price asc')->find();
                 if (is_array($df_spec) && !empty($df_spec)) {
                     $spec_data = array();
                     $spec_data['spec_id'] = $df_spec['spec_id'];
                     $spec_data['spec_name'] = $df_spec['spec_name'];
                     $spec_data['goods_price'] = $df_spec['spec_goods_price'];
                     $this->model->where('goods_id=' . $goods_id)->save($spec_data);
                 }
             } else {
                 $spec_data = array();
                 $spec_data['spec_id'] = 0;
                 $spec_data['spec_name'] = '';
                 $this->model->where('goods_id=' . $goods_id)->save($spec_data);
                 $GoodsSpec->where('goods_id=' . $goods_id)->delete($data);
                 // 删除原来的规格
             }
             //商品多图片处理
             $GoodsPic = M('GoodsPic');
             $pic_val = $_POST['s_pic'];
             if (is_array($pic_val) && !empty($pic_val)) {
                 $pic_data = array();
                 $n = 1;
                 foreach ($pic_val as $p => $pv) {
                     $pic_data['p_sort'] = intval($pv['sort']);
                     $pic_data['goods_id'] = $goods_id;
                     $pic_name = 's_pic_' . $p;
                     if ($_FILES[$pic_name]['size'] > 0) {
                         $goods_img = 'g_' . $goods_id . '_' . $n . '_' . NOW_TIME;
                         $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES[$pic_name], 'saveName' => $goods_img, 'saveExt' => '');
                         $up_return = upload_one($param);
                         if ($up_return == 'error') {
                             $this->error('图片上传失败');
                             exit;
                         } else {
                             $pic_data['pic'] = $up_return;
                         }
                         $GoodsPic->add($pic_data);
                     }
                     $n++;
                 }
             }
             //图片处理END
             $this->success('操作成功', U('goods'));
             exit;
         } else {
             $this->error('操作失败');
         }
     } else {
         /**
          * 父类列表
          */
         $class_list = getTreeClassList(3);
         if (is_array($class_list)) {
             foreach ($class_list as $k => $v) {
                 $class_list[$k]['gc_name'] = str_repeat(" ", $v['deep'] * 2) . '├ ' . $v['gc_name'];
             }
         }
         $rs = $this->model->where('goods_id=' . $goods_id)->find();
         if (!empty($rs['tag'])) {
             $rs['tag'] = substr($rs['tag'], 1, -1);
             $rs['tag'] = explode('|', $rs['tag']);
         }
         $rs['goods_profile'] = unserialize($rs['goods_profile']);
         $rs['numAdd'] = count($rs['goods_profile']);
         $rs['goods_pic_more'] = unserialize($rs['goods_pic_more']);
         $rs['numMorepic'] = count($rs['goods_pic_more']);
         $this->assign('rs', $rs);
         $tag = $this->tagClassMod->relation(true)->order('tc_sort desc')->select();
         $this->assign('tag_list', $tag);
         $this->assign('rs', $rs);
         //规格
         $spec_list = M('GoodsSpec')->where('goods_id=' . $goods_id)->order('spec_goods_sort asc')->select();
         //多图片
         $pic_list = M('GoodsPic')->where('goods_id=' . $goods_id)->order('p_sort asc')->select();
         //常用城市
         $this->city_list = D('District')->where('usetype=1')->order('d_sort desc')->select();
         //相册
         $ac_list = M('AlbumClass')->order('aclass_sort asc')->select();
         $pc_list = M('AlbumPic')->where('aclass_id=1')->order('upload_time asc')->select();
         $this->assign('ac_list', $ac_list);
         $this->assign('pc_list', $pc_list);
         $this->assign('spec_list', $spec_list);
         $this->assign('spec_list_i', count($spec_list) + 1);
         $this->assign('pic_list', $pic_list);
         $this->assign('pic_list_i', count($pic_list) + 1);
         $this->assign('class_list', $class_list);
         $this->display();
     }
 }
コード例 #22
0
 public function base_information()
 {
     $Setting = M('Setting');
     if (IS_POST) {
         $data = array();
         if (!empty($_FILES['site_logo']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['site_logo'], 'saveName' => 'site_logo', 'saveExt' => '');
             //$up_return = upload_one($param);
             $up_return = upload_one_thumb($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['site_logo'] = $up_return;
             }
         }
         if (!empty($_FILES['member_logo']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['member_logo'], 'saveName' => 'member_logo', 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['member_logo'] = $up_return;
             }
         }
         if (!empty($_FILES['seller_logo']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['seller_logo'], 'saveName' => 'seller_logo', 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['seller_logo'] = $up_return;
             }
         }
         if (!empty($_FILES['weixin_qrcode']['name'])) {
             $param = array('savePath' => 'common/', 'subName' => '', 'files' => $_FILES['weixin_qrcode'], 'saveName' => 'weixin_qrcode', 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['weixin_qrcode'] = $up_return;
             }
         }
         $data['site_name'] = trim($_POST['site_name']);
         $data['weixin_account'] = trim($_POST['weixin_account']);
         $data['icp_number'] = trim($_POST['icp_number']);
         $data['statistics_code'] = htmlspecialchars(trim($_POST['statistics_code']));
         $data['time_zone'] = trim($_POST['time_zone']);
         $data['site_status'] = $_POST['site_status'];
         $data['closed_reason'] = $_POST['closed_reason'];
         $data['subdomain_status'] = $_POST['subdomain_status'] ? $_POST['subdomain_status'] : 0;
         $data['subdomain_refuse'] = trim($_POST['subdomain_refuse']);
         foreach ($data as $key => $val) {
             $val = is_array($val) ? serialize($val) : $val;
             $Setting->where(array('name' => $key))->save(array('value' => $val));
         }
         //写入缓存
         $params = array();
         $list = $Setting->getField('name,value');
         foreach ($list as $key => $val) {
             $params[$key] = unserialize($val) ? unserialize($val) : $val;
         }
         F('setting', $params);
         $this->success("设置成功");
         exit;
     } else {
         if (F('setting') === false) {
             $params = array();
             $list = $Setting->getField('name,value');
             foreach ($list as $key => $val) {
                 $params[$key] = unserialize($val) ? unserialize($val) : $val;
             }
             F('setting', $params);
             $vo = $params;
         } else {
             $vo = F('setting');
         }
         $this->assign('vo', $vo);
         $this->display();
     }
 }
コード例 #23
0
 public function curd()
 {
     if (IS_AJAX) {
         echo '错误!';
     } elseif (IS_POST) {
         $id = intval($_POST['article_id']);
         $data['article_title'] = str_rp(trim($_POST['article_title']));
         $data['ac_type'] = str_rp(trim($_POST['ac_type']));
         $data['article_url'] = str_rp(trim($_POST['article_url']));
         $data['seo_title'] = str_rp(trim($_POST['seo_title']));
         $data['seo_key'] = str_rp(trim($_POST['seo_key']));
         $data['seo_desc'] = str_rp(trim($_POST['seo_desc']));
         $data['article_sort'] = intval($_POST['article_sort']);
         $data['article_show'] = intval($_POST['article_show']);
         $data['article_content'] = str_replace('\'', ''', $_POST['article_content']);
         $data['article_time'] = NOW_TIME;
         $data['to_type'] = intval($_POST['to_type']);
         $arc_img = 'sa_' . $data['article_time'];
         //图片上传
         if ($_FILES['article_pic']['size']) {
             if ($id) {
                 //删除图片
                 $article_pic = $this->model->where(array('article_id' => $id))->getField('article_pic');
                 if ($article_pic) {
                     @unlink(BasePath . '/Uploads/' . $article_pic);
                 }
             }
             $param = array('savePath' => 'artic/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $arc_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['article_pic'] = $up_return;
             }
         }
         if ($id) {
             $res = $this->model->where(array('article_id' => $id))->save($data);
         } else {
             $res = $this->model->add($data);
         }
         if ($res) {
             $this->success('操作成功', U('index'));
         } else {
             $this->error('操作失败');
         }
     } elseif (IS_GET) {
         $id = intval($_GET['id']);
         $info = $this->model->where(array('article_id' => $id))->find();
         $this->assign('info', $info);
         $this->display();
     }
 }
コード例 #24
0
 public function wx_info_edit()
 {
     if (IS_POST) {
         $wx_id = intval($_POST['wx_id']);
         $data = array();
         $data['wx_title'] = str_rp(trim($_POST['wx_title']));
         $data['wx_url'] = str_rp(trim($_POST['wx_url']));
         $data['wx_sort'] = intval($_POST['wx_sort']);
         $data['wx_desc'] = str_rp(trim($_POST['wx_desc']));
         $data['wx_addtime'] = NOW_TIME;
         $wx_img = 'wx_' . $data['wx_addtime'];
         //图片上传
         if (!empty($_FILES['wx_img']['name'])) {
             $param = array('savePath' => 'artic/', 'subName' => '', 'files' => $_FILES['wx_img'], 'saveName' => $wx_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['wx_img'] = $up_return;
             }
         }
         $rest = M('WxInfo')->where('wx_id=' . $wx_id)->save($data);
         if ($rest) {
             $this->success('操作成功', U('wx_info'));
             exit;
         } else {
             $this->error('操作失败');
         }
     } else {
         $wx_id = intval($_GET['wx_id']);
         $this->vo = M('WxInfo')->where('wx_id=' . $wx_id)->find();
         $this->display('wx_info_edit');
     }
 }
コード例 #25
0
 public function admin_list()
 {
     $Admin = M('Admin');
     $op = trim($_GET['op']) ? trim($_GET['op']) : 'list';
     switch ($op) {
         case 'list':
             $list = $Admin->where(array('admin_id' => isLogin()))->select();
             $this->assign('list', $list);
             $this->display();
             break;
         case 'del':
             $admin_id = intval($_GET['admin_id']);
             if ($admin_id && $admin_id != 1) {
                 $Admin->where('admin_id=' . $admin_id)->delete();
                 $this->success("删除成功", U('admin_list'));
                 exit;
             }
             break;
         case 'edit':
             if (IS_POST) {
                 $admin_id = intval($_POST['admin_id']);
                 $admin_pwd = re_md5(trim($_POST['admin_pwd']));
                 $Admin->where('admin_id=' . $admin_id)->setField('admin_pwd', $admin_pwd);
                 if (!empty($_FILES)) {
                     $filename = 'sign_' . $admin_id;
                     $param = array('savePath' => 'signature/', 'subName' => '', 'files' => $_FILES['sign_pic'], 'saveName' => $filename, 'saveExt' => '', 'replace' => true);
                     $path = upload_one($param);
                     $image = new \Think\Image();
                     $image->open('./Uploads/' . $path);
                     $image->thumb(150, 150)->save('./Uploads/' . $path);
                     $Admin->where(array('admin_id' => $admin_id))->setField('admin_signature', $path);
                 }
                 $this->success("操作成功", U('admin_list'));
                 exit;
             } else {
                 $admin_id = intval($_GET['admin_id']);
                 $vo = $Admin->where('admin_id=' . $admin_id)->find();
                 $this->assign('vo', $vo);
                 $this->display('admin_edit');
             }
             break;
         case 'add':
             if (IS_POST) {
                 $data = array();
                 $data['admin_name'] = trim($_POST['admin_name']);
                 $data['admin_pwd'] = re_md5(trim($_POST['admin_pwd']));
                 $data['admin_lg_time'] = NOW_TIME;
                 $data['admin_lg_ip'] = get_client_ip();
                 $Admin->add($data);
                 $this->success("添加成功", U('admin_list'));
                 exit;
             } else {
                 $this->display('admin_add');
             }
             break;
     }
 }
コード例 #26
0
 public function storeclass_edit()
 {
     $StoreClass = M('StoreClass');
     if (IS_POST && intval($_POST['class_id'])) {
         $class_id = intval($_POST['class_id']);
         $data = array();
         $data['class_name'] = trim($_POST['class_name']);
         $data['class_pid'] = intval($_POST['class_pid']);
         $data['class_sort'] = intval($_POST['class_sort']);
         $data['class_recommend'] = intval($_POST['class_recommend']);
         $StoreClass->where('class_id=' . $class_id)->save($data);
         if (!empty($_FILES['class_img']['name']) && $class_id) {
             $param = array('savePath' => 'storeclass/', 'subName' => '', 'files' => $_FILES['class_img'], 'saveName' => 'sc_' . $class_id, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $StoreClass->where('class_id=' . $class_id)->setField('class_img', $up_return);
             }
         }
         $this->success("添加成功", U('storeclass'));
         exit;
     } else {
         $class_id = intval($_GET['class_id']);
         if ($class_id) {
             $p_class = $StoreClass->where('class_pid=0')->order('class_sort asc')->select();
             $vo = $StoreClass->where('class_id=' . $class_id)->find();
             $this->assign('vo', $vo);
             $this->assign('p_class', $p_class);
             $this->display();
         }
     }
 }
コード例 #27
0
ファイル: AlbumController.class.php プロジェクト: noikiy/oa
 public function replace_img_upload()
 {
     if (IS_POST && intval($_POST['apic_id'])) {
         $apic_id = intval($_POST['apic_id']);
         $rs = $this->ap_mod->where('apic_id=' . $apic_id)->find();
         //删除原图
         $apic_cover = $rs['apic_cover'];
         if ($apic_cover) {
             $del_img = BasePath . '/Uploads/' . $apic_cover;
             $del_img = iconv('gb2312', 'utf-8', $del_img);
             @unlink($del_img);
         }
         //$apic_cover_arr = explode('.',$rs['apic_cover']);
         //$apic_type = $apic_cover_arr[1];
         /**
          * 上传新图片
          */
         $param = array('savePath' => 'goods/', 'subName' => '', 'files' => $_FILES['file'], 'saveName' => '', 'saveExt' => '');
         $result = upload_one($param);
         if ($result == 'error') {
             $this->error('操作失败');
         } else {
             $data = array();
             $data['apic_name'] = $_FILES['file']['name'];
             $data['apic_cover'] = $result;
             $data['apic_size'] = intval($_FILES['file']['size']);
             $data['upload_time'] = NOW_TIME;
             $this->ap_mod->where('apic_id=' . $apic_id)->save($data);
             $url = U('Album/album_pic', array('aclass_id' => $rs['aclass_id']));
             echo '<script language="javascript" type="text/javascript">parent.location.href="' . $url . '";</script>';
             //$this->success("操作成功",U('Album/album_pic',array('aclass_id'=>$rs['aclass_id'])));
             //exit;
         }
     } else {
         $this->assign('apic_id', intval($_GET['apic_id']));
         $this->display();
     }
 }
コード例 #28
0
 public function report()
 {
     $this->reportMod = D('Report');
     if (IS_POST) {
         $data['rp_class_id'] = intval($_POST['rp_class_id']);
         $data['order_sn'] = str_rp(trimall($_POST['order_sn']));
         $data['content'] = str_rp(trim($_POST['content']));
         $data['addtime'] = NOW_TIME;
         $where['order_sn'] = $data['order_sn'];
         $where['member_id'] = $this->mid;
         $data['seller_id'] = M('Order')->where($where)->getField('member_id');
         $data['member_id'] = $this->mid;
         $data['from_to'] = 1;
         $data['handle_status'] = 0;
         if ($data['member_id']) {
             $map['order_sn'] = $data['order_sn'];
             $map['from_to'] = 1;
             $count = $this->reportMod->where($map)->count();
             if ($count) {
                 $this->error('您已经提交过相关申诉,请耐心等待.');
                 die;
             }
             //图片上传
             if (!empty($_FILES['pic']['size'])) {
                 $arc_img = NOW_TIME . '_' . nonce_str(8, 1, 1, 1);
                 $param = array('savePath' => 'report/' . $data['order_sn'] . '/', 'subName' => '', 'files' => $_FILES['pic'], 'saveName' => $arc_img, 'saveExt' => '');
                 $up_return = upload_one($param);
                 if ($up_return == 'error') {
                     $this->error('图片上传失败');
                     exit;
                 } else {
                     $data['report_pic'] = $up_return;
                 }
             }
             $res = $this->reportMod->add($data);
             if ($res) {
                 $detail['report_id'] = $res;
                 $detail['content'] = '会员对卖家发起申诉';
                 $detail['addtime'] = NOW_TIME;
                 M('ReportDetail')->add($detail);
                 $this->success('申诉成功.', U('progress', array('sn' => $data['order_sn'])));
             } else {
                 $this->error('抱歉,申诉申请失败.请联系客服.');
             }
         } else {
             $this->error('抱歉,没有相关订单信息.');
         }
     } elseif (IS_GET) {
         $this->classModel = M('ReportClass');
         $rp_class = $this->classModel->where(array('rp_class_belong' => 2))->order('rp_class_sort desc')->select();
         $this->assign('rp_class', $rp_class);
         $this->h3_title = '发起新的申诉';
         $this->assign('h3_text', '申诉任务');
         $this->display();
     }
 }
コード例 #29
0
ファイル: ArticleController.class.php プロジェクト: noikiy/oa
 public function article_edit()
 {
     if (IS_POST) {
         $article_id = intval($_POST['article_id']);
         $data = array();
         $data['article_title'] = trim($_POST['article_title']);
         $data['ac_id'] = intval($_POST['ac_id']);
         $data['article_desc'] = trim($_POST['article_desc']);
         $data['article_url'] = trim($_POST['article_url']);
         $data['article_show'] = intval($_POST['article_show']);
         $data['article_sort'] = intval($_POST['article_sort']);
         $data['article_content'] = str_replace('\'', '&#39;', $_POST['article_content']);
         $data['article_time'] = NOW_TIME;
         $arc_img = 'g_' . $data['article_time'];
         //图片上传
         if (!empty($_FILES['article_pic']['name'])) {
             $param = array('savePath' => 'artic/', 'subName' => '', 'files' => $_FILES['article_pic'], 'saveName' => $arc_img, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('图片上传失败');
                 exit;
             } else {
                 $data['article_pic'] = $up_return;
             }
         }
         $this->art->where('article_id=' . $article_id)->save($data);
         $this->success('操作成功', U('article'));
         exit;
     } else {
         $article_id = intval($_GET['article_id']);
         if ($article_id) {
             $vo = $this->art->where('article_id=' . $article_id)->find();
             $ac_list = $this->art_class->order('ac_sort asc')->select();
             $this->assign('vo', $vo);
             $this->assign('ac_list', $ac_list);
             $this->display('article_edit');
         }
     }
 }
コード例 #30
0
 public function addAccount()
 {
     if (IS_POST) {
         $data['member_id'] = $this->mid;
         $data['account_name'] = str_rp(trim($_POST['account_name']));
         $data['mobile'] = str_rp(trim($_POST['mobile']));
         $data['name'] = str_rp(trim($_POST['name']));
         $data['pf_id'] = intval($_POST['pf_id']);
         $data['province_id'] = intval($_POST['province_id']);
         $data['city_id'] = intval($_POST['city_id']);
         $data['area_id'] = intval($_POST['area_id']);
         $data['address'] = str_rp(trim($_POST['address']));
         $data['status'] = 0;
         //图片上传
         if ($_FILES['reputation_pic']['size']) {
             $fname = 'reputation_pic_' . $this->mid;
             $param = array('savePath' => 'member/' . $this->mid . '/', 'subName' => '', 'files' => $_FILES['reputation_pic'], 'saveName' => $fname, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('信誉等级图片上传失败');
                 exit;
             } else {
                 $data['reputation_pic'] = C('SiteUrl') . '/Uploads/' . $up_return;
             }
         } else {
             $this->error('请上传信誉等级图片');
         }
         //图片上传
         if ($_FILES['auth_pic']['size']) {
             $fname = 'auth_pic_' . $this->mid;
             $param = array('savePath' => 'member/' . $this->mid . '/', 'subName' => '', 'files' => $_FILES['auth_pic'], 'saveName' => $fname, 'saveExt' => '');
             $up_return = upload_one($param);
             if ($up_return == 'error') {
                 $this->error('实名认证图片上传失败');
                 exit;
             } else {
                 $data['auth_pic'] = C('SiteUrl') . '/Uploads/' . $up_return;
             }
         } else {
             $this->error('请上传实名认证图片');
         }
         $res = M('MemberAccount')->add($data);
         if ($res) {
             $this->success('绑定新的账号成功,请等待审核通过.', U('accountList'));
         } else {
             $this->error('绑定新的账号失败');
         }
     } elseif (IS_GET) {
         $this->province = M('district')->where(array('level' => 1))->order('d_sort asc')->select();
         $this->assign('h3_text', '新增账号');
         $this->display();
     }
 }