diff --git a/application/admin/controller/widget/Images.php b/application/admin/controller/widget/Images.php index 6772f0c6..0799c777 100644 --- a/application/admin/controller/widget/Images.php +++ b/application/admin/controller/widget/Images.php @@ -1,7 +1,6 @@ assign('pid',$pid); //分类标题 @@ -39,14 +38,14 @@ class Images extends AuthController return $this->fetch('widget/images'); } /** - * 编辑器上传图片 + * 图片管理上传图片 * @return \think\response\Json */ public function upload() { - $pid = input('pid')!=''?input('pid'):0; + $pid = input('pid')!= NULL ?input('pid'):session('pid'); - $res = Upload::image('file',$pid.'/'.date('Ymd')); + $res = Upload::image('file','attach'.DS.date('Y').DS.date('m').DS.date('d')); $thumbPath = Upload::thumb($res->dir); //产品图片上传记录 $fileInfo = $res->fileInfo->getinfo(); diff --git a/application/routine/common.php b/application/routine/common.php index 95f18862..c9ec2ab5 100644 --- a/application/routine/common.php +++ b/application/routine/common.php @@ -69,7 +69,7 @@ function createPoster($product = array()){ 'text'=>substr(iconv_substr($product['store_name'],0,mb_strlen($product['store_name']),'utf-8'),0,24).'...', 'left'=>50, 'top'=>500, - 'fontPath'=>ROOT_PATH.'public/uploads/poster/simsunb.ttf', //字体文件 + 'fontPath'=>ROOT_PATH.'public/static/font/simsunb.ttf', //字体文件 'fontSize'=>16, //字号 'fontColor'=>'40,40,40', //字体颜色 'angle'=>0, @@ -78,7 +78,7 @@ function createPoster($product = array()){ 'text'=>'¥'.$product['price'], 'left'=>50, 'top'=>580, - 'fontPath'=>ROOT_PATH.'public/uploads/poster/simsunb.ttf', //字体文件 + 'fontPath'=>ROOT_PATH.'public/static/font/simsunb.ttf', //字体文件 'fontSize'=>16, //字号 'fontColor'=>'40,40,40', //字体颜色 'angle'=>0, @@ -108,7 +108,7 @@ function createPoster($product = array()){ 'opacity'=>100, ), ), - 'background'=>ROOT_PATH.'public/uploads/poster/background.jpg' //背景图 + 'background'=>ROOT_PATH.UPLOAD_PATH.'/poster/background.jpg' //背景图 ); $imageDefault = array( 'left'=>0, diff --git a/application/routine/controller/AuthApi.php b/application/routine/controller/AuthApi.php index da3e1e49..802de255 100644 --- a/application/routine/controller/AuthApi.php +++ b/application/routine/controller/AuthApi.php @@ -1432,19 +1432,18 @@ class AuthApi extends AuthController{ public function get_code(){ header('content-type:image/jpg'); if(!$this->userInfo['uid']) return JsonService::fail('授权失败,请重新授权'); - $path = 'public/uploads/routine/'.$this->userInfo['uid'].'.jpg'; + $path = makePathToUrl('routine/code'); + if($path == '') + return JsonService::fail('生成上传目录失败,请检查权限!'); + $picname = $path.DS.$this->userInfo['uid'].'.jpg'; $domain = SystemConfigService::get('site_url').'/'; $domainTop = substr($domain,0,5); if($domainTop != 'https') $domain = 'https:'.substr($domain,5,strlen($domain)); - if(file_exists($path)) return JsonService::successful($domain.$path); + if(file_exists($picname)) return JsonService::successful($domain.$picname); else{ - if(!file_exists('public/uploads/routine')){ - $dir = iconv("UTF-8", "GBK", "public/uploads/routine"); - mkdir ($dir,0775,true); - } - file_put_contents($path,RoutineCode::getCode($this->userInfo['uid'])); + file_put_contents($picname,RoutineCode::getCode($this->userInfo['uid'])); } - return JsonService::successful($domain.$path); + return JsonService::successful($domain.$picname); } /** @@ -1954,11 +1953,12 @@ class AuthApi extends AuthController{ if(!$id) return JsonService::fail('参数错误'); $productInfo = StoreProduct::getValidProduct($id,'store_name,id,price,image,code_path'); if(empty($productInfo)) return JsonService::fail('参数错误'); - if($productInfo['code_path'] == '') { - $codePath = 'public/uploads/codepath/product/'.$productInfo['id'].'.jpg'; + if(strlen($productInfo['code_path'])< 10) { + $path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product'; + $codePath = $path.DS.$productInfo['id'].'.jpg'; if(!file_exists($codePath)){ - $dir = iconv("UTF-8", "GBK", "public/uploads/codepath/product"); - mkdir($dir,0775,true); + if(!is_dir($path)) + mkdir($path,0777,true); file_put_contents($codePath,RoutineCode::getPages('pages/product-con/index?id='.$productInfo['id'])); } $res = StoreProduct::edit(['code_path'=>$codePath],$id); @@ -1967,6 +1967,25 @@ class AuthApi extends AuthController{ } $posterPath = createPoster($productInfo); return JsonService::successful($posterPath); + +// if(!$id) return JsonService::fail('参数错误'); +// $productInfo = StoreProduct::getValidProduct($id,'store_name,id,price,image,code_path'); +// if(empty($productInfo)) return JsonService::fail('参数错误'); +// if($productInfo['code_path'] == '') { +// $path = 'public'.DS.'uploads'.DS.'codepath'.DS.'product'; +// $codePath = $path.DS.$productInfo['id'].'.jpg'; +// if(!file_exists($codePath)){ +// //$dir = iconv("UTF-8", "GBK", "public".DS."uploads".DS."codepath".DS."product"); +// if(!is_dir($path)) +// mkdir($path,0777,true); +// file_put_contents($codePath,RoutineCode::getPages('pages/product-con/index?id='.$productInfo['id'])); +// } +// $res = StoreProduct::edit(['code_path'=>$codePath],$id); +// if($res) $productInfo['code_path'] = $codePath; +// else return JsonService::fail('没有查看权限'); +// } +// $posterPath = createPoster($productInfo); +// return JsonService::successful($posterPath); } diff --git a/public/static/font/simsunb.ttf b/public/static/font/simsunb.ttf new file mode 100644 index 00000000..1c14f7fa Binary files /dev/null and b/public/static/font/simsunb.ttf differ diff --git a/public/system/module/widget/images.js b/public/system/module/widget/images.js index 7fec3247..bcea1aa5 100644 --- a/public/system/module/widget/images.js +++ b/public/system/module/widget/images.js @@ -40,8 +40,8 @@ layui.use(['layer','upload'], function() { var images = Array.from(self.document.getElementsByTagName('img')); images.forEach(function (image) { if(Array.from(image.parentNode.classList).indexOf('on') !== -1 && value.indexOf(image.src) == -1){ - // list.push(image.src); - list.push(image.getAttribute("src")); + list.push(image.src); + // list.push(image.getAttribute("src")); } }); parent.$f.changeField(parentinputname,list); @@ -51,8 +51,8 @@ layui.use(['layer','upload'], function() { var images = Array.from(self.document.getElementsByTagName('img')); images.forEach(function (image) { if(Array.from(image.parentNode.classList).indexOf('on') !== -1 ){ - // parent.changeIMG(parentinputname,image.src); - parent.changeIMG(parentinputname,image.getAttribute("src")); + parent.changeIMG(parentinputname,image.src); + // parent.changeIMG(parentinputname,image.getAttribute("src")); } }); var index = parent.layer.getFrameIndex(window.name); diff --git a/update.sql b/update.sql new file mode 100644 index 00000000..c7780a3f --- /dev/null +++ b/update.sql @@ -0,0 +1,113 @@ +-- 表注释 + alter table eb_store_coupon_issue comment '优惠券前台领取表'; + alter table eb_store_coupon_issue_user comment '优惠券前台用户领取记录表'; + alter table eb_store_pink comment '拼团表'; + alter table eb_user_notice_see comment '用户通知发送记录表'; + alter table eb_user_extract comment '用户提现表'; + alter table eb_user_group comment '用户分组表'; + alter table eb_user_recharge comment '用户充值表'; + alter table eb_user_notice comment '用户通知表'; + alter table eb_store_visit comment '产品浏览分析表'; + +-- --产品浏览分析表表 字段 +alter table eb_store_visit modify column product_id int(11) comment '产品ID'; +alter table eb_store_visit modify column cate_id int(11) comment '产品分类ID'; +alter table eb_store_visit modify column type char(50) comment '产品类型'; +alter table eb_store_visit modify column uid int(11) comment '用户ID'; +alter table eb_store_visit modify column count int(11) comment '访问次数'; +alter table eb_store_visit modify column content varchar(255) comment '备注描述'; +alter table eb_store_visit modify column add_time int(11) comment '添加时间'; + +-- +-- 字段注释 +-- 缓存表 字段 +-- alter table eb_cache modify column key varchar(32) comment '缓存key唯一值'; + alter table eb_cache modify column result text comment '缓存数据'; + alter table eb_cache modify column add_time int(10) comment '缓存时间'; + +-- --优惠券前台领取表 字段 +alter table eb_store_coupon_issue modify column cid int(10) comment '优惠券ID'; +alter table eb_store_coupon_issue modify column start_time int(10) comment '优惠券领取开启时间'; +alter table eb_store_coupon_issue modify column end_time int(10) comment '优惠券领取结束时间'; +alter table eb_store_coupon_issue modify column total_count int(10) comment '优惠券领取数量'; +alter table eb_store_coupon_issue modify column remain_count int(10) comment '优惠券剩余领取数量'; +alter table eb_store_coupon_issue modify column add_time int(10) comment '优惠券添加时间'; + +-- 优惠券前台用户领取记录表 字段 +alter table eb_store_coupon_issue_user modify column uid int(10) comment '领取优惠券用户ID'; +alter table eb_store_coupon_issue_user modify column issue_coupon_id int(10) comment '优惠券前台领取ID'; +alter table eb_store_coupon_issue_user modify column add_time int(10) comment '领取时间'; + +-- --用户分组表 字段 +alter table eb_user_group modify column group_name varchar(64) comment '用户分组名称'; + +-- --用户充值表 字段 +alter table eb_user_recharge modify column uid int(10) comment '充值用户UID'; +alter table eb_user_recharge modify column order_id varchar(32) comment '订单号'; +alter table eb_user_recharge modify column price decimal(8,2) comment '充值金额'; +alter table eb_user_recharge modify column recharge_type varchar(32) comment '充值类型'; +alter table eb_user_recharge modify column paid tinyint(1) comment '是否充值'; +alter table eb_user_recharge modify column pay_time int(10) comment '充值支付时间'; +alter table eb_user_recharge modify column add_time int(12) comment '充值时间'; + +-- --添加配置类型 +ALTER TABLE `eb_system_config_tab` ADD `type` INT(2) NULL DEFAULT '0' COMMENT '配置类型' AFTER `icon`; + +-- --添加小程序openid +ALTER TABLE `eb_wechat_user` ADD `routine_openid` varchar(32) NULL DEFAULT '' COMMENT '小程序唯一身份ID' AFTER `openid`; +-- --添加微信openid 允许为空 +ALTER TABLE `eb_wechat_user` CHANGE `openid` `openid` VARCHAR(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '用户的标识,对当前公众号唯一'; +-- --添加附件记录表 允许为空 +DROP TABLE IF EXISTS `eb_system_attachment`; +CREATE TABLE `eb_system_attachment` ( + `att_id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL COMMENT '附件名称', + `att_dir` varchar(200) NOT NULL COMMENT '附件路径', + `satt_dir` varchar(200) NOT NULL COMMENT '附件压缩路径', + `att_size` char(30) NOT NULL COMMENT '附件大小', + `att_type` char(30) NOT NULL COMMENT '附件类型', + `pid` int(10) NOT NULL COMMENT '分类ID0编辑器,1产品图片,2拼团图片,3砍价图片,4秒杀图片,5文章图片,6组合数据图', + `time` int(11) NOT NULL COMMENT '上传时间', + PRIMARY KEY (`att_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='附件管理表'; +SET FOREIGN_KEY_CHECKS = 1; +-- --修改文章表名称 +ALTER TABLE eb_wechat_news RENAME TO eb_article +-- --修改文章内容表名称 +ALTER TABLE eb_wechat_news_content RENAME TO eb_article_content +-- 文章表 添加 is_hot字段和is_banner字段 +alter table eb_article modify column is_hot tinyint(1) comment '是否热门(小程序)'; +alter table eb_article modify column is_banner tinyint(1) comment '是否轮播图(小程序)'; +-- 砍价产品表 添加 is_hot字段和is_banner字段 +alter table eb_store_bargain modify column look int(11) comment '砍价产品浏览量'; +alter table eb_store_bargain modify column share int(11) comment '砍价成品分享次数'; +-- --添加小程序模板消息表 允许为空 +DROP TABLE IF EXISTS `eb_routine_template`; +CREATE TABLE `eb_routine_template` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `tempkey` char(50) NOT NULL COMMENT '模板编号', + `name` char(100) NOT NULL COMMENT '模板名', + `content` varchar(1000) NOT NULL COMMENT '回复内容', + `tempid` char(100) NOT NULL COMMENT '模板ID', + `add_time` varchar(15) NOT NULL COMMENT '添加时间', + `status` tinyint(4) NOT NULL COMMENT '模板状态', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='小程序模板消息表'; +SET FOREIGN_KEY_CHECKS = 1; +-- --修改优惠劵领取为负数,还可以领 +ALTER TABLE `eb_store_coupon_issue` ADD `is_permanent` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '是否无限张数' AFTER `remain_count`; + +-- 订单表 添加 is_channel字段 +alter table eb_store_order modify column is_channel tinyint(1) comment '支付渠道(0微信公众号1微信小程序)'; + +-- 客服通知 +ALTER TABLE `eb_store_service` ADD `notify` INT(2) NULL DEFAULT '0' COMMENT '订单通知1开启0关闭' AFTER `status`; + +--v2.5.2 产品表 添加 产品海报图字段 +alter table eb_store_product modify column code_path varchar(64) comment '产品二维码地址(用户小程序海报)'; + +--v2.5.2 eb_system_group表 添加 产品海报图字段 +UPDATE eb_system_group SET fields='[{"name":"\u5206\u7c7b\u540d\u79f0","title":"name","type":"input","param":""},{"name":"\u5206\u7c7b\u56fe\u6807","title":"pic","type":"upload","param":""},{"name":"\u8df3\u8f6c\u8def\u5f84","title":"url","type":"select","param":"\/pages\/index\/index=\u5546\u57ce\u9996\u9875\n\/pages\/spread\/spread=\u4e2a\u4eba\u63a8\u5e7f\n\/pages\/coupon\/coupon=\u4f18\u60e0\u5238\n\/pages\/user\/user=\u4e2a\u4eba\u4e2d\u5fc3\n\/pages\/miao-list\/miao-list=\u79d2\u6740\u5217\u8868\n\/pages\/pink-list\/index=\u62fc\u56e2\u5217\u8868\u9875\n\/pages\/cut-list\/cut-list=\u780d\u4ef7\u5217\u8868\n\/pages\/productSort\/productSort=\u5206\u7c7b\u9875\u9762\n\/pages\/address\/address=\u5730\u5740\u5217\u8868\n\/pages\/cash\/cash=\u63d0\u73b0\u9875\u9762\n\/pages\/extension\/extension=\u63a8\u5e7f\u7edf\u8ba1\n\/pages\/main\/main=\u8d26\u6237\u91d1\u989d\n\/pages\/collect\/collect=\u6211\u7684\u6536\u85cf\n\/pages\/promotion-card\/promotion-card=\u63a8\u5e7f\u4e8c\u7ef4\u7801\u9875\u9762\n\/pages\/buycar\/buycar=\u8d2d\u7269\u8f66\u9875\u9762\n\/pages\/news-list\/news-list=\u6d88\u606f\u5217\u8868\u9875\n\/pages\/orders-list\/orders-list=\u8ba2\u5355\u5217\u8868\u9875\u9762\n\/pages\/new-list\/new-list=\u6587\u7ae0\u5217\u8868\u9875"},{"name":"\u5e95\u90e8\u83dc\u5355","title":"show","type":"radio","param":"\u662f=\u662f\n\u5426=\u5426"}]' where id = 47; + +--v2.5.2 清空拼团表-- +TRUNCATE table eb_store_pink \ No newline at end of file diff --git a/view/crmebN/pages/productSort/productSort.js b/view/crmebN/pages/productSort/productSort.js index c1ea2d3b..9ac8abc9 100644 --- a/view/crmebN/pages/productSort/productSort.js +++ b/view/crmebN/pages/productSort/productSort.js @@ -158,7 +158,7 @@ Page({ hiddendown: true }) } - var SoerErId = 0; + var SoerErId = 0; if ($taber >= 0) { for (var indexSoerEr in that.data.sorter){ if (that.data.sorter[indexSoerEr].id == $taber){ @@ -167,6 +167,7 @@ Page({ }) SoerErId = that.data.sorter[indexSoerEr].id; } + //console.log(that.data.sorter[indexSoerEr].id); } }else that.setData({total: '全部'}) that.setData({sid: SoerErId}) @@ -191,6 +192,7 @@ Page({ } } that.setData({ hiddendown: true }) + that.setData({ sid: 0 }) that.getProductList(); }, getCartCount: function () { @@ -235,7 +237,7 @@ Page({ var n=t+1; if (n%2>0) priceOrder ='asc'; else priceOrder='desc'; - var sid = that.data.sid; + var sid = that.data.sid; that.setData({ price: priceOrder, t: n, }) that.getProductList(); },