Ejemplo n.º 1
0
 function exchangcard()
 {
     $this->checkmemberlogin();
     $card = trim(IFilter::act(IReq::get('card')));
     $password = trim(IFilter::act(IReq::get('password')));
     if (empty($card)) {
         $this->message('充值卡号不能为空');
     }
     if (empty($password)) {
         $this->message('充值卡密码不能为空');
     }
     $checkinfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "card where card ='" . $card . "'  and card_password = '******' and uid =0 and status = 0");
     if (empty($checkinfo)) {
         $this->message('充值卡不存在或者已使用');
     }
     $arr['uid'] = $this->member['uid'];
     $arr['status'] = 1;
     $arr['username'] = $this->member['username'];
     $this->mysql->update(Mysite::$app->config['tablepre'] . 'card', $arr, "card ='" . $card . "'  and card_password = '******' and uid =0 and status = 0");
     //`$key`
     $this->mysql->update(Mysite::$app->config['tablepre'] . 'member', '`cost`=`cost`+' . $checkinfo['cost'], "uid ='" . $this->member['uid'] . "' ");
     $allcost = $this->member['cost'] + $checkinfo['cost'];
     $this->memberCls->addlog($this->member['uid'], 2, 1, $checkinfo['cost'], '充值卡充值', '使用充值卡' . $checkinfo['card'] . '充值' . $checkinfo['cost'] . '元', $allcost);
     $this->success('兑换成功');
 }
