예제 #1
0
파일: other.php 프로젝트: herrify/iwebshop
 public function getPaymentList()
 {
     $user_id = ISafe::get('user_id');
     $where = 'status = 0';
     if (!$user_id) {
         $where .= " and class_name != 'balance'";
     }
     switch (IClient::getDevice()) {
         //移动支付
         case IClient::MOBILE:
             //如果是微信客户端,必须用微信专用支付
             if (IClient::isWechat() == true) {
                 $where .= " and class_name = 'wap_wechat'";
             } else {
                 $where .= " and client_type in(2,3) and class_name !=  'wap_wechat' ";
             }
             break;
             //pc支付
         //pc支付
         case IClient::PC:
             $where .= ' and client_type in(1,3) ';
             break;
     }
     $paymentDB = new IModel('payment');
     return $paymentDB->query($where);
 }
예제 #2
0
 /**
  * @see paymentplugin::callback()
  */
 public function callback($ExternalData, &$paymentId, &$money, &$message, &$orderNo)
 {
     $partnerKey = Payment::getConfigParam($paymentId, 'M_PartnerKey');
     $user_id = ISafe::get('user_id');
     ksort($ExternalData);
     $temp = array();
     foreach ($ExternalData as $k => $v) {
         if ($k != 'sign') {
             $temp[] = $k . '=' . urlencode($v);
         }
     }
     $encryptKey = isset(IWeb::$app->config['encryptKey']) ? IWeb::$app->config['encryptKey'] : 'iwebshop';
     $testStr = join('&', $temp) . '&' . $user_id . $partnerKey . $encryptKey;
     $orderNo = $ExternalData['order_no'];
     $money = $ExternalData['total_fee'];
     if ($ExternalData['sign'] == md5($testStr)) {
         //支付单号
         switch ($ExternalData['is_success']) {
             case 'T':
                 $log = new AccountLog();
                 $config = array('user_id' => $user_id, 'event' => 'pay', 'note' => '通过余额支付方式进行商品购买', 'num' => '-' . $money, 'order_id' => $orderNo);
                 $log->write($config);
                 return true;
                 break;
             case 'F':
                 return false;
                 break;
         }
     } else {
         $message = '校验码不正确';
     }
     return false;
 }
예제 #3
0
 /**
  * @brief theme和skin进行选择
  */
 public static function onCreateController()
 {
     $controller = func_num_args() > 0 && func_get_arg(0) ? func_get_arg(0) : IWeb::$app->controller;
     /**
      * 对于theme和skin的判断流程
      * 1,直接从URL中获取是否已经设定了方案__theme,__skin
      * 2,从cookie获取数据
      */
     $urlTheme = IReq::get('__theme');
     $urlSkin = IReq::get('__skin');
     if ($urlTheme && $urlSkin && preg_match('|^\\w+$|', $urlTheme) && preg_match('|^\\w+$|', $urlSkin)) {
         ISafe::set('__theme', $theme = $urlTheme);
         ISafe::set('__skin', $skin = $urlSkin);
     } elseif (ISafe::get('__theme') && ISafe::get('__skin')) {
         $theme = ISafe::get('__theme');
         $skin = ISafe::get('__skin');
     }
     if (isset($theme) && isset($skin)) {
         $themePath = IWeb::$app->getViewPath() . $theme . "/" . IWeb::$app->controller->getId();
         if (is_dir($themePath)) {
             $controller->theme = $theme;
             $controller->skin = $skin;
         }
     }
 }
예제 #4
0
 /**
  * @brief 根据用户的权限过滤菜单
  * @return array
  */
 private function filterMenu()
 {
     $rights = ISafe::get('admin_right');
     //如果不是超级管理员则要过滤菜单
     if ($rights != 'administrator') {
         foreach (self::$menu as $firstKey => $firstVal) {
             if (is_array($firstVal)) {
                 foreach ($firstVal as $secondKey => $secondVal) {
                     if (is_array($secondVal)) {
                         foreach ($secondVal as $thirdKey => $thirdVal) {
                             if (!in_array($thirdKey, self::$commonMenu) && stripos(str_replace('@', '/', $rights), ',' . substr($thirdKey, 1) . ',') === false) {
                                 unset(self::$menu[$firstKey][$secondKey][$thirdKey]);
                             }
                         }
                         if (empty(self::$menu[$firstKey][$secondKey])) {
                             unset(self::$menu[$firstKey][$secondKey]);
                         }
                     }
                 }
                 if (empty(self::$menu[$firstKey])) {
                     unset(self::$menu[$firstKey]);
                 }
             }
         }
     }
 }
