コード例 #1
0
ファイル: systemseller.php プロジェクト: yongge666/sunupedu
 /**
  * @brief 商家登录动作
  */
 public function login()
 {
     $seller_name = IFilter::act(IReq::get('username'));
     $password = IReq::get('password');
     $message = '';
     if ($seller_name == '') {
         $message = '登录名不能为空';
     } else {
         if ($password == '') {
             $message = '密码不能为空';
         } else {
             $sellerObj = new IModel('seller');
             $sellerRow = $sellerObj->getObj('seller_name = "' . $seller_name . '" and is_del = 0 and is_lock = 0');
             if ($sellerRow && $sellerRow['password'] == md5($password)) {
                 $dataArray = array('login_time' => ITime::getDateTime());
                 $sellerObj->setData($dataArray);
                 $where = 'id = ' . $sellerRow["id"];
                 $sellerObj->update($where);
                 //存入私密数据
                 ISafe::set('seller_id', $sellerRow['id']);
                 ISafe::set('seller_name', $sellerRow['seller_name']);
                 ISafe::set('seller_pwd', $sellerRow['password']);
                 $this->redirect('/seller/index');
             } else {
                 $message = '用户名与密码不匹配';
             }
         }
     }
     if ($message != '') {
         $this->redirect('index', false);
         Util::showMessage($message);
     }
 }
コード例 #2
0
ファイル: pic.php プロジェクト: chenyongze/iwebshop
 function uploadFile()
 {
     //上传状态
     $state = false;
     //规格索引值
     $specIndex = IReq::get('specIndex');
     if ($specIndex === null) {
         $message = '没有找到规格索引值';
     } else {
         //本地上传方式
         if (isset($_FILES['attach']) && $_FILES['attach']['name'][0] != '') {
             $photoInfo = $this->upload();
             if ($photoInfo['flag'] == 1) {
                 $fileName = $photoInfo['dir'] . $photoInfo['name'];
                 $state = true;
             }
         } else {
             if ($fileName = IReq::get('outerSrc', 'post')) {
                 $state = true;
             } else {
                 if ($fileName = IReq::get('selectPhoto', 'post')) {
                     $state = true;
                 }
             }
         }
     }
     //根据状态值进行
     if ($state == true) {
         $this->actJs($specIndex, $fileName);
     } else {
         $message = '添加图片失败';
         $this->redirect('/block/pic', false);
         Util::showMessage($message);
     }
 }
コード例 #3
0
ファイル: systemadmin.php プロジェクト: chenyongze/iwebshop
 function login_act()
 {
     $admin_name = IFilter::act(IReq::get('admin_name'));
     $password = IReq::get('password');
     $captcha = IReq::get('captcha', 'post');
     $message = '';
     if ($admin_name == '') {
         $message = '登录名不能为空';
     } else {
         if ($password == '') {
             $message = '密码不能为空';
         } else {
             if ($captcha != ISafe::get('Captcha')) {
                 $message = '验证码输入不正确';
             } else {
                 $adminObj = new IModel('admin');
                 $adminRow = $adminObj->getObj('admin_name = "' . $admin_name . '"');
                 if (!empty($adminRow) && $adminRow['password'] == md5($password) && $adminRow['is_del'] == 0) {
                     $dataArray = array('last_ip' => IClient::getIp(), 'last_time' => ITime::getDateTime());
                     $adminObj->setData($dataArray);
                     $where = 'id = ' . $adminRow["id"];
                     $adminObj->update($where);
                     //根据角色分配权限
                     if ($adminRow['role_id'] == 0) {
                         ISafe::set('admin_right', 'administrator');
                         ISafe::set('admin_role_name', '超级管理员');
                     } else {
                         $roleObj = new IModel('admin_role');
                         $where = 'id = ' . $adminRow["role_id"] . ' and is_del = 0';
                         $roleRow = $roleObj->getObj($where);
                         ISafe::set('admin_right', $roleRow['rights']);
                         ISafe::set('admin_role_name', $roleRow['name']);
                     }
                     ISafe::set('admin_id', $adminRow['id']);
                     ISafe::set('admin_name', $adminRow['admin_name']);
                     ISafe::set('admin_pwd', $adminRow['password']);
                     $this->redirect('/system/default');
                 } else {
                     $message = '用户名与密码不匹配';
                 }
             }
         }
     }
     if ($message != '') {
         $this->admin_name = $admin_name;
         $this->redirect('index', false);
         Util::showMessage($message);
     }
 }
コード例 #4
0
ファイル: message.php プロジェクト: zhendeguoke1008/shop
 function registry_del()
 {
     $ids = IFilter::act(IReq::get('id'), 'int');
     if (empty($ids)) {
         $this->redirect('registry_list', false);
         Util::showMessage('请选择要删除的邮箱');
         exit;
     }
     if (is_array($ids)) {
         $ids = join(',', $ids);
     }
     $registryObj = new IModel('email_registry');
     $registryObj->del('id in (' . $ids . ')');
     $this->redirect('registry_list');
 }
