Browse Source

gateway-worker

master
Fanli2 4 years ago
parent
commit
795032554c
  1. 113
      app/Console/Commands/GatewayWorkerServer.php
  2. 2
      app/Console/Kernel.php
  3. 129
      app/GatewayWorker/Events.php
  4. 2
      app/Http/Controllers/Admin/AdController.php
  5. 2
      app/Http/Controllers/Admin/AdminController.php
  6. 2
      app/Http/Controllers/Admin/AdminRoleController.php
  7. 2
      app/Http/Controllers/Admin/ArticleController.php
  8. 2
      app/Http/Controllers/Admin/BaseController.php
  9. 2
      app/Http/Controllers/Admin/BonusController.php
  10. 2
      app/Http/Controllers/Admin/CategoryController.php
  11. 2
      app/Http/Controllers/Admin/CommonController.php
  12. 2
      app/Http/Controllers/Admin/DatabaseController.php
  13. 2
      app/Http/Controllers/Admin/FeedbackController.php
  14. 2
      app/Http/Controllers/Admin/FriendlinkController.php
  15. 2
      app/Http/Controllers/Admin/GoodsBrandController.php
  16. 2
      app/Http/Controllers/Admin/GoodsController.php
  17. 2
      app/Http/Controllers/Admin/GoodstypeController.php
  18. 2
      app/Http/Controllers/Admin/GuestbookController.php
  19. 2
      app/Http/Controllers/Admin/KeywordController.php
  20. 2
      app/Http/Controllers/Admin/KuaidiController.php
  21. 2
      app/Http/Controllers/Admin/LogController.php
  22. 2
      app/Http/Controllers/Admin/LoginController.php
  23. 2
      app/Http/Controllers/Admin/MenuController.php
  24. 2
      app/Http/Controllers/Admin/OrderController.php
  25. 2
      app/Http/Controllers/Admin/PageController.php
  26. 2
      app/Http/Controllers/Admin/SearchwordController.php
  27. 2
      app/Http/Controllers/Admin/SlideController.php
  28. 2
      app/Http/Controllers/Admin/SysconfigController.php
  29. 2
      app/Http/Controllers/Admin/TagController.php
  30. 2
      app/Http/Controllers/Admin/UserController.php
  31. 2
      app/Http/Controllers/Admin/UserRankController.php
  32. 2
      app/Http/Controllers/Admin/UserWithdrawController.php
  33. 2
      app/Http/Controllers/Admin/WeixinMenuController.php
  34. 4
      app/Http/Controllers/Api/ArctypeController.php
  35. 4
      app/Http/Controllers/Api/ArticleController.php
  36. 4
      app/Http/Controllers/Api/BonusController.php
  37. 4
      app/Http/Controllers/Api/CartController.php
  38. 4
      app/Http/Controllers/Api/CollectGoodsController.php
  39. 4
      app/Http/Controllers/Api/CommentController.php
  40. 4
      app/Http/Controllers/Api/FeedBackController.php
  41. 4
      app/Http/Controllers/Api/GoodsBrandController.php
  42. 4
      app/Http/Controllers/Api/GoodsController.php
  43. 4
      app/Http/Controllers/Api/GoodsSearchwordController.php
  44. 4
      app/Http/Controllers/Api/GoodsTypeController.php
  45. 4
      app/Http/Controllers/Api/NotifyController.php
  46. 4
      app/Http/Controllers/Api/OrderController.php
  47. 4
      app/Http/Controllers/Api/PageController.php
  48. 4
      app/Http/Controllers/Api/PaymentController.php
  49. 4
      app/Http/Controllers/Api/RegionController.php
  50. 4
      app/Http/Controllers/Api/SlideController.php
  51. 4
      app/Http/Controllers/Api/UserAddressController.php
  52. 4
      app/Http/Controllers/Api/UserBonusController.php
  53. 4
      app/Http/Controllers/Api/UserController.php
  54. 4
      app/Http/Controllers/Api/UserGoodsHistoryController.php
  55. 4
      app/Http/Controllers/Api/UserMessageController.php
  56. 4
      app/Http/Controllers/Api/UserMoneyController.php
  57. 4
      app/Http/Controllers/Api/UserPointController.php
  58. 4
      app/Http/Controllers/Api/UserRechargeController.php
  59. 4
      app/Http/Controllers/Api/UserWithdrawController.php
  60. 4
      app/Http/Controllers/Api/VerifyCodeController.php
  61. 4
      app/Http/Controllers/Weixin/WxPayController.php
  62. 4
      app/Http/Logic/CommentLogic.php
  63. 4
      app/Http/Logic/OrderLogic.php
  64. 4
      app/Http/Logic/UserLogic.php
  65. 2
      app/Http/Logic/UserMoneyLogic.php
  66. 2
      app/Http/Logic/UserPointLogic.php
  67. 2
      app/Http/Logic/UserWithdrawLogic.php
  68. 4
      app/Http/Model/Access.php
  69. 4
      app/Http/Model/Ad.php
  70. 4
      app/Http/Model/Admin.php
  71. 4
      app/Http/Model/AdminRole.php
  72. 4
      app/Http/Model/Arctype.php
  73. 4
      app/Http/Model/Article.php
  74. 4
      app/Http/Model/BaseModel.php
  75. 4
      app/Http/Model/Bonus.php
  76. 4
      app/Http/Model/Cart.php
  77. 4
      app/Http/Model/CollectGoods.php
  78. 4
      app/Http/Model/Comment.php
  79. 4
      app/Http/Model/FeedBack.php
  80. 4
      app/Http/Model/Friendlink.php
  81. 4
      app/Http/Model/Goods.php
  82. 4
      app/Http/Model/GoodsBrand.php
  83. 4
      app/Http/Model/GoodsImg.php
  84. 4
      app/Http/Model/GoodsSearchword.php
  85. 4
      app/Http/Model/GoodsType.php
  86. 4
      app/Http/Model/Guestbook.php
  87. 4
      app/Http/Model/Jobs.php
  88. 4
      app/Http/Model/Keyword.php
  89. 4
      app/Http/Model/Kuaidi.php
  90. 2
      app/Http/Model/Log.php
  91. 4
      app/Http/Model/Menu.php
  92. 4
      app/Http/Model/Order.php
  93. 4
      app/Http/Model/OrderGoods.php
  94. 4
      app/Http/Model/Page.php
  95. 4
      app/Http/Model/Payment.php
  96. 4
      app/Http/Model/Region.php
  97. 4
      app/Http/Model/Searchword.php
  98. 4
      app/Http/Model/Slide.php
  99. 4
      app/Http/Model/SmsLog.php
  100. 5
      app/Http/Model/Sysconfig.php