예제 #5
0
 function user_ico_upload()
 {
     $user_id = ISafe::get('user_id');
     $result = array('isError' => true);
     if (isset($_FILES['attach']['name']) && $_FILES['attach']['name'] != '') {
         $photoObj = new PhotoUpload();
         $photoObj->setThumb(100, 100, 'user_ico');
         $photo = $photoObj->run();
         if (!empty($photo['attach']['thumb']['user_ico'])) {
             $user_id = ISafe::get('user_id');
             $user_obj = new IModel('user');
             $dataArray = array('head_ico' => $photo['attach']['thumb']['user_ico']);
             $user_obj->setData($dataArray);
             $where = 'id = ' . $user_id;
             $isSuss = $user_obj->update($where);
             if ($isSuss !== false) {
                 $result['isError'] = false;
                 $result['data'] = IUrl::creatUrl() . $photo['attach']['thumb']['user_ico'];
                 ISafe::set('head_ico', $dataArray['head_ico']);
             } else {
                 $result['message'] = '上传失败';
             }
         } else {
             $result['message'] = '上传失败';
         }
     } else {
         $result['message'] = '请选择图片';
     }
     echo '<script type="text/javascript">parent.callback_user_ico(' . JSON::encode($result) . ');</script>';
 }
예제 #6
0
 function callback($in, &$paymentId, &$money, &$message, &$tradeno)
 {
     //比对md5码
     $pKey = $this->getConf($paymentId, 'PrivateKey');
     $user_id = ISafe::get('user_id');
     ksort($in);
     unset($in['controller']);
     unset($in['action']);
     unset($in['payment_name']);
     $temp = array();
     foreach ($in as $k => $v) {
         if ($k != 'sign') {
             $temp[] = $k . '=' . urlencode($v);
         }
     }
     $testStr = join('&', $temp) . '&' . $user_id . $pKey;
     $tradeno = $in['order_no'];
     $money = $in['total_fee'];
     if ($in['sign'] == md5($testStr)) {
         //支付单号
         switch ($in['is_success']) {
             case 'T':
                 $log = new AccountLog();
                 $config = array('user_id' => ISafe::get('user_id'), 'event' => 'pay', 'note' => '通过余额支付方式进行商品购买', 'num' => '-' . $money, 'order_id' => $tradeno);
                 $log->write($config);
                 return PAY_SUCCESS;
                 break;
             case 'F':
                 return PAY_FAILED;
                 break;
         }
     } else {
         IError::show(403, '校验码不正确');
     }
 }
예제 #7
0
 function logout()
 {
     ISafe::clear('seller_id');
     ISafe::clear('seller_name');
     ISafe::clear('seller_pwd');
     ISafe::clearAll();
     $this->redirect('index');
 }
예제 #8
0
 function logout()
 {
     ISafe::clear('admin_id');
     ISafe::clear('admin_right');
     ISafe::clear('admin_name');
     ISafe::clear('admin_pwd');
     ISafe::clearAll();
     $this->redirect('index');
 }
예제 #9
0
 /**
  * 获取版权信息,存储到缓存中进行比对
  * @return boolean
  */
 public static function getAuthorize()
 {
     $iwebshopAuthorize = ISafe::get('iwebshopAuthorize');
     if ($iwebshopAuthorize === null) {
         $return = self::send('_c=system&_a=authorize&host=' . IUrl::getHost());
         $iwebshopAuthorize = isset($return['success']) && $return['success'] == 1 ? true : false;
         ISafe::set('iwebshopAuthorize', $iwebshopAuthorize);
     }
     return $iwebshopAuthorize;
 }
예제 #10
0
 /**
  * @brief theme和skin进行选择
  */
 public static function onCreateController()
 {
     $controller = func_num_args() > 0 ? func_get_arg(0) : IWeb::$app->controller;
     //判断是否为后台管理控制器
     if (in_array($controller->getId(), self::$syscontroller)) {
         defined("IWEB_SCENE") ? "" : define("IWEB_SCENE", self::SCENE_SYSDEFAULT);
         $controller->theme = self::$sysTheme;
         $controller->skin = self::$sysSkin;
     } elseif (in_array($controller->getId(), self::$sellercontroller)) {
         defined("IWEB_SCENE") ? "" : define("IWEB_SCENE", self::SCENE_SYSSELLER);
         $controller->theme = self::$sysSellerTheme;
         $controller->skin = self::$sysSellerSkin;
     } else {
         defined("IWEB_SCENE") ? "" : define("IWEB_SCENE", self::SCENE_SITE);
         /**
          * 对于theme和skin的判断流程
          * 1,直接从URL中获取是否已经设定了方案__theme,__skin
          * 2,获取cookie中的方案名称
          * 3,读取config配置中的默认方案
          */
         $urlTheme = IReq::get('__theme');
         $urlSkin = IReq::get('__skin');
         if ($urlTheme && $urlSkin && preg_match('|^\\w+$|', $urlTheme) && preg_match('|^\\w+$|', $urlSkin)) {
             ISafe::set('__theme', $controller->theme = $urlTheme);
             ISafe::set('__skin', $controller->skin = $urlSkin);
         } elseif (ISafe::get('__theme') && ISafe::get('__skin')) {
             $controller->theme = ISafe::get('__theme');
             $controller->skin = ISafe::get('__skin');
         } else {
             if (isset(IWeb::$app->config['theme'])) {
                 //根据不同的客户端进行智能选择
                 if (is_array(IWeb::$app->config['theme'])) {
                     $client = IClient::getDevice();
                     $controller->theme = isset(IWeb::$app->config['theme'][$client]) ? IWeb::$app->config['theme'][$client] : current(IWeb::$app->config['theme']);
                 } else {
                     $controller->theme = IWeb::$app->config['theme'];
                 }
             }
             if (isset(IWeb::$app->config['skin'])) {
                 //根据不同的客户端进行智能选择
                 if (is_array(IWeb::$app->config['skin'])) {
                     $client = IClient::getDevice();
                     $controller->skin = isset(IWeb::$app->config['skin'][$client]) ? IWeb::$app->config['skin'][$client] : current(IWeb::$app->config['skin']);
                 } else {
                     $controller->skin = IWeb::$app->config['skin'];
                 }
             }
         }
     }
     //修正runtime配置
     IWeb::$app->runtimePath = IWeb::$app->getRuntimePath() . $controller->theme . '/';
     IWeb::$app->webRunPath = IWeb::$app->getWebRunPath() . $controller->theme . '/';
 }
