Просмотр исходного кода

!5 v2.5.2bug 修复
Merge pull request !5 from 聆听/develop

聆听 7 лет назад
Родитель
Сommit
cfb9c638f3

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/controller/setting/SystemConfig.php


+ 2 - 2
application/admin/controller/store/StoreProduct.php

@@ -146,7 +146,7 @@ class StoreProduct extends AuthController
             Form::input('keyword','产品关键字')->placeholder('多个用英文状态下的逗号隔开'),
             Form::input('unit_name','产品单位','件'),
             Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')))->icon('image')->width('100%')->height('550px'),
-            Form::frameImages('slider_image','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image','big'=>1)))->maxLength(5)->icon('images')->width('100%')->height('550px')->spin(0),
+            Form::frameImages('slider_image','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')))->maxLength(5)->icon('images')->width('100%')->height('550px')->spin(0),
             Form::number('price','产品售价')->min(0)->col(8),
             Form::number('ot_price','产品市场价')->min(0)->col(8),
             Form::number('give_integral','赠送积分')->min(0)->precision(0)->col(8),
@@ -279,7 +279,7 @@ class StoreProduct extends AuthController
             Form::input('keyword','产品关键字',$product->getData('keyword'))->placeholder('多个用英文状态下的逗号隔开'),
             Form::input('unit_name','产品单位',$product->getData('unit_name')),
             Form::frameImageOne('image','产品主图片(305*305px)',Url::build('admin/widget.images/index',array('fodder'=>'image')),$product->getData('image'))->icon('image')->width('100%')->height('550px'),
-            Form::frameImages('slider_image','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')),json_decode($product->getData('slider_image'),1))->maxLength(5)->icon('images'),
+            Form::frameImages('slider_image','产品轮播图(640*640px)',Url::build('admin/widget.images/index',array('fodder'=>'slider_image')),json_decode($product->getData('slider_image'),1))->maxLength(5)->icon('images')->width('100%')->height('550px'),
             Form::number('price','产品售价',$product->getData('price'))->min(0)->precision(2)->col(8),
             Form::number('ot_price','产品市场价',$product->getData('ot_price'))->min(0)->col(8),
             Form::number('give_integral','赠送积分',$product->getData('give_integral'))->min(0)->precision(0)->col(8),

+ 14 - 24
application/admin/controller/widget/Images.php

@@ -1,7 +1,6 @@
 <?php
 
 namespace app\admin\controller\widget;
-use function Sodium\add;
 use think\Request;
 use think\Url;
 use app\admin\model\system\SystemAttachment as SystemAttachmentModel;