コード例 #5
0
ファイル: ucenter.php プロジェクト: yongge666/sunupedu
 function trade_ticket()
 {
     $ticketId = IFilter::act(IReq::get('ticket_id', 'post'), 'int');
     $message = '';
     if (intval($ticketId) == 0) {
         $message = '请选择要兑换的代金券';
     } else {
         $nowTime = ITime::getDateTime();
         $ticketObj = new IModel('ticket');
         $ticketRow = $ticketObj->getObj('id = ' . $ticketId . ' and point > 0 and start_time <= "' . $nowTime . '" and end_time > "' . $nowTime . '"');
         if (empty($ticketRow)) {
             $message = '对不起,此代金券不能兑换';
         } else {
             $memberObj = new IModel('member');
             $where = 'user_id = ' . $this->user['user_id'];
             $memberRow = $memberObj->getObj($where, 'point');
             if ($ticketRow['point'] > $memberRow['point']) {
                 $message = '对不起,您的积分不足,不能兑换此类代金券';
             } else {
                 //生成红包
                 $dataArray = array('condition' => $ticketRow['id'], 'name' => $ticketRow['name'], 'card_name' => 'T' . IHash::random(8), 'card_pwd' => IHash::random(8), 'value' => $ticketRow['value'], 'start_time' => $ticketRow['start_time'], 'end_time' => $ticketRow['end_time'], 'is_send' => 1);
                 $propObj = new IModel('prop');
                 $propObj->setData($dataArray);
                 $insert_id = $propObj->add();
                 //用户prop字段值null时
                 $memberArray = array('prop' => ',' . $insert_id . ',');
                 $memberObj->setData($memberArray);
                 $result = $memberObj->update('user_id = ' . $this->user["user_id"] . ' and ( prop is NULL or prop = "" )');
                 //用户prop字段值非null时
                 if (!$result) {
                     $memberArray = array('prop' => 'concat(prop,"' . $insert_id . ',")');
                     $memberObj->setData($memberArray);
                     $result = $memberObj->update('user_id = ' . $this->user["user_id"], 'prop');
                 }
                 //代金券成功
                 if ($result) {
                     $pointConfig = array('user_id' => $this->user['user_id'], 'point' => '-' . $ticketRow['point'], 'log' => '积分兑换代金券,扣除了 -' . $ticketRow['point'] . '积分');
                     $pointObj = new Point();
                     $pointObj->update($pointConfig);
                 }
             }
         }
     }
     //展示
     if ($message != '') {
         $this->integral();
         Util::showMessage($message);
     } else {
         $this->redirect('redpacket');
     }
 }
コード例 #6
0
ファイル: comment.php プロジェクト: zhendeguoke1008/shop
 /**
  * @brief 显示咨询信息
  */
 function refer_edit()
 {
     $rid = intval(IReq::get('rid'));
     if (!$rid) {
         $this->refer_list();
         $msg = '没有找到相关记录!';
         Util::showMessage($msg);
         return false;
     }
     $tb_refer = new IModel('refer');
     $items = $tb_refer->query("id=" . $rid);
     if (is_array($items) && ($item = $items[0])) {
         if ($item['goods_id']) {
             $tb_goods = new IModel('goods');
             $data_goods = $tb_goods->query("id=" . $item['goods_id']);
             if ($data_goods && is_array($data_goods) && ($info = $data_goods[0])) {
                 $item['goods_name'] = $info['name'];
             }
         }
         if ($item['user_id']) {
             $tb_user = new IModel('user');
             $data_user = $tb_user->query("id=" . $item['user_id']);
             if ($data_user && is_array($data_user) && ($info = $data_user[0])) {
                 $item['user_name'] = $info['username'];
             }
         }
         if ($item['admin_id']) {
             $tb_admin = new IModel('admin');
             $data_admin = $tb_admin->query("id=" . $item['admin_id']);
             if ($data_admin && is_array($data_admin) && ($info = $data_admin[0])) {
                 $item['admin_name'] = $info['admin_name'];
             }
         }
         $this->refer = $item;
         $this->redirect('refer_edit');
     } else {
         $this->refer_list();
         $msg = '没有找到相关记录!';
         Util::showMessage($msg);
         return false;
     }
 }
コード例 #7
0
ファイル: comment.php プロジェクト: yongge666/sunupedu
 /**
  * @brief 显示讨论信息
  */
 function discussion_edit()
 {
     $did = intval(IReq::get('did'));
     if (!$did) {
         $this->discussion_list();
         return false;
     }
     $query = new IQuery("discussion as d");
     $query->join = "right join goods as goods on d.goods_id = goods.id left join user as u on d.user_id = u.id";
     $query->fields = "d.id,d.time,d.contents,u.id as userid,u.username,goods.id as goods_id,goods.name as goods_name";
     $query->where = "d.id=" . $did;
     $items = $query->find();
     if ($items) {
         $this->discussion = $items[0];
         $this->redirect('discussion_edit');
     } else {
         $this->discussion_list();
         $msg = '没有找到相关记录!';
         Util::showMessage($msg);
     }
 }
