huangdong 6 rokov pred
rodič
commit
4fd2621992

+ 14 - 0
.idea/php-test-framework.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="PhpTestFrameworkVersionCache">
+    <tools_cache>
+      <tool tool_name="PHPUnit">
+        <cache>
+          <versions>
+            <info id="Local" version="5.4.4" />
+          </versions>
+        </cache>
+      </tool>
+    </tools_cache>
+  </component>
+</project>

+ 8 - 0
.idea/php.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="PhpUnit">
+    <phpunit_settings>
+      <PhpUnitSettings load_method="PHPUNIT_PHAR" custom_loader_path="" phpunit_phar_path="$PROJECT_DIR$/../phpunit-5.4.4.phar" />
+    </phpunit_settings>
+  </component>
+</project>

+ 59 - 0
data/resource/mobile/talk/css/room_goods.css

@@ -0,0 +1,59 @@
+html, body {
+    background: #ffffff;
+    font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, 微软雅黑, Arial, sans-serif;
+}
+.thumbnail {
+    margin-right: 13px;
+}
+.thumbnail img{
+    width: 80px;
+    height: 80px;
+    vertical-align: middle;
+    border: 1px solid #DCDCDC;
+}
+.weui-flex__item {
+    overflow: hidden;
+}
+.goods_item {
+    position: relative;
+    padding: 15px;
+    font-size: 15px;
+    font-weight: 400;
+    color: #333333;
+    align-items: center;
+}
+.goods_item:after {
+    content: "";
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    width: 100%;
+    height: 1px;
+    background: #DCDCDC;
+    -webkit-transform: scaleY(0.5);
+    transform: scaleY(0.5);
+}
+.goods_name {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+
+}
+.desc {
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    font-size: 12px;
+    color: #999999;
+    line-height: 2.5;
+}
+.price {
+    font-weight: bolder;
+}
+.empty_notice {
+    width: 261px;
+    height: 150px;
+    background: url(../images/empty.png) no-repeat center;
+    background-size: contain;
+    margin: 20px auto;
+}

+ 21 - 95
mobile/templates/default/talk/room_goods.php

@@ -8,109 +8,35 @@
           href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/weui.css?<?php echo bonus_version(); ?>"/>
     <link rel="stylesheet"
           href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css?<?php echo bonus_version(); ?>">
-    <style type="text/css">
-        html, body {
-            background: #ffffff;
-            font-family: PingFang SC, Hiragino Sans GB, Microsoft YaHei, 微软雅黑, Arial, sans-serif;
-        }
-        .thumbnail {
-            margin-right: 13px;
-        }
-        .thumbnail img{
-            width: 80px;
-            height: 80px;
-            vertical-align: middle;
-            border: 1px solid #DCDCDC;
-        }
-        .weui-flex__item {
-            overflow: hidden;
-        }
-        .goods_item {
-            position: relative;
-            padding: 15px;
-            font-size: 15px;
-            font-weight: 400;
-            color: #333333;
-            align-items: center;
-        }
-        .goods_item:after {
-            content: "";
-            position: absolute;
-            bottom: 0;
-            left: 0;
-            width: 100%;
-            height: 1px;
-            background: #DCDCDC;
-            -webkit-transform: scaleY(0.5);
-            transform: scaleY(0.5);
-        }
-        .goods_name {
-            overflow: hidden;
-            text-overflow: ellipsis;
-            white-space: nowrap;
-
-        }
-        .desc {
-            overflow: hidden;
-            text-overflow: ellipsis;
-            white-space: nowrap;
-            font-size: 12px;
-            color: #999999;
-            line-height: 2.5;
-        }
-        .price {
-            font-weight: bolder;
-        }
-    </style>
+    <link type="text/css" rel="stylesheet"
+          href="<?php echo RESOURCE_SITE_URL; ?>/mobile/talk/css/room_goods.css?<?php echo bonus_version(); ?>"/>
 </head>
 <body>
