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

会员专区显示PV和贡献值、积分的问题

橙汁先生 1 год назад
Родитель
Сommit
0598905e96

+ 24 - 20
app/common/repositories/store/product/ProductRepository.php

@@ -992,26 +992,26 @@ class ProductRepository extends BaseRepository
992
         }
992
         }
993
 
993
 
994
         if($res['mer_id'] == 496){
994
         if($res['mer_id'] == 496){
995
-         
995
+
996
             $s = 0;
996
             $s = 0;
997
-            
997
+
998
             if($res['price']==1180){
998
             if($res['price']==1180){
999
                 $s = 1000;
999
                 $s = 1000;
1000
             }else if($res['price']==10620){
1000
             }else if($res['price']==10620){
1001
                 $s = 9000;
1001
                 $s = 9000;
1002
             }else if($res['price']==11800){
1002
             }else if($res['price']==11800){
1003
                 $s = 10000;
1003
                 $s = 10000;
1004
-            }else if($res['price'] == '2360'){
1004
+            }else if($res['price'] == 2360){
1005
                 $s= 2000;
1005
                 $s= 2000;
1006
-            }else if($res['price'] == '9440'){
1006
+            }else if($res['price'] == 9440){
1007
                 $s = 8000;
1007
                 $s = 8000;
1008
             }
1008
             }
1009
-            
1009
+
1010
             $res['yanglao'] = round($s * 0.035,2);
1010
             $res['yanglao'] = round($s * 0.035,2);
1011
         }
1011
         }
1012
 
1012
 
1013
 
1013
 
1014
-       
1014
+
1015
 
1015
 
1016
         $res['pv']=($k['pv']);
1016
         $res['pv']=($k['pv']);
1017
         $res['jifen']=($k['jifen']);
1017
         $res['jifen']=($k['jifen']);
@@ -1646,7 +1646,7 @@ class ProductRepository extends BaseRepository
1646
 
1646
 
1647
             //plate_mer_profit 产品获得的佣金 数据库添加商品已经算好的佣金
1647
             //plate_mer_profit 产品获得的佣金 数据库添加商品已经算好的佣金
1648
 
1648
 
1649
-           // $pv=decimal2($product['plate_mer_profit']*0.5);//pv=佣金的50%
1649
+            // $pv=decimal2($product['plate_mer_profit']*0.5);//pv=佣金的50%
1650
             // $dui_jifen=decimal2($product['plate_mer_profit']*0.4);
1650
             // $dui_jifen=decimal2($product['plate_mer_profit']*0.4);
1651
             // $dui_jingdou=decimal2($product['plate_mer_profit']*0.5);
1651
             // $dui_jingdou=decimal2($product['plate_mer_profit']*0.5);
1652
             // $dui_price=$total_price-$dui_jifen;//用积分兑换,所需要的现金 佣金的*40%
1652
             // $dui_price=$total_price-$dui_jifen;//用积分兑换,所需要的现金 佣金的*40%
@@ -1665,16 +1665,20 @@ class ProductRepository extends BaseRepository
1665
             // $jfduihuan='';
1665
             // $jfduihuan='';
1666
             // $jdduihuan='';
1666
             // $jdduihuan='';
1667
 
1667
 
1668
-           
1668
+
1669
             //$v['vr'] = 0;
1669
             //$v['vr'] = 0;
1670
             $num_yl = 0;
1670
             $num_yl = 0;
1671
-            
1671
+
1672
             if($product['price'] == '1180'){
1672
             if($product['price'] == '1180'){
1673
                 $num_yl = 1000;
1673
                 $num_yl = 1000;
1674
             }else if($product['price'] == '10620'){
1674
             }else if($product['price'] == '10620'){
1675
                 $num_yl = 9000;
1675
                 $num_yl = 9000;
1676
             }else if($product['price'] == '11800'){
1676
             }else if($product['price'] == '11800'){
1677
                 $num_yl = 10000;
1677
                 $num_yl = 10000;
1678
+            }else if($product['price'] == '2360'){
1679
+                $num_yl = 2000;
1680
+            }else if($product['price'] == '9440'){
1681
+                $num_yl = 8000;
1678
             }
1682
             }