コード例 #8
0
ファイル: seller.php プロジェクト: yongge666/sunupedu
 /**
  * @brief 显示评论信息
  */
 function comment_edit()
 {
     $cid = IFilter::act(IReq::get('cid'), 'int');
     if (!$cid) {
         $this->comment_list();
         return false;
     }
     $query = new IQuery("comment as c");
     $query->join = "left join goods as goods on c.goods_id = goods.id left join user as u on c.user_id = u.id";
     $query->fields = "c.*,u.username,goods.name,goods.seller_id";
     $query->where = "c.id=" . $cid . " and goods.seller_id = " . $this->seller['seller_id'];
     $items = $query->find();
     if ($items) {
         $this->comment = current($items);
         $this->redirect('comment_edit');
     } else {
         $this->comment_list();
         $msg = '没有找到相关记录!';
         Util::showMessage($msg);
     }
 }
コード例 #9
0
ファイル: member.php プロジェクト: Wen1750686723/utao
 /**
  * @brief 保存用户组修改
  */
 function group_save()
 {
     $maxexp = IReq::get('maxexp');
     $minexp = IReq::get('minexp');
     if ($maxexp <= $minexp) {
         $errorMsg = '最大经验值必须大于最小经验值';
     }
     $group_id = (int) IReq::get('group_id', 'post');
     $form_array = array('user_group' => array(array('name' => 'group_name', 'field' => 'group_name', 'rules' => 'required'), array('name' => 'discount', 'field' => 'discount'), array('name' => 'minexp', 'field' => 'minexp'), array('name' => 'maxexp', 'field' => 'maxexp')));
     //验证表单
     $validationObj = new Formvalidation($form_array);
     $form_data = $validationObj->run();
     foreach ($form_data as $key => $value) {
         foreach ($value as $v) {
             $group[$v['name']] = $v['postdate'];
             $tb_model[$v['field']] = $v['postdate'];
         }
     }
     if ($validationObj->isError() || isset($errorMsg)) {
         //验证失败
         $this->data['group'] = $group;
         $this->setRenderData($this->data);
         //加载视图
         $this->redirect('group_edit', false);
         $errorMsg = isset($errorMsg) ? $errorMsg : $validationObj->getError();
         Util::showMessage($errorMsg);
     } else {
         //验证成功
         $tb_user_group = new IModel("user_group");
         $tb_user_group->setData($tb_model);
         if ($group_id) {
             $affected_rows = $tb_user_group->update("id=" . $group_id);
             if ($affected_rows) {
                 $this->redirect('group_list', false);
                 Util::showMessage('更新用户组成功!');
                 return;
             }
             $this->redirect('group_list', false);
         } else {
             $gid = $tb_user_group->add();
             $this->redirect('group_list', false);
             if ($gid) {
                 Util::showMessage('添加用户组成功!');
             } else {
                 Util::showMessage('添加用户组失败!');
             }
         }
     }
 }
コード例 #10
0
ファイル: brand.php プロジェクト: Wen1750686723/utao
 /**
  * @brief 删除品牌
  */
 function brand_del()
 {
     $brand_id = (int) IReq::get('bid');
     if ($brand_id) {
         $tb_brand = new IModel('brand');
         $where = "id=" . $brand_id;
         if ($tb_brand->del($where)) {
             $this->brand_list();
         } else {
             $this->brand_list();
             $msg = "没有找到相关分类记录!";
             Util::showMessage($msg);
         }
     } else {
         $this->brand_list();
         $msg = "没有找到相关品牌记录!";
         Util::showMessage($msg);
     }
 }
コード例 #11
0
ファイル: system.php プロジェクト: Wen1750686723/utao
 public function oauth_edit_act()
 {
     $id = IFilter::act(IReq::get('id'));
     if ($id == 0) {
         $this->redirect('oauth_list', false);
         Util::showMessage('请选择要修改的登录平台');
         exit;
     }
     $oauthDBObj = new IModel('oauth');
     $oauthRow = $oauthDBObj->getObj('id = ' . $id);
     if (empty($oauthRow)) {
         $this->redirect('oauth_list', false);
         Util::showMessage('请选择要修改的登录平台');
         exit;
     }
     $dataArray = array('name' => IFilter::act(IReq::get('name')), 'is_close' => IFilter::act(IReq::get('is_close')), 'description' => IFilter::act(IReq::get('description')), 'config' => array());
     //获取字段数据
     $oauthObj = new Oauth($id);
     $oauthFields = $oauthObj->getFields();
     if (!empty($oauthFields)) {
         $parmsArray = array_keys($oauthFields);
         foreach ($parmsArray as $val) {
             $dataArray['config'][$val] = IFilter::act(IReq::get($val));
         }
     }
     $dataArray['config'] = serialize($dataArray['config']);
     $oauthDBObj->setData($dataArray);
     $oauthDBObj->update('id = ' . $id);
     $this->redirect('oauth_list');
 }