예제 #11
0
    /**
     * @brief 展示插件
     * @param string $name 用户名
     * @param string $pwd  密码
     */
    public function show($name = '', $pwd = '')
    {
        $sessionName = ISafe::name();
        $sessionId = ISafe::id();
        $uploadUrl = IUrl::creatUrl($this->submit);
        $admin_name = $name == '' ? ISafe::get('admin_name') : $name;
        $admin_pwd = $pwd == '' ? ISafe::get('admin_pwd') : $pwd;
        echo <<<OEF
\t\t<script type="text/javascript">
\t\twindow.onload = function()
\t\t{
\t\t\tnew SWFUpload({
\t\t\t\t// Backend Settings
\t\t\t\tupload_url: "{$uploadUrl}",
\t\t\t\tpost_params: {"{$sessionName}": "{$sessionId}","admin_name":"{$admin_name}","admin_pwd":"{$admin_pwd}"},

\t\t\t\t// File Upload Settings
\t\t\t\tfile_types : "*.jpg;*.jpge;*.png;*.gif",

\t\t\t\t// Event Handler Settings - these functions as defined in Handlers.js
\t\t\t\t//  The handlers are not part of SWFUpload but are part of my website and control how
\t\t\t\t//  my website reacts to the SWFUpload events.
\t\t\t\tswfupload_preload_handler : preLoad,
\t\t\t\tswfupload_load_failed_handler : loadFailed,
\t\t\t\tfile_queue_error_handler : fileQueueError,
\t\t\t\tfile_dialog_complete_handler : fileDialogComplete,
\t\t\t\tupload_progress_handler : uploadProgress,
\t\t\t\tupload_error_handler : uploadError,
\t\t\t\tupload_success_handler : uploadSuccess,
\t\t\t\tupload_complete_handler : uploadComplete,

\t\t\t\t// Button Settings
\t\t\t\tbutton_placeholder_id : "uploadButton",
\t\t\t\tbutton_width: 50,
\t\t\t\tbutton_height: 21,
\t\t\t\tbutton_text : '选择...',
\t\t\t\tbutton_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
\t\t\t\tbutton_cursor: SWFUpload.CURSOR.HAND,

\t\t\t\t// Flash Settings
\t\t\t\tflash_url : "{$this->path}swfupload.swf",

\t\t\t\tcustom_settings : {
\t\t\t\t\tupload_target : "divFileProgressContainer"
\t\t\t\t},

\t\t\t\t// Debug Settings
\t\t\t\tdebug: false
\t\t\t});
\t\t};
\t\t</script>
OEF;
    }
예제 #12
0
 /**
  * 构造函数
  */
 public function __construct($user_id = null)
 {
     $this->user_id = $user_id ? $user_id : ISafe::get('user_id');
     //获取用户组ID及组的折扣率
     if ($this->user_id != null) {
         $groupObj = new IModel('member as m , user_group as g');
         $groupRow = $groupObj->getObj('m.user_id = ' . $this->user_id . ' and m.group_id = g.id', 'g.*');
         if ($groupRow) {
             $this->group_id = $groupRow['id'];
             $this->group_discount = $groupRow['discount'] * 0.01;
         }
     }
 }
예제 #13
0
 public function checkUserRights()
 {
     $object = $this->ctrlObj;
     $user = array();
     $user['user_id'] = intval(ISafe::get('user_id'));
     $user['username'] = ISafe::get('username');
     $user['head_ico'] = ISafe::get('head_ico');
     $user['user_pwd'] = ISafe::get('user_pwd');
     if (self::isValidUser($user['username'], $user['user_pwd'])) {
         $object->user = $user;
     } else {
         ISafe::clear('user_id');
         ISafe::clear('user_pwd');
         ISafe::clear('username');
         ISafe::clear('head_ico');
     }
 }