Ejemplo n.º 2
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;
         }
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
function smarty_function_load_data($params, &$smarty)
{
    (!isset($params['table']) || empty($params['table'])) && exit('`table` is empty!');
    // $Mconfig = include(hopedir."config/hopeconfig.php");
    // print_r($Mconfig);
    $type = isset($params['type']) ? $params['type'] : 'list';
    //total  总数量   one    list 3个分类
    $fileds = isset($params['fileds']) ? $params['fileds'] : '*';
    $where = isset($params['where']) ? $params['where'] : '';
    $where = empty($where) ? '' : ' where ' . $where;
    $orderby = isset($params['orderby']) ? 'order by ' . $params['orderby'] : '';
    $limit = isset($params['limit']) ? 'LIMIT 0,' . $params['limit'] : 'LIMIT 0,1';
    if (!class_exists('mysql_class')) {
        include hopedir . "lib/core/extend/mysql_class.php";
        //core\extend
        $mysql = new mysql_class();
    } else {
        $mysql = new mysql_class();
    }
    $page = intval(IFilter::act(IReq::get('page')));
    $pagesize = intval(IFilter::act(IReq::get('pagesize')));
    $pagesize = isset($params['pagesize']) ? $params['pagesize'] : $pagesize;
    $pagesize = empty($pagesize) ? 10 : $pagesize;
    // $db = $class::factory(array('table' => $params['table']));
    //var_dump($params);
    if (!empty($params['assign'])) {
        //把数据赋值给变量$params['assign'],这样前端就可以使用这个变量了(例如可以结合foreach输出一个列表等)
        //  $smarty->assign($params['assign'], $db->get_block_list(array($params['where']), $params['limit']));
        if ($type == 'total') {
            $result = $mysql->counts("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " " . $orderby . " " . $limit . "");
        } elseif ($type == 'one') {
            $result = $mysql->select_one("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " " . $orderby . " " . $limit . "");
        } else {
            if (isset($params['showpage']) && $params['showpage'] == true) {
                if (!class_exists('page')) {
                    include hopedir . "lib/core/extend/page.php";
                    //core\extend
                    $pageclass = new page();
                } else {
                    $pageclass = new page();
                }
                $pageclass->setpage($page, $pagesize);
                $result['list'] = $mysql->getarr("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . "  " . $orderby . "  limit " . $pageclass->startnum() . ", " . $pageclass->getsize() . "");
                $shuliang = $mysql->counts("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " ");
                $pageclass->setnum($shuliang);
                if (isset($params['pagetype'])) {
                    $result['pagecontent'] = $pageclass->ajaxbar($params['pagetype']);
                } else {
                    $result['pagecontent'] = $pageclass->getpagebar();
                }
            } else {
                $result['list'] = $mysql->getarr("select " . $fileds . " from " . Mysite::$app->config['tablepre'] . $params['table'] . "  " . $where . " " . $orderby . "  " . $limit . "");
            }
        }
        /*
            $result['list'] = array();
             $result['pagecontent'] = ''; */
        $smarty->assign($params['assign'], $result);
    }
}
Ejemplo n.º 5
0
 /**
  * @see paymentplugin::getSendData()
  */
 public function getSendData($payment)
 {
     $defaultbank = IFilter::act(IReq::get('defaultbank'));
     $return = array();
     //基本参数
     $return['service'] = 'create_direct_pay_by_user';
     $return['partner'] = $payment['M_PartnerId'];
     $return['seller_email'] = $payment['M_Email'];
     $return['_input_charset'] = 'utf-8';
     $return['payment_type'] = 1;
     $return['return_url'] = $this->callbackUrl;
     $return['notify_url'] = $this->serverCallbackUrl;
     $return['defaultbank'] = $defaultbank;
     $return['paymethod'] = 'bankPay';
     //业务参数
     $return['subject'] = $payment['R_Name'];
     $return['out_trade_no'] = $payment['M_OrderNO'];
     $return['total_fee'] = number_format($payment['M_Amount'], 2, '.', '');
     //除去待签名参数数组中的空值和签名参数
     $para_filter = $this->paraFilter($return);
     //对待签名参数数组排序
     $para_sort = $this->argSort($para_filter);
     //生成签名结果
     $mysign = $this->buildMysign($para_sort, $payment['M_PartnerKey']);
     //签名结果与签名方式加入请求提交参数组中
     $return['sign'] = $mysign;
     $return['sign_type'] = 'MD5';
     return $return;
 }
Ejemplo n.º 6
0
 /**
  * @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);
     }
 }
Ejemplo n.º 7
0
 function ungift()
 {
     $this->checkmemberlogin();
     $id = intval(IReq::get('id'));
     if (empty($id)) {
         $this->message('获取兑换记录失败');
     }
     $info = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "giftlog where uid ='" . $this->member['uid'] . "' and id=" . $id . " ");
     if (empty($info)) {
         $this->message('获取兑换记录失败');
     }
     if ($info['status'] != 0) {
         $this->message('兑换已处理不可取消');
     }
     $lipininfo = $this->mysql->select_one("select * from " . Mysite::$app->config['tablepre'] . "gift where id ='" . $info['giftid'] . "'  order by id asc  ");
     $titles = isset($lipininfo['title']) ? $lipininfo['title'] : $info['id'];
     $this->mysql->update(Mysite::$app->config['tablepre'] . 'giftlog', array('status' => '4'), "id='" . $id . "'");
     $ndata['score'] = $this->member['score'] + $info['score'];
     //更新用户积分
     $this->mysql->update(Mysite::$app->config['tablepre'] . 'member', '`score` = `score`+' . $info['score'], "uid='" . $this->member['uid'] . "'");
     //写消息
     $this->memberCls->addlog($this->member['uid'], 1, 1, $info['score'], '取消兑换礼品', '取消兑换ID为:' . $id . '的礼品[' . $titles . '],帐号积分' . $ndata['score'], $ndata['score']);
     $lidata['stock'] = $lipininfo['stock'] + $info['count'];
     $lidata['sell_count'] = $lipininfo['sell_count'] - $info['count'];
     $this->mysql->update(Mysite::$app->config['tablepre'] . 'gift', $lidata, "id='" . $info['giftid'] . "'");
     $this->success('操作成功');
 }
Ejemplo n.º 8
0
 public function getNoticeList()
 {
     $page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
     $query = new IQuery('announcement');
     $query->order = 'id desc';
     $query->page = $page;
     return $query;
 }
Ejemplo n.º 9
0
 public function getHelpListByCatId($catId)
 {
     $page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
     $query = new IQuery('help');
     $query->where = "cat_id = " . $catId;
     $query->order = 'sort desc,id desc';
     $query->page = $page;
     return $query;
 }
Ejemplo n.º 10
0
 public function getArticleListByCatid($category_id)
 {
     $page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
     $query = new IQuery('article');
     $query->where = 'category_id = ' . $category_id . ' and visibility = 1';
     $query->order = 'id desc';
     $query->page = $page;
     return $query;
 }
Ejemplo n.º 11
0
 public function getSellerList()
 {
     $page = IReq::get('page') ? IFilter::act(IReq::get('page'), 'int') : 1;
     $query = new IQuery('seller');
     $query->where = 'is_del = 0';
     $query->order = 'id desc';
     $query->page = $page;
     return $query;
 }
Ejemplo n.º 12
0
 /**
  * @brief 处理curd动作
  * @return String
  */
 public function curd()
 {
     $action = $this->id;
     $controller = $this->controller;
     $curdinfo = $this->initinfo();
     if (is_array($curdinfo)) {
         $modelName = $curdinfo['model'];
         $key = $curdinfo['key'];
         $actions = $curdinfo['actions'];
         switch ($action) {
             case 'add':
             case 'upd':
                 if (method_exists($controller, 'getValidate')) {
                     $validate = $controller->getValidate();
                 } else {
                     $validate = null;
                 }
                 if ($validate != null) {
                     $formValidate = new IFormValidation($validate);
                     $data = $formValidate->run();
                 }
                 $model = new IModel($modelName);
                 if (isset($data) && $data !== null) {
                     $model->setData($data[$modelName]);
                     if ($action = 'add') {
                         $flag = $model->add();
                     } else {
                         $flag = $model->upd("{$key} = '" . IReq::get($key) . "'");
                     }
                 }
                 if (isset($flag) && $flag) {
                     $_GET['action'] = $actions['success'];
                 } else {
                     $_GET['action'] = $actions['fail'];
                 }
                 $controller->run();
                 return true;
             case 'del':
                 $model = new IModel($modelName);
                 $flag = $model->del("{$key} = '" . IReq::get($key) . "'");
                 if ($flag) {
                     $_GET['action'] = $actions['success'];
                 } else {
                     $_GET['action'] = $actions['fail'];
                 }
                 $controller->run();
                 return true;
             case 'get':
                 $model = new IModel($modelName);
                 $rs = $model->getObj("{$key} = '" . IReq::get($key) . "'");
                 echo JSON::encode($rs);
                 return false;
         }
     }
 }
Ejemplo n.º 13
0
 /**
  * @param string $method form 表单提交方法,默认post方式提交
  * @return array 表单验证后的信息
  * @brief 表单元素验证
  */
 function run()
 {
     $lang = new ILanguage();
     $lang->load("form_validation");
     foreach ($this->fieldData as $key => $value) {
         foreach ($value as $k => $v) {
             //获取要验证的数据
             $this->fieldData[$key][$k]['postdate'] = IReq::get($this->fieldData[$key][$k]['name']);
             //发现有误不继续验证
             if ($this->errorflag) {
                 continue;
             }
             //获取验证规则
             $rules = explode('|', $v['rules']);
             foreach ($rules as $rule) {
                 //如果有数组带有错误信息,直接跳出
                 if ($this->fieldData[$key][$k]['error'] != '' || $this->errorflag) {
                     break;
                 }
                 $param = FALSE;
                 if (preg_match("/(.*?)\\[(.*?)\\]/", $rule, $match)) {
                     $rule = $match[1];
                     $param = $match[2];
                 }
                 //如果验证规则为空,则跳过不进行验证
                 if ($rule == '') {
                     continue;
                 }
                 //如果验证函数不存在,则进行正则表达式验证
                 $result = true;
                 if (method_exists($this, $rule)) {
                     //如果表单没有值并且不是必填的时候,不需要进行验证
                     if ($this->fieldData[$key][$k]['postdate'] || !$this->fieldData[$key][$k]['postdate'] && $rule == 'required') {
                         $result = $this->{$rule}($this->fieldData[$key][$k]['postdate'], $param);
                     }
                 } else {
                     $result = $this->check($rule, $this->fieldData[$key][$k]['postdate']);
                 }
                 if (!$result) {
                     //验证不通过,返回null,构建错误内容
                     $msg = $lang->g('fv_' . $rule);
                     $this->validate[$this->fieldData[$key][$k]['name']] = array('value' => $this->fieldData[$key][$k]['postdate'], 'msg' => $this->fieldData[$key][$k]['label'] . $msg);
                     $this->fieldData[$key][$k]['error'] = $this->fieldData[$key][$k]['label'] . $msg;
                     $this->errorMsg = $this->fieldData[$key][$k]['label'] . $msg;
                     $this->errorflag = true;
                 }
             }
         }
     }
     if ($this->errorflag) {
         IWeb::$app->setRenderData(array('validate' => $this->validate));
     }
     return $this->fieldData;
 }
Ejemplo n.º 14
0
 function delsingle()
 {
     $uid = IReq::get('id');
     $uid = is_array($uid) ? $uid : array($uid);
     $ids = join(',', $uid);
     if (empty($ids)) {
         $this->message('单页ID不能为空');
     }
     $this->mysql->delete(Mysite::$app->config['tablepre'] . 'single', "id in (" . $ids . ") ");
     $this->success('操作成功');
 }
Ejemplo n.º 15
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 . '/';
 }
Ejemplo n.º 16
0
 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);
     }
 }