コード例 #12
0
ファイル: system.php プロジェクト: yongge666/sunupedu
 /**
  *修改管理员密码
  */
 function admin_repwd_act()
 {
     //提取密码 [ 密码设置 ]
     $password = IReq::get('password', 'post');
     $repassword = IReq::get('repassword', 'post');
     if ($password && $password === $repassword) {
         $passwordMd5 = md5($password);
         $adminObj = new IModel('admin');
         $adminObj->setData(array('password' => $passwordMd5));
         $adminObj->update('id = ' . $this->admin['admin_id']);
         //同步更新safe
         ISafe::set('admin_pwd', $passwordMd5);
         $this->redirect('default');
     } else {
         $message = '密码不能为空,并且二次输入的必须一致';
         $this->redirect('admin_repwd', false);
         Util::showMessage($message);
     }
 }
コード例 #13
0
ファイル: simple.php プロジェクト: Wen1750686723/utao
 function reg_act()
 {
     $email = IFilter::act(IReq::get('email', 'post'));
     $username = IFilter::act(IReq::get('username', 'post'));
     $password = IFilter::act(IReq::get('password', 'post'));
     $repassword = IFilter::act(IReq::get('repassword', 'post'));
     $captcha = IReq::get('captcha', 'post');
     $message = '';
     /*注册信息校验*/
     if (IValidate::email($email) == false) {
         $message = '邮箱格式不正确';
     } else {
         if (!Util::is_username($username)) {
             $message = '用户名必须是由2-20个字符,可以为字数,数字下划线和中文';
         } else {
             if (!preg_match('|\\S{6,32}|', $password)) {
                 $message = '密码必须是字母,数字,下划线组成的6-32个字符';
             } else {
                 if ($password != $repassword) {
                     $message = '2次密码输入不一致';
                 } else {
                     if ($captcha != ISafe::get('Captcha')) {
                         $message = '验证码输入不正确';
                     } else {
                         $userObj = new IModel('user');
                         $where = 'email = "' . $email . '" or username = "******" or username = "******"';
                         $userRow = $userObj->getObj($where);
                         if (!empty($userRow)) {
                             if ($email == $userRow['email']) {
                                 $message = '此邮箱已经被注册过,请重新更换';
                             } else {
                                 $message = "此用户名已经被注册过,请重新更换";
                             }
                         }
                     }
                 }
             }
         }
     }
     //校验通过
     if ($message == '') {
         //user表
         $userArray = array('username' => $username, 'password' => md5($password), 'email' => $email);
         $userObj->setData($userArray);
         $user_id = $userObj->add();
         if ($user_id) {
             //member表
             $memberArray = array('user_id' => $user_id, 'time' => ITime::getDateTime());
             $memberObj = new IModel('member');
             $memberObj->setData($memberArray);
             $memberObj->add();
             //用户私密数据
             ISafe::set('username', $username);
             ISafe::set('user_id', $user_id);
             ISafe::set('user_pwd', $userArray['password']);
             //自定义跳转页面
             $callback = IReq::get('callback') ? urlencode(IReq::get('callback')) : '';
             $this->redirect('/simple/success_info?callback=' . $callback);
         } else {
             $message = '注册失败';
         }
     }
     //出错信息展示
     if ($message != '') {
         $this->email = $email;
         $this->username = $username;
         $this->redirect('reg', false);
         Util::showMessage($message);
     }
 }
コード例 #14
0
ファイル: simple.php プロジェクト: zhendeguoke1008/shop
 function deposit_cart_clear()
 {
     //必须为登录用户
     if ($this->user['user_id'] == null) {
         $this->redirect('/simple/login?callback=/simple/cart');
     }
     $goodsCarObj = new IModel('goods_car');
     $goodsCarObj->del('user_id = ' . $this->user['user_id']);
     $this->cart();
     Util::showMessage('操作成功');
 }
コード例 #15
0
ファイル: ucenter.php プロジェクト: Wen1750686723/utao
 function favorite_del()
 {
     $user_id = $this->user['user_id'];
     $id = IReq::get('id');
     if (!empty($id)) {
         $id = Util::intval_value($id);
         $favoriteObj = new IModel('favorite');
         if (is_array($id)) {
             $idStr = join(',', $id);
             $where = 'user_id = ' . $user_id . ' and id in (' . $idStr . ')';
         } else {
             $where = 'user_id = ' . $user_id . ' and id = ' . $id;
         }
         $favoriteObj->del($where);
         $this->redirect('favorite');
     } else {
         $this->redirect('favorite', false);
         Util::showMessage('请选择要删除的数据');
     }
 }
