Browse Source

no message

BF-202210271038\Administrator 2 years ago
parent
commit
525579e34a

+ 2 - 0
app/Console/Commands/TestCommand.php

@@ -99,6 +99,8 @@ class TestCommand extends Command
      */
     public function handle()
     {
+        MemberServer::creatServer()->verificationLevel([3]);
+        dd(1221);
         $data=Address::generate();
         dd($data);
 //        for ($i=0;$i<=23;++$i){

+ 3 - 1
app/Http/Controllers/ContractDistribution/ContractDistributionsController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\ContractDistribution;
 use App\Http\Controllers\AdminBaseController;
 use App\Http\Requests\ContractDistributionCreateRequest;
 use App\Http\Requests\ContractDistributionUpdateRequest;
+use App\Models\Broadcast;
 use App\Models\Contract;
 use App\Models\ContractDistribution;
 use App\Repositories\Eloquent\ContractDistributionRepositoryEloquent;
@@ -91,10 +92,11 @@ class ContractDistributionsController extends AdminBaseController
      */
     protected function _indexPost($datum)
     {
-        $status = ['失败', '成功', '广播失败'];
+        $status = ['失败', '成功', '广播失败','广播成功'];
         foreach ($datum as $value) {
             $value->{'type'} = ContractServer::creatServer()->getDistributionArrStr($value->{'type'});
             $value->{'status'} = empty($status[$value->{'status'}]) ? '状态异常' : $status[$value->{'status'}];
+            $value->{'hash'} =$value->{'broadcast_id'}? Broadcast::where('id',$value->{'broadcast_id'})->value('hash'):'';
         }
         return $datum;
     }

+ 4 - 1
app/Observers/ContractDistributionObserver.php

@@ -40,7 +40,10 @@ class ContractDistributionObserver
                 if($distribution->{'nbn_money'}-$distribution->{'service_money'}>0){
                     $sysAddress=CommonServer::creatServer()->getConfigValue('sys_address');
                     $sysPrivate=CommonServer::creatServer()->getConfigValue('sys_private');
-                    BroadcastServer::addBroadcast(1,$distribution->{'nbn_money'}-$distribution->{'service_money'},$sysAddress,$sysPrivate,$distribution->{'to_address'},0,$distribution->{'id'},$distribution->{'type'});
+                   $broadcastId= BroadcastServer::addBroadcast(1,$distribution->{'nbn_money'}-$distribution->{'service_money'},$sysAddress,$sysPrivate,$distribution->{'to_address'},0,$distribution->{'id'},$distribution->{'type'});
+                   if($broadcastId){
+                       $distribution->update(['broadcast_id' => $broadcastId]);
+                   }
                 }
             }
         }

+ 3 - 1
app/Servers/ContractServer.php

@@ -367,11 +367,13 @@ class ContractServer
         $agencyMoney=round(($contract->{'money'}-$contract->{'platform_money'})*$contract->{'agency_proportion'}/100,6);
         $exchangeMoney=CommonServer::creatServer()->getConfigValue('exchange_money');
         $dbMoney=$agencyMoney*$exchangeMoney;
-        if($agencyMoney>0){
+        if($exchangeMoney >0){
             $member=Member::where('id',$contract->{'m_id'})->select(['id','address','is_boss'])->first();
             $this->addDistribution($contract->{'id'},$contract->{'m_id'},$dbMoney,0,7,$member->{'id'},$member->{'address'},$contract->{'agency_proportion'},1,'代币分账');
             MoneyDetailServer::creatServer()->write(1,1,$dbMoney,1,$member->{'id'},'报单代币清分',$contract->{'id'});
         }else{
+            $sedimentAddress=CommonServer::creatServer()->getConfigValue('sediment_address');
+            $this->addDistribution($contract->{'id'},$contract->{'m_id'},0,$agencyMoney,7,0,$sedimentAddress,$contract->{'agency_proportion'},1,'代币价格为0,转入沉淀分账');
             $this->addContractLog($contract,'代币价格为0,不分发');
         }
 

+ 1 - 1
app/Servers/MemberServer.php

@@ -192,7 +192,7 @@ class MemberServer
         foreach ($pIds as $pId){
             $member=Member::where('id',$pId)->select(['id','address','level_id'])->first();
             $contractNum=ContractServer::creatServer()->getTeamContractNum($pId);
-            $newLevelId=Level::where('total_num','>=',$contractNum)->orderBy('id','desc')->value('id');
+            $newLevelId=Level::where('total_num','<=',$contractNum)->where('id','>',$member->{'level_id'})->orderBy('id','desc')->value('id');
             if(!empty($newLevelId) && $newLevelId>$member->{'level_id'}){
                 $member->update(['level_id'=>$newLevelId]);
             }