1679
 
1683
 
1680
             if($product['mer_id'] == 496){
1684
             if($product['mer_id'] == 496){
@@ -1683,14 +1687,14 @@ class ProductRepository extends BaseRepository
1683
                 $pv=$num_yl;
1687
                 $pv=$num_yl;
1684
                 //$v['vr']=$v['price'];
1688
                 //$v['vr']=$v['price'];
1685
                 //1:为会员专区,
1689
                 //1:为会员专区,
1686
-               
1687
-                $fzone_paytype= [ 
1690
+
1691
+                $fzone_paytype= [
1688
                     1=>[
1692
                     1=>[
1689
                         1=>$product['price'],//VR
1693
                         1=>$product['price'],//VR
1690
                         2=>$product['price']//现金
1694
                         2=>$product['price']//现金
1691
                     ]
1695
                     ]
1692
-                ];   
1693
-             
1696
+                ];
1697
+
1694
             }else if($product['mer_id'] == 439){
1698
             }else if($product['mer_id'] == 439){
1695
                 //精彩生活和商贸区
1699
                 //精彩生活和商贸区
1696
                 $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
1700
                 $jf = $product['price'] - round($product['concession_pri']*0.3, 2) . ' + ' . round($product['concession_pri']*0.3, 2);
@@ -1712,10 +1716,10 @@ class ProductRepository extends BaseRepository
1712
                     $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1716
                     $jcprice1 = $product['price'] - round($product['concession_pri']*0.35, 2);
1713
                     $jcjd1 = round($product['concession_pri']*0.35, 2);
1717
                     $jcjd1 = round($product['concession_pri']*0.35, 2);
1714
 
1718
 
1715
-                    
1719
+
1716
                     //支付组合
1720
                     //支付组合
1717
                     // $fzone_paytype= [
1721
                     // $fzone_paytype= [
1718
-                     
1722
+
1719
                     //     2=>[
1723
                     //     2=>[
1720
                     //         1=>[$jcvr,$jcjf],//VR+积分
1724
                     //         1=>[$jcvr,$jcjf],//VR+积分
1721
                     //         2=>[$jcprice,$jcjf1],//现金+积分
1725
                     //         2=>[$jcprice,$jcjf1],//现金+积分
@@ -1738,7 +1742,7 @@ class ProductRepository extends BaseRepository
1738
                 }
1742
                 }
1739
             }else if($product['mer_id'] == 476){
1743
             }else if($product['mer_id'] == 476){
1740
                 //复购区
1744
                 //复购区
1741
-                
1745
+
1742
             }
1746
             }
1743
 
1747
 
1744
 
1748
 
@@ -1784,7 +1788,7 @@ class ProductRepository extends BaseRepository
1784
      * 计算商品的养老金
1788
      * 计算商品的养老金
1785
      * @param int $good_id
1789
      * @param int $good_id
1786
      * @param int $price
1790
      * @param int $price
1787
-    * @param int $dc
1791
+     * @param int $dc
1788
      * @param null $product_attr_unique
1792
      * @param null $product_attr_unique
1789
      * @return string
1793
      * @return string
1790
      */
1794
      */
@@ -1823,7 +1827,7 @@ class ProductRepository extends BaseRepository
1823
 //                if ($mer_id == 496) {
1827
 //                if ($mer_id == 496) {
1824
 //                    $yanglao = $total_price * 5 / 100;
1828
 //                    $yanglao = $total_price * 5 / 100;
1825
 //                } else {
1829
 //                } else {
1826
-                    $yanglao = $total_price * $shop_bonus_setting['yanglao_rate'] / 100;
1830
+                $yanglao = $total_price * $shop_bonus_setting['yanglao_rate'] / 100;
1827
 //                }
1831
 //                }
1828
             }
1832
             }
1829
             $yanglao= decimal2($yanglao);
1833
             $yanglao= decimal2($yanglao);
@@ -1902,7 +1906,7 @@ class ProductRepository extends BaseRepository
1902
                         'gong_sku_id'      => $value['sku_id'],