예제 #14
0
 public static function checkUserRights()
 {
     $object = IWeb::$app->getController();
     $user = array();
     $user['user_id'] = intval(ISafe::get('user_id'));
     $user['username'] = ISafe::get('username');
     $user['head_ico'] = ISafe::get('head_ico');
     $user['user_pwd'] = ISafe::get('user_pwd');
     if (self::isValidUser($user['username'], $user['user_pwd'])) {
         $object->user = $user;
     } else {
         ISafe::clear('user_id');
         ISafe::clear('user_pwd');
         ISafe::clear('username');
         ISafe::clear('head_ico');
     }
 }
예제 #15
0
 /**
  * @brief 生成验证码
  * @return image图像
  */
 public function getCaptcha()
 {
     //清空布局
     $this->layout = '';
     //配置参数
     $width = IReq::get('w') ? IReq::get('w') : 130;
     $height = IReq::get('h') ? IReq::get('h') : 45;
     $wordLength = IReq::get('l') ? IReq::get('l') : 5;
     $fontSize = IReq::get('s') ? IReq::get('s') : 25;
     //创建验证码
     $ValidateObj = new Captcha();
     $ValidateObj->width = $width;
     $ValidateObj->height = $height;
     $ValidateObj->maxWordLength = $wordLength;
     $ValidateObj->minWordLength = $wordLength;
     $ValidateObj->fontSize = $fontSize;
     $ValidateObj->CreateImage($text);
     //设置验证码
     ISafe::set('captcha', $text);
 }
예제 #16
0
 public function order_recycle_del()
 {
     //post数据
     $id = IFilter::act(IReq::get('id'), 'int');
     $id_str = $id;
     //生成order对象
     $tb_order = new IModel('order');
     if (!empty($id)) {
         $where = '';
         $prop = '';
         $order_id = '';
         if (is_array($id) && isset($id[0]) && $id[0] != '') {
             $id_str = join(',', $id);
             $where = ' id in (' . $id_str . ')';
             $prop = ' id in (' . $id_str . ') and pay_status =0 and prop is not null';
             $order_id = ' order_id in (' . $id_str . ')';
         } else {
             $where = 'id = ' . $id;
             $prop = 'id = ' . $id . ' and pay_status =0 and prop is not null';
             $order_id = 'id = ' . $id;
         }
         //先修改红包
         $order_info = $tb_order->query($prop);
         if (count($order_info) > 0) {
             $tb_prop = new IModel('prop');
             foreach ($order_info as $value) {
                 $tb_prop->setData(array('is_close' => 0));
                 if ($value['prop']) {
                     $tb_prop->update('id=' . $value['prop']);
                 }
             }
         }
         //删除订单商品
         $tb_order_goods = new IQuery('order_goods');
         $tb_order_goods->fields = 'id';
         $tb_order_goods->where = $order_id;
         $order_info = $tb_order_goods->find();
         if (count($order_info) > 0) {
             $tb_order_go = new IModel('order_goods');
             foreach ($order_info as $value) {
                 if ($value['id']) {
                     $tb_order_go->del('id=' . $value['id']);
                 }
             }
         }
         //删除订单
         $tb_order->del($where);
         $logObj = new log('db');
         $logObj->write('operation', array("管理员:" . ISafe::get('admin_name'), "删除回收站中退货单", '退货单ID:' . $id_str));
         $this->redirect('order_recycle_list');
     } else {
         $this->redirect('order_recycle_list', false);
         Util::showMessage('请选择要删除的数据');
     }
 }
예제 #17
0
 /**
  * @brief 登录后的处理
  * @param array $userRow 用户数组信息
  */
 public static function loginAfter($userRow)
 {
     //用户私密数据
     ISafe::set('user_id', $userRow['id']);
     ISafe::set('username', $userRow['username']);
     ISafe::set('head_ico', $userRow['head_ico']);
     ISafe::set('user_pwd', $userRow['password']);
     ISafe::set('last_login', isset($userRow['last_login']) ? $userRow['last_login'] : '');
     //更新最后一次登录时间
     $memberObj = new IModel('member');
     $dataArray = array('last_login' => ITime::getDateTime());
     $memberObj->setData($dataArray);
     $where = 'user_id = ' . $userRow["id"];
     $memberObj->update($where);
     $memberRow = $memberObj->getObj($where, 'exp');
     //根据经验值分会员组
     $groupObj = new IModel('user_group');
     $groupRow = $groupObj->getObj($memberRow['exp'] . ' between minexp and maxexp and minexp > 0 and maxexp > 0', 'id', 'discount', 'desc');
     if (!empty($groupRow)) {
         $dataArray = array('group_id' => $groupRow['id']);
         $memberObj->setData($dataArray);
         $memberObj->update('user_id = ' . $userRow["id"]);
     }
 }