Ejemplo n.º 17
0
 function user()
 {
     //店铺统计
     $selecttype = intval(IFilter::act(IReq::get('selecttype')));
     $tempselecttype = in_array($selecttype, array(0, 1, 2, 3)) ? $selecttype : 0;
     $wherearray = array('0' => '', '1' => ' where addtime > ' . strtotime('-1 month'), '2' => ' where addtime > ' . strtotime('-7 day'), '3' => ' where addtime > ' . strtotime(date('Y-m-d', time())));
     $tempdata = $this->mysql->getarr("select count(id) as shuliang ,DATE_FORMAT(FROM_UNIXTIME(`addtime`),'%k') as month from " . Mysite::$app->config['tablepre'] . "order  " . $wherearray[$tempselecttype] . " group by month    order by month desc  limit 0,10");
     $list = array();
     if (is_array($tempdata)) {
         foreach ($tempdata as $key => $value) {
             $list[$value['month']] = $value['shuliang'];
         }
     }
     $data['list'] = $list;
     $data['selecttype'] = $selecttype;
     Mysite::$app->setdata($data);
 }
Ejemplo n.º 18
0
 function saveadvtype()
 {
     $arrtypename = IReq::get('typename');
     $arrtypeurl = IReq::get('typeurl');
     $arrtypeorder = IReq::get('typeorder');
     if (empty($arrtypename)) {
         $this->message('广告类型不能为空');
     }
     if (is_array($arrtypename)) {
         $orderinfo = array();
         foreach ($arrtypename as $key => $value) {
             if (isset($arrtypeorder[$key])) {
                 $dokey = !empty($arrtypeorder[$key]) ? $arrtypeorder[$key] : 0;
                 array_push($orderinfo, $dokey);
             } else {
                 array_push($orderinfo, 0);
             }
         }
         $orderinfo = array_unique($orderinfo);
         sort($orderinfo);
         $newinfo = array();
         foreach ($orderinfo as $key => $value) {
             foreach ($arrtypename as $k => $v) {
                 if (isset($arrtypeorder[$k])) {
                     $checkcode = !empty($arrtypeorder[$k]) ? $arrtypeorder[$k] : 0;
                 } else {
                     $checkcode = 0;
                 }
                 if ($checkcode == $value) {
                     $data['typename'] = $v;
                     $data['typeurl'] = isset($arrtypeurl[$k]) ? $arrtypeurl[$k] : '';
                     $data['typeorder'] = $checkcode;
                     $newinfo[] = $data;
                 }
             }
         }
     } else {
         $newinfo['typename'] = $arrtypename;
         $newinfo['typeurl'] = $arrtypeurl;
         $newinfo['typeorder'] = $arrtypeorder;
     }
     $siteinfo['advtype'] = serialize($newinfo);
     $config = new config('hopeconfig.php', hopedir);
     $config->write($siteinfo);
     $this->success('操作成功');
 }