113
app/Console/Commands/GatewayWorkerServer.php

@ -0,0 +1,113 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use GatewayWorker\BusinessWorker;
use GatewayWorker\Gateway;
use GatewayWorker\Register;
use Workerman\Worker;
class GatewayWorkerServer extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'gateway-worker {action} {--d}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Start a GatewayWorker server.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
global $argv;
$action = $this->argument('action');
if (!in_array($action, ['start', 'stop', 'restart', 'reload', 'status'])) {
exit('Arguments Error');
}
$argv[0] = 'artisan gateway-worker';
$argv[1] = $action;
$argv[2] = $this->option('d') ? '-d' : ''; //必须是一个-,上面定义命令两个--,后台启动用两个--
$this->start();
}
private function start()
{
$this->startGateWay();
$this->startBusinessWorker();
$this->startRegister();
Worker::runAll();
}
private function startBusinessWorker()
{
$worker = new BusinessWorker();
$worker->name = 'BusinessWorker';
$worker->count = 1;
$worker->registerAddress = '127.0.0.1:1236';
$worker->eventHandler = \App\GatewayWorker\Events::class; //设置使用哪个类来处理业务,业务类至少要实现onMessage静态方法,onConnect和onClose静态方法可以不用实现
}
private function startGateWay()
{
$gateway = new Gateway("websocket://0.0.0.0:2346");
$gateway->name = 'Gateway'; //设置BusinessWorker进程的名称
$gateway->count = 1; //设置BusinessWorker进程的数量
$gateway->lanIp = '127.0.0.1'; #内网ip,多服务器分布式部署的时候需要填写真实的内网ip
$gateway->startPort = 2300; //监听本机端口的起始端口
$gateway->pingInterval = 30; //心跳间隔时间(秒)
$gateway->pingNotResponseLimit = 0; //心跳检测的时间间隔数
$gateway->pingData = '{"type":"ping"}'; //心跳消息
$gateway->registerAddress = '127.0.0.1:1236'; //注册服务地址
}
private function startRegister()
{
new Register('text://0.0.0.0:1236');
}
private function init()
{
}
//php artisan gateway-worker start --d之后,打开浏览器F12将内容复制到console里return就行
/* ws = new WebSocket("ws://127.0.0.1:2346?token=123456");
ws.onopen = function() {
ws.send('{"name":"one","user_id":"111"}');
ws.send('{"name":"two","user_id":"222"}');
//定义一个定时器,每10秒钟发送一个包,包的内容随意,一般发送心跳包的间隔在60秒以内
setInterval(function () {
ws.send('{"type":"heart","msg":"Heartbeat reply"}');
}, 10000);
};
ws.onmessage = function(e) {
console.log("收到服务端的消息:" + e.data);
};
ws.onclose = function(e) {
console.log("服务已断开" );
}; */
}