예제 #18
0
 /**
  * @brief 获取订单中的支付信息
  * @payment_id   支付方式信息
  * @type         信息获取方式 order:订单支付;recharge:在线充值;
  * @argument     参数
  * @return array 支付提交信息
  * R表示店铺 ; P表示用户;
  */
 public function getPaymentInfo($payment_id, $type, $argument)
 {
     if ($type == 'order') {
         $order_id = $argument;
         //获取订单信息
         $orderObj = new IModel('order');
         $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
         if (empty($orderRow)) {
             IError::show(403, '订单信息不正确,不能进行支付');
         }
         //团购
         if ($orderRow['type'] == 1) {
             $regimentRelationObj = new IModel('regiment_user_relation');
             $relationRow = $regimentRelationObj->getObj('order_no = "' . $orderRow['order_no'] . '"');
             if (empty($relationRow)) {
                 IError::show(403, '团购订单已经失效');
                 exit;
             } else {
                 if (abs(ITime::getDiffSec($relationRow['join_time'])) > regiment::time_limit() * 60) {
                     IError::show(403, '支付时间已经过期');
                     exit;
                 }
             }
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $orderRow['order_amount'];
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
         $payment['P_Email'] = '';
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Block::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['payment_type'], 'status' => 0);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge_' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Def_Amount'] = 0.01;
     $payment['M_Time'] = time();
     $payment['M_Goods'] = '';
     $payment['M_Language'] = "zh_CN";
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     $payment['R_Postcode'] = '';
     $payment['R_Email'] = '';
     return $payment;
 }
예제 #19
0
 function discussUpdate()
 {
     $goods_id = IFilter::act(IReq::get('id'), 'int');
     $content = IFilter::act(IReq::get('content'), 'text');
     $captcha = IReq::get('captcha');
     $return = array('isError' => true, 'message' => '');
     if (!$this->user['user_id']) {
         $return['message'] = '请先登录系统';
     } else {
         if ($captcha != ISafe::get('captcha')) {
             $return['message'] = '验证码输入不正确';
         } else {
             if (trim($content) == '') {
                 $return['message'] = '内容不能为空';
             } else {
                 $return['isError'] = false;
                 //插入讨论表
                 $tb_discussion = new IModel('discussion');
                 $dataArray = array('goods_id' => $goods_id, 'user_id' => $this->user['user_id'], 'time' => date('Y-m-d H:i:s'), 'contents' => $content);
                 $tb_discussion->setData($dataArray);
                 $tb_discussion->add();
                 $return['time'] = $dataArray['time'];
                 $return['contents'] = $content;
                 $return['username'] = $this->user['username'];
             }
         }
     }
     echo JSON::encode($return);
 }
예제 #20
0
 public function upgrade_5()
 {
     //执行sql等清理
     $version = ISafe::get("upgrade_version");
     $upgrade_zip_path = ISafe::get("upgrade_zip_path");
     if ($version == null || $upgrade_zip_path == null) {
         die;
     }
     $upgrade_zip_path = realpath($upgrade_zip_path);
     $upgrade = new IWebUpgrade('shop', $version);
     $upgrade->upgrade($upgrade_zip_path);
     echo "success";
     exit;
 }
예제 #21
0
 /**
  * 操作数据库
  *
  * @param float $num 操作金额
  * @return bool|array 返回true代表成功,返回array代表着本次操作的错误信息
  */
 private function log($num)
 {
     if (!is_numeric($num)) {
         $this->error[] = "错误的操作金额:{$num}";
         return $this->error;
     }
     $num = sprintf("%.2f", $num);
     $this->num = $num;
     if ($this->_note === null) {
         $this->note();
     }
     if ($this->error) {
         return $this->error;
     }
     $tb_account_log = new IModel("account_log");
     $arr = array();
     $arr['admin_id'] = $this->admin['id'];
     $arr['user_id'] = $this->user['id'];
     $arr['event'] = $this->allow_event[$this->event];
     $arr['note'] = addslashes($this->_note);
     $arr['amount'] = $num;
     $arr['amount_log'] = $this->user['balance'];
     $arr['type'] = $num >= 0 ? 0 : 1;
     $arr['time'] = $this->time;
     $tb_account_log->setData($arr);
     $tb_account_log->add();
     //后台管理员操作记录
     if ($arr['admin_id']) {
         $logObj = new Log();
         $logObj->write('operation', array("管理员:" . ISafe::get('admin_name'), "对账户金额进行了修改", $arr['note']));
     }
     return true;
 }