Ejemplo n.º 19
0
 /**
  * @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);
     }
 }
Ejemplo n.º 20
0
 function goodsupload()
 {
     $link = IUrl::creatUrl('member/login');
     if ($this->member['uid'] == 0 && $this->admin['uid'] == 0) {
         $this->message('未登陆', $link);
     }
     $type = IReq::get('type');
     $goodsid = intval(IReq::get('goodsid'));
     $shopid = ICookie::get('adminshopid');
     if ($shopid < 0) {
         echo '无权限操作';
         exit;
     }
     if (is_array($_FILES) && isset($_FILES['imgFile'])) {
         $json = new Services_JSON();
         $uploadpath = 'upload/shop/';
         $filepath = '/upload/shop/';
         $upload = new upload($uploadpath, array('gif', 'jpg', 'jpge', 'doc', 'png'));
         //upload
         $file = $upload->getfile();
         if ($upload->errno != 15 && $upload->errno != 0) {
             echo "<script>parent.uploaderror('" . json_encode($upload->errmsg()) . "');</script>";
         } else {
             if ($goodsid > 0 && $shopid > 0) {
                 $data['img'] = $filepath . $file[0]['saveName'];
                 $this->mysql->update(Mysite::$app->config['tablepre'] . 'goods', $data, "id='" . $goodsid . "' and shopid='" . $shopid . "'");
             }
             echo "<script>parent.uploadsucess('" . $filepath . $file[0]['saveName'] . "');</script>";
         }
         exit;
     }
     $imgurl = '';
     if ($goodsid > 0 && $type == 'goods') {
         $temp = $this->mysql->select_one("select img from " . Mysite::$app->config['tablepre'] . "goods where id='" . $goodsid . "' and shopid='" . $shopid . "'");
         $imgurl = $temp['img'];
     }
     Mysite::$app->setdata(array('type' => $type, 'goodsid' => $goodsid, 'imgurl' => $imgurl));
 }
Ejemplo n.º 21
0
      		</dl>
      		<?php 
}
?>
		</div>
	</div>
	<?php 
echo IFilter::stripSlash($siteConfig->site_footer_code);
?>
</div>

<script type='text/javascript'>
$(function()
{
	<?php 
$word = IReq::get('word') ? IFilter::act(IReq::get('word'), 'text') : '输入关键字...';
?>
	$('input:text[name="word"]').val("<?php 
echo isset($word) ? $word : "";
?>
");

	$('input:text[name="word"]').bind({
		keyup:function(){autoComplete('<?php 
echo IUrl::creatUrl("/site/autoComplete");
?>
','<?php 
echo IUrl::creatUrl("/site/search_list/word/@word@");
?>
','<?php 
echo isset($siteConfig->auto_finish) ? $siteConfig->auto_finish : "";
Ejemplo n.º 22
0
?>
			</span>
		</div>

		<div id="admin_left">
			<ul class="submenu"></ul>
			<div id="copyright"></div>
		</div>

		<div id="admin_right">
			<script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/my97date/wdatepicker.js"></script>
<?php 
$search = IReq::get('search') ? IFilter::act(IReq::get('search'), 'strict') : array();
?>

<div class="headbar">
	<div class="position"><span>统计</span><span>></span><span>商户数据统计</span><span>></span><span>货款结算列表</span></div>
	<div class="operating">
		<div class="search f_l">
			<form name="searchBill" action="<?php 
echo IUrl::creatUrl("/");
?>
" method="get">
				<input type='hidden' name='controller' value='market' />
				<input type='hidden' name='action' value='bill_list' />

				<span>
					申请时间
Ejemplo n.º 23
0
 /**
  * @brief 商品检索,可以直接读取 $_GET 全局变量:attr,order,brand,min_price,max_price
  *        在检索商品过程中计算商品结果中的进一步属性和规格的筛选
  * @param mixed $defaultWhere string(条件) or array('search' => '模糊查找','category_extend' => '商品分类ID','字段' => 对应数据)
  * @param int $limit 读取数量
  * @param bool $isCondition 是否筛选出商品的属性,价格等数据
  * @return IQuery
  */
 public static function find($defaultWhere = '', $limit = 21, $isCondition = true)
 {
     //获取配置信息
     $siteConfigObj = new Config("site_config");
     $site_config = $siteConfigObj->getInfo();
     $orderArray = array();
     //排序
     //开始查询
     $goodsObj = new IQuery("goods as go");
     $goodsObj->page = isset($_GET['page']) ? intval($_GET['page']) : 1;
     $goodsObj->fields = ' go.* ';
     $goodsObj->pagesize = $limit;
     /*where条件拼接*/
     //(1),当前产品分类
     $where = ' go.is_del = 0 ';
     //(2),商品属性,规格筛选
     $attrCond = array();
     $childSql = '';
     $attrArray = IReq::get('attr') ? IFilter::act(IReq::get('attr')) : array();
     foreach ($attrArray as $key => $val) {
         if ($key && $val) {
             $attrCond[] = ' attribute_id = ' . intval($key) . ' and FIND_IN_SET("' . $val . '",attribute_value)';
         }
     }
     //合并规格与属性的值,并且生成SQL查询语句
     $GoodsId = null;
     if ($attrCond) {
         $tempArray = array();
         foreach ($attrCond as $key => $cond) {
             $tempArray[] = '(' . $cond . ')';
         }
         $childSql = join(' or ', $tempArray);
         $goodsAttrObj = new IQuery('goods_attribute');
         $goodsAttrObj->fields = 'goods_id';
         $goodsAttrObj->where = $childSql;
         $goodsAttrObj->group = 'goods_id';
         $goodsAttrObj->having = 'count(goods_id) >= ' . count($attrCond);
         //每个子条件都有一条记录,则存在几个count(条件)必须包含count(goods_id)条数量
         $goodsIdArray = $goodsAttrObj->find();
         $goodsIds = array();
         foreach ($goodsIdArray as $key => $val) {
             $goodsIds[] = $val['goods_id'];
         }
         $GoodsId = $GoodsId === null ? array_unique($goodsIds) : array_unique(array_intersect($goodsIds, $GoodsId));
     }
     //(3),处理defaultWhere条件 goods, category_extend
     if ($defaultWhere) {
         //兼容array 和 string 数据类型的goods条件筛选
         $goodsCondArray = array();
         if (is_string($defaultWhere)) {
             $goodsCondArray[] = $defaultWhere;
         } else {
             if (is_array($defaultWhere)) {
                 foreach ($defaultWhere as $key => $val) {
                     if (!$val) {
                         continue;
                     }
                     //商品分类检索
                     if ($key == 'category_extend') {
                         $currentCatGoods = array();
                         $categoryExtendObj = new IModel('category_extend');
                         $categoryExtendList = $categoryExtendObj->query("category_id in (" . $val . ")", 'goods_id', 'id', 'desc');
                         foreach ($categoryExtendList as $key => $val) {
                             $currentCatGoods[] = $val['goods_id'];
                         }
                         $GoodsId = $GoodsId === null ? array_unique($currentCatGoods) : array_unique(array_intersect($currentCatGoods, $GoodsId));
                     } else {
                         if ($key == 'search') {
                             $wordWhere = array();
                             $wordLikeOrder = array();
                             //检查输入的内容是否为分词形式
                             if (preg_match("#\\s+#", $defaultWhere['search']) == false) {
                                 $wordWhere[] = ' name like "%' . $defaultWhere['search'] . '%" or find_in_set("' . $defaultWhere['search'] . '",search_words) ';
                                 $wordLikeOrder[] = $defaultWhere['search'];
                             }
                             //进行分词
                             if (IString::getStrLen($defaultWhere['search']) >= 4 || IString::getStrLen($defaultWhere['search']) <= 100) {
                                 $wordData = words_facade::run($defaultWhere['search']);
                                 if (isset($wordData['data']) && count($wordData['data']) >= 2) {
                                     foreach ($wordData['data'] as $word) {
                                         $wordWhere[] = ' name like "%' . $word . '%" ';
                                         $wordLikeOrder[] = $word;
                                     }
                                 }
                             }
                             //分词排序
                             if (count($wordLikeOrder) > 1) {
                                 $orderTempArray = array();
                                 foreach ($wordLikeOrder as $key => $val) {
                                     $orderTempArray[] = "(CASE WHEN name LIKE '%" . $val . "%' THEN " . $key . " ELSE 100 END)";
                                 }
                                 $orderArray[] = " (" . join('+', $orderTempArray) . ") asc ";
                             }
                             $goodsCondArray[] = join(' or ', $wordWhere);
                         } else {
                             $goodsCondArray[] = $key . ' = "' . $val . '"';
                         }
                     }
                 }
             }
         }
         //goods 条件
         if ($goodsCondArray) {
             $goodsDB = new IModel('goods as go');
             $goodsCondData = $goodsDB->query(join(" and ", $goodsCondArray), "id");
             $goodsCondId = array();
             foreach ($goodsCondData as $key => $val) {
                 $goodsCondId[] = $val['id'];
             }
             $GoodsId = $GoodsId === null ? array_unique($goodsCondId) : array_unique(array_intersect($goodsCondId, $GoodsId));
         }
     }
     //过滤商品ID被删除的情况
     if ($GoodsId) {
         if (!isset($goodsDB)) {
             $goodsDB = new IModel("goods as go");
         }
         $goodsCondData = $goodsDB->query("go.id in (" . join(',', $GoodsId) . ") and go.is_del = 0 ", "id");
         $GoodsId = array();
         foreach ($goodsCondData as $key => $val) {
             $GoodsId[] = $val['id'];
         }
     }
     $GoodsId = $GoodsId === array() || $GoodsId === null ? array(0) : array_unique($GoodsId);
     //存在商品ID数据
     if ($GoodsId) {
         $GoodsId = array_slice($GoodsId, 0, search_goods::MAX_GOODSID);
         $where .= " and go.id in (" . join(',', $GoodsId) . ") ";
         //商品属性进行检索
         if ($isCondition == true) {
             /******属性 开始******/
             $attrTemp = array();
             $goodsAttrDB = new IModel('goods_attribute');
             $attrData = $goodsAttrDB->query("goods_id in (" . join(',', $GoodsId) . ")");
             foreach ($attrData as $key => $val) {
                 //属性
                 if ($val['attribute_id']) {
                     if (!isset($attrTemp[$val['attribute_id']])) {
                         $attrTemp[$val['attribute_id']] = array();
                     }
                     $checkSelectedArray = explode(",", $val['attribute_value']);
                     foreach ($checkSelectedArray as $k => $v) {
                         if (!in_array($v, $attrTemp[$val['attribute_id']])) {
                             $attrTemp[$val['attribute_id']][] = $v;
                         }
                     }
                 }
             }
             //属性的数据拼接
             if ($attrTemp) {
                 $attrDB = new IModel('attribute');
                 $attrData = $attrDB->query("id in (" . join(',', array_keys($attrTemp)) . ") and search = 1", "*", "id", "asc", 8);
                 foreach ($attrData as $key => $val) {
                     self::$attrSearch[] = array('id' => $val['id'], 'name' => $val['name'], 'value' => $attrTemp[$val['id']]);
                 }
             }
             /******属性 结束******/
             /******品牌 开始******/
             $brandQuery = new IModel('brand as b,goods as go');
             self::$brandSearch = $brandQuery->query("go.brand_id = b.id and go.id in (" . join(',', $GoodsId) . ")", "distinct b.id,b.name", "b.sort", "asc", 10);
             /******品牌 结束******/
             /******价格 开始******/
             self::$priceSearch = goods_class::getGoodsPrice(join(',', $GoodsId));
             /******价格 结束******/
         }
     }
     //(4),商品价格
     $where .= floatval(IReq::get('min_price')) ? ' and go.sell_price >= ' . floatval(IReq::get('min_price')) : '';
     $where .= floatval(IReq::get('max_price')) ? ' and go.sell_price <= ' . floatval(IReq::get('max_price')) : '';
     //(5),商品品牌
     $where .= intval(IReq::get('brand')) ? ' and go.brand_id = ' . intval(IReq::get('brand')) : '';
     //排序类别
     $order = IFilter::act(IReq::get('order'), 'url');
     if ($order == null) {
         $order = isset($site_config['order_by']) ? $site_config['order_by'] : 'new';
         $asc = isset($site_config['order_type']) ? $site_config['order_type'] : 'desc';
     } else {
         if (stripos($order, '_toggle')) {
             $order = str_replace('_toggle', '', $order);
             $asc = 'asc';
         } else {
             $asc = 'desc';
         }
     }
     switch ($order) {
         //销售量
         case "sale":
             $orderArray[] = ' go.sale ' . $asc;
             break;
             //评分
         //评分
         case "cpoint":
             $orderArray[] = ' go.grade ' . $asc;
             break;
             //最新上架
         //最新上架
         case "new":
             $orderArray[] = ' go.id ' . $asc;
             break;
             //价格
         //价格
         case "price":
             $orderArray[] = ' go.sell_price ' . $asc;
             break;
             //根据排序字段
         //根据排序字段
         default:
             $orderArray[] = ' go.sort asc ';
     }
     //设置IQuery类的各个属性
     $goodsObj->where = $where;
     $goodsObj->order = join(',', $orderArray);
     return $goodsObj;
 }