2
app/Console/Kernel.php

@ -6,6 +6,7 @@ use DB;
use Log;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Console\Commands\GatewayWorkerServer;
class Kernel extends ConsoleKernel
{
@ -15,6 +16,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected $commands = [
GatewayWorkerServer::class,
Commands\UnpayOrderSetInvalid::class,
Commands\SendEmail::class,
];

129
app/GatewayWorker/Events.php

@ -0,0 +1,129 @@
<?php
namespace App\GatewayWorker;
use GatewayWorker\Lib\Gateway;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use App\Common\ReturnData;
use App\Common\Helper;
class Events
{
/**
* 当businessWorker进程启动时触发,每个进程生命周期内都只会触发一次
* 可以在这里为每一个businessWorker进程做一些全局初始化工作,例如设置定时器,初始化redis等连接等
* 不要在onWorkerStart内执行长时间阻塞或者耗时的操作,这样会导致BusinessWorker无法及时与Gateway建立连接,造成应用异常
* @param mixed $worker Worker对象
*/
public static function onWorkerStart($businessWorker)
{
echo "onWorkerStart\r\n";
}
/**
* 当客户端连接上gateway进程时(TCP三次握手完毕时)触发的回调函数
* onConnect事件仅仅代表客户端与gateway完成了TCP三次握手,这时客户端还没有发来任何数据,此时除了通过$_SERVER['REMOTE_ADDR']获得对方ip,没有其他可以鉴别客户端的数据或者信息,所以在onConnect事件里无法确认对方是谁。要想知道对方是谁,需要客户端发送鉴权数据,例如某个token或者用户名密码之类,在onMesssge里做鉴权
* @param int $client_id
*/
public static function onConnect($client_id)
{
echo "onConnect\r\n";
Gateway::sendToClient($client_id, json_encode(['type' => 'onConnect', 'client_id' => $client_id]));
}
/**
* 当客户端连接上gateway完成websocket握手时触发的回调函数
* 注意:此回调只有gateway为websocket协议并且gateway没有设置onWebSocketConnect时才有效
* @param int $client_id
* @param mixed $data websocket握手时的http头数据,包含get、server等变量
*/
public static function onWebSocketConnect($client_id, $data)
{
Log::info('onWebSocketConnect,client_id:' . $client_id . '-' . json_encode($data));
echo "onWebSocketConnect\r\n";
if (!isset($data['get']['token'])) {
echo "closeClient\r\n";
return Gateway::closeClient($client_id);
}
$access_token = $data['get']['token'];
//通过client_id绑定用户ID
$res = self::bing_client($client_id, ['access_token' => $access_token]);
if ($res['code'] != ReturnData::SUCCESS) {
return Gateway::sendToClient($client_id, json_encode($res));
}
Gateway::sendToClient($client_id, json_encode(ReturnData::create(ReturnData::SUCCESS)));
}
/**
* 有消息时
* @param int $client_id 发消息的client_id
* @param mixed $message 完整的客户端请求数据,数据类型取决于Gateway所使用协议的decode方法返的回值类型
*/
public static function onMessage($client_id, $data)
{
echo "onMessage\r\n";
// Debug输出
echo "client:{$_SERVER['REMOTE_ADDR']}:{$_SERVER['REMOTE_PORT']} gateway:{$_SERVER['GATEWAY_ADDR']}:{$_SERVER['GATEWAY_PORT']} client_id:$client_id session:" . json_encode($_SESSION) . " onMessage:" . $message . "\n";
// data = {"type":"login", "uid":"666"}
$data = json_decode($data, true);
Log::info('onMessage,client_id:' . $client_id . '-' . json_encode($data));
// 没有传消息类型视为非法请求,关闭连接
if (!isset($data['type'])) {
return Gateway::closeClient($client_id);
}
$uid = Gateway::getUidByClientId($client_id);
// 判断绑定的UID为空,消息类型不是心跳视为非法请求,关闭连接
if (empty($uid) && $data['type'] !== 'heart') {
return Gateway::closeClient($client_id);
}
switch ($data['type']) {
case 'heart': //心跳回复
Gateway::sendToCurrentClient(json_encode(ReturnData::create(ReturnData::SUCCESS)));
break;
default:
Gateway::sendToCurrentClient(json_encode(ReturnData::create(ReturnData::PARAMS_ERROR)));
}
}
/**
* 当客户端断开连接时
* @param integer $client_id 断开连接的客户端client_id
* @return void
*/
public static function onClose($client_id)
{
// debug
echo "client:{$_SERVER['REMOTE_ADDR']}:{$_SERVER['REMOTE_PORT']} gateway:{$_SERVER['GATEWAY_ADDR']}:{$_SERVER['GATEWAY_PORT']} client_id:$client_id onClose:''\n";
Log::info('Workerman close connection,client_id:' . $client_id);
echo "onClose\r\n";
}
/**
* 通过client_id绑定用户ID
* @param int $client_id
* @param mixed $message ['access_token']
*/
public static function bing_client($client_id, $message)
{
if (!Gateway::isOnline($client_id)) {
return ReturnData::create(ReturnData::PARAMS_ERROR, null, 'client_id错误');
}
//client_id绑定用户ID
$token = DB::table('token')->where(['token' => $message['access_token']])->first();
if (!$token) {
return ReturnData::create(ReturnData::PARAMS_ERROR, null, '鉴权失败');
}
Gateway::bindUid($client_id, $token->uid);
return ReturnData::create(ReturnData::SUCCESS);
}
}

2
app/Http/Controllers/Admin/AdController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/AdminController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/AdminRoleController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/ArticleController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use Illuminate\Http\Request;
use App\Http\Logic\ArticleLogic;

2
app/Http/Controllers/Admin/BaseController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
class BaseController extends CommonController
{

2
app/Http/Controllers/Admin/BonusController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/CategoryController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/CommonController.php

@ -3,7 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use DB;
use Illuminate\Support\Facades\DB;
class CommonController extends Controller
{

2
app/Http/Controllers/Admin/DatabaseController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use Illuminate\Http\Request;
use App\Common\Helper;

2
app/Http/Controllers/Admin/FeedbackController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/FriendlinkController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/GoodsBrandController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
class GoodsBrandController extends BaseController
{

2
app/Http/Controllers/Admin/GoodsController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
class GoodsController extends BaseController
{

2
app/Http/Controllers/Admin/GoodstypeController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
class GoodsTypeController extends BaseController
{

2
app/Http/Controllers/Admin/GuestbookController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
class GuestbookController extends BaseController
{

2
app/Http/Controllers/Admin/KeywordController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
class KeywordController extends BaseController
{

2
app/Http/Controllers/Admin/KuaidiController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Common\Helper;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/LogController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/LoginController.php

@ -3,7 +3,7 @@ namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Log;
use Illuminate\Support\Facades\Log;
class LoginController extends CommonController
{

2
app/Http/Controllers/Admin/MenuController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use Illuminate\Support\Facades\DB;
class MenuController extends BaseController
{

2
app/Http/Controllers/Admin/OrderController.php

@ -6,7 +6,7 @@ use App\Http\Model\Order;
use App\Http\Model\OrderGoods;
use App\Http\Model\User;
use App\Http\Model\Region;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/PageController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use Illuminate\Support\Facades\DB;
class PageController extends BaseController
{

2
app/Http/Controllers/Admin/SearchwordController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use Illuminate\Support\Facades\DB;
class SearchwordController extends BaseController
{

2
app/Http/Controllers/Admin/SlideController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\Helper;
use App\Common\ReturnData;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/SysconfigController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use Illuminate\Support\Facades\DB;
class SysconfigController extends BaseController
{

2
app/Http/Controllers/Admin/TagController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use Illuminate\Support\Facades\DB;
class TagController extends BaseController
{

2
app/Http/Controllers/Admin/UserController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Common\Helper;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/UserRankController.php

@ -2,7 +2,7 @@
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Admin\CommonController;
use DB;
use Illuminate\Support\Facades\DB;
use App\Http\Model\UserRank;
use App\Common\Helper;

2
app/Http/Controllers/Admin/UserWithdrawController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Common\Helper;
use Illuminate\Http\Request;

2
app/Http/Controllers/Admin/WeixinMenuController.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Controllers\Admin;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Common\Helper;
use Illuminate\Http\Request;

4
app/Http/Controllers/Api/ArctypeController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/ArticleController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/BonusController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/CartController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/CollectGoodsController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/CommentController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/FeedBackController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/GoodsBrandController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/GoodsController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/GoodsSearchwordController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/GoodsTypeController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/NotifyController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/OrderController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/PageController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/PaymentController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/RegionController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/SlideController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserAddressController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserBonusController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserGoodsHistoryController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserMessageController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserMoneyController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserPointController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserRechargeController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/UserWithdrawController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Api/VerifyCodeController.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Controllers\Api;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request;
use App\Common\ReturnData;
use App\Common\Helper;

4
app/Http/Controllers/Weixin/WxPayController.php

@ -3,8 +3,8 @@
namespace App\Http\Controllers\Weixin;
use Illuminate\Http\Request;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class WxPayController extends BaseController
{

4
app/Http/Logic/CommentLogic.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Logic;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Http\Model\Comment;
use App\Http\Model\Order;

4
app/Http/Logic/OrderLogic.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Logic;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Http\Model\Order;
use App\Http\Requests\OrderRequest;

4
app/Http/Logic/UserLogic.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Logic;
use Log;
use DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Common\Token;
use App\Http\Model\User;

2
app/Http/Logic/UserMoneyLogic.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Logic;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Http\Model\UserMoney;
use App\Http\Requests\UserMoneyRequest;

2
app/Http/Logic/UserPointLogic.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Logic;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Http\Model\UserPoint;
use App\Http\Requests\UserPointRequest;

2
app/Http/Logic/UserWithdrawLogic.php

@ -1,6 +1,6 @@
<?php
namespace App\Http\Logic;
use DB;
use Illuminate\Support\Facades\DB;
use App\Common\ReturnData;
use App\Http\Model\UserMoney;
use App\Http\Model\UserWithdraw;

4
app/Http/Model/Access.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Access extends BaseModel
{

4
app/Http/Model/Ad.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Ad extends BaseModel
{

4
app/Http/Model/Admin.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Admin extends BaseModel
{

4
app/Http/Model/AdminRole.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class AdminRole extends BaseModel
{

4
app/Http/Model/Arctype.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Arctype extends BaseModel
{

4
app/Http/Model/Article.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Article extends BaseModel
{

4
app/Http/Model/BaseModel.php

@ -2,8 +2,8 @@
namespace App\Http\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Schema;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class BaseModel extends Model
{

4
app/Http/Model/Bonus.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Bonus extends BaseModel
{

4
app/Http/Model/Cart.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Cart extends BaseModel
{

4
app/Http/Model/CollectGoods.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class CollectGoods extends BaseModel
{

4
app/Http/Model/Comment.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Comment extends BaseModel
{

4
app/Http/Model/FeedBack.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class FeedBack extends BaseModel
{

4
app/Http/Model/Friendlink.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Friendlink extends BaseModel
{

4
app/Http/Model/Goods.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Goods extends BaseModel
{

4
app/Http/Model/GoodsBrand.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class GoodsBrand extends BaseModel
{

4
app/Http/Model/GoodsImg.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class GoodsImg extends BaseModel
{

4
app/Http/Model/GoodsSearchword.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class GoodsSearchword extends BaseModel
{

4
app/Http/Model/GoodsType.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class GoodsType extends BaseModel
{

4
app/Http/Model/Guestbook.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Guestbook extends BaseModel
{

4
app/Http/Model/Jobs.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Jobs extends BaseModel
{

4
app/Http/Model/Keyword.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Keyword extends BaseModel
{

4
app/Http/Model/Kuaidi.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Kuaidi extends BaseModel
{

2
app/Http/Model/Log.php

@ -2,7 +2,7 @@
namespace App\Http\Model;
use DB;
use Illuminate\Support\Facades\DB;
class Log extends BaseModel
{

4
app/Http/Model/Menu.php

@ -2,8 +2,8 @@
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Menu extends BaseModel
{

4
app/Http/Model/Order.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Order extends BaseModel
{

4
app/Http/Model/OrderGoods.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class OrderGoods extends BaseModel
{

4
app/Http/Model/Page.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Page extends BaseModel
{

4
app/Http/Model/Payment.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Payment extends BaseModel
{

4
app/Http/Model/Region.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Region extends BaseModel
{

4
app/Http/Model/Searchword.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Searchword extends BaseModel
{

4
app/Http/Model/Slide.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Slide extends BaseModel
{

4
app/Http/Model/SmsLog.php

@ -1,7 +1,7 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
//短信发送记录
class SmsLog extends BaseModel

5
app/Http/Model/Sysconfig.php

@ -1,7 +1,8 @@
<?php
namespace App\Http\Model;
use DB;
use Log;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class Sysconfig extends BaseModel
{

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save