|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
|
|
|
namespace App\Http\Controllers; |
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Cache; |
|
|
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; |
|
|
|
use Illuminate\Foundation\Bus\DispatchesJobs; |
|
|
|
use Illuminate\Foundation\Validation\ValidatesRequests; |
|
|
|
@ -11,7 +12,17 @@ class Controller extends BaseController |
|
|
|
{ |
|
|
|
use AuthorizesRequests, DispatchesJobs, ValidatesRequests; |
|
|
|
|
|
|
|
protected $user_id = 1; |
|
|
|
protected $user_id = 0; |
|
|
|
protected $agent_id = 0; //代理商ID
|
|
|
|
|
|
|
|
public function __construct() |
|
|
|
{ |
|
|
|
// TODO 登录部分待优化
|
|
|
|
$auth = request()->header('Authentication'); |
|
|
|
$appid = request()->header('appid'); |
|
|
|
$this->user_id = Cache::get($auth); |
|
|
|
$this->agent_id = Cache::get($appid); |
|
|
|
} |
|
|
|
|
|
|
|
protected function success($data = [], $msg = 'success', $code = 1, $status = 200): array |
|
|
|
{ |
|
|
|
@ -23,12 +34,12 @@ class Controller extends BaseController |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
protected function error($data = [], $msg = 'error', $code = -1, $status = 500): array |
|
|
|
protected function error($msg = 'error', $code = -1, $status = 500): array |
|
|
|
{ |
|
|
|
return [ |
|
|
|
'code' => $code, |
|
|
|
'msg' => $msg, |
|
|
|
'data' => $data, |
|
|
|
'data' => [], |
|
|
|
'status' => $status, |
|
|
|
]; |
|
|
|
} |
|
|
|
|