Ejemplo n.º 24
0
<script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/artdialog/artDialog.js"></script><script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/artdialog/plugins/iframeTools.js"></script><link rel="stylesheet" type="text/css" href="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/artdialog/skins/default.css" />
</head>
<body style='width:420px;min-height:120px;'>
<div class="pop_win">
	<div class="content">
		<form action="<?php 
echo IFilter::act(IReq::get('callback'), 'url');
?>
" method='post' enctype='multipart/form-data'>
			<table class='form_table'>
				<colgroup>
					<col width="120px" />
					<col />
				</colgroup>

				<tr>
					<td class="t_r">选择图片文件:</td>
					<td><input type='file' class='file' name='attach' /></td>
				</tr>
			</table>
		</form>
	</div>
Ejemplo n.º 25
0
 /**
  * 快递单
  * */
 function exdelivry()
 {
     $id = IReq::get('id');
     $tb_delivery_doc = new IQuery('delivery_doc as dd');
     $tb_delivery_doc->fields = 'd.name,dd.delivery_code,fc.freight_name';
     $tb_delivery_doc->where = 'order_id=' . $id;
     $tb_delivery_doc->join = 'left join delivery as d on dd.delivery_type=d.id left join freight_company as fc on d.freight_id=fc.id';
     $delivery_info = $tb_delivery_doc->find();
     $get_content = '暂无相关信息!';
     if (count($delivery_info) > 0) {
         //获得用户申请的id
         $config = new Config("site_config");
         $config_info = $config->getInfo();
         $express_key = isset($config_info['express_key']) ? $config_info['express_key'] : '';
         if ($express_key) {
             //获得物流名称和物流单号
             $delivery_code = $delivery_info[0]['delivery_code'];
             $name = $delivery_info[0]['freight_name'];
             $get_content = '物流公司或者货运单号错误';
             $type = '1';
             if ($delivery_code != '' && $name != '') {
                 $name = str_replace(' ', '', $name);
                 $delivery_code = str_replace(' ', '', $delivery_code);
                 $sUrl = $this->module->getBasePath();
                 include $sUrl . 'plugins/freight/company.php';
                 $company = new Company();
                 $name = $company->getCompany($name);
                 $AppKey = $express_key;
                 $url = 'http://api.kuaidi100.com/api?id=' . $AppKey . '&com=' . $name . '&nu=' . $delivery_code . '&show=2&muti=1&order=asc';
                 //请勿删除变量$powered 的信息,否者本站将不再为你提供快递接口服务。
                 $powered = '查询数据由:<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a> 网站提供 ';
                 //优先使用curl模式发送数据
                 if (function_exists('curl_init') == 1) {
                     $curl = curl_init();
                     curl_setopt($curl, CURLOPT_URL, $url);
                     curl_setopt($curl, CURLOPT_HEADER, 0);
                     curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
                     curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
                     curl_setopt($curl, CURLOPT_TIMEOUT, 5);
                     $get_content = curl_exec($curl);
                     $type = '2';
                     curl_close($curl);
                 } else {
                     include $sUrl . 'plugins/freight/snoopy.php';
                     $snoopy = new snoopy();
                     $snoopy->referer = 'http://www.google.com/';
                     //伪装来源
                     $snoopy->fetch($url);
                     $get_content = $snoopy->results;
                     $type = '2';
                 }
             }
         } else {
             $get_content = '您还没有申请ID,请到<a href="http://kuaidi100.com" target="_blank">KuaiDi100.Com (快递100)</a>申请!';
         }
     }
     $this->setRenderData(array('conent' => $get_content, 'type' => $type));
     $this->redirect('exdelivry');
 }
