|
@@ -11,6 +11,7 @@ use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\InteractsWithQueue;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Queue\SerializesModels;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
+use App\Wen\Utils\UserUtils;
|
|
|
|
|
|
class AskFinishJob implements ShouldQueue
|
|
class AskFinishJob implements ShouldQueue
|
|
{
|
|
{
|
|
@@ -40,12 +41,29 @@ class AskFinishJob implements ShouldQueue
|
|
['countdown_time','<=',time()], //计划任务一分钟一次,所以这里不延迟了
|
|
['countdown_time','<=',time()], //计划任务一分钟一次,所以这里不延迟了
|
|
];
|
|
];
|
|
|
|
|
|
- $update = [
|
|
|
|
- 'status' => 20,
|
|
|
|
- 'finish_time' => time(),
|
|
|
|
- ];
|
|
|
|
|
|
+ $list = DB::table('ask_order')->where($where)->limit(5)->get();
|
|
|
|
+ if(empty($list)){
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $list = json_decode(json_encode($list),true);
|
|
|
|
+ foreach($list as $key => $order){
|
|
|
|
+
|
|
|
|
+ $update = [
|
|
|
|
+ 'status' => 20,
|
|
|
|
+ 'finish_time' => time(),
|
|
|
|
+ ];
|
|
|
|
+
|
|
|
|
+ DB::table('ask_order')->where('id',$order['id'])->update($update);
|
|
|
|
+
|
|
|
|
+ //给答主钱
|
|
|
|
+ UserUtils::update_user_financial($order['blogger_user_id'], 103, $order['blogger_price'], '咨询收益'.$order['blogger_price']);
|
|
|
|
+
|
|
|
|
+ //更新答主的完成订单数
|
|
|
|
+ $order_number = DB::table('ask_order')->where('blogger_user_id',$order['blogger_user_id'])->where('status',20)->count();
|
|
|
|
+ DB::table('blogger')->where('user_id',$order['blogger_user_id'])->update(['order_number' => $order_number]);
|
|
|
|
|
|
- DB::table('ask_order')->where($where)->update($update);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|