@@ -20,22 +19,15 @@ use service\FormBuilder as Form;
  */
 class Images extends AuthController
 {
-    const dir = [
-        0=>['tid'=>0,'name'=>'编辑器','path'=>'editor']
-        ,1=>['tid'=>1,'name'=>'产品图片','path'=>'store/product']
-        ,2=>['tid'=>2,'name'=>'拼团图片','path'=>'store/combination']
-        ,3=>['tid'=>3,'name'=>'砍价图片','path'=>'store/bargain']
-        ,4=>['tid'=>4,'name'=>'秒杀图片','path'=>'store/seckill']
-        ,5=>['tid'=>5,'name'=>'文章图片','path'=>'wechat/image']
-        ,6=>['tid'=>6,'name'=>'组合数据图','path'=>'common']
-    ];
     /**
      * 附件列表
      * @return \think\response\Json
      */
    public function index()
    {
-       $pid = input('pid')!=''?input('pid'):0;
+       $pid = input('pid') != NULL ?input('pid'):session('pid');
+       if($pid != NULL)session('pid',$pid);
+       if(!empty(session('pid')))$pid = session('pid');
        $this->assign('pid',$pid);
        //分类标题
        $typearray = Category::getAll();
@@ -46,17 +38,21 @@ 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();
+        //入口是public需要替换图片路径
+        if(strpos(PUBILC_PATH,'public') == false){
+            $res->dir = str_replace('public/','',$res->dir);
+        }
         SystemAttachmentModel::attachmentAdd($res->fileInfo->getSaveName(),$fileInfo['size'],$fileInfo['type'],$res->dir,$thumbPath,$pid);
         $info = array(
 //            "originalName" => $fileInfo['name'],
@@ -92,19 +88,13 @@ class Images extends AuthController
     public function deleteimganddata($att_id){
         $attinfo = SystemAttachmentModel::get($att_id)->toArray();
         if($attinfo){
-            if(strpos($attinfo['att_dir'],'public') !== false){
-                @unlink(ROOT_PATH.ltrim($attinfo['att_dir'],'/'));
-                @unlink(ROOT_PATH.ltrim($attinfo['satt_dir'],'/'));
-            }else{
-                @unlink(ROOT_PATH.ltrim('public'.$attinfo['att_dir'],'/'));
-                @unlink(ROOT_PATH.ltrim('public'.$attinfo['satt_dir'],'/'));
-            }
-
+            @unlink(ROOT_PATH.ltrim($attinfo['att_dir'],'.'));
+            @unlink(ROOT_PATH.ltrim($attinfo['satt_dir'],'.'));
             SystemAttachmentModel::where(['att_id'=>$att_id])->delete();
         }
     }
     /**
-     * 移动图片分类
+     * 移动图片分类显示
      */
     public function moveimg($imgaes){
 
@@ -123,7 +113,7 @@ class Images extends AuthController
         return $this->fetch('public/form-builder');
     }
 
-    /**移动图片
+    /**移动图片分类操作
      * @param Request $request
      * @param $id
      */

+ 1 - 1
application/admin/model/system/SystemAttachment.php

@@ -38,7 +38,7 @@ class SystemAttachment extends ModelBasic
         $model = new self;
         $where['pid'] = $id;
         $model->where($where)->order('att_id desc');
-        return $model->page($model,$where,'',30);
+        return $model->page($model,$where,'',24);
     }
     /**
      * 获取单条信息

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/model/system/SystemConfig.php


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/view/setting/system_config/index.php


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
application/admin/view/setting/system_config/index_alone.php


+ 2 - 2
application/admin/view/store/store_product/index.php

@@ -71,7 +71,7 @@
                     <div class="layui-btn-container">
                         {switch name='type'}
                             {case value="1"}
-                                <button class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:760,w:900})">添加产品</button>
+                                <button class="layui-btn layui-btn-sm" onclick="$eb.createModalFrame(this.innerText,'{:Url('create')}',{h:760,w:1100})">添加产品</button>
                             {/case}
                             {case value="2"}
                                 <button class="layui-btn layui-btn-sm" data-type="show">批量上架</button>
@@ -110,7 +110,7 @@
                         <button type="button" class="layui-btn layui-btn-xs btn-success" onclick="$eb.createModalFrame('{{d.store_name}}-属性','{:Url('attr')}?id={{d.id}}',{h:700,w:800})">
                             属性
                         </button>
-                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('{{d.store_name}}-编辑','{:Url('edit')}?id={{d.id}}')">
+                        <button type="button" class="layui-btn layui-btn-xs layui-btn-normal" onclick="$eb.createModalFrame('{{d.store_name}}-编辑','{:Url('edit')}?id={{d.id}}',{h:760,w:1100})">
                             编辑
                         </button>
                         <button type="button" class="layui-btn layui-btn-xs" onclick="dropdown(this)">操作 <span class="caret"></span></button>

+ 8 - 6
application/admin/view/widget/images.php

@@ -24,17 +24,17 @@
         border-radius: 1px;
         background: #e5e5e5;
     }
-    .main .left .nav{margin:0;}
-    .main .left .nav li{padding: 4px;}
+    .main .left .nav{margin:0;padding-bottom: 100px;}
+    .main .left .nav li{padding: 4px;height: 22px;}
     .main .left .nav li.active{background-color: #293846;border-left: 2px solid #19AA8D;}
     .main .left .nav li.active a{color: #a7b1c2;}
     .main .left .nav li.child{padding: 2px;padding-left: 7px;}
     .main .right{width: calc(100% - 117px);float: right;}
     .main .right .right-top{position: fixed;background-color: #fff;  z-index: 1000;width: 100%;padding: 7px 10px 0;height: 38px;border-bottom: 1px solid #e5e5e5;border-top: 1px solid #e5e5e5;}
     .main .right .imagesbox{position: fixed;top:58px;min-height: 200px;height: calc(100% - 88px);;overflow-y: auto;}
-    .main .right .imagesbox .image-item{position: relative;display: inline-block;  width: 15%;  border: 1px solid #e5e5e5;  cursor: default;  margin: 10px 0 0 1%;padding: 0.5%;}
-    .main .right .imagesbox .image-item img{width: 100%;}
-    .main .right .imagesbox .on{background:#f8ac59;}
+    .main .right .imagesbox .image-item{position: relative;display: inline-block;  width: 112px;height: 112px;  border: 1px solid #ECECEC;background-color: #F7F6F6;  cursor: default;  margin: 10px 0 0 10px;padding: 5px;}
+    .main .right .imagesbox .image-item img{width: 112px;height: 112px;}
+    .main .right .imagesbox .on{border: 3px dashed #0092DC;padding: 3px;}
     .main .right .foot-tool{position: fixed;bottom: 0px;width: calc(100% - 117px);background-color:#fff;height: 30px;padding: 7px 10px 0;border-top: 1px solid #e5e5e5;}
     .main .right .foot-tool .page{padding: 0px 10px;float: right;}
     .main .right .foot-tool .page ul{width: 100%}
@@ -62,7 +62,9 @@
                      <li ><a href="{:Url('index',array('pid'=>$vo.id,'fodder'=>$Request.param.fodder,'big'=>$Request.param.big))}">{$vo.name}</a></li>
                 {/if}
                 {volist name="$vo.child" id="voo" key="kk"}
-                       <li class="child {if condition="$voo.id eq $pid"} active{/if}"><a href="{:Url('index',array('pid'=>$voo.id,'fodder'=>$Request.param.fodder,'big'=>$Request.param.big))}">-{$voo.name}</a></li>
+                       <li class="child {if condition="$voo.id eq $pid"} active{/if}">
+                        <a href="{:Url('index',array('pid'=>$voo.id,'fodder'=>$Request.param.fodder,'big'=>$Request.param.big))}">{if condition="$kk eq count($vo.child)"}└{else/}├{/if}{$voo.name}</a>
+                        </li>
                     {/volist}
                 {/volist}
             </ul>

+ 1 - 1
application/common.php

@@ -24,7 +24,7 @@ function sensitive_words_filter($str)
     $words = file($file);
     foreach($words as $word)
     {
-        $word = str_replace(array("\r\n","\r","\n"," "), '', $word);
+        $word = str_replace(array("\r\n","\r","\n","/","<",">","="," "), '', $word);
         if (!$word) continue;
 
         $ret = preg_match("/$word/", $str, $match);

+ 3 - 3
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,

+ 35 - 14
application/routine/controller/AuthApi.php

@@ -77,8 +77,9 @@ class AuthApi extends AuthController{
      * 获取退款理由
      */
     public function get_refund_reason(){
-        $reason = SystemConfig::getValue('refund_reason')?:[];//退款理由
-        $reason = explode('=',$reason);
+        $reason = SystemConfig::getValue('stor_reason')?:[];//退款理由
+        $reason = str_replace("\r\n","\n",$reason);//防止不兼容
+        $reason = explode("\n",$reason);
         return JsonService::successful($reason);
     }
 
@@ -861,6 +862,7 @@ class AuthApi extends AuthController{
         }
     }
 
+
     /**
      * 申请退款
      * @param string $uni
@@ -1430,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);
     }
 
     /**
@@ -1952,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);
@@ -1965,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);
     }
 
 

+ 1 - 0
application/routine/controller/Routine.php

@@ -4,6 +4,7 @@ use behavior\wechat\PaymentBehavior;
 use service\HookService;
 use service\RoutineNotify;
 
+
 /**
  * 小程序支付回调
  * Class Routine

+ 1 - 1
application/version.php

@@ -1,2 +1,2 @@
-version=v2.5.9
+version=v2.5.2
 version_code=129

+ 1 - 0
application/wap/view/first/index/index.html

@@ -15,6 +15,7 @@
 <div class="page-index" id="app-index">
     <section ref="bsDom">
         <div>
+            
             <!--<div class="search-wrapper">
                 <form method="post" @submit.prevent="goSearch">
                     <div class="search-box flex"><input type="text" v-model="keyword" placeholder="商品搜索: 请输入商品关键词"> <a

+ 5 - 0
extend/behavior/wechat/PaymentBehavior.php

@@ -113,6 +113,11 @@ class PaymentBehavior
         WechatService::payOrderRefund($orderNo,$opt);
     }
 
+    /**
+     * 小程序支付订单退款
+     * @param $orderNo
+     * @param array $opt
+     */
     public static function routinePayOrderRefund($orderNo, array $opt)
     {
         $refundDesc = isset($opt['desc']) ? $opt['desc'] : '';

+ 3 - 2
extend/service/RoutineRefund.php

@@ -22,6 +22,7 @@ class RoutineRefund
      * @param string $refundDesc 退款原因
      * @return string
      */
+
     public static function doRefund($totalFee, $refundFee, $refundNo, $wxOrderNo='',$orderNo='',$refundDesc = '')
     {
         $config = array(
@@ -94,11 +95,11 @@ class RoutineRefund
         //默认格式为PEM,可以注释
         curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
 //        curl_setopt($ch,CURLOPT_SSLCERT,getcwd().'/cert/apiclient_cert.pem');
-        curl_setopt($ch,CURLOPT_SSLCERT,realpath('.'.self::options()['pay_routine_client_cert'][0]));
+        curl_setopt($ch,CURLOPT_SSLCERT,realpath('.'.self::options()['pay_routine_client_cert']));
         //默认格式为PEM,可以注释
         curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
 //        curl_setopt($ch,CURLOPT_SSLKEY,getcwd().'/cert/apiclient_key.pem');
-        curl_setopt($ch,CURLOPT_SSLKEY,realpath('.'.self::options()['pay_routine_client_key'][0]));
+        curl_setopt($ch,CURLOPT_SSLKEY,realpath('.'.self::options()['pay_routine_client_key']));
         //第二种方式,两个文件合成一个.pem文件
 //        curl_setopt($ch,CURLOPT_SSLCERT,getcwd().'/all.pem');
         $data = curl_exec($ch);

+ 1 - 0
extend/service/RoutineService.php

@@ -2,6 +2,7 @@
 namespace service;
 use think\Url;
 
+
 /**
  * 小程序支付
  * Created by PhpStorm.

BIN
public/static/font/simsunb.ttf


+ 4 - 4
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);

Разница между файлами не показана из-за своего большого размера
+ 113 - 0
update.sql


+ 4 - 2
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();
     },