Ejemplo n.º 26
0
 /**
  * @brief 获取url参数
  * @param String url 需要分析的url,默认为当前url
  */
 public static function beginUrl($url = '')
 {
     //四种
     //native: /index.php?controller=blog&action=read&id=100
     //pathinfo:/blog/read/id/100
     //native-pathinfo:/index.php/blog/read/id/100
     //diy:/blog-100.html
     $obj = IServerVars::factory($_SERVER['SERVER_SOFTWARE']);
     $url = !empty($url) ? $url : $obj->realUri();
     preg_match('/\\.php(.*)/', $url, $phpurl);
     if (!isset($phpurl[1]) || !$phpurl[1]) {
         if ($url != "") {
             //强行赋值
             //todo:检测是否有bug
             $phpurl = array(1 => "?");
         } else {
             return;
         }
     }
     $url = $phpurl[1];
     $urlArray = array();
     $rewriteRule = isset(IWeb::$app->config['rewriteRule']) ? IWeb::$app->config['rewriteRule'] : 'native';
     if ($rewriteRule != 'native') {
         $urlArray = self::decodeRouteUrl($url);
     }
     if ($urlArray == array()) {
         if ($url[0] == '?') {
             $urlArray = $_GET;
         } else {
             $urlArray = self::pathinfoToArray($url);
         }
     }
     if (isset($urlArray[self::UrlCtrlName])) {
         $tmp = explode('-', $urlArray[self::UrlCtrlName]);
         if (count($tmp) == 2) {
             IReq::set('module', $tmp[0]);
             IReq::set(self::UrlCtrlName, $tmp[1]);
         } else {
             IReq::set(self::UrlCtrlName, $urlArray[self::UrlCtrlName]);
         }
     }
     if (isset($urlArray[self::UrlActionName])) {
         IReq::set(self::UrlActionName, $urlArray[self::UrlActionName]);
         if (IReq::get('action') == 'run') {
             IReq::set('action', null);
         }
     }
     unset($urlArray[self::UrlActionName], $urlArray[self::UrlActionName], $urlArray[self::Anchor]);
     foreach ($urlArray as $key => $value) {
         IReq::set($key, $value);
     }
 }
