gq 7 years ago
parent
commit
2a86bb02a9
2 changed files with 33 additions and 11 deletions
  1. 24 11
      server/app/Console/Commands/DreamDJS.php
  2. 9 0
      server/app/Models/AccountLog.php

+ 24 - 11
server/app/Console/Commands/DreamDJS.php

xqd
@@ -55,18 +55,31 @@ class DreamDJS extends Command
             foreach ($end_dream_info as $item){
 //                (1)给梦想者发消息   梦想结束记录日志account_logs
                 $dream_user = $item->user;
-                $img = $item->img;  //梦想图片
-                $arr = [
-                    'from_type'=>'梦想币',
-                    'from_id'=>$dream_user->id,
-                    'from_name'=>$dream_user->nickname,
-                    'op'=>'梦想结束',
-                    'from_amount'=>$item->get_coin,
-                    'to_type'=>'梦想币',
-                    'to_id'=>$dream_user->id,
-                ];
-
                 if (!empty($dream_user)) {
+                    $img = $item->img;  //梦想图片
+                    $arr = [
+                        'from_type'=>'梦想币',
+                        'from_id'=>$dream_user->id,
+                        'from_name'=>$dream_user->nickname,
+                        'op'=>'梦想结束',
+                        'from_amount'=>$item->get_coin,
+                        'to_type'=>'梦想币',
+                        'to_id'=>$dream_user->id,
+                        'to_name'=>$dream_user->nickname,
+                        'to_amount'=>$item->get_coin,
+                        'channel'=>'平台内',
+                        'avatar'=>empty($img) ? '' : $img->pic,
+                        'title'=>$item->name,
+                        'dream_id'=>$item->id,
+                    ];
+                    $exist = AccountLog::where('dream_id',$item->id)->first();
+                    if (empty($exist)) {
+//                        AccountLog::firstOrCreate($arr);
+                        AccountLog::create($arr);
+                    }
+
+
+
                     $message = "你的梦想《".$item->name."》已结束,点击了解接下来的步骤";
                     $info = $dream_user->nickname.'会以你提供的微信/电话联系你约好时间地点亲自感谢你给予的支持和鼓励。如果你不希望见面或
                             不想要梦想者拥有你的联系方式,请按《不需要见面》的按钮或联系客服。';

+ 9 - 0
server/app/Models/AccountLog.php

xqd
@@ -10,12 +10,21 @@ class AccountLog extends Model
 
     protected $fillable = [
         'from_type',
+        'from_name',
         'to_type',
         'from_id',
         'to_id',
+        'to_name',
         'op',
         'from_amount',
         'to_amount',
+        'transaction_id',
+        'avatar',
+        'channel',
+        'avatar',
+        'title',
+        'dream_id',
+        'note',
     ];
     //交易行为定义
     const OP_CHARGE         = 'CHARGE';