hrjy 2 年之前
父节点
当前提交
52e63a8262
共有 3 个文件被更改,包括 31 次插入5 次删除
  1. 19 2
      .idea/workspace.xml
  2. 2 2
      app/api/controller/auction/AuctionController.php
  3. 10 1
      app/api/controller/user/UserController.php

+ 19 - 2
.idea/workspace.xml

@@ -7,6 +7,7 @@
     <list default="true" id="9df7b838-09db-466a-bed4-3e1ac8c3624d" name="变更" comment="commit">
       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
       <change beforePath="$PROJECT_DIR$/app/api/controller/auction/AuctionController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/api/controller/auction/AuctionController.php" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/app/api/controller/user/UserController.php" beforeDir="false" afterPath="$PROJECT_DIR$/app/api/controller/user/UserController.php" afterDir="false" />
     </list>
     <option name="SHOW_DIALOG" value="false" />
     <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -153,7 +154,16 @@
       <workItem from="1658363562193" duration="1213000" />
       <workItem from="1658381357747" duration="2624000" />
       <workItem from="1658709259583" duration="5148000" />
-      <workItem from="1658795404719" duration="2457000" />
+      <workItem from="1658795404719" duration="5791000" />
+      <workItem from="1658882464655" duration="1024000" />
+      <workItem from="1658968599352" duration="1187000" />
+      <workItem from="1659054737580" duration="1192000" />
+      <workItem from="1659077235774" duration="1109000" />
+      <workItem from="1659494355365" duration="1210000" />
+      <workItem from="1659573059465" duration="1179000" />
+      <workItem from="1659659810037" duration="2396000" />
+      <workItem from="1659918556904" duration="7352000" />
+      <workItem from="1660006423251" duration="3557000" />
     </task>
     <task id="LOCAL-00001" summary="commit">
       <created>1655962607195</created>
@@ -253,7 +263,14 @@
       <option name="project" value="LOCAL" />
       <updated>1658713062626</updated>
     </task>
-    <option name="localTasksCounter" value="15" />
+    <task id="LOCAL-00015" summary="commit">
+      <created>1658798088364</created>
+      <option name="number" value="00015" />
+      <option name="presentableId" value="LOCAL-00015" />
+      <option name="project" value="LOCAL" />
+      <updated>1658798088364</updated>
+    </task>
+    <option name="localTasksCounter" value="16" />
     <servers />
   </component>
   <component name="TypeScriptGeneratedFilesManager">

+ 2 - 2
app/api/controller/auction/AuctionController.php

@@ -540,7 +540,7 @@ class AuctionController
         $user = User::where('uid', $request->uid())->find();
         if ($data['type'] == 1){
             // 金豆兑换广告值
-            $proportion = SystemConfigService::get('anticipate');
+            $proportion = 2;
             $price = $data['price'] * $proportion;
             if ($user['golden_bean'] < $price) return app('json')->fail('金豆不足');
             $user['golden_bean'] -= $price;
@@ -550,7 +550,7 @@ class AuctionController
             UserBill::income('广告值兑换', $request->uid(), 'anticipate', 'dh_anticipate', $data['price'], '', $user['anticipate'], '金豆兑换'.$data['price'].'广告值');
         }elseif ($data['type'] == 2) {
             // 金豆兑换趣豆
-            $proportion = SystemConfigService::get('integral');
+            $proportion = sys_config('integral');
             $price = $data['price'] * $proportion;
             if ($user['golden_bean'] < $price) return app('json')->fail('金豆不足');
             $user['golden_bean'] -= $price;

+ 10 - 1
app/api/controller/user/UserController.php

@@ -80,7 +80,16 @@ class UserController
         $profit = 0;
         if (count($order) > 0){
             foreach ($order as $item) {
-                $profit += ($item['price'] - $item['gs_price']) * ($item['deduct']/$item['rise']);
+                if ($item['gs_price'] > 0){
+                    if (isset($item['deduct']) && isset($item['rise'])){
+                        $cf = $item['deduct']/$item['rise'];
+                    }else{
+                        $cf = 0;
+                    }
+                    $profit += ($item['gs_price'] - $item['price']) - (($item['gs_price'] - $item['price']) * $cf);
+                    if ($profit > 0) $profit = round($profit, 2);
+                }
+                if ($profit <= 0) $profit = 0;
             }
         }
         return $profit;