コード例 #16
0
ファイル: comment.php プロジェクト: chenyongze/iwebshop
 /**
  * @brief 发送信件
  */
 function message_send()
 {
     $where = ' 1 ';
     $tb_user_group = new IModel('user_group');
     $tb_user = new IModel('user');
     $data_group = $tb_user_group->query();
     $data_group = is_array($data_group) ? $data_group : array();
     $group = array();
     foreach ($data_group as $value) {
         $group[$value['id']] = $value['group_name'];
     }
     $and = ' and ';
     $where = '`status`="1"' . $and;
     $group_key = IFilter::act(IReq::get('group_key', 'post'), 'string');
     $group_v = IFilter::act(IReq::get('group_value', 'post'), 'int');
     if ($group_key && $group_v) {
         if ($group_key == 'eq') {
             $where .= "group_id='{$group_v}' {$and}";
         } else {
             $where .= "group_id!='{$group_v}' {$and} ";
         }
     }
     $truename_key = IFilter::string(IReq::get('truename_key', 'post'));
     $truename_v = IFilter::act(IReq::get('truename_value', 'post'), 'string');
     if ($truename_key && $truename_v) {
         if ($truename_key == 'eq') {
             $where .= "true_name='{$truename_v}' {$and}";
         } else {
             $where .= 'true_name like "%' . $truename_v . '%"' . $and;
         }
     }
     $mobile_key = IFilter::string(IReq::get('mobile_key', 'post'));
     $mobile_v = IFilter::act(IReq::get('mobile_value', 'post'), 'string');
     if ($mobile_key && $mobile_v) {
         if ($mobile_key == 'eq') {
             $where .= "mobile='{$mobile_v}' {$and} ";
         } else {
             $where .= 'mobile like "%' . $mobile_v . '%"' . $and;
         }
     }
     $telephone_key = IFilter::string(IReq::get('telephone_key', 'post'));
     $telephone_v = IFilter::act(IReq::get('telephone_value', 'post'), 'string');
     if ($telephone_key && $telephone_v) {
         if ($telephone_key == 'eq') {
             $where .= "telephone='{$telephone_v}' {$and} ";
         } else {
             $where .= 'telephone like "%' . $telephone_v . '%"' . $and;
         }
     }
     $username_key = IFilter::string(IReq::get('username_key', 'post'));
     $username_v = IFilter::act(IReq::get('username_value', 'post'), 'string');
     $user_ids = array();
     if ($username_key && $username_v) {
         if ($username_key == 'eq') {
             $sql = "username='******' ";
         } else {
             $sql = 'username like "%' . $username_v . '%"';
         }
         $tmp = $tb_user->query($sql);
         if ($tmp) {
             foreach ($tmp as $value) {
                 $user_ids[] = $value['id'];
             }
         }
     }
     $email_key = IFilter::string(IReq::get('email_key', 'post'));
     $email_v = IFilter::act(IReq::get('email_value', 'post'), 'string');
     if ($email_key && $email_v) {
         if ($email_key == 'eq') {
             $sql = "email='{$email_v}' ";
         } else {
             $sql = 'email like "%' . $email_v . '%"';
         }
         $tmp = $tb_user->query($sql);
         if ($tmp) {
             foreach ($tmp as $value) {
                 $user_ids[] = $value['id'];
             }
         }
     }
     if ($user_ids) {
         $where .= "user_id IN (" . implode(',', $user_ids) . ") {$and}";
     }
     $zip_key = IFilter::string(IReq::get('zip_key', 'post'));
     $zip_v = IFilter::act(IReq::get('zip_value', 'post'), 'string');
     if ($zip_key && $zip_v) {
         if ($zip_key == 'eq') {
             $where .= "zip='{$zip_v}' {$and} ";
         } else {
             $where .= 'zip like "%' . $zip_v . '%"' . $and;
         }
     }
     $sex = intval(IReq::get('sex', 'post'));
     if ($sex && $sex != '-1') {
         $where .= 'sex=' . $sex . $and;
     }
     $point_key = IFilter::string(IReq::get('point_key', 'post'));
     $point_v = intval(IReq::get('point_value', 'post'));
     if ($point_key && $point_v) {
         if ($point_key == 'eq') {
             $where .= 'point= "' . $point_v . '"' . $and;
         } elseif ($point_key == 'gt') {
             $where .= 'point > "' . $point_v . '"' . $and;
         } else {
             $where .= 'point < "' . $point_v . '"' . $and;
         }
     }
     $regtimeBegin = IFilter::string(IReq::get('regtimeBegin', 'post'));
     if ($regtimeBegin) {
         $where .= '`time` > "' . $regtimeBegin . '"' . $and;
     }
     $regtimeEnd = IFilter::string(IReq::get('regtimeEnd', 'post'));
     if ($regtimeEnd) {
         $where .= '`time` < "' . $regtimeEnd . '"' . $and;
     }
     $where .= ' 1 ';
     $content = array();
     $content['title'] = IReq::get('title');
     $content['content'] = IReq::get('content');
     Mess::sendToUser($where, $content);
     $this->message_list();
     Util::showMessage("站内消息群发成功");
 }