Ejemplo n.º 27
0
 /**
  * 查询删除
  */
 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");
 }
Ejemplo n.º 28
0
<?php

$siteConfig = new Config("site_config");
$callback = IReq::get('callback') ? urlencode(IFilter::act(IReq::get('callback'), 'url')) : '';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title><?php 
echo $siteConfig->name;
?>
</title>
	<link type="image/x-icon" href="favicon.ico" rel="icon">
	<link rel="stylesheet" href="<?php 
echo IUrl::creatUrl("") . "views/" . $this->theme . "/skin/" . $this->skin . "/css/index.css";
?>
" />
	<script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/jquery/jquery-1.11.3.min.js"></script><script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/jquery/jquery-migrate-1.2.1.min.js"></script>
	<script type="text/javascript" charset="UTF-8" src="<?php 
echo BASE_URL;
?>
/runtime/_systemjs/autovalidate/validate.js"></script><link rel="stylesheet" type="text/css" href="<?php 
echo BASE_URL;
Ejemplo n.º 29
0
">网站首页>></a></p>
						<p class="mt_40 f_r"><a class="next_step" href="javascript:next_step();">下一步</a></p>
					</td>
				</tr>
			</table>
			<?php 
}
?>

		</div>
	</div>
</div>

<script type='text/javascript'>
<?php 
$callback = IReq::get('callback') ? IFilter::clearUrl(IReq::get('callback')) : IUrl::getRefRoute();
?>