예제 #22
0
 function admin_edit_act()
 {
     $id = IFilter::act(IReq::get('id', 'post'));
     $adminObj = new IModel('admin');
     //错误信息
     $message = null;
     $dataArray = array('id' => $id, 'admin_name' => IFilter::string(IReq::get('admin_name', 'post')), 'role_id' => IFilter::act(IReq::get('role_id', 'post')), 'email' => IFilter::string(IReq::get('email', 'post')));
     //检查管理员name唯一性
     $isPass = $this->check_admin($dataArray['admin_name'], $id);
     if ($isPass == false) {
         $message = $dataArray['admin_name'] . '管理员已经存在,请更改名字';
     }
     //提取密码 [ 密码设置 ]
     $password = IReq::get('password', 'post');
     $repassword = IReq::get('repassword', 'post');
     //修改操作
     if ($id) {
         if ($password != null || $repassword != null) {
             if ($password == null || $repassword == null || $password != $repassword) {
                 $message = '密码不能为空,并且二次输入的必须一致';
             } else {
                 $dataArray['password'] = md5($password);
             }
         }
         //有错误
         if ($message != null) {
             $this->adminRow = $dataArray;
             $this->redirect('admin_edit', false);
             Util::showMessage($message);
         } else {
             $where = 'id = ' . $id;
             $adminObj->setData($dataArray);
             $adminObj->update($where);
             //同步更新safe
             ISafe::set('admin_name', $dataArray['admin_name']);
             ISafe::set('admin_pwd', $dataArray['password']);
         }
     } else {
         if ($password == null || $repassword == null || $password != $repassword) {
             $message = '密码不能为空,并且二次输入的必须一致';
         } else {
             $dataArray['password'] = md5($password);
         }
         if ($message != null) {
             $this->adminRow = $dataArray;
             $this->redirect('admin_edit', false);
             Util::showMessage($message);
         } else {
             $dataArray['create_time'] = ITime::getDateTime();
             $adminObj->setData($dataArray);
             $adminObj->add();
         }
     }
     $this->redirect('admin_list');
 }
예제 #23
0
 public function bind_nexists_user()
 {
     $username = IFilter::act(IReq::get('username'));
     $email = IFilter::act(IReq::get('email'));
     $oauth_id = IFilter::act(ISession::get('oauth_id'));
     $oauth_userInfo = IFilter::act(ISession::get('oauth_userInfo'));
     /*注册信息校验*/
     if (IValidate::email($email) == false) {
         $message = '邮箱格式不正确';
     } else {
         if (!Util::is_username($username)) {
             $message = '用户名必须是由2-20个字符,可以为字数,数字下划线和中文';
         } 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 = "此用户名已经被注册过,请重新更换";
                 }
             } else {
                 $userData = array('email' => $email, 'username' => $username, 'password' => md5(ITime::getDateTime()));
                 $userObj->setData($userData);
                 $user_id = $userObj->add();
                 $memberObj = new IModel('member');
                 $memberData = array('user_id' => $user_id, 'true_name' => $oauth_userInfo['name'], 'last_login' => ITime::getDateTime(), 'sex' => isset($oauth_userInfo['sex']) ? $oauth_userInfo['sex'] : 1, 'time' => ITime::getDateTime());
                 $memberObj->setData($memberData);
                 $memberObj->add();
                 $oauthUserObj = new IModel('oauth_user');
                 //插入关系表
                 $oauthUserData = array('oauth_user_id' => $oauth_userInfo['id'], 'oauth_id' => $oauth_id, 'user_id' => $user_id, 'datetime' => ITime::getDateTime());
                 $oauthUserObj->setData($oauthUserData);
                 $oauthUserObj->add();
                 $userRow = CheckRights::isValidUser($userData['email'], $userData['password']);
                 CheckRights::loginAfter($userRow);
                 //自定义跳转页面
                 $callback = ISafe::get('callback');
                 $this->redirect('/site/success?message=' . urlencode("注册成功!") . '&callback=' . $callback);
             }
         }
     }
     if ($message != '') {
         $this->message = $message;
         $this->redirect('bind_user', false);
     }
 }
예제 #24
0
 /**
  *	列表展示
  *	@author keenhome@126.com
  *	@date 2013-4-30
  */
 public function buy()
 {
     $gid = IFilter::act(IReq::get('gid'), 'int');
     $tb_goods = new IModel('goods');
     //增加点击次数
     if (!ISafe::get('visit' . $gid)) {
         $tb_goods->setData(array('click' => 'click + 1'));
         $tb_goods->update('id = ' . $gid, 'click');
         ISafe::set('click' . $gid, '1');
     }
     $goodsRow = $tb_goods->getObj('ID = ' . $gid, 'url');
     if (count($goodsRow) > 0 && $goodsRow['url']) {
         header("Location:" . $goodsRow['url']);
     } else {
         header("Location:/");
     }
 }
예제 #25
0
 function password_edit()
 {
     $user_id = $this->user['user_id'];
     $fpassword = IReq::get('fpassword');
     $password = IReq::get('password');
     $repassword = IReq::get('repassword');
     $userObj = new IModel('user');
     $where = 'id = ' . $user_id;
     $userRow = $userObj->getObj($where);
     if (!preg_match('|\\w{6,32}|', $password)) {
         $message = '密码格式不正确,请重新输入';
     } else {
         if ($password != $repassword) {
             $message = '二次密码输入的不一致,请重新输入';
         } else {
             if (md5($fpassword) != $userRow['password']) {
                 $message = '原始密码输入错误';
             } else {
                 $passwordMd5 = md5($password);
                 $dataArray = array('password' => $passwordMd5);
                 $userObj->setData($dataArray);
                 $result = $userObj->update($where);
                 if ($result) {
                     ISafe::set('user_pwd', $passwordMd5);
                     $message = '密码修改成功';
                 } else {
                     $message = '密码修改失败';
                 }
             }
         }
     }
     $this->redirect('password', false);
     Util::showMessage($message);
 }
