当前位置: 首页>>代码示例>>PHP>>正文


PHP Import::img方法代码示例

本文整理汇总了PHP中Import::img方法的典型用法代码示例。如果您正苦于以下问题:PHP Import::img方法的具体用法?PHP Import::img怎么用?PHP Import::img使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Import的用法示例。


在下文中一共展示了Import::img方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajax_edit_add

 function ajax_edit_add($data = array(), $id = 0)
 {
     if (!empty($data['width']) && !empty($data['height']) && !empty($data['link_logo'])) {
         if (!empty($id)) {
             $sql = "SELECT link_logo FROM `{$this->App->prefix()}friend_link` WHERE link_id='{$id}'";
             $var = $this->App->findvar($sql);
             if ($data['link_logo'] != $var) {
                 Import::fileop()->delete_file(SYS_PATH . $var);
                 //删除文件
                 $q = dirname($var);
                 $h = basename($var);
                 Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
                 Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
                 if (file_exists(SYS_PATH . $data['link_logo'])) {
                     Import::img()->thumb(SYS_PATH . $data['link_logo'], SYS_PATH . $data['link_logo'], $data['width'], $data['height']);
                 }
             }
         }
     }
     if (empty($id)) {
         if ($this->App->insert('friend_link', $data)) {
             $this->action('system', 'add_admin_log', '添加友情链接:' . $data['link_name']);
         } else {
             echo "无法添加友情链接,意外错误!";
         }
     } else {
         if ($this->App->update('friend_link', $data, 'link_id', $id)) {
             $this->action('system', 'add_admin_log', '修改友情链接:' . $data['link_name']);
         } else {
             echo "数据未变动,无需更新!";
         }
     }
     exit;
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:34,代码来源:controller.php

示例2: goodsinfo

 function goodsinfo()
 {
     $this->layout('kong2');
     $gid = isset($_GET['id']) ? intval($_GET['id']) : 0;
     //$sid = isset($_GET['shopid']) ? intval($_GET['shopid']) : 0;
     $sid = $this->Session->read('Shop.uid');
     if ($gid > 0) {
         $sql = "SELECT * FROM `{$this->App->prefix()}user_shopgoods` WHERE goods_id='{$gid}' LIMIT 1";
         $rt = $this->App->findrow($sql);
         $this->set('rt', $rt);
     }
     if (isset($_POST) && !empty($_POST)) {
         $_POST['is_on_sale'] = isset($_POST['is_on_sale']) && intval($_POST['is_on_sale']) > 0 ? intval($_POST['is_on_sale']) : '0';
         $_POST['is_best'] = isset($_POST['is_best']) && intval($_POST['is_best']) > 0 ? intval($_POST['is_best']) : '0';
         $_POST['is_new'] = isset($_POST['is_new']) && intval($_POST['is_new']) > 0 ? intval($_POST['is_new']) : '0';
         $_POST['is_hot'] = isset($_POST['is_hot']) && intval($_POST['is_hot']) > 0 ? intval($_POST['is_hot']) : '0';
         $_POST['is_promote'] = isset($_POST['is_promote']) && intval($_POST['is_promote']) > 0 ? intval($_POST['is_promote']) : '0';
         if ($gid > 0) {
             //编辑
             if ($rt['original_img'] != $_POST['original_img']) {
                 //修改了上传文件 那么重新上传
                 $source_path = SYS_PATH . DS . str_replace('/', DS, $_POST['original_img']);
                 $pa = dirname($_POST['original_img']);
                 $thumb = basename($_POST['original_img']);
                 $tw_s = intval($GLOBALS['LANG']['th_width_s']) > 0 ? intval($GLOBALS['LANG']['th_width_s']) : 200;
                 $th_s = intval($GLOBALS['LANG']['th_height_s']) > 0 ? intval($GLOBALS['LANG']['th_height_s']) : 200;
                 $tw_b = intval($GLOBALS['LANG']['th_width_b']) > 0 ? intval($GLOBALS['LANG']['th_width_b']) : 450;
                 $th_b = intval($GLOBALS['LANG']['th_height_b']) > 0 ? intval($GLOBALS['LANG']['th_height_b']) : 450;
                 if (isset($_POST['goods_thumb']) && !empty($_POST['goods_thumb'])) {
                     //留空
                 } else {
                     Import::img()->thumb($source_path, dirname($source_path) . DS . 'thumb_s' . DS . $thumb, $tw_s, $th_s);
                     //小缩略图
                     $_POST['goods_thumb'] = $pa . '/thumb_s/' . $thumb;
                 }
                 Import::img()->thumb($source_path, dirname($source_path) . DS . 'thumb_b' . DS . $thumb, $tw_b, $th_b);
                 //大缩略图
                 $_POST['goods_img'] = $pa . '/thumb_b/' . $thumb;
             }
             $_POST['meta_keys'] = !empty($_POST['meta_keys']) ? str_replace(array(',', '。', '.'), ',', $_POST['meta_keys']) : "";
             $this->App->update('user_shopgoods', $_POST, 'goods_id', $gid);
             $this->jump(SITE_URL . 'shop/sp.php?type=photosinfo', 0, '修改成功!');
             exit;
         } else {
             //添加
             $_POST['meta_keys'] = !empty($_POST['meta_keys']) ? str_replace(array(',', '。', '.'), ',', $_POST['meta_keys']) : "";
             $_POST['add_time'] = mktime();
             $_POST['uid'] = $sid;
             //商品图片
             if (!empty($_POST['original_img'])) {
                 $pa = dirname($_POST['original_img']);
                 $thumb = basename($_POST['original_img']);
                 //商品小图
                 if (isset($_POST['goods_thumb']) && !empty($_POST['goods_thumb'])) {
                     //留空即可
                 } else {
                     $_POST['goods_thumb'] = $pa . '/thumb_s/' . $thumb;
                 }
                 //商品中图
                 $_POST['goods_img'] = $pa . '/thumb_b/' . $thumb;
             }
             $this->App->insert('user_shopgoods', $_POST);
             $this->jump(SITE_URL . 'shop/sp.php?type=photosinfo', 0, '添加成功!');
             exit;
         }
     }
     $this->set('catelist', $this->get_goods_cate_tree(0, $sid));
     $this->template('goodsinfo');
 }
开发者ID:jasonhzy,项目名称:wxfx,代码行数:69,代码来源:controller.php

示例3: ttest

 function ttest()
 {
     $imgobj = Import::img();
     $crawler = Import::crawler();
     $iconv = Import::gz_iconv();
     require_once SYS_PATH_ADMIN . 'inc' . DS . 'download.php';
     //$crawler->curl_get_con('http://www.womai.com/Product-0-526333.htm');exit;
     //$imgobj->grabImage("http://www.21ej.com/picture/139-848-892.gif",SYS_PATH."test.gif");
     DownImageKeep("http://www.21ej.com/picture/139-848-d892.gif", "http://www.baidu.com", SYS_PATH . "test.gif", "", 0, 1);
     exit;
     $sql = "SELECT tb1.url,tb2.goods_preg_1,tb2.goods_preg_2,tb2.goods_preg_3,tb2.goods_preg_4,tb2.goods_preg_5 FROM `{$this->App->prefix()}goods_cache_url` AS tb1 LEFT JOIN `{$this->App->prefix()}goods_cache_site` AS tb2 ON tb2.gcid = tb1.gcid WHERE tb1.gcid='1' LIMIT 3";
     $rt = $this->App->find($sql);
     $str = "";
     if (!empty($rt)) {
         foreach ($rt as $row) {
             $url = $row['url'];
             echo $con = $crawler->curl_get_con($url);
             exit;
             if (empty($con)) {
                 continue;
             }
             $con = $iconv->ec_iconv('GB2312', 'UTF8', $con);
             //分类
             $goods_preg_1 = $row['goods_preg_1'];
             @preg_match($goods_preg_1, $con, $arr1);
             $catetitle = isset($arr1[1]) ? $arr1[1] : "";
             //标题
             $goods_preg_2 = $row['goods_preg_2'];
             @preg_match($goods_preg_2, $con, $arr2);
             $goodstitle = isset($arr2[1]) ? $arr2[1] : "";
             //价格
             $goods_preg_3 = $row['goods_preg_3'];
             @preg_match($goods_preg_3, $con, $arr3);
             $goodsprice = isset($arr3[1]) ? $arr3[1] : "";
             $goods_preg_4 = $row['goods_preg_4'];
             if (!empty($goods_preg_4)) {
                 $goods_preg_4 = str_replace('"', "'", $goods_preg_4);
                 @preg_match($goods_preg_4, $con, $arr4);
                 $goodsimg = isset($arr4[1]) ? $arr4[1] : "";
                 $simg = "photos/g/" . date('Ym', mktime()) . "/ej" . mktime() . substr($goodsimg, -4);
                 $imgobj->imagescopy("http://www.21ej.com/" . $goodsimg, SYS_PATH . $simg);
             }
             $goods_preg_5 = $row['goods_preg_5'];
             if (!empty($goods_preg_5)) {
                 @preg_match($goods_preg_5, $con, $arr5);
                 $goodsdesc = isset($arr5[1]) ? $arr5[1] : "";
             }
         }
     }
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:50,代码来源:controller.php

示例4: upload

 function upload($filename, $filedir = "")
 {
     if (empty($filedir) || empty($filename)) {
         return false;
     }
     $imgobj = Import::img();
     $f_name = $_FILES[$filename]['name'];
     //获取上传源文件名
     $t = strrchr($f_name, '.');
     //图片类型
     $name = time() . time() . $t;
     //原始图名称
     //设置生成缩略图图片的大小
     $dir = basename(dirname($filedir));
     $tw_s = 260;
     $th_s = 260;
     $tw_b = 600;
     $th_b = 600;
     $result = false;
     switch ($dir) {
         case 'articlephoto':
             //文章图片
             break;
         case 'catephoto':
             //分类图片
             break;
         case 'companylogo':
             //客户公司图片
             break;
         case 'friendlogo':
             //友情链接图片图片
             break;
         case 'site_icon':
             //网站图标
             break;
         case 'brand':
             //品牌的banner图
         //品牌的banner图
         case 'goods':
             //商品
             $tw_s = intval($GLOBALS['LANG']['th_width_s']) > 0 ? intval($GLOBALS['LANG']['th_width_s']) : 260;
             $th_s = intval($GLOBALS['LANG']['th_height_s']) > 0 ? intval($GLOBALS['LANG']['th_height_s']) : 260;
             $tw_b = intval($GLOBALS['LANG']['th_width_b']) > 0 ? intval($GLOBALS['LANG']['th_width_b']) : 600;
             $th_b = intval($GLOBALS['LANG']['th_height_b']) > 0 ? intval($GLOBALS['LANG']['th_height_b']) : 600;
             break;
         case 'avatar':
             $tw_s = 150;
             $th_s = 150;
             $tw_b = 150;
             $th_b = 150;
             $result = true;
             break;
     }
     $imgname = $imgobj->upload($filename, $filedir . $name);
     $other = array('banner', 'brand', 'cover', 'top_img');
     if (file_exists($filedir . $name)) {
         if ($dir == 'avatar') {
             //头像 生成150
             $imgobj->thumb($filedir . $name, $filedir . 'thumb_s' . DS . $name, $tw_s, $th_s);
             @unlink($filedir . $name);
             //Import::->fileop()->delete_file($filedir.$name);
             $imgobj->thumb($filedir . 'thumb_s' . DS . $name, $filedir . $name, $tw_b, $th_b);
             @unlink($filedir . 'thumb_b' . DS . $name);
             //Import::->fileop()->delete_file($filedir.'thumb_b'.DS.$name);
         } else {
             if (!in_array($dir, $other)) {
                 $imgobj->thumb($filedir . $name, $filedir . 'thumb_s' . DS . $name, $tw_s, $th_s);
                 $imgobj->thumb($filedir . $name, $filedir . 'thumb_b' . DS . $name, $tw_b, $th_b);
             }
         }
     }
     return $name;
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:73,代码来源:controller.php

示例5: zhuanyi_goods

 function zhuanyi_goods()
 {
     if (isset($_GET['kk']) && isset($_GET['maxpage'])) {
         $imgobj = Import::img();
         $kk = $_GET['kk'];
         $list = 20;
         if ($kk == 0) {
             $tt = $this->App->findvar("SELECT COUNT(goods_id) FROM `{$this->App->prefix()}goods`");
             $maxpage = ceil($tt / $list);
         } else {
             $maxpage = $_GET['maxpage'];
         }
         $start = $kk * $list;
         $sql = "SELECT g.*,u.user_name FROM `{$this->App->prefix()}goods` AS g LEFT JOIN `{$this->App->prefix()}user` AS u ON u.user_id = g.uid LIMIT {$start},{$list}";
         $rt = $this->App->find($sql);
         $str = "";
         if (!empty($rt)) {
             foreach ($rt as $row) {
                 //检查是否已经存在该记录
                 if ($row['uid'] > 0) {
                     $sgid = $this->App->findvar("SELECT sgid FROM `{$this->App->prefix()}suppliers_goods` WHERE suppliers_id='{$row['uid']}' AND goods_id='{$row['goods_id']}'");
                     if (empty($sgid)) {
                         $this->App->insert('suppliers_goods', array('suppliers_id' => $row['uid'], 'goods_id' => $row['goods_id'], 'market_price' => $row['market_price'], 'shop_price' => $row['shop_price'], 'pifa_price' => $row['pifa_price'], 'is_on_sale' => $row['is_on_sale'], 'is_delete' => $row['is_delete'], 'is_check' => $row['is_check'], 'addtime' => mktime()));
                         $str .= '转移=>供应商[' . $row['user_name'] . '] goods_id[' . $row['goods_id'] . '] 供应价[' . $row['market_price'] . '] 零售价[' . $row['shop_price'] . '] 批发价[' . $row['pifa_price'] . ']' . "<br/>";
                     } else {
                         //$this->App->update('suppliers_goods',array('suppliers_id'=>$row['uid'],'goods_id'=>$row['goods_id'],'market_price'=>$row['market_price'],'shop_price'=>$row['shop_price'],'pifa_price'=>$row['pifa_price'],'is_on_sale'=>$row['is_on_sale'],'is_delete'=>$row['is_delete'],'addtime'=>mktime()),array("goods_id='$row[goods_id]'","suppliers_id='$row[uid]'"));
                         $str .= "该商品已经存在=goods_id:" . $row['goods_id'] . ",正在更新!<br/>";
                     }
                 } else {
                     $str .= "没有指定供应商!<br/>";
                 }
             }
         }
         $kk = $kk + 1;
         $str .= "<font color=red>==============Load.....page(" . $kk . ")================</font><br />";
         if ($kk > $maxpage) {
             $kk = "";
         }
         sleep(2);
         $rts = array('kk' => $kk, 'url' => $str, 'maxpage' => $maxpage);
         die(Import::json()->encode($rts));
     }
     $this->template('zhuanyi_goods');
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:44,代码来源:controller.php

示例6: ajax_upload

 function ajax_upload($filename = "")
 {
     @set_time_limit(600);
     //最大运行时间
     $fop = Import::fileop();
     $aid = $this->Session->read('adminid');
     $fn = SYS_PATH . 'cache' . DS . 'admin-' . $aid . '.php';
     //记录错误日记
     $fop->writefile($fn, "");
     $tw_s = intval($GLOBALS['LANG']['th_width_s']) > 0 ? intval($GLOBALS['LANG']['th_width_s']) : 200;
     $th_s = intval($GLOBALS['LANG']['th_height_s']) > 0 ? intval($GLOBALS['LANG']['th_height_s']) : 200;
     $tw_b = intval($GLOBALS['LANG']['th_width_b']) > 0 ? intval($GLOBALS['LANG']['th_width_b']) : 450;
     $th_b = intval($GLOBALS['LANG']['th_height_b']) > 0 ? intval($GLOBALS['LANG']['th_height_b']) : 450;
     if (!empty($_FILES[$filename]['tmp_name'])) {
         $fn = SYS_PATH . 'cache' . DS . 'admin-upload-' . $aid . '.xls';
         if (file_exists($fn)) {
             unlink($fn);
         }
         //删除原来文件
         $fop->copyfile($filename, $fn);
         //复制文件到服务器
         if (!file_exists($fn)) {
             $fop->copyfile($filename, $fn);
             if (!file_exists($fn)) {
                 echo '<script> alert("上传时发生意外错误!"); </script>';
                 return false;
             }
         }
         $data = Import::excel();
         //$data->read($_FILES[$filename]['tmp_name']);
         $data->read($fn);
         //读取文件
         $importkey = $data->sheets[0]['cells'][1];
         for ($i = 2; $i <= $data->sheets[0]['numRows']; $i++) {
             //以下注释的for循环打印excel表数据
             $this->rtData = array();
             //商品数据
             $this->rtData_gallery = array();
             //商品相册
             for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
                 $this->goods_key($importkey[$j], $data->sheets[0]['cells'][$i][$j]);
                 //传送 键=>值 处理
             }
             $this->rtData['is_on_sale'] = '0';
             $uuid = 0;
             $uuid = $this->rtData['uid'];
             if (!($uuid > 0)) {
                 $uuid = '18';
             }
             $this->rtData['uid'] = $uuid;
             $this->rtData['add_time'] = mktime();
             $inData = $this->rtData;
             //print_r($inData); exit;
             $goods_id = 0;
             //检查该商品已经存在数据库中
             $sn = $inData['goods_bianhao'];
             //优先级是商品编号检查
             if (!empty($sn)) {
                 $sql = "SELECT goods_id FROM `{$this->App->prefix()}goods` WHERE goods_bianhao='{$sn}' AND uid='{$uuid}'";
                 $goods_id = $this->App->findvar($sql);
                 //if(!empty($snvar)) continue;
             } else {
                 $sa = $inData['goods_name'];
                 //商品名称检查是否该商品已经存在
                 if (!empty($sa)) {
                     //最后更新:2012-12-11 10:26
                     $sql = "SELECT goods_id FROM `{$this->App->prefix()}goods` WHERE goods_name='{$sa}' AND uid='{$uuid}'";
                     $goods_id = $this->App->findvar($sql);
                     //if(!empty($savar)) continue;
                 }
             }
             if (!empty($inData['goods_name'])) {
                 //商品图片
                 $val = $inData['original_img'];
                 if (!empty($val)) {
                     $pa = dirname($val);
                     $thumb = basename($val);
                     if (is_file(SYS_PATH . $pa . DS . 'thumb_s' . DS . $thumb)) {
                         $pp = SYS_PATH . $pa . DS . 'thumb_s' . DS . mktime() . $thumb;
                         $pps = $pa . '/thumb_s/' . mktime() . $thumb;
                     } else {
                         $pp = SYS_PATH . $pa . DS . 'thumb_s' . DS . $thumb;
                         $pps = $pa . '/thumb_s/' . $thumb;
                     }
                     Import::img()->thumb(SYS_PATH . $val, $pp, $tw_s, $th_s);
                     //小缩略图
                     $inData['goods_thumb'] = $pps;
                     if (is_file(SYS_PATH . $pa . DS . 'thumb_b' . DS . $thumb)) {
                         $pp = SYS_PATH . $pa . DS . 'thumb_b' . DS . mktime() . $thumb;
                         $pps = $pa . '/thumb_b/' . mktime() . $thumb;
                     } else {
                         $pp = SYS_PATH . $pa . DS . 'thumb_b' . DS . $thumb;
                         $pps = $pa . '/thumb_b/' . $thumb;
                     }
                     Import::img()->thumb(SYS_PATH . $val, $pp, $tw_b, $th_b);
                     //大缩略图
                     $inData['goods_img'] = $pps;
                 }
                 if ($goods_id > 0) {
                     //更新
//.........这里部分代码省略.........
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:101,代码来源:controller.php

示例7: keyword

 function keyword($keyword = '')
 {
     if (!empty($keyword)) {
         $wecha_id = $this->wecha_id;
         switch ($keyword) {
             case '推广链接':
                 $RL = $this->App->findrow("SELECT user_id,is_subscribe FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1");
                 $issubscribe = isset($RL['is_subscribe']) ? $RL['is_subscribe'] : '0';
                 $uid = isset($RL['user_id']) ? $RL['user_id'] : '0';
                 unset($RL);
                 if ($issubscribe == '0') {
                     return array('请先关注抢占分享地盘!', 'text');
                     exit;
                 }
                 $thisurl = SITE_URL . "m/in.php?tid=" . $uid;
                 return array('复制链接发送给朋友赚钱:' . $thisurl, 'text');
                 break;
             case 'ranklist':
                 // 排行榜
                 $RL = $this->App->findrow("SELECT user_id,user_rank FROM `{$this->App->prefix()}user` WHERE wecha_id='{$this->wecha_id}' LIMIT 1");
                 $uid = isset($RL['user_id']) ? $RL['user_id'] : '0';
                 $purt = $this->App->findrow("SELECT ut.parent_uid,u.wecha_id FROM `{$this->App->prefix()}user_tuijian` AS ut LEFT JOIN `{$this->App->prefix()}user` AS u ON u.user_id = ut.parent_uid WHERE ut.uid='{$uid}' LIMIT 1");
                 $puid = isset($purt['parent_uid']) ? $purt['parent_uid'] : '0';
                 if ($uid > 0) {
                     $gzcount = $this->App->findvar("SELECT COUNT(user_id) FROM `{$this->App->prefix()}user` LIMIT 1");
                     $gzcount = $gzcount * 5 + 750;
                     if ($puid > 0) {
                         $nickname = $this->App->findrow("SELECT nickname FROM `{$this->App->prefix()}user` WHERE user_id = '{$puid}' LIMIT 1");
                         if (empty($nickname)) {
                             $nickname = '官网';
                         }
                         $str = '来自好友【' . $nickname['nickname'] . '】的推荐成为第【' . $gzcount . '】位会员,立即关注,抢夺店主地盘!';
                     } else {
                         $str = '来自【官网】的推荐成为第【' . $gzcount . '】位会员,立即关注,抢夺店主地盘!';
                     }
                 }
                 $data = '{"touser":"' . $wecha_id . '","msgtype":"text","text":{"content":"' . $str . '"}}';
                 $access_token = $this->_get_access_token();
                 $rt = $this->curlPost('https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . $access_token, $data, 0);
                 $orderid = $this->App->findvar("SELECT order_id FROM  `{$this->App->prefix()}goods_order_info` where `user_id`='{$RL['user_id']}' and `pay_status`=1");
                 if ($orderid or $RL['user_rank'] > 1) {
                     return array('你已经是店主 发送你的名片给你的好友 赚钱吧', 'text');
                 } else {
                     return array("您还不是店主,请<a href=\"" . SITE_URL . "/m/oauth.php?oid=1\">购买商品</a>成为店主", 'text');
                 }
                 break;
             case 'qr':
                 //生成二维码
             //生成二维码
             case '我的二维码':
                 //生成二维码
                 $yuming = str_replace(array('www', '.'), '', $_SERVER["HTTP_HOST"]);
                 if (!empty($yuming)) {
                     $yuming = $yuming . DS;
                 }
                 if (!empty($wecha_id)) {
                     $tb = 'markimg';
                     $sql = "SELECT is_subscribe,user_rank,user_id,quid,headimgurl,nickname FROM `{$this->App->prefix()}user` WHERE wecha_id='{$wecha_id}' LIMIT 1";
                     $RT = $this->App->findrow($sql);
                     if ($RT['is_subscribe'] == '0') {
                         return array('关注后购买成为合伙人生成推广二维码赚钱吧!', 'text');
                         exit;
                     }
                     $access_token = $this->_get_access_token();
                     if ($RT['user_rank'] == '1') {
                         //生成推荐人二维码
                         $tb = 'markimg2';
                         /* $uid = isset($RT['user_id']) ? $RT['user_id'] : '0';
                         			$puid = $this->return_daili_uid($uid);//返回上级分销商 */
                         /*
                         if($puid > 0){
                         	 $sql = "SELECT is_subscribe,user_rank,user_id,quid,headimgurl,nickname FROM `{$this->App->prefix()}user` WHERE user_id='$puid' LIMIT 1";
                         	$RT = $this->App->findrow($sql); 
                         }else{//生成官网二维码
                         	$tb = 'markimg3';
                         	$this->send(array('openid'=>$wecha_id,'appid'=>'','appsecret'=>'','nickname'=>''),$tb);
                         	$sql = "SELECT site_url FROM `{$this->App->prefix()}systemconfig` WHERE type='basic' LIMIT 1";
                         	$f3 = $this->App->findvar($sql);
                         	if(!empty($f3)) $f3 = SYS_PATH.$f3;
                         	if(file_exists($f3)){
                         				$type = "image";
                         				$filedata = array("media"=>"@".$f3);
                         				$url = "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=$access_token&type=$type";
                         				$result = $this->https_request($url,$filedata);
                         				$json = json_decode($result);
                         				$media_id = $json->media_id;
                         				if(!empty($media_id)) $this->send(array('openid'=>$wecha_id,'appid'=>'','appsecret'=>'','media_id'=>$media_id),'markimgsend'); 
                         				exit;
                         	}
                         	
                         	//return array('你是由官网推荐,请购买后生成你的推广二维码!', 'text');
                         	exit;
                         }
                         */
                         $this->send(array('openid' => $wecha_id, 'appid' => '', 'appsecret' => '', 'nickname' => ''), $tb);
                         //return array("对不起、您不是东家,获得推广图片,请购买<a href='#'>商品<a/>成为东家", 'xml');
                         exit;
                     }
                     $uid = $RT['user_id'];
                     $quid = $RT['quid'];
//.........这里部分代码省略.........
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:101,代码来源:controller.php

示例8: info


//.........这里部分代码省略.........
             $this->jump('goods.php?type?goods_list');
             exit;
         }
         //当前商品的相册
         $sql = "SELECT * FROM `{$this->App->prefix()}goods_gallery` WHERE goods_id='{$gid}'";
         $this->set('gallerylist', $this->App->find($sql));
         //当前商品属性的属性
         $sql = "SELECT tb1.*,tb2.attr_name,tb2.attr_is_select FROM `{$this->App->prefix()}goods_attr` AS tb1 LEFT JOIN `{$this->App->prefix()}attribute` AS tb2 ON tb1.attr_id=tb2.attr_id WHERE tb1.goods_id='{$gid}'";
         $goods_attr = $this->App->find($sql);
         $rt['goods_attr'] = array();
         if (!empty($goods_attr)) {
             foreach ($goods_attr as $row) {
                 $rt['goods_attr'][$row['attr_id']][] = $row;
             }
             unset($row, $goods_attr);
         }
         //商品的赠品类型
         $sql = "SELECT  type  FROM `{$this->App->prefix()}goods_gift` WHERE goods_id='{$gid}'";
         $rt['gift_type_id'] = $this->App->findcol($sql);
         if (isset($_POST) && !empty($_POST)) {
             if (empty($_POST['goods_name'])) {
                 echo '<script>alert("商品名称不能为空!");</script>';
             } else {
                 //货号
                 if (empty($_POST['goods_sn'])) {
                     $_POST['goods_sn'] = 'GZFH' . str_repeat('0', 6 - strlen($gid)) . $gid;
                 }
                 //检查当前的货号是否存在
                 $checkvar = $this->App->findvar("SELECT goods_sn FROM `{$this->App->prefix()}goods` WHERE goods_sn={$_POST['goods_sn']} LIMIT 1");
                 if (!empty($checkvar)) {
                     $_POST['goods_sn'] = $_POST['goods_sn'] . '-1';
                     //重新定义一个
                 }
                 if ($rt['original_img'] != $_POST['original_img']) {
                     //修改了上传文件 那么重新上传
                     $source_path = SYS_PATH . DS . str_replace('/', DS, $_POST['original_img']);
                     $pa = dirname($_POST['original_img']);
                     $thumb = basename($_POST['original_img']);
                     $tw_s = intval($GLOBALS['LANG']['th_width_s']) > 0 ? intval($GLOBALS['LANG']['th_width_s']) : 200;
                     $th_s = intval($GLOBALS['LANG']['th_height_s']) > 0 ? intval($GLOBALS['LANG']['th_height_s']) : 200;
                     $tw_b = intval($GLOBALS['LANG']['th_width_b']) > 0 ? intval($GLOBALS['LANG']['th_width_b']) : 450;
                     $th_b = intval($GLOBALS['LANG']['th_height_b']) > 0 ? intval($GLOBALS['LANG']['th_height_b']) : 450;
                     if (isset($_POST['goods_thumb']) && !empty($_POST['goods_thumb'])) {
                         //留空
                     } else {
                         Import::img()->thumb($source_path, dirname($source_path) . DS . 'thumb_s' . DS . $thumb, $tw_s, $th_s);
                         //小缩略图
                         $_POST['goods_thumb'] = $pa . '/thumb_s/' . $thumb;
                     }
                     Import::img()->thumb($source_path, dirname($source_path) . DS . 'thumb_b' . DS . $thumb, $tw_b, $th_b);
                     //大缩略图
                     $_POST['goods_img'] = $pa . '/thumb_b/' . $thumb;
                 }
                 $_POST['meta_keys'] = !empty($_POST['meta_keys']) ? str_replace(array(',', '。', '.'), ',', $_POST['meta_keys']) : "";
                 $_POST['last_update'] = mktime();
                 //更新时间
                 $this->App->update('goods', $_POST, 'goods_id', $gid);
                 //更新商品属性[从新添加]
                 if (!empty($attr_id_list) && !empty($gid)) {
                     foreach ($attr_id_list as $kk => $id) {
                         if (empty($attr_value_list[$kk])) {
                             continue;
                         }
                         $rtdata = array();
                         $rtdata['attr_id'] = $id;
                         $rtdata['attr_value'] = isset($attr_value_list[$kk]) ? $attr_value_list[$kk] : "NULL";
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:67,代码来源:controller.php

示例9: ajax_addads_info

 function ajax_addads_info($data = array(), $id = 0)
 {
     if (!empty($data['tid'])) {
         //生成指定宽度高度的图片
         $tid = $data['tid'];
         $sql = "SELECT ad_width,ad_height FROM `{$this->App->prefix()}ad_position` WHERE tid='{$tid}'";
         $rr = $this->App->findrow($sql);
         $width = $rr['ad_width'];
         $height = $rr['ad_height'];
         if (!empty($width) && !empty($height) && !empty($data['ad_img'])) {
             if (!empty($id)) {
                 $sql = "SELECT ad_img FROM `{$this->App->prefix()}ad_content` WHERE pid='{$id}'";
                 $var = $this->App->findvar($sql);
                 if ($data['ad_img'] != $var) {
                     Import::fileop()->delete_file(SYS_PATH . $var);
                     //删除文件
                     $q = dirname($var);
                     $h = basename($var);
                     Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_s' . DS . $h);
                     Import::fileop()->delete_file(SYS_PATH . $q . DS . 'thumb_b' . DS . $h);
                     if (file_exists(SYS_PATH . $data['ad_img'])) {
                         Import::img()->thumb(SYS_PATH . $data['ad_img'], SYS_PATH . $data['ad_img'], $width, $height);
                     }
                 }
             }
         }
     }
     if (!empty($id)) {
         $data['uptime'] = time();
     } else {
         $data['addtime'] = time();
     }
     $ad_name = $data['ad_name'];
     if (empty($id)) {
         if ($this->App->insert('ad_content', $data)) {
             @file_get_contents(SITE_URL . 'data/flashdata/dynfocus/loadjs.php');
             //将数据写入文件
             $this->action('system', 'add_admin_log', '添加广告:' . $ad_name);
         } else {
             echo "无法添加广告,意外错误!";
         }
     } else {
         if ($this->App->update('ad_content', $data, 'pid', $id)) {
             @file_get_contents(SITE_URL . 'data/flashdata/dynfocus/loadjs.php');
             //将数据写入文件
             $this->action('system', 'add_admin_log', '修改广告:' . (empty($ad_name) ? "激活状态" : $ad_name));
         } else {
             echo "数据未变动,无需更新!";
         }
     }
     exit;
 }
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:52,代码来源:controller.php

示例10: ajax_suppliers_upload_cache_photo

 function ajax_suppliers_upload_cache_photo($data = array())
 {
     if (empty($data['str_spec'])) {
         die("非法!");
     }
     $uid = $this->check_is_suppliers();
     @set_time_limit(600);
     //最大运行时间
     $ar_spec = explode('++', $data['str_spec']);
     $goods = array();
     $photo_gallery_desc = array();
     $photo_gallery_url = array();
     foreach ($ar_spec as $str) {
         $item_ar = @explode('---', $str);
         if (count($item_ar) == 3) {
             if (in_array($item_ar[0], array('photo_gallery_desc', 'photo_gallery_url'))) {
                 if ($item_ar[0] == 'photo_gallery_desc') {
                     $photo_gallery_desc[$item_ar[2]][] = $item_ar[1];
                     //相册描述
                 } elseif ($item_ar[0] == 'photo_gallery_url') {
                     $photo_gallery_url[$item_ar[2]][] = $item_ar[1];
                     //相册图片
                 }
             } else {
                 $goods[$item_ar[2]][$item_ar[0]] = $item_ar[1];
             }
         }
     }
     $datas = array();
     $imgobj = Import::img();
     foreach ($goods as $item => $row) {
         if (empty($row['goods_bianhao'])) {
             $gid = $this->App->findvar("SELECT MAX(goods_id) + 1 FROM `{$this->App->prefix()}goods`");
             $gid = empty($gid) ? 1 : $gid;
             $goods_bianhao = '2EJ' . str_repeat('0', 6 - strlen($gid)) . $gid;
         } else {
             $goods_bianhao = $row['goods_bianhao'];
         }
         //检查是否已经存在
         if (empty($row['goods_sn'])) {
             $row['goods_sn'] = $goods_bianhao;
         }
         $ginfo = $this->App->findrow("SELECT goods_id,goods_thumb,goods_img,original_img FROM `{$this->App->prefix()}goods` WHERE goods_sn='{$row['goods_sn']}'");
         $gid = isset($ginfo['goods_id']) ? $ginfo['goods_id'] : 0;
         $datas['goods_bianhao'] = $goods_bianhao;
         $datas['goods_sn'] = $row['goods_sn'];
         if ($row['goods_numbers'] > 0) {
             $datas['goods_number'] = $row['goods_numbers'];
         }
         $datas['goods_name'] = $row['goods_name'];
         if ($row['pifa_price'] > 0) {
             $datas['market_price'] = $row['pifa_price'];
         }
         if ($row['pifa_price'] > 0) {
             $datas['pifa_price'] = $row['pifa_price'];
         }
         if ($row['shop_price'] > 0) {
             $datas['shop_price'] = $row['shop_price'];
         }
         if ($row['cat_id'] > 0) {
             $datas['cat_id'] = $row['cat_id'];
         }
         if ($row['brand_id'] > 0) {
             $datas['brand_id'] = $row['brand_id'];
         }
         $datas['goods_brief'] = $row['goods_brief'];
         $datas['goods_unit'] = $row['goods_unit'];
         if ($row['goods_weight'] > 0) {
             $datas['goods_weight'] = $row['goods_weight'];
         }
         if ($row['warn_number'] > 0) {
             $datas['warn_number'] = $row['warn_number'];
         }
         if (!empty($row['sourcepathname'])) {
             $imgobj->filecopy($row['sourcepathname'], $row['uploadname']);
             if ($gid > 0) {
                 $fop = Import::fileop();
                 //删除原来的图片
                 $fop->delete_file(SYS_PATH . $ginfo['goods_thumb']);
                 $fop->delete_file(SYS_PATH . $ginfo['goods_img']);
                 $fop->delete_file(SYS_PATH . $ginfo['original_img']);
                 //商品相册
                 /*$sql = "SELECT img_url FROM `{$this->App->prefix()}goods_gallery` WHERE goods_id ='$gid'";
                 		$gallery_img = $this->App->findcol($sql);
                 		if(!empty($gallery_img)){
                 			foreach($gallery_img as $img){
                 				$q = dirname($img);
                 				$h = basename($img);
                 				$fop->delete_file(SYS_PATH.$q.DS.'thumb_s'.DS.$h);
                 				$fop->delete_file(SYS_PATH.$q.DS.'thumb_b'.DS.$h);
                 				$fop->delete_file(SYS_PATH.$img); //
                 			}
                 			unset($gallery_img);
                 		}*/
                 unset($ginfo);
             }
         } else {
             continue;
         }
         if (!file_exists($row['uploadname'])) {
//.........这里部分代码省略.........
开发者ID:zhaoshengloveqingqing,项目名称:fenxiao,代码行数:101,代码来源:controller.php


注:本文中的Import::img方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。