コード例 #17
0
ファイル: simple -6-29.php プロジェクト: yongge666/sunupedu
 /**
  * @brief 商户的增加动作
  */
 public function seller_reg()
 {
     $seller_name = IFilter::act(IReq::get('seller_name'));
     $email = IFilter::act(IReq::get('email'));
     $password = IFilter::act(IReq::get('password'));
     $repassword = IFilter::act(IReq::get('repassword'));
     $truename = IFilter::act(IReq::get('true_name'));
     $phone = IFilter::act(IReq::get('phone'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $province = IFilter::act(IReq::get('province'), 'int');
     $city = IFilter::act(IReq::get('city'), 'int');
     $area = IFilter::act(IReq::get('area'), 'int');
     $address = IFilter::act(IReq::get('address'));
     $home_url = IFilter::act(IReq::get('home_url'));
     if ($password == '') {
         $errorMsg = '请输入密码!';
     }
     if ($password != $repassword) {
         $errorMsg = '两次输入的密码不一致!';
     }
     //创建商家操作类
     $sellerDB = new IModel("seller");
     if ($sellerDB->getObj("seller_name = '{$seller_name}'")) {
         $errorMsg = "登录用户名重复";
     } else {
         if ($sellerDB->getObj("true_name = '{$truename}'")) {
             $errorMsg = "商户真实全称重复";
         }
     }
     //操作失败表单回填
     if (isset($errorMsg)) {
         $this->sellerRow = $_POST;
         $this->redirect('seller', false);
         Util::showMessage($errorMsg);
     }
     //待更新的数据
     $sellerRow = array('true_name' => $truename, 'phone' => $phone, 'mobile' => $mobile, 'email' => $email, 'address' => $address, 'province' => $province, 'city' => $city, 'area' => $area, 'home_url' => $home_url, 'is_lock' => 1);
     //商户资质上传
     if (isset($_FILES['paper_img']['name']) && $_FILES['paper_img']['name']) {
         $uploadObj = new PhotoUpload();
         $uploadObj->setIterance(false);
         $photoInfo = $uploadObj->run();
         if (isset($photoInfo['paper_img']['img']) && file_exists($photoInfo['paper_img']['img'])) {
             $sellerRow['paper_img'] = $photoInfo['paper_img']['img'];
         }
     }
     $sellerRow['seller_name'] = $seller_name;
     $sellerRow['password'] = md5($password);
     $sellerRow['create_time'] = ITime::getDateTime();
     $sellerDB->setData($sellerRow);
     $sellerDB->add();
     //短信通知商城平台
     $siteConfig = new Config('site_config');
     if ($siteConfig->mobile) {
         $content = smsTemplate::sellerReg(array('{true_name}' => $truename));
         $result = Hsms::send($mobile, $content);
     }
     $this->redirect('/site/success?message=' . urlencode("申请成功!请耐心等待管理员的审核"));
 }
コード例 #18
0
ファイル: site.php プロジェクト: Wen1750686723/utao
 function consult_act()
 {
     $goods_id = intval(IReq::get('goods_id', 'post'));
     $captcha = IReq::get('captcha', 'post');
     $question = IFilter::act(IReq::get('question', 'post'));
     $type = intval(IReq::get('type'));
     $callback = IReq::get('callback');
     $message = '';
     if ($captcha != ISafe::get('Captcha')) {
         $message = '验证码输入不正确';
     } else {
         if (!trim($question)) {
             $message = '咨询内容不能为空';
         } else {
             if ($goods_id == 0) {
                 $message = '商品ID不能为空';
             } else {
                 $goodsObj = new IModel('goods');
                 $goodsRow = $goodsObj->getObj('id = ' . $goods_id);
                 if (empty($goodsRow)) {
                     $message = '不存在此商品';
                 }
             }
         }
     }
     if ($message != '') {
         $this->callback = $callback;
         $this->goods_id = $goods_id;
         $dataArray = array('type' => $type, 'question' => $question);
         $this->consultRow = $dataArray;
         //渲染goods数据
         $goodsObj = new IModel('goods');
         $goodsRow = $goodsObj->getObj('id = ' . $this->goods_id);
         //获取次商品的评论数和平均分(保留小数点后一位)
         $commentObj = new IModel('comment');
         $commentRow = $commentObj->getObj('goods_id = ' . $this->goods_id, 'count(*) as comments,sum(`point`)/count(*) as apoint');
         $goodsRow['apoint'] = round($commentRow['apoint'], 1);
         $goodsRow['comments'] = $commentRow['comments'];
         $this->goodsRow = $goodsRow;
         $this->redirect('consult', false);
         Util::showMessage($message);
     } else {
         $dataArray = array('question' => $question, 'goods_id' => $goods_id, 'user_id' => isset($this->user['user_id']) ? $this->user['user_id'] : 0, 'time' => ITime::getDateTime(), 'type' => $type);
         $referObj = new IModel('refer');
         $referObj->setData($dataArray);
         $referObj->add();
         $this->redirect('success?callback=/site/products/id/' . $goods_id);
     }
 }
コード例 #19
0
ファイル: goods.php プロジェクト: xzdesk/iwebshop.com
 function spec_photo_del()
 {
     $id = IReq::get('id', 'post');
     if (isset($id[0]) && $id[0] != '') {
         $obj = new IModel('spec_photo');
         $id_str = '';
         foreach ($id as $rs) {
             if ($id_str != '') {
                 $id_str .= ',';
             }
             $id_str .= $rs;
             $photoRow = $obj->getObj('id = ' . $rs, 'address');
             if (file_exists($photoRow['address'])) {
                 unlink($photoRow['address']);
             }
         }
         $where = ' id in (' . $id_str . ')';
         $obj->del($where);
         $this->redirect('spec_photo');
     } else {
         $this->redirect('spec_photo', false);
         Util::showMessage('请选择要删除的id值');
     }
 }
コード例 #20
0
ファイル: market.php プロジェクト: yongge666/sunupedu
 function regiment_del()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     if ($id) {
         $regObj = new IModel('regiment');
         if (is_array($id)) {
             $idStr = join(',', $id);
             $where = ' id in (' . $idStr . ')';
             $uwhere = ' regiment_id in (' . $idStr . ')';
         } else {
             $where = 'id = ' . $id;
             $uwhere = 'regiment_id = ' . $id;
         }
         $regObj->del($where);
         $this->redirect('regiment_list');
     } else {
         $this->redirect('regiment_list', false);
         Util::showMessage('请选择要删除的id值');
     }
 }
コード例 #21
0
ファイル: goods.php プロジェクト: Wen1750686723/utao
 /**
  * @brief 删除商品分类
  */
 function category_del()
 {
     $category_id = IFilter::act(IReq::get('cid'), 'int');
     if ($category_id) {
         $tb_category = new IModel('category');
         $catRow = $tb_category->getObj('parent_id = ' . $category_id);
         //要删除的分类下还有子节点
         if (!empty($catRow)) {
             $this->category_list();
             Util::showMessage('无法删除此分类,此分类下还有子分类');
             exit;
         }
         $tb_category_extend = new IModel('category_extend');
         $cate_ext = $tb_category_extend->getObj('category_id = ' . $category_id);
         //要删除的分类下还有商品
         if (!empty($cate_ext)) {
             $this->category_list();
             Util::showMessage('此分类下还有商品,请先删除商品!');
             exit;
         }
         if ($tb_category->del('id = ' . $category_id)) {
             //更新缓存
             $cacheObj = new ICache('file');
             $cacheObj->del('goodsCategory');
             $this->category_list();
         } else {
             $this->category_list();
             $msg = "没有找到相关分类记录!";
             Util::showMessage($msg);
         }
     } else {
         $this->category_list();
         $msg = "没有找到相关分类记录!";
         Util::showMessage($msg);
     }
 }
コード例 #22
0
ファイル: member.php プロジェクト: xzdesk/iwebshop.com
 /**
  * @brief 商户的增加动作
  */
 public function seller_add()
 {
     $seller_id = IFilter::act(IReq::get('id'), 'int');
     $seller_name = IFilter::act(IReq::get('seller_name'));
     $email = IFilter::act(IReq::get('email'));
     $password = IFilter::act(IReq::get('password'));
     $repassword = IFilter::act(IReq::get('repassword'));
     $truename = IFilter::act(IReq::get('true_name'));
     $phone = IFilter::act(IReq::get('phone'));
     $mobile = IFilter::act(IReq::get('mobile'));
     $province = IFilter::act(IReq::get('province'), 'int');
     $city = IFilter::act(IReq::get('city'), 'int');
     $area = IFilter::act(IReq::get('area'), 'int');
     $cash = IFilter::act(IReq::get('cash'), 'float');
     $is_vip = IFilter::act(IReq::get('is_vip'), 'int');
     $is_lock = IFilter::act(IReq::get('is_lock'), 'int');
     $address = IFilter::act(IReq::get('address'));
     $account = IFilter::act(IReq::get('account'));
     $server_num = IFilter::act(IReq::get('server_num'));
     $home_url = IFilter::act(IReq::get('home_url'));
     $sort = IFilter::act(IReq::get('sort'), 'int');
     if (!$seller_id && $password == '') {
         $errorMsg = '请输入密码!';
     }
     if ($password != $repassword) {
         $errorMsg = '两次输入的密码不一致!';
     }
     //创建商家操作类
     $sellerDB = new IModel("seller");
     if ($sellerDB->getObj("seller_name = '{$seller_name}' and id != {$seller_id}")) {
         $errorMsg = "登录用户名重复";
     } else {
         if ($sellerDB->getObj("true_name = '{$truename}' and id != {$seller_id}")) {
             $errorMsg = "商户真实全程重复";
         }
     }
     //操作失败表单回填
     if (isset($errorMsg)) {
         $this->sellerRow = $_POST;
         $this->redirect('seller_edit', false);
         Util::showMessage($errorMsg);
     }
     //待更新的数据
     $sellerRow = array('true_name' => $truename, 'account' => $account, 'phone' => $phone, 'mobile' => $mobile, 'email' => $email, 'address' => $address, 'is_vip' => $is_vip, 'is_lock' => $is_lock, 'cash' => $cash, 'province' => $province, 'city' => $city, 'area' => $area, 'server_num' => $server_num, 'home_url' => $home_url, 'sort' => $sort);
     //商户资质上传
     if (isset($_FILES['paper_img']['name']) && $_FILES['paper_img']['name']) {
         $uploadObj = new PhotoUpload();
         $uploadObj->setIterance(false);
         $photoInfo = $uploadObj->run();
         if (isset($photoInfo['paper_img']['img']) && file_exists($photoInfo['paper_img']['img'])) {
             $sellerRow['paper_img'] = $photoInfo['paper_img']['img'];
         }
     }
     //添加新会员
     if (!$seller_id) {
         $sellerRow['seller_name'] = $seller_name;
         $sellerRow['password'] = md5($password);
         $sellerRow['create_time'] = ITime::getDateTime();
         $sellerDB->setData($sellerRow);
         $sellerDB->add();
     } else {
         //修改密码
         if ($password) {
             $sellerRow['password'] = md5($password);
         }
         $sellerDB->setData($sellerRow);
         $sellerDB->update("id = " . $seller_id);
     }
     $this->redirect('seller_list');
 }
コード例 #23
0
ファイル: member.php プロジェクト: zhendeguoke1008/shop
 function withdraw_status()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     $re_note = IFilter::act(IReq::get('re_note'), 'string');
     if ($id) {
         $withdrawObj = new IModel('withdraw');
         $dataArray = array('re_note' => $re_note);
         if (IReq::get('status') !== NULL) {
             $dataArray['status'] = IFilter::act(IReq::get('status'), 'int');
         }
         $withdrawObj->setData($dataArray);
         $where = "`id`= {$id} AND `status` = 0";
         $re = $withdrawObj->update($where);
         $this->withdraw_detail(true);
         if ($re != 0) {
             $logObj = new log('db');
             $logObj->write('operation', array("管理员:" . $this->admin['admin_name'], "修改了提现申请", "ID值为:" . $id));
         }
         Util::showMessage("更新成功");
     } else {
         $this->redirect('withdraw_list');
     }
 }