예제 #26
0
파일: site.php 프로젝트: Wen1750686723/utao
 function spec_md5()
 {
     $cid = IFilter::act(IReq::get('cid'));
     $cidArray = explode(',', trim($cid, ','));
     sort($cidArray);
     $gid = IFilter::act(IReq::get('gid'));
     $tb_products = new IModel('products');
     $procducts_info = $tb_products->query(" goods_id='" . $gid . "' and spec_md5='" . md5(serialize($cidArray)) . "'");
     //获得货品的会员价格
     $user_id = ISafe::get('user_id');
     $group_price = 0;
     if ($user_id) {
         $tb_group_price = new IQuery('group_price as g');
         $tb_group_price->join = 'left join member as m on m.group_id=g.group_id';
         $tb_group_price->fields = 'g.price';
         $tb_group_price->where = 'g.goods_id=' . $gid . ' and g.products_id=' . $procducts_info[0]['id'] . ' and m.user_id=' . $user_id;
         $group_price_info = $tb_group_price->find();
         if (count($group_price_info) > 0) {
             $group_price = $group_price_info[0]['price'];
         }
     }
     $pid = 0;
     if (count($procducts_info) > 0) {
         $pid = $procducts_info[0]['id'] . ',' . $procducts_info[0]['sell_price'] . ',' . $procducts_info[0]['market_price'] . ',' . $procducts_info[0]['store_nums'] . ',' . $procducts_info[0]['products_no'] . ',' . $group_price;
     }
     echo $pid;
 }
예제 #27
0
 function add_download_ticket()
 {
     $isError = true;
     $ticket_num = IFilter::act(IReq::get('ticket_num'));
     $ticket_pwd = IFilter::act(IReq::get('ticket_pwd'));
     $propObj = new IModel('prop');
     $propRow = $propObj->getObj('card_name = "' . $ticket_num . '" and card_pwd = "' . $ticket_pwd . '" and type = 0 and is_userd = 0 and is_send = 1 and is_close = 0 and NOW() between start_time and end_time');
     if (empty($propRow)) {
         $message = '代金券不可用,请确认代金券的卡号密码并且此代金券从未被使用过';
     } else {
         //登录用户
         if ($this->user['user_id']) {
             $memberObj = new IModel('member');
             $memberRow = $memberObj->getObj('user_id = ' . $this->user['user_id'], 'prop');
             if (stripos($memberRow['prop'], ',' . $propRow['id'] . ',') !== false) {
                 $message = '代金券已经存在,不能重复添加';
             } else {
                 $isError = false;
                 $message = '添加成功';
                 if ($memberRow['prop'] == '') {
                     $propUpdate = ',' . $propRow['id'] . ',';
                 } else {
                     $propUpdate = $memberRow['prop'] . $propRow['id'] . ',';
                 }
                 $dataArray = array('prop' => $propUpdate);
                 $memberObj->setData($dataArray);
                 $memberObj->update('user_id = ' . $this->user['user_id']);
             }
         } else {
             $isError = false;
             $message = '添加成功';
             ISafe::set("ticket_" . $propRow['id'], $propRow['id']);
         }
     }
     $result = array('isError' => $isError, 'data' => $propRow, 'message' => $message);
     echo JSON::encode($result);
 }
