hefei il y a 1 an
Parent
commit
1633e45c10

+ 0 - 16
app/common.php

@@ -898,19 +898,3 @@ if (!function_exists("is_json")){
898 898
     }
899 899
 }
900 900
 
901
-
902
-
903
-if (!function_exists("round_optimize")){
904
-    /**
905
-     * round公用四舍五入去除
906
-     * @return string
907
-     */
908
-    function round_optimize($amount, $decimals = 2): string
909
-    {
910
-        if ($amount > 0) {
911
-            $factor = pow(10, $decimals);
912
-            return floor($amount * $factor) / $factor;
913
-        }
914
-        return $amount;
915
-    }
916
-}

+ 9 - 0
app/common/repositories/BaseRepository.php

@@ -29,4 +29,13 @@ class BaseRepository
29 29
     {
30 30
         return call_user_func_array([$this->dao, $name], $arguments);
31 31
     }
32
+
33
+    public function roundOptimize($amount, $decimals = 2)
34
+    {
35
+        if ($amount > 0) {
36
+            $factor = pow(10, $decimals);
37
+            return floor($amount * $factor) / $factor;
38
+        }
39
+        return $amount;
40
+    }
32 41
 }

+ 1 - 1
app/common/repositories/store/order/StoreOrderRepository.php

@@ -3827,7 +3827,7 @@ class StoreOrderRepository extends BaseRepository
3827 3827
             $yongjin = $pvfee * $yongjinbili / 100;
3828 3828
 
3829 3829
             // 佣金百分之90进入佣金池  佣金百分之10进入复购金
3830
-            $tuiguanyongjin = round_optimize($yongjin * 0.9, 2);
3830
+            $tuiguanyongjin = $this->roundOptimize($yongjin * 0.9, 2);
3831 3831
             $tuiguanfugou = $yongjin;//复购金赠送函数里面有计算百分之10
3832 3832
 
3833 3833
             //end会费

+ 4 - 4
app/common/repositories/user/UserThirdRepository.php

@@ -747,7 +747,7 @@ class UserThirdRepository extends BaseRepository
747 747
     /**
748 748
      * 添加预估积分记录
749 749
      */
750
-    public static function yuguJifen($price,$user_id,$order_sn,$type_shop)
750
+    public function yuguJifen($price,$user_id,$order_sn,$type_shop)
751 751
     {
752 752
         if (empty($user_id)) {
753 753
             Db::name('log')->insert(['data' => "type_shop:{$type_shop}, $order_sn, $order_sn, 赠送积分, 不存在用户ID"]);
@@ -847,7 +847,7 @@ class UserThirdRepository extends BaseRepository
847 847
             //判断是否是老用户  is_old=1是1.0的用户,1.0的用户要总pv*45%的红包
848 848
             if($user["is_old"]==1){
849 849
                 //添加红包
850
-                $hongbao=round_optimize($inc_score*0.45,2);
850
+                $hongbao = $this->roundOptimize($inc_score*0.45,2);
851 851
                 $hongbao_data = [
852 852
                     "uid"           =>$user_id,
853 853
                     "number"  =>    $hongbao,
@@ -875,7 +875,7 @@ class UserThirdRepository extends BaseRepository
875 875
         
876 876
                 // @todo 用户身份比例
877 877
                 $yongjinbili = StoreOrderRepository::getUserGroupRate($sprerdUser['user_group']);
878
-                $tuiguanyongjin=round_optimize($yongjinbili*$inc_score,2);//按照身份获得佣金
878
+                $tuiguanyongjin=$this->roundOptimize($yongjinbili*$inc_score,2);//按照身份获得佣金
879 879
 
880 880
                 //添加推广积分
881 881
                 $tuijifendata = [
@@ -896,7 +896,7 @@ class UserThirdRepository extends BaseRepository
896 896
 
897 897
                 //添加推荐献值 普通用户 贡献值为 pv* 30%;推广人是业务员及以上身份,贡献值为:pv的1:1
898 898
                 if($sprerdUser['user_group'] <= 1){
899
-                    $gongxian = round_optimize($gongxian*0.3,2);
899
+                    $gongxian = $this->roundOptimize($gongxian*0.3,2);
900 900
                 }
901 901
                 $tuigangongxian_data = [
902 902
                     "uid"           =>$sprerdUser['uid'],

+ 1 - 1
app/controller/merchant/Common.php

@@ -58,7 +58,7 @@ class Common extends BaseController
58 58
         $merId = $this->merId;
59 59
 
60 60
         // $list['gongxian'] = Db::name('user_sign_gongxian')->where('mer_id', $merId)->sum('number');
61
-        $list['jingdou'] = Db::name('user_sign_jingdou')->where('mer_id', $merId)->sum('number');
61
+        $list['jingdou'] = Db::name('user_sign_jingdou')->where('mer_id', $merId)->where('status',1)->sum('number');
62 62
         $list['fenrunzhi'] = Db::name('order_merchant')->where('mer_id', $merId)->where('paid', 1)->sum('available');
63 63
     
64 64
         $list['xianxia'] = Db::name('order_merchant')->where('mer_id', $merId)->where('paid', 1)->count();