//DOM加载结束
$(function(){
	//回调地址设置
	$('input[name="callback"]').val("<?php 
echo isset($callback) ? $callback : "";
?>
");
	$('.reg_btn').attr('href',"<?php 
echo IUrl::creatUrl("/simple/reg?callback=" . $callback . "");
?>
");

	$(".form_table input").focus(function(){$(this).addClass('current');}).blur(function(){$(this).removeClass('current');})
Ejemplo n.º 30
0
 function goods_copy()
 {
     $idArray = explode(',', IReq::get('id'));
     $idArray = IFilter::act($idArray, 'int');
     $goodsDB = new IModel('goods');
     $goodsAttrDB = new IModel('goods_attribute');
     $goodsPhotoRelationDB = new IModel('goods_photo_relation');
     $productsDB = new IModel('products');
     $goodsData = $goodsDB->query('id in (' . join(',', $idArray) . ') and is_share = 1 and is_del = 0 and seller_id = 0', '*');
     if ($goodsData) {
         foreach ($goodsData as $key => $val) {
             //判断是否重复
             if ($goodsDB->getObj('seller_id = ' . $this->seller['seller_id'] . ' and name = "' . $val['name'] . '"')) {
                 die('商品不能重复复制');
             }
             $oldId = $val['id'];
             //商品数据
             unset($val['id'], $val['visit'], $val['favorite'], $val['sort'], $val['comments'], $val['sale'], $val['grade'], $val['is_share']);
             $val['seller_id'] = $this->seller['seller_id'];
             $val['goods_no'] .= '-' . $this->seller['seller_id'];
             $goodsDB->setData($val);
             $goods_id = $goodsDB->add();
             //商品属性
             $attrData = $goodsAttrDB->query('goods_id = ' . $oldId);
             if ($attrData) {
                 foreach ($attrData as $k => $v) {
                     unset($v['id']);
                     $v['goods_id'] = $goods_id;
                     $goodsAttrDB->setData($v);
                     $goodsAttrDB->add();
                 }
             }
             //商品图片
             $photoData = $goodsPhotoRelationDB->query('goods_id = ' . $oldId);
             if ($photoData) {
                 foreach ($photoData as $k => $v) {
                     unset($v['id']);
                     $v['goods_id'] = $goods_id;
                     $goodsPhotoRelationDB->setData($v);
                     $goodsPhotoRelationDB->add();
                 }
             }
             //货品
             $productsData = $productsDB->query('goods_id = ' . $oldId);
             if ($productsData) {
                 foreach ($productsData as $k => $v) {
                     unset($v['id']);
                     $v['products_no'] .= '-' . $this->seller['seller_id'];
                     $v['goods_id'] = $goods_id;
                     $productsDB->setData($v);
                     $productsDB->add();
                 }
             }
         }
         die('success');
     } else {
         die('复制的商品不存在');
     }
 }