afa 6 сар өмнө
parent
commit
3a1526eabf

+ 1 - 2
application/admin/controller/Ajax.php

@@ -120,8 +120,7 @@ class Ajax extends Backend
                 //获取oss实例
                 $ossClient = new OssClient($config['KeyId'],$config['KeySecret'],$config['Endpoint']);
                 $bucket = $config['Bucket']; //创建的项目
-                $object =  $config['Directory'] . '/' . $filename['name'] ; //文件名
-
+                $object =  $config['Directory'] . '/'.date('Ym').'/' .sha1(date('YmdHis', time()) . uniqid()). pathinfo( $filename['name'], PATHINFO_EXTENSION);; //文件名
                 $res = $ossClient->uploadFile($bucket,$object,$file->getRealPath());
                 $url = str_replace("http://", "https://", $res['info']['url']);
                 $this->success(__('Uploaded successful'), '', ['url' => $url, 'fullurl' => $url]);

+ 3 - 3
application/api/controller/Teac.php

@@ -45,7 +45,7 @@ class Teac extends Api
         if(!$validate->scene('buying')->check($params)) $this->error($validate->getError());
         if(config('teac_trade.buy_min_num') > $params['stock']) $this->error('数量不能低于'.config('teac_trade.buy_min_num'));
         if(config('teac_trade.buy_min_price') > $params['price']) $this->error('价格不能低于'.config('teac_trade.buy_min_price'));
-        $chabao = bcmul($params['price'], $params['stock'], 2) ;
+        $chabao = bcmul($params['price'], $params['stock'], 4) ;
         if($ledgerWalletModel->getWalletChaBao($this->auth->id) < $chabao) $this->error('您的钱包茶宝余额不足');
       
         Db::startTrans();
@@ -109,7 +109,7 @@ class Teac extends Api
         if($this->auth->id == $row['user_id']) $this->error('不能购买自己的订单');
         if($params['num'] > $row['stock'] - $row['num']) $this->error('库存不足');
         $chabao = $ledgerWalletModel->getWalletChaBao($this->auth->id);
-        $tatal = bcmul($row['price'], $params['num'], 2);
+        $tatal = bcmul($row['price'], $params['num'], 4);
         if($chabao < $tatal) $this->error('您的钱包茶宝余额不足');
 
         // 启动事务
@@ -156,7 +156,7 @@ class Teac extends Api
         try {
 
             $fee = config('teac_trade.buy_serve_fee');
-            $chabao = bcmul($row['price'], $params['num'], 2);
+            $chabao = bcmul($row['price'], $params['num'], 4);
             // 出售购买
             $userTeac::setUserCreateOrder($this->auth->id, $row['id'], ProductTeac::Buying, $params['num'], $row['price'],  $fee);
 

+ 6 - 6
application/api/logic/TeacLogin.php

@@ -45,8 +45,8 @@ class TeacLogin
     {
 
         $ledgerWalletModel = Loader::model('LedgerWalletModel');
-        $total_price = bcmul($chabao, $num, 2); //总价
-        $fee = bcmul($total_price, $fee, 2); //手续费
+        $total_price = bcmul($chabao, $num, 4); //总价
+        $fee = bcmul($total_price, $fee, 4); //手续费
 
         //扣除用户茶宝
         $ledgerWalletModel->changeWalletAccount($uid, Asset::TOKEN, -$total_price, LedgerTokenChangeModel::BuySellg, $fromUid);
@@ -56,7 +56,7 @@ class TeacLogin
 
 
         //添加来源茶宝
-        $ledgerWalletModel->changeWalletAccount($fromUid, Asset::TOKEN, bcsub($total_price, $fee, 2), LedgerTokenChangeModel::BuySellg, $uid);
+        $ledgerWalletModel->changeWalletAccount($fromUid, Asset::TOKEN, bcsub($total_price, $fee, 4), LedgerTokenChangeModel::BuySellg, $uid);
 
         return true;
     }
@@ -71,11 +71,11 @@ class TeacLogin
     {
 
         $ledgerWalletModel = Loader::model('LedgerWalletModel');
-        $total_price = bcmul($chabao, $num, 2); //总价
-        $fee = bcmul($total_price, $fee, 2); //手续费
+        $total_price = bcmul($chabao, $num, 4); //总价
+        $fee = bcmul($total_price, $fee, 4); //手续费
 
         //添加用户茶宝
-        $ledgerWalletModel->changeWalletAccount($uid, Asset::TOKEN, bcsub($total_price, $fee, 2), LedgerTokenChangeModel::BuySellg, $fromUid);
+        $ledgerWalletModel->changeWalletAccount($uid, Asset::TOKEN, bcsub($total_price, $fee, 4), LedgerTokenChangeModel::BuySellg, $fromUid);
 
      
         //扣除用户Teac

+ 2 - 2
application/common/model/ProductTeac.php

@@ -49,14 +49,14 @@ class ProductTeac extends Model
     //添加订单信息
     public static function setUserCreateOrder(int $uid, int $typeId, float $price, int $stock, float $fee, float $frozen): object
     {
-        $total_price = bcmul($price, $stock, 2);
+        $total_price = bcmul($price, $stock, 4);
         return self::create([
             'user_id' => $uid,
             'type_id' => $typeId,
             'price'   => $price,
             'stock'   => $stock,
             'total_price'=> $total_price,
-            'fee'        => bcmul($total_price, $fee, 2),
+            'fee'        => bcmul($total_price, $fee, 4),
             'frozen'     => $frozen,
         ]); 
       

+ 2 - 2
application/common/model/UserTeac.php

@@ -27,7 +27,7 @@ class UserTeac extends Model
     //添加订单记录
     public static function setUserCreateOrder(int $uid, int $tradeId, int $typeId, int $num, float $price, float $fee)
     {   
-        $total_price = bcmul($price, $num, 2); //总价
+        $total_price = bcmul($price, $num, 4); //总价
         return self::create([
             'user_id'       => $uid,
             'trade_id'      => $tradeId,
@@ -35,7 +35,7 @@ class UserTeac extends Model
             'num'           => $num,
             'price'         => $price,
             'total_price'   => $total_price,
-            'fee'           => bcmul($total_price, $fee, 2)
+            'fee'           => bcmul($total_price, $fee, 4)
         ]);
     }