1906
                         'gong_sku_id'      => $value['sku_id'],
1903
                         'price'            => $value['edit_price'],
1907
                         'price'            => $value['edit_price'],
1904
                         'plate_mer_profit' => $plate_mer_profit,
1908
                         'plate_mer_profit' => $plate_mer_profit,
1905
-						'concession_pri'   => $plate_mer_profit,
1909
+                        'concession_pri'   => $plate_mer_profit,
1906
                         'cost'             => $attrInfo[$value['sku_id']]['cost'],
1910
                         'cost'             => $attrInfo[$value['sku_id']]['cost'],
1907
                         'ot_price'         => $attrInfo[$value['sku_id']]['ot_price'],
1911
                         'ot_price'         => $attrInfo[$value['sku_id']]['ot_price'],
1908
                         'gong_pension'     => $attrInfo[$value['sku_id']]['gong_pension']
1912
                         'gong_pension'     => $attrInfo[$value['sku_id']]['gong_pension']
@@ -1936,7 +1940,7 @@ class ProductRepository extends BaseRepository
1936
                 'cost'             => $updateData[0]['cost'],
1940
                 'cost'             => $updateData[0]['cost'],
1937
                 'ot_price'         => $updateData[0]['ot_price'],
1941
                 'ot_price'         => $updateData[0]['ot_price'],
1938
                 'plate_mer_profit' => $updateData[0]['plate_mer_profit'],
1942
                 'plate_mer_profit' => $updateData[0]['plate_mer_profit'],
1939
-				'concession_pri'   => $updateData[0]['plate_mer_profit'],
1943
+                'concession_pri'   => $updateData[0]['plate_mer_profit'],
1940
                 'is_show'          => 0,
1944
                 'is_show'          => 0,
1941
                 'yanglaojin_scale' => $yanglaojin_scale,
1945
                 'yanglaojin_scale' => $yanglaojin_scale,
1942
                 'type'             => $type
1946
                 'type'             => $type

+ 35 - 0
app/controller/api/merchant/sxy/Access.php

@@ -754,6 +754,41 @@ class Access
754
 
754
 
755
     //小程序支付
755
     //小程序支付
756
     public function pay_wechat_mp(StoreGroupOrderRepository $groupOrderRepository){
756
     public function pay_wechat_mp(StoreGroupOrderRepository $groupOrderRepository){
757
+
758
+        $oid = Request::param('oid','');
759
+
760
+
761
+        $store_order_data = Db::name('store_order')->where('group_order_id',$oid)->find();
762
+
763
+        $array_fzone_paytype = json_decode(  $store_order_data['fzone_paytype'],true);
764
+        if(!empty($array_fzone_paytype['type'])){
765
+
766
+            //a3 会员专区的现金+VR支付
767
+            if($array_fzone_paytype['type'] == 'a3'){
768
+
769
+                $userdata = Db::name('user')->where('uid',$store_order_data['uid'])->find();
770
+                //查询用户的VR是否足够
771
+                $vr_pri = $userdata['vr'] - $array_fzone_paytype['other'];
772
+                if($vr_pri < 0){
773
+                    return app('json')->fail('VR不足,请重试!');
774
+                }
775
+            }
776
+            //b2 精彩生活区的现金+积分支付
777
+            if($array_fzone_paytype['type'] == 'b2'){
778
+
779
+                //查询用户的积分是否足够
780
+                $score_pri = $userdata['score'] - $array_fzone_paytype['other'];
781
+                if($score_pri < 0){
782
+                    return app('json')->fail('积分不足,请重试!');
783
+                }
784
+            }
785
+
786
+
787
+        }else{
788
+            return app('json')->fail('数据异常,请重新下单,并选择支付方式!');
789
+        }
790
+
791
+
757
         try {
792
         try {
758
             log::info("微信小程序回调");
793
             log::info("微信小程序回调");
759
             Db::name('log')->insert(['data'=>'汇付订单支付pay_wechat_mp-66666666---发起支付']);
794
             Db::name('log')->insert(['data'=>'汇付订单支付pay_wechat_mp-66666666---发起支付']);