APPLE пре 3 година
родитељ
комит
4eb52d2f3d
2 измењених фајлова са 7 додато и 1 уклоњено
  1. 2 0
      app/Services/Common/ScoreGoodsService.php
  2. 5 1
      app/Services/Common/TradeService.php

+ 2 - 0
app/Services/Common/ScoreGoodsService.php

@@ -122,6 +122,8 @@ class ScoreGoodsService extends BaseService
             }
             $data['albums'] = json_encode($albums, 256);
         }
+        $thumbs = $data['thumb']? [['url'=>$data['thumb']]]:[];
+        $data['thumbs'] = array_merge($thumbs, $albums);
         return parent::edit($data); // TODO: Change the autogenerated stub
     }
 

+ 5 - 1
app/Services/Common/TradeService.php

@@ -626,8 +626,12 @@ class TradeService extends BaseService
             $bonusRate = $bonusRate ? $bonusRate : 5;
             $bonus = $info['real_price'] * $bonusRate / 100;
 
+            $profitRate = ConfigService::make()->getConfigByCode('profit_rate');
+            $profitRate = $profitRate ? $profitRate : 0;
+            $profit = $info['real_price'] * $profitRate / 100;
+
             if ($bonus > 0) {
-                if (!$this->model->where(['id' => $id, 'mark' => 1])->update(['bonus' => $bonus, 'update_time' => time()])) {
+                if (!$this->model->where(['id' => $id, 'mark' => 1])->update(['bonus' => $bonus,'profit'=> $profit, 'update_time' => time()])) {
                     $this->error = 2051;
                     DB::rollBack();
                     return true;