Browse Source

数据校验

541469799@qq.com 10 tháng trước cách đây
mục cha
commit
73990bdf0d

+ 9 - 1
app/index/controller/Comment.php

@@ -12,9 +12,11 @@ declare (strict_types = 1);
 
 namespace app\index\controller;
 
+use app\common\model\User as UserAlias;
 use app\index\model\Order as OrderModel;
 use app\index\model\Comment as CommentModel;
 use app\index\model\OrderGoods as OrderGoodsModel;
+use app\index\model\User as UserModel;
 use think\facade\Session;
 
 /**
@@ -80,7 +82,13 @@ class Comment extends Controller
         // 提交商品评价
         $model = new CommentModel;
         if ($model->increased($orderInfo, $goodsList, $this->postForm())) {
-            return $this->renderSuccess([], '评价发表成功');
+            //评论获得积分
+            //只有前十条评论给积分
+            $totalReviews = $model->rowsUserTotal($userId);
+            if ($totalReviews < 10) {
+                UserModel::setIncPoints(intval($userId), UserAlias::POINTS_FOR_REVIEW, 'Post a review.');
+                return $this->renderSuccess([], '评价发表成功');
+            }
         }
         return $this->renderError($model->getError() ?: '评价发表失败');
     }

+ 7 - 0
app/index/controller/Passport.php

@@ -12,6 +12,8 @@ declare (strict_types=1);
 
 namespace app\index\controller;
 
+use app\common\model\User as UserAlias;
+use app\index\model\User as UserModel;
 use think\facade\Cache;
 use app\index\service\passport\Login as LoginService;
 use think\facade\Session;
@@ -64,6 +66,11 @@ class Passport extends Controller
         if (!$LoginService->toRegister($this->postForm())) {
             return $this->renderError($LoginService->getError());
         }
+        $form = $this->postForm();
+        if (!empty($form['mobile'])){
+            $userInfo = $LoginService->getUserInfo();
+            UserModel::setIncPoints(intval($userInfo['user_id']), UserAlias::POINTS_FOR_REGISTER, 'Register .');
+        }
 
         return $this->renderSuccess([], 'Registration is successful');
     }

+ 11 - 1
app/index/model/Comment.php

@@ -87,6 +87,16 @@ class Comment extends CommentModel
         return $this->where($filter)->count();
     }
 
+    /**
+     * 获取指定用户评价总数量
+     * @param int $userId
+     * @return int
+     */
+    public function rowsUserTotal(int $userId)
+    {
+        return $this->where(['user_id',$userId])->where('status',1)->where('is_delete',0)->count();
+    }
+
     public function rowsTotalBatch(array $goodsIds)
     {
         $filter = [
@@ -101,7 +111,7 @@ class Comment extends CommentModel
      * @param int|null $scoreType 评分 (10好评 20中评 30差评)
      * @return array[]
      */
-    private function getFilter(int $goodsId, int $scoreType = null)
+    private function getFilter(int $goodsId, int $scoreType = null, int $userId = null)
     {
         // 筛选条件
         $filter = [

+ 3 - 1
app/index/view/index/aboutUs.html

@@ -12,16 +12,18 @@
     <h2>Who We Are</h2>
     <p>Freeshippingvapes is a professional vape shop online aimed at USA market.
     </p>
-
+    <br>
     <h2>Our Mission</h2>
     <p>We devote to provide valued customers with high-quality and various e-cigarettes at best price from the regular
         source.</p>
+    <br>
 
     <h2>What We Offer</h2>
     <p> Freeshippingvapes has experienced and professional team who rigorously screens, tests and sources from all major
         e-cigarette brands on a daily basis to provide vapors around the world with good products that we really know,
         as well as continuously exploring and researching more advanced technology and products. We provide free
         shipping for most of our products in the U.S.</p>
+    <br>
 
     <h2>Contact Us</h2>
     <p>If you have any questions or inquiries, feel free to contact us at <a href="mailto:info@example.com">info@example.com</a>.

+ 11 - 0
app/index/view/index/privacyPolicy.html

@@ -18,6 +18,7 @@
         <br>
         3) Like many websites, we use "cookies" to enhance your experience and gather information about visitors and
         visits to our websites. </p>
+    <br>
 
     <h2>How do we use your information?</h2>
     <p>We may use the information we collect from you when you register, purchase products, enter a contest or
@@ -36,6 +37,7 @@
         subscribed to receive e-mail newsletters, you will not receive these e-mails. Visitors who register or
         participate in other site features such as marketing programs and 'members-only' content will be given a choice
         whether they would like to be on our e-mail list and receive e-mail communications from us.</p>
+    <br>
 
     <h2>How do we protect visitor information?</h2>
     <p>We implement a variety of security measures to maintain the safety of your personal information. Your personal
@@ -45,6 +47,7 @@
         information you supply is transmitted via Secure Socket Layer (SSL) technology and then encrypted into our
         databases to be only accessed as stated above.
     </p>
+    <br>
 
     <h2>Do we use "cookies"?</h2>
     <p>Yes. Cookies are small files that a site or its service provider transfers to your computer's hard drive through
@@ -65,6 +68,7 @@
         cookies. If you turn cookies off, you won't have access to many features that make your site experience more
         efficient and some of our services will not function properly.
     </p>
+    <br>
 
     <h2>How can you unsubscribe, remove or modify information you have provided to us?</h2>
     <p>To modify your e-mail subscriptions, please let us know by modifying your preferences in the "My Account"
@@ -72,6 +76,7 @@
         Or you can contact with us to delete all of your online account information from our database, including but not
         limited to the information above.
     </p>
+    <br>
 
     <h2>Third party links</h2>
     <p>In an attempt to provide you with increased value, we may include third party links on our site. These linked
@@ -79,20 +84,26 @@
         content and activities of these linked sites. Nonetheless, we seek to protect the integrity of our site and
         welcome any feedback about these linked sites (including if a specific link does not work).
     </p>
+    <br>
 
     <h2>Questions and feedback</h2>
     <p>We welcome your questions, comments, and concerns about privacy. Please send us any and all feedback pertaining
         to privacy, or any other issue.
     </p>
+    <br>
+
     <h2>Online Policy Only</h2>
     <p>This online privacy policy applies only to information collected through our website and not to information
         collected offline.
     </p>
+    <br>
 
     <h2>Terms and Conditions</h2>
     <p>Please also visit our Terms and Conditions section establishing the use, disclaimers, and limitations of
         liability governing the use of our website.
     </p>
+    <br>
+
     <h2>Your Consent</h2>
     <p>By using our site, this means you consent to our privacy policy.
     </p>

+ 5 - 0
app/index/view/index/returnWarranty.html

@@ -26,11 +26,13 @@
         <br>
         Our Customer Service will review your case and offer a return back within 24 hours.
     </p>
+    <br>
 
     <h2>3 Months Warranty</h2>
     <p>We have certain guarantee period for our products from the date of original purchase, usually come with 3 months
         warranty, please check the Guarantee section in item description carefully.
     </p>
+    <br>
 
     <h2>Disclaim</h2>
     <p> 1. Artificial damage and problems caused by misuse are not covered by warranty.
@@ -45,6 +47,7 @@
         <br>
         2.Any hardware cracking, modification is at your own risk, it will void warranty.
     </p>
+    <br>
 
     <h2>
         Exchange terms</h2>
@@ -84,6 +87,7 @@
         *For exchanges, the processing time for the exchanged item will be between 3-5 business days, upon receiving
         your item back, and depending on stock availability.
     </p>
+    <br>
 
     <h2>Missing items from package</h2>
     <p>We have the confidence that each order is proceed in a fast and correct way. We record the order weight
@@ -105,6 +109,7 @@
         <br>
         *Alternatively we can arrange a refund of the missing item for you.
     </p>
+    <br>
 
     <h2>Refund terms</h2>
     <p>(1) All items you want to return and get refund must contact us by email directly.

+ 5 - 0
app/index/view/index/salesTerms.html

@@ -36,6 +36,7 @@
         All users agree that access to and the use of this site are subject to the following terms and conditions and
         other applicable laws.
     </p>
+    <br>
 
     <h2>Ordering</h2>
     <p>In the event that a product listed is mistakenly listed at an incorrect prices, we reserves the right to refuse
@@ -44,6 +45,7 @@
         limit the number of products available for purchase. We reserve the right to change stock available for purchase
         at any time, even after you place an order.
     </p>
+    <br>
 
     <h2>Order Cancelation</h2>
     <p> To contact our customer support team to cancel an order, please fill out the 'Contact Us' form by clicking here
@@ -53,6 +55,7 @@
         able to do so if an order has already Processed. As that means your order has already processed for shipment and
         is boxed, awaiting collection. If an order has already been shipped from our facility, we unfortunately are not
         able to cancel the order.</p>
+    <br>
 
     <h2>Shipping and Handling</h2>
     <p>With most orders, they can be sent out for delivery within 72 business hours. We strive to ship orders out as
@@ -86,6 +89,7 @@
         All non-receipt of orders must be reported within 3 months from the date the item is shipped to you. After this
         time We will no longer be able to investigate and no compensation will be offered.
     </p>
+    <br>
 
     <h2>Communication</h2>
     <p>
@@ -96,6 +100,7 @@
         or comments from our legal consumers. We welcome all comments to help make navigating all links, working or
         non-working, as easily as possible.
     </p>
+    <br>
 
     <h2>Term Termination</h2>
     <p>