+<?php
+if(!empty($output['goods'])) {
+    echo '<div class="group_goods_list" id="group_goods_list">';
 
-<div class="group_goods_list" id="group_goods_list">
-    <?php
-    if(!empty($output['goods'])) {
-        foreach ($output['goods'] as $goods) {
-            echo "
-                <div class=\"weui-flex goods_item\" data-goods_id=\"{$goods['goods_id']}\">
-                    <div class=\"thumbnail\">
-                        <img src=\"{$goods['goods_image_url']}\" alt=\"\">
-                    </div>
-                    <div class=\"weui-flex__item\">
-                        <p class=\"goods_name\">{$goods['goods_mobile_name']}</p>
-                        <p class=\"desc\">{$goods['goods_jingle']}</p>
-                        <p class=\"price\">¥{$goods['goods_price']}</p>
-                    </div>
-                </div>";
-        }
-    }else{
+    foreach ($output['goods'] as $goods) {
         echo "
-        <div class=\"weui-flex goods_item\" data-goods_id=\"6158\">
-        <div class=\"thumbnail\">
-            <img src=\"<?php echo RESOURCE_SITE_URL ?>/mobile/talk/images/avatars.png\" alt=\"\">
-        </div>
-        <div class=\"weui-flex__item\">
-            <p class=\"goods_name\">paparecipe 春雨蜂蜜面膜</p>
-            <p class=\"desc\">5片/肌肤滋润肌底深补水,让肌肤如沐春雨</p>
-            <p class=\"price\">¥80.00</p>
-        </div>
-        </div>
-        <div class=\"weui-flex goods_item\" data-goods_id=\"6158\">
-            <div class=\"thumbnail\">
-                <img src=\"<?php echo RESOURCE_SITE_URL ?>/mobile/talk/images/avatars.png\" alt=\"\">
-            </div>
-            <div class=\"weui-flex__item\">
-                <p class=\"goods_name\">paparecipe 春雨蜂蜜面膜</p>
-                <p class=\"desc\">5片/肌肤滋润肌底深补水,让肌肤如沐春雨</p>
-                <p class=\"price\">¥80.00</p>
-            </div>
-        </div>";
+            <div class=\"weui-flex goods_item\" data-goods_id=\"{$goods['goods_id']}\">
+                <div class=\"thumbnail\">
+                    <img src=\"{$goods['goods_image_url']}\" alt=\"\">
+                </div>
+                <div class=\"weui-flex__item\">
+                    <p class=\"goods_name\">{$goods['goods_mobile_name']}</p>
+                    <p class=\"desc\">{$goods['goods_jingle']}</p>
+                    <p class=\"price\">¥{$goods['goods_price']}</p>
+                </div>
+            </div>";
     }
-    ?>
-</div>
-
 
+    echo "</div>";
+}else{
+    echo "<div class=\"empty_notice\" id=\"empty_notice\"></div>";
+}
+?>
 <div id="load_state"></div>
 
-
 <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js?<?php echo bonus_version(); ?>"></script>
 <script src="https://cdn.bootcss.com/jquery-weui/1.2.0/js/jquery-weui.min.js?<?php echo bonus_version(); ?>"></script>
 <script src="<?php echo RESOURCE_SITE_URL; ?>/mobile/comm/utility.js?<?php echo bonus_version(); ?>"></script>

+ 46 - 0
test/TestGD.php

@@ -73,4 +73,50 @@ class TestGD extends PHPUnit_Framework_TestCase
 
         return $image;
     }
+
+    private function scanDir($dir)
+    {
+        if(is_dir($dir))
+        {
+            $files_path = [];
+            $files_name = [];
+            $items = scandir($dir);
+            foreach ($items as $item)
+            {
+                if($item == '.' || $item == '..') continue;//取出系统目录
+                $name = $item;
+                $path = $dir.$item;
+                if(is_file($path)) {
+                    $files_path[] = $path;
+                    $files_name[] = $name;
+                }
+            }
+        }
+
+        return ["files_path"=>$files_path,"files_name"=>$files_name];
+    }
+
+    public function testGetCarPicture()
+    {
+        $dir = BASE_ROOT_PATH."/data/upload/uploadtmp/";//图片库  或 车型图片库
+        $files = $this->scanDir($dir); //读取文件路径
+
+        foreach ($files['files_name'] as $file_name){
+            if($file_name == '1') {
+                //头图 约定名称
+            }
+            elseif($file_name == '2')
+            {
+                //车型亮点 约定名称
+            }
+            else
+            {
+                //其他依次
+            }
+
+        }
+
+        //可能需要转换成自己的url
+        return ["head"=>"","hot"=>"","other"=>""];
+    }
 }