コード例 #24
0
 /**
  * @brief 删除收货地址的信息
  */
 public function recycle_del()
 {
     // 获取POST数据
     $id = IFilter::act(IReq::get('id'), 'int');
     //加载 商家发货点信息
     $tb_merch_ship_info = new IModel('merch_ship_info');
     if (!empty($id)) {
         $tb_merch_ship_info->del(Util::joinStr($id));
         $this->redirect('recycle_list');
     } else {
         $this->redirect('recycle_list', false);
         Util::showMessage('请选择要删除的数据');
     }
 }
コード例 #25
0
ファイル: tools.php プロジェクト: yongge666/sunupedu
 /**
  * 查询删除
  */
 function search_del()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     //生成search对象
     $tb_search = new IModel('search');
     if (!empty($id)) {
         if (is_array($id) && isset($id[0]) && $id[0] != '') {
             $id_str = join(',', $id);
             $where = ' id in (' . $id_str . ')';
         } else {
             $where = 'id = ' . $id;
         }
         $tb_search->del($where);
     } else {
         Util::showMessage('请选择要删除的数据');
     }
     $this->redirect("search_list");
 }
コード例 #26
0
ファイル: seller.php プロジェクト: xzdesk/iwebshop.com
 function pro_rule_del()
 {
     $id = IFilter::act(IReq::get('id'), 'int');
     if (!empty($id)) {
         $promotionObj = new IModel('promotion');
         if (is_array($id)) {
             $idStr = join(',', $id);
             $where = ' id in (' . $idStr . ')';
         } else {
             $where = 'id = ' . $id;
         }
         $promotionObj->del($where . ' and seller_id = ' . $this->seller['seller_id']);
         $this->redirect('pro_rule_list');
     } else {
         $this->redirect('pro_rule_list', false);
         Util::showMessage('请选择要删除的促销活动');
     }
 }