|
@@ -6,14 +6,45 @@ use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
|
|
use Illuminate\Routing\Controller as BaseController;
|
|
|
+
|
|
|
+//
|
|
|
use App\Common\Library\Easemob;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
+use App\Jobs\EasemobJob;
|
|
|
+
|
|
|
class Controller extends BaseController
|
|
|
{
|
|
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
|
|
|
|
|
public function test(){
|
|
|
- $easemob = new Easemob();
|
|
|
- $rs = $easemob->push_text(1018,'标题','内容');
|
|
|
- dd($rs);
|
|
|
+ /*$easemob = new Easemob();
|
|
|
+ $rs = $easemob->push_text(1009,'标题','内容');
|
|
|
+ dd($rs);*/
|
|
|
+ (new EasemobJob(1))->handle();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public function plantask(){
|
|
|
+
|
|
|
+ $list = DB::table('mt_message')->where('dispatch_status',0)->orderBy('id','asc')->get()->toArray();
|
|
|
+ //dd($list);
|
|
|
+ //
|
|
|
+ if(!empty($list)){
|
|
|
+ foreach($list as $key => $val){
|
|
|
+ $msg_id = $val->id;
|
|
|
+ dispatch((new EasemobJob($msg_id))->delay(0));//加入队列
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新
|
|
|
+ $ids = array_column($list,'id');
|
|
|
+
|
|
|
+ $update = [
|
|
|
+ 'dispatch_status' => 1,
|
|
|
+ ];
|
|
|
+
|
|
|
+ DB::table('mt_message')->whereIn('id',$ids)->update($update);
|
|
|
}
|
|
|
}
|