|
@@ -0,0 +1,36 @@
|
|
|
+#!/usr/bin/env php
|
|
|
+<?php
|
|
|
+ini_set('memory_limit',-1);
|
|
|
+use think\App;
|
|
|
+use Workerman\Worker as WO;
|
|
|
+
|
|
|
+define('APP_PATH', __DIR__ . '/application/');
|
|
|
+bcscale(2);
|
|
|
+// 加载框架引导文件
|
|
|
+require __DIR__.'/thinkphp/base.php';
|
|
|
+App::initCommon();
|
|
|
+WO::$logFile=sprintf('%s/workerman.log',RUNTIME_PATH);
|
|
|
+WO::$pidFile=sprintf('%s/workerman.pid',RUNTIME_PATH);
|
|
|
+WO::$processTitle='beauti-no';
|
|
|
+
|
|
|
+abstract class Com{
|
|
|
+ protected static function log($data){
|
|
|
+ user_log('commands/'.class_basename(get_called_class()),$data);
|
|
|
+ }
|
|
|
+ protected static function logError(\Exception $exception){
|
|
|
+ user_log('commands/'.class_basename(get_called_class()),[
|
|
|
+ 'exception'=>$exception->getMessage(),
|
|
|
+ 'file'=>$exception->getFile().' line:'.$exception->getLine(),
|
|
|
+ 'trace'=>$exception->getTrace()
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ protected static function newWorker(){
|
|
|
+ $work=new WO();
|
|
|
+ $work->name=class_basename(static::class);
|
|
|
+ return $work;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+require __DIR__.'/commands/mobile_delete.php';
|
|
|
+
|
|
|
+WO::runAll();
|