Browse Source

add appreciate setting

stanley-king 7 years ago
parent
commit
7c2ebe981e
4 changed files with 45 additions and 36 deletions
  1. 2 2
      helper/ugc/setting.php
  2. 3 0
      helper/ugc/special.php
  3. 2 2
      mobile/control/control.php
  4. 38 32
      mobile/control/special.php

+ 2 - 2
helper/ugc/setting.php

@@ -153,14 +153,14 @@ class setting
         return $type;
     }
     public function appreciate() {
-        return $this->mSetting['appreciate'] == true ? true : false;
+        return $this->mSetting['appreciate'] === true ? 1 : 0;
     }
 
     public function format()
     {
         $result['submit_rule'] = $this->submit_rule();
         $result['reader_type'] = $this->reader_type();
-//        $result['appreciate']  = $this->appreciate();
+        $result['appreciate']  = $this->appreciate();
 
         return $result;
     }

+ 3 - 0
helper/ugc/special.php

@@ -233,6 +233,9 @@ class special
     public function clicks() {
         return intval($this->mItems['clicks']);
     }
+    public function has_appreciate() {
+        return intval($this->mItems['appreciate']) == 1;
+    }
     public function appreciates() {
         return intval($this->mItems['appreciates']);
     }

+ 2 - 2
mobile/control/control.php

@@ -289,9 +289,9 @@ class mbMemberControl extends mobileControl
 
 function bonus_version()
 {
-    return "v=2017081108";
+    return "v=2017081109";
 }
 function shop_version()
 {
-    return "v=2017081106";
+    return "v=2017081109";
 }

+ 38 - 32
mobile/control/special.php

@@ -215,9 +215,9 @@ class tpl_ugc
         if(!empty($title))
         {
             $str = "<div class=\"title\">
-                    <h3>{$title}</h3>
-                    <span class=\"br\"></span>
-                </div>";
+                        <h3>{$title}</h3>
+                        <span class=\"br\"></span>
+                    </div>";
             echo $str;
         }
     }
@@ -371,11 +371,11 @@ class tpl_ugc
                             </div>";
         if(!empty($recoment))
         {
-            $str                    .= "<div class=\"recommend\">
+            $str        .= "<div class=\"recommend\">
                                 <span class=\"label\">推荐理由:{$recoment}</span><span></span>
                             </div>";
         }
-        $str .=       "</a>
+        $str .=         "</a>
                     </div>
                 </div>";
         echo $str;
@@ -425,16 +425,17 @@ class tpl_ugc
             $option = $val['text'];
 
             $si = sprintf("%c",$opindex++);
-            $soptions .= "<div class=\"question_option\">
-                            <label>
-                                <input type=\"{$box}\" value=\"{$key}\" class=\"check\" name=\"question{$qindex}\">
-                                <span class=\"label\">{$si}、{$option}</span>
-                            </label>
-                        </div>";
-        }
-        $end = "</div>
-                    </div>
-                </div>";
+            $soptions .=        "<div class=\"question_option\">
+                                     <label>
+                                         <input type=\"{$box}\" value=\"{$key}\" class=\"check\" name=\"question{$qindex}\">
+                                         <span class=\"label\">{$si}、{$option}</span>
+                                     </label>
+                                  </div>";
+        }
+        $end =              '</div>
+                        </div>
+                    </div>';
+
         $str = "{$header}{$soptions}{$end}";
         echo $str;
     }
@@ -489,7 +490,8 @@ class tpl_ugc
                         </div>";
             $str .= $soption;
         }
-        $str .= '</div></div>';
+        $str .=     '</div>';
+        $str .= '</div>';
 
         echo $str;
     }
@@ -529,7 +531,7 @@ class tpl_ugc
                         <div class=\"vote_type\" data-type=\"{$vote_type}\">/{$svote_type}</div>
                     </div>";
 
-        $str .= '<div class="results">';
+        $str .=    '<div class="results">';
         $result = $this->special->vote_result();
         $total = 0;
         foreach ($result as $key => $val) {
@@ -548,20 +550,21 @@ class tpl_ugc
                 $per = 0;
             }
 
-            $option = "<div class=\"result\">
-                        <div class=\"result_option\">{$title}</div>
-                        <div class=\"status\">
-                            <div class=\"status_line\">
-                                <div class=\"stat\"></div>
-                                <div class=\"status_bg\"></div>
+            $option =   "<div class=\"result\">
+                            <div class=\"result_option\">{$title}</div>
+                            <div class=\"status\">
+                                <div class=\"status_line\">
+                                    <div class=\"stat\"></div>
+                                    <div class=\"status_bg\"></div>
+                                </div>
+                                <span class=\"num\">{$count}票</span>
+                                <span class=\"percentage\">{$per}%</span>
                             </div>
-                            <span class=\"num\">{$count}票</span>
-                            <span class=\"percentage\">{$per}%</span>
-                        </div>
-                       </div>";
+                          </div>";
             $str .= $option;
         }
-        $str .= '</div></div>';
+        $str .=     '</div>';
+        $str .= '</div>';
 
         echo $str;
     }
@@ -650,6 +653,9 @@ class tpl_ugc
     }
     private function show_appreciate()
     {
+        $fappreciate = $this->special->has_appreciate();
+        if($fappreciate == false) return;
+
         $nums = $this->special->appreciates();
         $header = "<div class=\"appreciate\">
                         <p class=\"appreciate_pro\">如果你喜欢该文章,请随意打赏。</p >
@@ -663,7 +669,6 @@ class tpl_ugc
                         <div class=\"appreciate_users\">";
 
             $avatars = $this->appreciate_avatars($this->special_id(),20);
-
             $sAvatars = '';
             foreach ($avatars as $avatar) {
                 $sAvatars .= "<img src=\"{$avatar}\">";
@@ -675,10 +680,11 @@ class tpl_ugc
             }
         }
         else {
-            $header .= "赞赏";
-            $header .= "</div>";
+            $header .=          "赞赏";
+            $header .=     "</div>";
+            $header .=  "</div>";
         }
-        $header .= '</div>';
+        $header .='</div>';
         echo $header;
     }