예제 #28
0
 /**
  * @brief 获取订单中的支付信息 M:必要信息; R表示店铺; P表示用户;
  * @param $payment_id int    支付方式ID
  * @param $type       string 信息获取方式 order:订单支付;recharge:在线充值;
  * @param $argument   mix    参数
  * @return array 支付提交信息
  */
 public static function getPaymentInfo($payment_id, $type, $argument)
 {
     //最终返回值
     $payment = array();
     //初始化配置参数
     $paymentInstance = Payment::createPaymentInstance($payment_id);
     $configParam = $paymentInstance->configParam();
     foreach ($configParam as $key => $val) {
         $payment[$key] = '';
     }
     //获取公共信息
     $paymentRow = self::getPaymentById($payment_id, 'config_param');
     if ($paymentRow) {
         $paymentRow = JSON::decode($paymentRow);
         foreach ($paymentRow as $key => $item) {
             $payment[$key] = $item;
         }
     }
     if ($type == 'order') {
         $orderIdArray = $argument;
         $M_Amount = 0;
         $M_OrderNO = array();
         foreach ($orderIdArray as $key => $order_id) {
             //获取订单信息
             $orderObj = new IModel('order');
             $orderRow = $orderObj->getObj('id = ' . $order_id . ' and status = 1');
             if (empty($orderRow)) {
                 IError::show(403, '订单信息不正确,不能进行支付');
             }
             //判断商品库存
             $orderGoodsDB = new IModel('order_goods');
             $orderGoodsList = $orderGoodsDB->query('order_id = ' . $order_id);
             foreach ($orderGoodsList as $key => $val) {
                 if (!goods_class::checkStore($val['goods_nums'], $val['goods_id'], $val['product_id'])) {
                     IError::show(403, '商品库存不足无法支付,请重新下单');
                 }
             }
             $M_Amount += $orderRow['order_amount'];
             $M_OrderNO[] = $orderRow['order_no'];
         }
         $payment['M_Remark'] = $orderRow['postscript'];
         $payment['M_OrderId'] = $orderRow['id'];
         $payment['M_OrderNO'] = $orderRow['order_no'];
         $payment['M_Amount'] = $M_Amount;
         //用户信息
         $payment['P_Mobile'] = $orderRow['mobile'];
         $payment['P_Name'] = $orderRow['accept_name'];
         $payment['P_PostCode'] = $orderRow['postcode'];
         $payment['P_Telephone'] = $orderRow['telphone'];
         $payment['P_Address'] = $orderRow['address'];
         //订单批量结算缓存机制
         $cacheObj = new ICache('file');
         $cacheObj->set($payment['M_OrderNO'], join(",", $M_OrderNO));
     } else {
         if ($type == 'recharge') {
             if (ISafe::get('user_id') == null) {
                 IError::show(403, '请登录系统');
             }
             if (!isset($argument['account']) || $argument['account'] <= 0) {
                 IError::show(403, '请填入正确的充值金额');
             }
             $rechargeObj = new IModel('online_recharge');
             $reData = array('user_id' => ISafe::get('user_id'), 'recharge_no' => Order_Class::createOrderNum(), 'account' => $argument['account'], 'time' => ITime::getDateTime(), 'payment_name' => $argument['paymentName']);
             $rechargeObj->setData($reData);
             $r_id = $rechargeObj->add();
             //充值时用户id跟随交易号一起发送,以"_"分割
             $payment['M_OrderNO'] = 'recharge' . $reData['recharge_no'];
             $payment['M_OrderId'] = $r_id;
             $payment['M_Amount'] = $reData['account'];
         }
     }
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     //交易信息
     $payment['M_Time'] = time();
     $payment['M_Paymentid'] = $payment_id;
     //店铺信息
     $payment['R_Address'] = isset($site_config['address']) ? $site_config['address'] : '';
     $payment['R_Name'] = isset($site_config['name']) ? $site_config['name'] : '';
     $payment['R_Mobile'] = isset($site_config['mobile']) ? $site_config['mobile'] : '';
     $payment['R_Telephone'] = isset($site_config['phone']) ? $site_config['phone'] : '';
     return $payment;
 }
예제 #29
0
					<div class="price f_r t_r">
						<b class="block">¥<%=data['sell_price']%> x <%=data['count']%></b>
						<input class="del" type="button" value="删除" onclick="removeCart('<?php 
echo IUrl::creatUrl("/simple/removeCart");
?>
','<%=data['id']%>','<%=data['type']%>');$('#site_cart_dd_<%=item%>').hide('slow');" />
					</div>
				</dd>
				<%}%>

				<dd class="static"><span>共<b name="mycart_count"><%=goodsCount%></b>件商品</span>金额总计:<b name="mycart_sum">¥<%=goodsSum%></b></dd>

				<%if(goodsData){%>
				<dd class="static">
					<?php 
if (ISafe::get('user_id')) {
    ?>
					<a class="f_l" href="javascript:void(0)" onclick="deposit_ajax('<?php 
    echo IUrl::creatUrl("/simple/deposit_cart_set");
    ?>
');">寄存购物车>></a>
					<?php 
}
?>
					<label class="btn_orange"><input type="button" value="去购物车结算" onclick="window.location.href='<?php 
echo IUrl::creatUrl("/simple/cart");
?>
';" /></label>
				</dd>
				<%}%>
			</dl>
예제 #30
0
 /**
  * @brief 订单删除功能_删除回收站中的数据,彻底删除
  */
 public function order_recycle_del()
 {
     //post数据
     $id = IFilter::act(IReq::get('id'), 'int');
     //生成order对象
     $tb_order = new IModel('order');
     if ($id) {
         $id = is_array($id) ? join(',', $id) : $id;
         Order_class::resetOrderProp($id);
         //删除订单
         $tb_order->del('id in (' . $id . ')');
         //记录日志
         $logObj = new log('db');
         $logObj->write('operation', array("管理员:" . ISafe::get('admin_name'), "删除回收站中退货单", '退货单ID:' . $id));
         $this->redirect('order_recycle_list');
     } else {
         $this->redirect('order_recycle_list', false);
         Util::showMessage('请选择要删除的数据');
     }
 }