Преглед изворни кода

Merge branch 'Haozi' of ssh://was.baoshi56.com:10022/var/git/bswas

 Conflicts:
	app/User.php
	bootstrap/cache/packages.php
	composer.lock
LD пре 5 година
родитељ
комит
79ddd30962

+ 1 - 0
app/Http/Controllers/CustomerController.php

@@ -187,6 +187,7 @@ class CustomerController extends Controller
             "user_workgroup_id"     => request("user_workgroup_id"),
             "waring_line_on"        => request("waring_line_on"),
             "description"           => request("description"),
+            "subjection"           => request("subjection"),
         ]);
         $this->success($owner);
     }

+ 1 - 1
app/Http/Controllers/ProcurementController.php

@@ -174,7 +174,7 @@ class ProcurementController extends Controller
             $procurement=Procurement::query()->find($param['id']);
             $unit_price=$param['unit_price'];
             if (!$unit_price){
-                $priceCoefficient=Configuration::query()->where('name','priceCoefficient')->value('value');
+                $priceCoefficient=Configuration::query()->where('name','价格系数')->value('value');
                 $unit_price=$priceCoefficient*$param['offer'];
             }
             $procurement->update([

+ 15 - 0
app/Http/Controllers/TestController.php

@@ -121,6 +121,7 @@ use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Str;
 use Maatwebsite\Excel\Facades\Excel;
 use Mockery\Mock;
+use Overtrue\LaravelPinyin\Facades\Pinyin;
 use PhpMyAdmin\Server\Status\Data;
 use Ramsey\Collection\Collection;
 use Zttp\Zttp;
@@ -1672,4 +1673,18 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
             $orderService->syncOrder($item);
         }
     }
+
+    public function testUser()
+    {
+        $procurementQuotations=ProcurementQuotation::query()
+            ->with('procurement.ownerMaterial.material')
+            ->where('status',0)
+            ->whereNull('offer')
+            //->where('created_at','>=',Carbon::parse($now)->subHours(4))
+            //->where('created_at','<=',$now)
+            ->get();
+        dd($procurementQuotations->toJson());
+
+
+    }
 }

+ 40 - 72
app/Http/Controllers/api/procurement/wechat/AuthController.php

@@ -2,97 +2,65 @@
 
 namespace App\Http\Controllers\api\procurement\wechat;
 
-use App\UserDetail;
-use Illuminate\Support\Facades\Auth;
+use App\User;
+use Firebase\JWT\JWT;
 use App\Http\Controllers\Controller;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Facades\Hash;
 
 class AuthController extends Controller
 {
-    /**
-     * Create a new AuthController instance.
-     * 要求附带email和password(数据来源users表)
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        // 这里额外注意了:官方文档样例中只除外了『login』
-        // 这样的结果是,token 只能在有效期以内进行刷新,过期无法刷新
-        // 如果把 refresh 也放进去,token 即使过期但仍在刷新期以内也可刷新
-        // 不过刷新一次作废
-        $this->middleware('auth:api', ['except' => ['login']]);
-        // 另外关于上面的中间件,官方文档写的是『auth:api』
-        // 但是我推荐用 『jwt.auth』,效果是一样的,但是有更加丰富的报错信息返回
-    }
 
-    /**
-     * Get a JWT via given credentials.
-     *
-     * @return \Illuminate\Http\JsonResponse
-     */
     public function login()
     {
         $phone=request('phone');
-        $user_id=UserDetail::query()->where('mobile_phone',$phone)->value('user_id');
+        $password = request("password");
+        $user=User::query()->with('roles')
+            ->whereHas('userDetail',function ($query)use($phone){
+            /** @var Builder $query */
+            $query->where('mobile_phone',$phone);
+        })->whereHas('roles',function ($builder){
+                /** @var Builder $builder */
+            $builder->whereIn('name',['供应商','收货员']);
+            })
+            ->first();
+        if (!$user)return response()->json(['status'=>0,'message' => '当前用户不存在!'], 401);
+        if (!Hash::check($password,$user->password)) return response()->json(['status'=>0,'message' => '很抱歉,您的手机号和密码不匹配'], 401);
+
         $credentials = [
-            'id'=>$user_id,
-            'password'=>request('password')
+            'id'=>$user->id,
+            'name'=>$user->name,
         ];
-
-
-        if (! $token = auth('api')->attempt($credentials)) {
-            return response()->json(['error' => '很抱歉,您的手机号和密码不匹配'], 401);
+        $token = $this->getJWTToken($credentials);
+        $userType=0;
+        foreach ($user->roles as $role){
+            if ($role->name=='供应商')$userType=1;
+            if ($role->name=='收货员')$userType=2;
         }
-
-        return $this->respondWithToken($token);
+        return response()->json(['status'=>1,'message' => $userType,'data'=>$token], 200);
     }
 
-    /**
-     * Get the authenticated User.
-     *
-     * @return \Illuminate\Http\JsonResponse
-     */
     public function me()
     {
         return response()->json(auth('api')->user());
     }
 
-    /**
-     * Log the user out (Invalidate the token).
-     *
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function logout()
+    public function getJWTToken($value)
     {
-        auth('api')->logout();
-
-        return response()->json(['message' => 'Successfully logged out']);
-    }
-
-    /**
-     * Refresh a token.
-     * 刷新token,如果开启黑名单,以前的token便会失效。
-     * 值得注意的是用上面的getToken再获取一次Token并不算做刷新,两次获得的Token是并行的,即两个都可用。
-     * @return \Illuminate\Http\JsonResponse
-     */
-    public function refresh()
-    {
-        return $this->respondWithToken(auth('api')->refresh());
+        $time = time();
+        $payload = [
+            'iat' => $time,
+            'nbf' => $time,
+            'exp' => $time+7200,
+            'data' => [
+                'id' => $value['id'],
+                'name' => $value['name']
+            ]
+        ];
+        $key =  env('JWT_SECRET');
+        $alg = 'HS256';
+        $token = JWT::encode($payload,$key,$alg);
+        return $token;
     }
 
-    /**
-     * Get the token array structure.
-     *
-     * @param  string $token
-     *
-     * @return \Illuminate\Http\JsonResponse
-     */
-    protected function respondWithToken($token)
-    {
-        return response()->json([
-            'access_token' => $token,
-            'token_type' => 'bearer',
-            'expires_in' => auth('api')->factory()->getTTL() * 60
-        ]);
-    }
 }

+ 23 - 0
app/Http/Controllers/api/procurement/wechat/ProcurementController.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace App\Http\Controllers\api\procurement\wechat;
+
+use App\Http\Controllers\Controller;
+use App\ProcurementQuotation;
+use Carbon\Carbon;
+use Illuminate\Support\Facades\Auth;
+
+class ProcurementController extends Controller
+{
+    public function getQuotation(){
+        $now=Carbon::now()->toDateTimeString();
+        $procurementQuotations=ProcurementQuotation::query()
+            ->with('procurement.ownerMaterial.material')
+            ->where('status',0)
+            ->whereNull('offer')
+            //->where('created_at','>=',Carbon::parse($now)->subHours(4))
+            //->where('created_at','<=',$now)
+            ->get();
+        if (!empty($procurementQuotations))return response()->json(['status'=>1,'data'=>$procurementQuotations->toJson()], 200);
+    }
+}

+ 17 - 42
app/Http/Middleware/ProcurementApiAuth.php

@@ -3,54 +3,29 @@
 namespace App\Http\Middleware;
 
 use Closure;
-use Tymon\JWTAuth\Exceptions\JWTException;
-use Tymon\JWTAuth\Exceptions\TokenExpiredException;
-use Tymon\JWTAuth\Exceptions\TokenInvalidException;
-use Tymon\JWTAuth\Facades\JWTAuth;
+use Firebase\JWT\JWT;
 
 
 class ProcurementApiAuth
 {
-    /**
-     * Handle an incoming request.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \Closure  $next
-     * @return mixed
-     */
+
     public function handle($request, Closure $next)
     {
-        try {
-            if (! $user = JWTAuth::parseToken()->authenticate()) {
-                return response()->json([
-                    'code' => 1004,
-                    'msg' => '用户不存在'
-
-                ], 404);
-            }
-            return $next($request);
-
-        } catch (TokenExpiredException $e) {
-
-            return response()->json([
-                'code' => 1003,
-                'msg' => 'token 过期' ,
-            ]);
-
-        } catch (TokenInvalidException $e) {
-
-            return response()->json([
-                'code' => 1002,
-                'msg' => 'token 无效',
-            ]);
-
-        }catch (JWTException $e) {
-
-            return response()->json([
-                'code' => 1001,
-                'msg' => '缺少token' ,
-            ]);
-
+        $alg =
+            [
+                "typ" => "JWT", //声明类型为jwt
+                "alg" => "HS256" //声明签名算法为SHA256
+            ];
+        $jwt = $request->header('token');
+
+        $key = env('JWT_SECRET');
+        try{
+            JWT::decode($jwt,$key,$alg);
+        }
+        catch (\Exception $e)
+        {
+            return response()->json('token无效:'.$e);
         }
+        return $next($request);
     }
 }

+ 7 - 1
app/Owner.php

@@ -31,7 +31,13 @@ class Owner extends Model
         "waring_line_on",       //月单量预警
         "description",          //描述
         "warehouse_id",         //仓库ID
-        "user_workgroup_id"     //仓库小组(工作组)
+        "user_workgroup_id",     //仓库小组(工作组)
+        'subjection'             //主体公司
+    ];
+    const subjection=[
+        0=>'',
+        1 => "宝时物流",
+        2 => "宝时供应链",
     ];
 
     public static function filterAuthorities(){

+ 33 - 0
app/ProcurementQuotation.php

@@ -3,9 +3,12 @@
 namespace App;
 
 use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Database\Eloquent\Model;
 
 use App\Traits\ModelLogChanging;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
 
 class ProcurementQuotation extends Model
 {
@@ -16,7 +19,37 @@ class ProcurementQuotation extends Model
         'procurement_id','offer', 'operator', 'quoted_at','status','created_at','supplier_id'
     ];
 
+    const status=[
+        0 => "待报价",
+        1 => "待审核",
+        2 => "待接单",
+        3 => "已失效",
+        4 => "生成中",
+        5 => "待收货",
+        6 => "待确定",
+        7 => "待出账",
+        8 => "已出账",
+        9 => "完结",
+    ];
     public  function supplier(){
         return $this->hasOne('App\Supplier','id','supplier_id');
     }
+    public function procurement(){
+        return $this->belongsTo('App\Procurement','procurement_id','id');
+    }
+
+    protected static function booted()
+    {
+        /** @var User $user */
+        $user = Auth::user();
+        if ($user && !$user->isSuperAdmin()) {
+            /** @var \stdClass $user */
+            $ids = array_column(DB::select(DB::raw("SELECT supplier_id FROM supplier_user WHERE user_id = ?"),[$user->id]),"supplier_id");
+            if (count($ids)>0){
+                static::addGlobalScope('supplier', function (Builder $builder)use ($ids) {
+                    $builder->whereIn('supplier_id',  $ids);
+                });
+            }
+        }
+    }
 }

+ 3 - 2
app/Services/ProcurementService.php

@@ -14,6 +14,7 @@ class ProcurementService
 {
     use ServiceAppAop;
 
+    //选中最低报价
     public function screenLowestQuotation($procurement_id){
         if (!$procurement_id) return null;
         $procurementQuotation=ProcurementQuotation::query()->with('supplier')
@@ -27,11 +28,11 @@ class ProcurementService
         if (!empty($procurement->ownerMaterial->material->supplier))$suppliers=$procurement->ownerMaterial->material->supplier;
         foreach ($suppliers as $supplier){
             $procurementQuotation= new ProcurementQuotation([
-                'procurement_id'=>10,
+                'procurement_id'=>$procurement_id,
                 'supplier_id'=>$supplier->id,
             ]);
             $procurementQuotation->save();
-            //TODO 添加广播推送给指定供应商
+            //TODO 推送给指定耗材类型供应商
         }
     }
 }

+ 45 - 15
app/Services/RejectedBillService.php

@@ -9,6 +9,7 @@ use App\Order;
 use App\OrderIssue;
 use App\OrderIssueRejectedBill;
 use App\OrderPackage;
+use App\Owner;
 use App\RejectedBill;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
@@ -17,6 +18,7 @@ use Carbon\Carbon;
 use App\Traits\ServiceAppAop;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Query\Builder;
+use Overtrue\LaravelPinyin\Facades\Pinyin;
 use function Symfony\Component\String\s;
 
 
@@ -83,24 +85,25 @@ class RejectedBillService
         $rejectedBills = $this->getRejectedBills($logisticNumberReturn);
         if (!$rejectedBills) return null;
         $updateParams = [[
-            'id','logistic_number_return', 'is_loaded', 'updated_at'
+            'id', 'is_loaded', 'updated_at'
         ]];
         $updated_at = Carbon::now()->toDateTimeString();
         /** @var DataHandlerService $dataHandlerService */
         $dataHandlerService = app(DataHandlerService::class);
         $rejectedBills_map = $dataHandlerService->dataHeader(['logistic_number_return'], $rejectedBills);
         foreach ($updateCollect as $data) {
-            if (!$data->asnreference3 && !$data->notes) {
-                continue;
-            }
+            if (!$data->asnreference3 && !$data->notes) continue;
             if ($data->asnreference3) {
-                $rejectedBill = $dataHandlerService->getKeyValue(['logistic_number_return' => $data->asnreference3], $rejectedBills_map);
+                $param=[];
+                preg_match("/[a-zA-Z]{0,5}\d{6,20}/", $data->asnreference3, $param);
+                if (count($param)<1) continue;
+                $rejectedBill = $dataHandlerService->getKeyValue(['logistic_number_return' => $param[0]], $rejectedBills_map);
                 if ($rejectedBill && $rejectedBill->is_loaded != 1) $updateParams[] = [
                     'id'=>$rejectedBill->id,
-                    'logistic_number_return' => $data->asnreference3,
                     'is_loaded' => 1,
                     'updated_at' => $updated_at,
                 ];
+                unset( $param);
             } else {
                 $result = [];
                 preg_match("/[a-zA-Z]{0,5}\d{6,20}/", $data->notes, $result);
@@ -108,10 +111,22 @@ class RejectedBillService
                 $rejectedBill = $dataHandlerService->getKeyValue(['logistic_number_return' => $result[0]], $rejectedBills_map);
                 if ($rejectedBill && $rejectedBill->is_loaded != 1) $updateParams[] = [
                     'id'=>$rejectedBill->id,
-                    'logistic_number_return' => $result[0],
                     'is_loaded' => 1,
                     'updated_at' => $updated_at,
                 ];
+                if (!$rejectedBill){
+                    $checkedNumber=$this->screenCheckNumber($data->customerid,$data->notes);
+                    if (!$checkedNumber)continue;
+                    $rejects=RejectedBill::query()->where('checked_numbers',$checkedNumber)->get();
+                   foreach ($rejects as $reject){
+                       $updateParams[] = [
+                           'id'=>$reject->id,
+                           'is_loaded' => 1,
+                           'updated_at' => $updated_at,
+                       ];
+                   }
+                }
+
                unset($result);
             }
         }
@@ -134,11 +149,12 @@ class RejectedBillService
     {
         $logisticNumberReturn = [];
         foreach ($updateCollect as $data) {
-            if (!$data->asnreference3 && !$data->notes) {
-                continue;
-            }
+            if (!$data->asnreference3 && !$data->notes) continue;
             if ($data->asnreference3) {
-                array_push($logisticNumberReturn, $data->asnreference3);
+                $param=[];
+                preg_match("/[a-zA-Z]{0,5}\d{6,20}/", $data->asnreference3, $param);
+                if (count($param) > 0) array_push($logisticNumberReturn, $param[0]);
+                unset($param);
             } else {
                 $result = [];
                 preg_match("/[a-zA-Z]{0,5}\d{6,20}/", $data->notes, $result);
@@ -167,7 +183,7 @@ class RejectedBillService
         $rejectedBills = $this->getRejectedBills($logisticNumberReturn);
         if (!$rejectedBills) return null;
         $updateParams = [[
-            'id','logistic_number_return', 'is_checked','checked_numbers','updated_at'
+            'id', 'is_checked','checked_numbers','updated_at'
         ]];
         $updated_at = Carbon::now()->toDateTimeString();
         /** @var DataHandlerService $dataHandlerService */
@@ -176,14 +192,17 @@ class RejectedBillService
         foreach ($asnHerders as $data) {
             if (!$data->asnreference3 && !$data->notes) continue;
             if ($data->asnreference3) {
-                $rejectedBill = $dataHandlerService->getKeyValue(['logistic_number_return' => $data->asnreference3], $rejectedBills_map);
+                $param=[];
+                preg_match("/[a-zA-Z]{0,5}\d{6,20}/", $data->asnreference3, $param);
+                if (count($param)<1) continue;
+                $rejectedBill = $dataHandlerService->getKeyValue(['logistic_number_return' => $param[0]], $rejectedBills_map);
                 if ($rejectedBill && $rejectedBill->is_checked != 1) $updateParams[] = [
                     'id'=>$rejectedBill->id,
-                    'logistic_number_return' => $data->asnreference3,
                     'is_checked' => 1,
                     'checked_numbers' => $rejectedBill->makeCheckedNumbers(),
                     'updated_at' => $updated_at,
                 ];
+                unset($param);
             } else {
                 $result = [];
                 preg_match("/[a-zA-Z]{0,5}\d{6,20}/", $data->notes, $result);
@@ -192,7 +211,6 @@ class RejectedBillService
                 if ($rejectedBill && $rejectedBill->is_checked != 1)
                     $updateParams[] = [
                         'id'=>$rejectedBill->id,
-                        'logistic_number_return' => $result[0],
                         'is_checked' => 1,
                         'checked_numbers' => $rejectedBill->makeCheckedNumbers(),
                         'updated_at' => $updated_at,
@@ -221,6 +239,18 @@ class RejectedBillService
         }
         return null;
     }
+    public function screenCheckNumber($ownerCode,$note){
+        $ownerName=Owner::query()->where('code',$ownerCode)->value('name');
+        $result = [];
+        $pinyinOwnerName=Pinyin::convert($ownerName);
+        $pinyinArr=array_map(function($pinyin){
+            return $pinyin[0];
+        },$pinyinOwnerName);
+        $initials=implode("", $pinyinArr);
+        preg_match("/$initials{0,5}\d{6,20}/", $note, $result);
+        if (count($result)<1) return null;
+        return $result[0];
+    }
 
     /**
      * @param string $logisticNumber

+ 4 - 9
app/Services/StoreService.php

@@ -11,6 +11,7 @@ use App\Services\common\QueryService;
 use App\Store;
 use App\StoreRejected;
 use App\ValueStore;
+use App\Warehouse;
 use Carbon\Carbon;
 use Illuminate\Support\Facades\Cache;
 
@@ -95,12 +96,8 @@ class StoreService
     public function createStore($asnHerders)
     {
         if (!$asnHerders) return null;
-        /**
-         * @var OwnerService $ownerService
-         * @var WarehouseService $wareHouseService
-         */
+        /** @var OwnerService $ownerService */
         $ownerService = app(OwnerService::class);
-        $wareHouseService = app(WarehouseService::class);
         $owner_codes = [];
         $warehouse_codes = [];
         foreach ($asnHerders as $asnHerder) {
@@ -110,7 +107,7 @@ class StoreService
                 $warehouse_codes[$asnHerder['warehouseid']] = $asnHerder['warehouseid'];
         }
         $owners = $ownerService->getOwnerByCodes($owner_codes);
-        $warehouses = $wareHouseService->getWareHouseByCodes($warehouse_codes);
+        $warehouses = Warehouse::query()->get();
         $owners_code_map=[];
         foreach ($owners as $owner) {
             $owners_code_map[$owner->code] = $owner;
@@ -181,15 +178,13 @@ class StoreService
         /**
          * @var DataHandlerService $dataHandlerService
          * @var OwnerService $ownerService
-         * @var WarehouseService $wareHouseService
          */
         $ownerService = app(OwnerService::class);
-        $wareHouseService = app(WarehouseService::class);
         $dataHandlerService = app(DataHandlerService::class);
         $stores = $this->getByWms($asnHerders);
         $store_asn_code_map = $dataHandlerService->dataHeader(['asn_code'], $stores);
         $owners = $ownerService->getOwnerByCodes(array_unique(data_get($asnHerders,'*.customerid')));
-        $warehouses = $wareHouseService->getWareHouseByCodes(array_unique(data_get($asnHerders,'*.warehouseid')));
+        $warehouses = Warehouse::query()->get();
         $owner_code_map = $dataHandlerService->dataHeader(['code'], $owners);
         $warehouses_map = $dataHandlerService->dataHeader(['code'], $warehouses);
         $updateParams = [[

+ 1 - 1
app/Services/WarehouseService.php

@@ -91,7 +91,7 @@ Class WarehouseService
         return Cache::remember("WareHouse_{$code}",config('cache.expirations.warehouse'),function()use($code){
             $wareHouse =  Warehouse::query()->where('code',$code)->first();
             if($wareHouse)return $wareHouse;
-            return Warehouse::query()->create(['name'=>$code,'code'=>$code]);
+            return null;
         });
     }
 }

+ 3 - 13
app/User.php

@@ -9,9 +9,7 @@ use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
 use App\Traits\ModelTimeFormat;
-use Tymon\JWTAuth\Contracts\JWTSubject;
 
-//class User extends Authenticatable implements JWTSubject
 class User extends Authenticatable
 {
     use ModelLogChanging;
@@ -82,6 +80,9 @@ class User extends Authenticatable
     function roles(){
         return $this->belongsToMany('App\Role','user_role','id_user','id_role');
     }
+    function userDetail(){
+        return $this->hasOne('App\UserDetail','user_id','id');
+    }
 
     function logistics(){
         return $this->belongsToMany('App\Logistic','logistic_user','user_id','logistic_id');
@@ -133,15 +134,4 @@ class User extends Authenticatable
         }
         return $workgroupIds;
     }
-
-//    //jwt
-//    public function getJWTIdentifier()
-//    {
-//        return $this->getKey();
-//    }
-//
-//    public function getJWTCustomClaims()
-//    {
-//        return [];
-//    }
 }

+ 32 - 44
bootstrap/cache/packages.php

@@ -1,125 +1,113 @@
 <?php return array (
-  'barryvdh/laravel-debugbar' => 
+  'barryvdh/laravel-debugbar' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Barryvdh\\Debugbar\\ServiceProvider',
     ),
-    'aliases' => 
+    'aliases' =>
     array (
       'Debugbar' => 'Barryvdh\\Debugbar\\Facade',
     ),
   ),
-  'beyondcode/laravel-dump-server' => 
+  'beyondcode/laravel-dump-server' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'BeyondCode\\DumpServer\\DumpServerServiceProvider',
     ),
   ),
-  'facade/ignition' => 
+  'facade/ignition' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Facade\\Ignition\\IgnitionServiceProvider',
     ),
-    'aliases' => 
+    'aliases' =>
     array (
       'Flare' => 'Facade\\Ignition\\Facades\\Flare',
     ),
   ),
-  'fideloper/proxy' => 
+  'fideloper/proxy' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Fideloper\\Proxy\\TrustedProxyServiceProvider',
     ),
   ),
-  'intervention/image' => 
+  'intervention/image' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Intervention\\Image\\ImageServiceProvider',
     ),
-    'aliases' => 
+    'aliases' =>
     array (
       'Image' => 'Intervention\\Image\\Facades\\Image',
     ),
   ),
-  'laravel/tinker' => 
+  'laravel/tinker' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Laravel\\Tinker\\TinkerServiceProvider',
     ),
   ),
-  'laravel/ui' => 
+  'laravel/ui' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Laravel\\Ui\\UiServiceProvider',
     ),
   ),
-  'maatwebsite/excel' => 
+  'maatwebsite/excel' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Maatwebsite\\Excel\\ExcelServiceProvider',
     ),
-    'aliases' => 
+    'aliases' =>
     array (
       'Excel' => 'Maatwebsite\\Excel\\Facades\\Excel',
     ),
   ),
-  'nesbot/carbon' => 
+  'nesbot/carbon' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Carbon\\Laravel\\ServiceProvider',
     ),
   ),
-  'nunomaduro/collision' => 
+  'nunomaduro/collision' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
     ),
   ),
-  'overtrue/laravel-pinyin' => 
+  'overtrue/laravel-pinyin' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Overtrue\\LaravelPinyin\\ServiceProvider',
     ),
-    'aliases' => 
+    'aliases' =>
     array (
       'Pinyin' => 'Overtrue\\LaravelPinyin\\Facades\\Pinyin',
     ),
   ),
-  'te7a-houdini/laravel-trix' => 
+  'te7a-houdini/laravel-trix' =>
   array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Te7aHoudini\\LaravelTrix\\LaravelTrixServiceProvider',
     ),
   ),
-  'tymon/jwt-auth' => 
+  'yajra/laravel-oci8' =>
   array (
-    'aliases' => 
-    array (
-      'JWTAuth' => 'Tymon\\JWTAuth\\Facades\\JWTAuth',
-      'JWTFactory' => 'Tymon\\JWTAuth\\Facades\\JWTFactory',
-    ),
-    'providers' => 
-    array (
-      0 => 'Tymon\\JWTAuth\\Providers\\LaravelServiceProvider',
-    ),
-  ),
-  'yajra/laravel-oci8' => 
-  array (
-    'providers' => 
+    'providers' =>
     array (
       0 => 'Yajra\\Oci8\\Oci8ServiceProvider',
     ),
   ),
-);
+);

+ 12 - 14
bootstrap/cache/services.php

@@ -35,13 +35,12 @@
     31 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
     32 => 'Overtrue\\LaravelPinyin\\ServiceProvider',
     33 => 'Te7aHoudini\\LaravelTrix\\LaravelTrixServiceProvider',
-    34 => 'Tymon\\JWTAuth\\Providers\\LaravelServiceProvider',
-    35 => 'Yajra\\Oci8\\Oci8ServiceProvider',
-    36 => 'App\\Providers\\AppServiceProvider',
-    37 => 'App\\Providers\\AuthServiceProvider',
-    38 => 'App\\Providers\\BroadcastServiceProvider',
-    39 => 'App\\Providers\\EventServiceProvider',
-    40 => 'App\\Providers\\RouteServiceProvider',
+    34 => 'Yajra\\Oci8\\Oci8ServiceProvider',
+    35 => 'App\\Providers\\AppServiceProvider',
+    36 => 'App\\Providers\\AuthServiceProvider',
+    37 => 'App\\Providers\\BroadcastServiceProvider',
+    38 => 'App\\Providers\\EventServiceProvider',
+    39 => 'App\\Providers\\RouteServiceProvider',
   ),
   'eager' => 
   array (
@@ -66,13 +65,12 @@
     18 => 'NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider',
     19 => 'Overtrue\\LaravelPinyin\\ServiceProvider',
     20 => 'Te7aHoudini\\LaravelTrix\\LaravelTrixServiceProvider',
-    21 => 'Tymon\\JWTAuth\\Providers\\LaravelServiceProvider',
-    22 => 'Yajra\\Oci8\\Oci8ServiceProvider',
-    23 => 'App\\Providers\\AppServiceProvider',
-    24 => 'App\\Providers\\AuthServiceProvider',
-    25 => 'App\\Providers\\BroadcastServiceProvider',
-    26 => 'App\\Providers\\EventServiceProvider',
-    27 => 'App\\Providers\\RouteServiceProvider',
+    21 => 'Yajra\\Oci8\\Oci8ServiceProvider',
+    22 => 'App\\Providers\\AppServiceProvider',
+    23 => 'App\\Providers\\AuthServiceProvider',
+    24 => 'App\\Providers\\BroadcastServiceProvider',
+    25 => 'App\\Providers\\EventServiceProvider',
+    26 => 'App\\Providers\\RouteServiceProvider',
   ),
   'deferred' => 
   array (

+ 4 - 4
composer.json

@@ -8,7 +8,8 @@
     ],
     "license": "MIT",
     "require": {
-        "php": "^7.2.34",
+        "php": "^7.2.14",
+        "ext-bcmath": "*",
         "ext-json": "*",
         "ext-mbstring": "*",
         "ext-openssl": "*",
@@ -17,6 +18,7 @@
         "endroid/qr-code": "^3.7",
         "facade/ignition": "^2.0",
         "fideloper/proxy": "^4.0",
+        "firebase/php-jwt": "^5.2",
         "intervention/image": "^2.5",
         "kitetail/zttp": "^0.6.0",
         "laravel/framework": "7.*",
@@ -28,9 +30,7 @@
         "predis/predis": "^1.1",
         "pusher/pusher-php-server": "^4.1",
         "te7a-houdini/laravel-trix": "^2.0",
-        "tymon/jwt-auth": "1.*@rc",
-        "yajra/laravel-oci8": "7.0",
-        "ext-bcmath": "*"
+        "yajra/laravel-oci8": "7.0"
     },
     "require-dev": {
         "barryvdh/laravel-debugbar": "^3.2",

+ 77 - 331
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "bd899d37c9f0c3f51a186b6ede5d96d4",
+    "content-hash": "41e668d9b377a739ea97d87f19647ce8",
     "packages": [
         {
             "name": "bacon/bacon-qr-code",
@@ -1372,6 +1372,66 @@
             ],
             "time": "2021-01-24T12:00:00+00:00"
         },
+        {
+            "name": "firebase/php-jwt",
+            "version": "v5.2.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/firebase/php-jwt.git",
+                "reference": "f42c9110abe98dd6cfe9053c49bc86acc70b2d23"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f42c9110abe98dd6cfe9053c49bc86acc70b2d23",
+                "reference": "f42c9110abe98dd6cfe9053c49bc86acc70b2d23",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "require-dev": {
+                "phpunit/phpunit": ">=4.8 <=9"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "Firebase\\JWT\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Neuman Vong",
+                    "email": "neuman+pear@twilio.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Anant Narayanan",
+                    "email": "anant@php.net",
+                    "role": "Developer"
+                }
+            ],
+            "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.",
+            "homepage": "https://github.com/firebase/php-jwt",
+            "keywords": [
+                "jwt",
+                "php"
+            ],
+            "support": {
+                "issues": "https://github.com/firebase/php-jwt/issues",
+                "source": "https://github.com/firebase/php-jwt/tree/v5.2.1"
+            },
+            "time": "2021-02-12T00:02:00+00:00"
+        },
         {
             "name": "guzzlehttp/guzzle",
             "version": "6.5.5",
@@ -1957,16 +2017,16 @@
         },
         {
             "name": "laravel/tinker",
-            "version": "v2.6.0",
+            "version": "v2.6.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/laravel/tinker.git",
-                "reference": "daae1c43f1300fe88c05d83db6f3d8f76677ad88"
+                "reference": "04ad32c1a3328081097a181875733fa51f402083"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/laravel/tinker/zipball/daae1c43f1300fe88c05d83db6f3d8f76677ad88",
-                "reference": "daae1c43f1300fe88c05d83db6f3d8f76677ad88",
+                "url": "https://api.github.com/repos/laravel/tinker/zipball/04ad32c1a3328081097a181875733fa51f402083",
+                "reference": "04ad32c1a3328081097a181875733fa51f402083",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -2025,9 +2085,9 @@
             ],
             "support": {
                 "issues": "https://github.com/laravel/tinker/issues",
-                "source": "https://github.com/laravel/tinker/tree/v2.6.0"
+                "source": "https://github.com/laravel/tinker/tree/v2.6.1"
             },
-            "time": "2021-01-26T20:35:18+00:00"
+            "time": "2021-03-02T16:53:12+00:00"
         },
         {
             "name": "laravel/ui",
@@ -2090,81 +2150,6 @@
             },
             "time": "2020-11-03T19:45:19+00:00"
         },
-        {
-            "name": "lcobucci/jwt",
-            "version": "3.3.3",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/lcobucci/jwt.git",
-                "reference": "c1123697f6a2ec29162b82f170dd4a491f524773"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/lcobucci/jwt/zipball/c1123697f6a2ec29162b82f170dd4a491f524773",
-                "reference": "c1123697f6a2ec29162b82f170dd4a491f524773",
-                "shasum": "",
-                "mirrors": [
-                    {
-                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
-                        "preferred": true
-                    }
-                ]
-            },
-            "require": {
-                "ext-mbstring": "*",
-                "ext-openssl": "*",
-                "php": "^5.6 || ^7.0"
-            },
-            "require-dev": {
-                "mikey179/vfsstream": "~1.5",
-                "phpmd/phpmd": "~2.2",
-                "phpunit/php-invoker": "~1.1",
-                "phpunit/phpunit": "^5.7 || ^7.3",
-                "squizlabs/php_codesniffer": "~2.3"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "3.1-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Lcobucci\\JWT\\": "src"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "BSD-3-Clause"
-            ],
-            "authors": [
-                {
-                    "name": "Luís Otávio Cobucci Oblonczyk",
-                    "email": "lcobucci@gmail.com",
-                    "role": "Developer"
-                }
-            ],
-            "description": "A simple library to work with JSON Web Token and JSON Web Signature",
-            "keywords": [
-                "JWS",
-                "jwt"
-            ],
-            "support": {
-                "issues": "https://github.com/lcobucci/jwt/issues",
-                "source": "https://github.com/lcobucci/jwt/tree/3.3.3"
-            },
-            "funding": [
-                {
-                    "url": "https://github.com/lcobucci",
-                    "type": "github"
-                },
-                {
-                    "url": "https://www.patreon.com/lcobucci",
-                    "type": "patreon"
-                }
-            ],
-            "time": "2020-08-20T13:22:28+00:00"
-        },
         {
             "name": "league/commonmark",
             "version": "1.5.7",
@@ -2949,79 +2934,6 @@
             ],
             "time": "2021-02-15T16:11:48+00:00"
         },
-        {
-            "name": "namshi/jose",
-            "version": "7.2.3",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/namshi/jose.git",
-                "reference": "89a24d7eb3040e285dd5925fcad992378b82bcff"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/namshi/jose/zipball/89a24d7eb3040e285dd5925fcad992378b82bcff",
-                "reference": "89a24d7eb3040e285dd5925fcad992378b82bcff",
-                "shasum": "",
-                "mirrors": [
-                    {
-                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
-                        "preferred": true
-                    }
-                ]
-            },
-            "require": {
-                "ext-date": "*",
-                "ext-hash": "*",
-                "ext-json": "*",
-                "ext-pcre": "*",
-                "ext-spl": "*",
-                "php": ">=5.5",
-                "symfony/polyfill-php56": "^1.0"
-            },
-            "require-dev": {
-                "phpseclib/phpseclib": "^2.0",
-                "phpunit/phpunit": "^4.5|^5.0",
-                "satooshi/php-coveralls": "^1.0"
-            },
-            "suggest": {
-                "ext-openssl": "Allows to use OpenSSL as crypto engine.",
-                "phpseclib/phpseclib": "Allows to use Phpseclib as crypto engine, use version ^2.0."
-            },
-            "type": "library",
-            "autoload": {
-                "psr-4": {
-                    "Namshi\\JOSE\\": "src/Namshi/JOSE/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Alessandro Nadalin",
-                    "email": "alessandro.nadalin@gmail.com"
-                },
-                {
-                    "name": "Alessandro Cinelli (cirpo)",
-                    "email": "alessandro.cinelli@gmail.com"
-                }
-            ],
-            "description": "JSON Object Signing and Encryption library for PHP.",
-            "keywords": [
-                "JSON Web Signature",
-                "JSON Web Token",
-                "JWS",
-                "json",
-                "jwt",
-                "token"
-            ],
-            "support": {
-                "issues": "https://github.com/namshi/jose/issues",
-                "source": "https://github.com/namshi/jose/tree/master"
-            },
-            "time": "2016-12-05T07:27:31+00:00"
-        },
         {
             "name": "nesbot/carbon",
             "version": "2.45.1",
@@ -3548,16 +3460,16 @@
         },
         {
             "name": "phpoffice/phpspreadsheet",
-            "version": "1.16.0",
+            "version": "1.17.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/PHPOffice/PhpSpreadsheet.git",
-                "reference": "76d4323b85129d0c368149c831a07a3e258b2b50"
+                "reference": "c55269cb06911575a126dc225a05c0e4626e5fb4"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/76d4323b85129d0c368149c831a07a3e258b2b50",
-                "reference": "76d4323b85129d0c368149c831a07a3e258b2b50",
+                "url": "https://api.github.com/repos/PHPOffice/PhpSpreadsheet/zipball/c55269cb06911575a126dc225a05c0e4626e5fb4",
+                "reference": "c55269cb06911575a126dc225a05c0e4626e5fb4",
                 "shasum": "",
                 "mirrors": [
                     {
@@ -3591,7 +3503,7 @@
             },
             "require-dev": {
                 "dompdf/dompdf": "^0.8.5",
-                "friendsofphp/php-cs-fixer": "^2.16",
+                "friendsofphp/php-cs-fixer": "^2.18",
                 "jpgraph/jpgraph": "^4.0",
                 "mpdf/mpdf": "^8.0",
                 "phpcompatibility/php-compatibility": "^9.3",
@@ -3649,9 +3561,9 @@
             ],
             "support": {
                 "issues": "https://github.com/PHPOffice/PhpSpreadsheet/issues",
-                "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.16.0"
+                "source": "https://github.com/PHPOffice/PhpSpreadsheet/tree/1.17.1"
             },
-            "time": "2020-12-31T18:03:49+00:00"
+            "time": "2021-03-02T17:54:11+00:00"
         },
         {
             "name": "phpoption/phpoption",
@@ -6214,80 +6126,6 @@
             ],
             "time": "2021-01-22T09:19:47+00:00"
         },
-        {
-            "name": "symfony/polyfill-php56",
-            "version": "v1.20.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/polyfill-php56.git",
-                "reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675",
-                "reference": "54b8cd7e6c1643d78d011f3be89f3ef1f9f4c675",
-                "shasum": "",
-                "mirrors": [
-                    {
-                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
-                        "preferred": true
-                    }
-                ]
-            },
-            "require": {
-                "php": ">=7.1"
-            },
-            "type": "metapackage",
-            "extra": {
-                "branch-alias": {
-                    "dev-main": "1.20-dev"
-                },
-                "thanks": {
-                    "name": "symfony/polyfill",
-                    "url": "https://github.com/symfony/polyfill"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Nicolas Grekas",
-                    "email": "p@tchwork.com"
-                },
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions",
-            "homepage": "https://symfony.com",
-            "keywords": [
-                "compatibility",
-                "polyfill",
-                "portable",
-                "shim"
-            ],
-            "support": {
-                "source": "https://github.com/symfony/polyfill-php56/tree/v1.20.0"
-            },
-            "funding": [
-                {
-                    "url": "https://symfony.com/sponsor",
-                    "type": "custom"
-                },
-                {
-                    "url": "https://github.com/fabpot",
-                    "type": "github"
-                },
-                {
-                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
-                    "type": "tidelift"
-                }
-            ],
-            "time": "2020-10-23T14:02:19+00:00"
-        },
         {
             "name": "symfony/polyfill-php72",
             "version": "v1.22.1",
@@ -7524,96 +7362,6 @@
             },
             "time": "2020-07-13T06:12:54+00:00"
         },
-        {
-            "name": "tymon/jwt-auth",
-            "version": "1.0.2",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/tymondesigns/jwt-auth.git",
-                "reference": "e588cb719539366c0e2f6017f975379cb73e9680"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/tymondesigns/jwt-auth/zipball/e588cb719539366c0e2f6017f975379cb73e9680",
-                "reference": "e588cb719539366c0e2f6017f975379cb73e9680",
-                "shasum": "",
-                "mirrors": [
-                    {
-                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
-                        "preferred": true
-                    }
-                ]
-            },
-            "require": {
-                "illuminate/auth": "^5.2|^6|^7|^8",
-                "illuminate/contracts": "^5.2|^6|^7|^8",
-                "illuminate/http": "^5.2|^6|^7|^8",
-                "illuminate/support": "^5.2|^6|^7|^8",
-                "lcobucci/jwt": "<3.4",
-                "namshi/jose": "^7.0",
-                "nesbot/carbon": "^1.0|^2.0",
-                "php": "^5.5.9|^7.0"
-            },
-            "require-dev": {
-                "illuminate/console": "^5.2|^6|^7|^8",
-                "illuminate/database": "^5.2|^6|^7|^8",
-                "illuminate/routing": "^5.2|^6|^7|^8",
-                "mockery/mockery": ">=0.9.9",
-                "phpunit/phpunit": "~4.8|~6.0"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-develop": "1.0-dev"
-                },
-                "laravel": {
-                    "aliases": {
-                        "JWTAuth": "Tymon\\JWTAuth\\Facades\\JWTAuth",
-                        "JWTFactory": "Tymon\\JWTAuth\\Facades\\JWTFactory"
-                    },
-                    "providers": [
-                        "Tymon\\JWTAuth\\Providers\\LaravelServiceProvider"
-                    ]
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Tymon\\JWTAuth\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Sean Tymon",
-                    "email": "tymon148@gmail.com",
-                    "homepage": "https://tymon.xyz",
-                    "role": "Developer"
-                }
-            ],
-            "description": "JSON Web Token Authentication for Laravel and Lumen",
-            "homepage": "https://github.com/tymondesigns/jwt-auth",
-            "keywords": [
-                "Authentication",
-                "JSON Web Token",
-                "auth",
-                "jwt",
-                "laravel"
-            ],
-            "support": {
-                "issues": "https://github.com/tymondesigns/jwt-auth/issues",
-                "source": "https://github.com/tymondesigns/jwt-auth"
-            },
-            "funding": [
-                {
-                    "url": "https://www.patreon.com/seantymon",
-                    "type": "patreon"
-                }
-            ],
-            "time": "2020-11-27T12:32:42+00:00"
-        },
         {
             "name": "vlucas/phpdotenv",
             "version": "v4.2.0",
@@ -10370,18 +10118,16 @@
     ],
     "aliases": [],
     "minimum-stability": "dev",
-    "stability-flags": {
-        "tymon/jwt-auth": 5
-    },
+    "stability-flags": [],
     "prefer-stable": true,
     "prefer-lowest": false,
     "platform": {
         "php": "^7.2.34",
+        "ext-bcmath": "*",
         "ext-json": "*",
         "ext-mbstring": "*",
         "ext-openssl": "*",
-        "ext-pdo": "*",
-        "ext-bcmath": "*"
+        "ext-pdo": "*"
     },
     "platform-dev": [],
     "plugin-api-version": "2.0.0"

+ 0 - 2
config/app.php

@@ -224,8 +224,6 @@ return [
         'URL' => Illuminate\Support\Facades\URL::class,
         'Validator' => Illuminate\Support\Facades\Validator::class,
         'View' => Illuminate\Support\Facades\View::class,
-        'JWTAuth' => 'Tymon\JWTAuth\Facades\JWTAuth',
-        'JWTFactory' => 'Tymon\JWTAuth\Facades\JWTFactory',
     ],
 
 ];

+ 1 - 2
config/auth.php

@@ -42,8 +42,7 @@ return [
         ],
 
         'api' => [
-//            'driver' => 'token',
-            'driver' => 'jwt',
+            'driver' => 'token',
             'provider' => 'users',
             'hash' => false,
         ],

+ 0 - 304
config/jwt.php

@@ -1,304 +0,0 @@
-<?php
-
-/*
- * This file is part of jwt-auth.
- *
- * (c) Sean Tymon <tymon148@gmail.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-return [
-
-    /*
-    |--------------------------------------------------------------------------
-    | JWT Authentication Secret
-    |--------------------------------------------------------------------------
-    |
-    | Don't forget to set this in your .env file, as it will be used to sign
-    | your tokens. A helper command is provided for this:
-    | `php artisan jwt:secret`
-    |
-    | Note: This will be used for Symmetric algorithms only (HMAC),
-    | since RSA and ECDSA use a private/public key combo (See below).
-    |
-    */
-
-    'secret' => env('JWT_SECRET'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | JWT Authentication Keys
-    |--------------------------------------------------------------------------
-    |
-    | The algorithm you are using, will determine whether your tokens are
-    | signed with a random string (defined in `JWT_SECRET`) or using the
-    | following public & private keys.
-    |
-    | Symmetric Algorithms:
-    | HS256, HS384 & HS512 will use `JWT_SECRET`.
-    |
-    | Asymmetric Algorithms:
-    | RS256, RS384 & RS512 / ES256, ES384 & ES512 will use the keys below.
-    |
-    */
-
-    'keys' => [
-
-        /*
-        |--------------------------------------------------------------------------
-        | Public Key
-        |--------------------------------------------------------------------------
-        |
-        | A path or resource to your public key.
-        |
-        | E.g. 'file://path/to/public/key'
-        |
-        */
-
-        'public' => env('JWT_PUBLIC_KEY'),
-
-        /*
-        |--------------------------------------------------------------------------
-        | Private Key
-        |--------------------------------------------------------------------------
-        |
-        | A path or resource to your private key.
-        |
-        | E.g. 'file://path/to/private/key'
-        |
-        */
-
-        'private' => env('JWT_PRIVATE_KEY'),
-
-        /*
-        |--------------------------------------------------------------------------
-        | Passphrase
-        |--------------------------------------------------------------------------
-        |
-        | The passphrase for your private key. Can be null if none set.
-        |
-        */
-
-        'passphrase' => env('JWT_PASSPHRASE'),
-
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | JWT time to live
-    |--------------------------------------------------------------------------
-    |
-    | Specify the length of time (in minutes) that the token will be valid for.
-    | Defaults to 1 hour.
-    |
-    | You can also set this to null, to yield a never expiring token.
-    | Some people may want this behaviour for e.g. a mobile app.
-    | This is not particularly recommended, so make sure you have appropriate
-    | systems in place to revoke the token if necessary.
-    | Notice: If you set this to null you should remove 'exp' element from 'required_claims' list.
-    |
-    */
-
-    'ttl' => env('JWT_TTL', 60),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Refresh time to live
-    |--------------------------------------------------------------------------
-    |
-    | Specify the length of time (in minutes) that the token can be refreshed
-    | within. I.E. The user can refresh their token within a 2 week window of
-    | the original token being created until they must re-authenticate.
-    | Defaults to 2 weeks.
-    |
-    | You can also set this to null, to yield an infinite refresh time.
-    | Some may want this instead of never expiring tokens for e.g. a mobile app.
-    | This is not particularly recommended, so make sure you have appropriate
-    | systems in place to revoke the token if necessary.
-    |
-    */
-
-    'refresh_ttl' => env('JWT_REFRESH_TTL', 20160),
-
-    /*
-    |--------------------------------------------------------------------------
-    | JWT hashing algorithm
-    |--------------------------------------------------------------------------
-    |
-    | Specify the hashing algorithm that will be used to sign the token.
-    |
-    | See here: https://github.com/namshi/jose/tree/master/src/Namshi/JOSE/Signer/OpenSSL
-    | for possible values.
-    |
-    */
-
-    'algo' => env('JWT_ALGO', 'HS256'),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Required Claims
-    |--------------------------------------------------------------------------
-    |
-    | Specify the required claims that must exist in any token.
-    | A TokenInvalidException will be thrown if any of these claims are not
-    | present in the payload.
-    |
-    */
-
-    'required_claims' => [
-        'iss',
-        'iat',
-        'exp',
-        'nbf',
-        'sub',
-        'jti',
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | Persistent Claims
-    |--------------------------------------------------------------------------
-    |
-    | Specify the claim keys to be persisted when refreshing a token.
-    | `sub` and `iat` will automatically be persisted, in
-    | addition to the these claims.
-    |
-    | Note: If a claim does not exist then it will be ignored.
-    |
-    */
-
-    'persistent_claims' => [
-        // 'foo',
-        // 'bar',
-    ],
-
-    /*
-    |--------------------------------------------------------------------------
-    | Lock Subject
-    |--------------------------------------------------------------------------
-    |
-    | This will determine whether a `prv` claim is automatically added to
-    | the token. The purpose of this is to ensure that if you have multiple
-    | authentication models e.g. `App\User` & `App\OtherPerson`, then we
-    | should prevent one authentication request from impersonating another,
-    | if 2 tokens happen to have the same id across the 2 different models.
-    |
-    | Under specific circumstances, you may want to disable this behaviour
-    | e.g. if you only have one authentication model, then you would save
-    | a little on token size.
-    |
-    */
-
-    'lock_subject' => true,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Leeway
-    |--------------------------------------------------------------------------
-    |
-    | This property gives the jwt timestamp claims some "leeway".
-    | Meaning that if you have any unavoidable slight clock skew on
-    | any of your servers then this will afford you some level of cushioning.
-    |
-    | This applies to the claims `iat`, `nbf` and `exp`.
-    |
-    | Specify in seconds - only if you know you need it.
-    |
-    */
-
-    'leeway' => env('JWT_LEEWAY', 0),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Blacklist Enabled
-    |--------------------------------------------------------------------------
-    |
-    | In order to invalidate tokens, you must have the blacklist enabled.
-    | If you do not want or need this functionality, then set this to false.
-    |
-    */
-
-    'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
-
-    /*
-    | -------------------------------------------------------------------------
-    | Blacklist Grace Period
-    | -------------------------------------------------------------------------
-    |
-    | When multiple concurrent requests are made with the same JWT,
-    | it is possible that some of them fail, due to token regeneration
-    | on every request.
-    |
-    | Set grace period in seconds to prevent parallel request failure.
-    |
-    */
-
-    'blacklist_grace_period' => env('JWT_BLACKLIST_GRACE_PERIOD', 0),
-
-    /*
-    |--------------------------------------------------------------------------
-    | Cookies encryption
-    |--------------------------------------------------------------------------
-    |
-    | By default Laravel encrypt cookies for security reason.
-    | If you decide to not decrypt cookies, you will have to configure Laravel
-    | to not encrypt your cookie token by adding its name into the $except
-    | array available in the middleware "EncryptCookies" provided by Laravel.
-    | see https://laravel.com/docs/master/responses#cookies-and-encryption
-    | for details.
-    |
-    | Set it to true if you want to decrypt cookies.
-    |
-    */
-
-    'decrypt_cookies' => false,
-
-    /*
-    |--------------------------------------------------------------------------
-    | Providers
-    |--------------------------------------------------------------------------
-    |
-    | Specify the various providers used throughout the package.
-    |
-    */
-
-    'providers' => [
-
-        /*
-        |--------------------------------------------------------------------------
-        | JWT Provider
-        |--------------------------------------------------------------------------
-        |
-        | Specify the provider that is used to create and decode the tokens.
-        |
-        */
-
-        'jwt' => Tymon\JWTAuth\Providers\JWT\Lcobucci::class,
-
-        /*
-        |--------------------------------------------------------------------------
-        | Authentication Provider
-        |--------------------------------------------------------------------------
-        |
-        | Specify the provider that is used to authenticate users.
-        |
-        */
-
-        'auth' => Tymon\JWTAuth\Providers\Auth\Illuminate::class,
-
-        /*
-        |--------------------------------------------------------------------------
-        | Storage Provider
-        |--------------------------------------------------------------------------
-        |
-        | Specify the provider that is used to store tokens in the blacklist.
-        |
-        */
-
-        'storage' => Tymon\JWTAuth\Providers\Storage\Illuminate::class,
-
-    ],
-
-];

+ 32 - 0
database/migrations/2021_03_03_140834_add_time_colume_to_procurements.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddTimeColumeToProcurements extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('procurements', function (Blueprint $table) {
+            $table->bigInteger('time')->nullable()->comment('接单倒计时');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('procurements', function (Blueprint $table) {
+            $table->dropColumn('time');
+        });
+    }
+}

+ 40 - 0
database/migrations/2021_03_03_175304_add_authority_to_customer_owner.php

@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddAuthorityToCustomerOwner extends Migration
+{
+    public $addAuthorities = [
+        "客户管理-项目-停用",
+    ];
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        foreach ($this->addAuthorities as $authority){
+            \App\Authority::query()->firstOrCreate([
+                "name"=>$authority
+            ],[
+                "name"=>$authority,
+                "alias_name"=>$authority
+            ]);
+        }
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        foreach ($this->addAuthorities as $authority){
+            \App\Authority::query()->where("name",$authority)->delete();
+        }
+    }
+}

+ 32 - 0
database/migrations/2021_03_03_175807_add_subjection_to_owners.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddSubjectionToOwners extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owners', function (Blueprint $table) {
+            $table->tinyInteger('subjection')->default(0)->comment('主体公司');//1:宝时物流 2:宝时供应链
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owners', function (Blueprint $table) {
+            $table->dropColumn('subjection');
+        });
+    }
+}

+ 4 - 0
resources/views/customer/project/create.blade.php

@@ -101,6 +101,7 @@
                     phone_number : "{{$owner->phone_number ?? ''}}",
                     description : "{{$owner->description ?? ''}}",
                     waring_line_on : "{{$owner->waring_line_on ?? ''}}",
+                    subjection : "{{$owner->subjection ?? ''}}",
                 },
                 ownerTemp : {},
                 customers : [
@@ -174,6 +175,7 @@
                     ],
                     feature_type:{!! json_encode(\App\Feature::type,JSON_UNESCAPED_UNICODE) !!},
                     logic : ['包含','不包含','等于'],
+                    ownerSubjections:{!! json_encode(\App\Owner::subjection,JSON_UNESCAPED_UNICODE) !!},
                 },
                 poolMapping:{},//基础数据选择池的映射对象 供展示使用
                 selectedModel:{//已选定的计费模型
@@ -384,6 +386,7 @@
                     params.tax_rate !== old.tax_rate ||
                     params.waring_line_on !== old.waring_line_on ||
                     params.phone_number !== old.phone_number ||
+                    params.subjection !== old.subjection ||
                     params.description !== old.description){
                         let result = undefined;
                         window.tempTip.postBasicRequest(url,params,res=>{
@@ -403,6 +406,7 @@
                             this.ownerTemp.description = res.description;
                             this.ownerTemp.customer_name = params.customer_name;
                             this.ownerTemp.owner_group_name = params.owner_group_name;
+                            this.ownerTemp.subjection = params.subjection;
                             result = true;
                         });
                         while (result){

+ 38 - 4
resources/views/customer/project/index.blade.php

@@ -66,18 +66,23 @@
                     <td>
                         <label><input type="checkbox" :value="owner.id" v-model="checkData"></label>
                     </td>
+                    <td>@{{ i+1 }}</td>
                     <td>@{{ owner.name }}</td>
                     <td>@{{ owner.customer_name }}</td>
                     <td>@{{ owner.user_owner_group_name }}</td>
                     <td>@{{ owner.user_work_group_name }}</td>
                     <td>@{{ owner.created_at }}</td>
                     <td>@{{ owner.customer_company_name }}</td>
+                    <td>@{{ ownerSubjection[owner.subjection] }}</td>
                     <td>@{{ owner.is_activation }}</td>
                     <td>
-                        <a :href="'{{url('customer/project')}}/'+owner.id+'/edit'"><button class="btn btn-sm btn0sm btn-outline-info">编辑</button></a>
+                        <button class="btn btn-sm btn-info text-white" @click="showModal(owner)">各项计价</button>
                     </td>
                     <td>
-                        <button class="btn btn-sm btn-info text-white" @click="showModal(owner)">各项计价</button>
+                        <a :href="'{{url('customer/project')}}/'+owner.id+'/edit'"><button class="btn btn-sm btn0sm btn-outline-info">编辑</button></a>
+                        @can('客户管理-项目-停用')
+                            <button class="btn btn-sm btn-outline-danger" @click="destroy(owner)">停用</button>
+                        @endcan
                     </td>
                 </tr>
             </table>
@@ -102,6 +107,7 @@
                         name : "{{$owner->name}}",
                         //code : "{{--{{$owner->code}}--}}",
                         created_at : "{{$owner->created_at}}",
+                        subjection : "{{$owner->subjection}}",
                         /*contracts : [
                             {{--@foreach($owner->contracts as $contract)
                             { number:"{{$contract->contract_number}}",salesman:"{{$contract->salesman}}" },
@@ -140,6 +146,7 @@
                     {name:"{{$ownerGroup->id}}",value:"{{$ownerGroup->name}}"},
                     @endforeach
                 ],
+                ownerSubjection:{!! json_encode(\App\Owner::subjection,JSON_UNESCAPED_UNICODE) !!},
             },
             mounted(){
                 $('#container').removeClass('d-none');
@@ -164,15 +171,17 @@
                 let column = [
                     {name:'cloneCheckAll',customization:true,type:'checkAll',column:'id',
                         dom:$('#cloneCheckAll').removeClass('d-none'), neglect: true},
+                    {name:'index',value: '序号', neglect: true},
                     {name:'name',value: '项目'},
                     {name:'customer',value: '客户'},
                     {name:'user_owner_group_name',value: '项目小组'},
                     {name:'user_work_group_name',value: '仓库小组'},
                     {name:'created_at',value: '创建日期'},
                     {name:'customer_full_name',value: '公司全称'},
+                    {name:'subjection',value: '主体公司'},
                     {name:'is_activating',value: '是否激活', neglect: true},
-                    {name:'operating',value: '操作', neglect: true},
                     {name:'relating_price',value: '关联报价', neglect: true},
+                    {name:'operating',value: '操作', neglect: true},
                 ];
                 let _this=this;
                 setTimeout(function () {
@@ -244,7 +253,32 @@
                         window.tempTip.show("网络错误:"+err);
                     });
                 },
+                destroy:function(owner){
+                    confirm('确定要停用项目“' + owner.name + '”吗?');
+                    let data=this;
+                    let url = "{{url('maintenance/owner')}}/"+owner.id;
+                    axios.delete(url,{id:owner.id})
+                        .then(function (response) {
+                            if(response.data.success){
+                                for (let i = 0; i < data.owners.length; i++) {
+                                    if (data.owners[i].id===owner.id){
+                                        data.owners.splice(i,1);
+                                        break;
+                                    }
+                                }
+                                tempTip.setDuration(1000);
+                                tempTip.showSuccess('停用项目"'+owner.name+'"成功!')
+                            }else{
+                                tempTip.setDuration(1000);
+                                tempTip.show('停用项目"'+owner.name+'"失败!')
+                            }
+                        })
+                        .catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show('停用项目失败!'+'网络错误:' + err);
+                        });
+                },
             },
         });
     </script>
-@endsection
+@endsection

+ 7 - 1
resources/views/customer/project/part/_two.blade.php

@@ -34,6 +34,12 @@
         <strong>@{{ errors.user_workgroup_id[0] }}</strong>
     </span>
 </div>
+<div class="row mt-3">
+    <label for="subjection" class="col-2">主体公司</label>
+    <select id="subjection" v-model="owner.subjection" class="form-control form-control-sm col-4 mb-0" >
+        <option v-for="(ownerSubjection,i) in pool.ownerSubjections" :value="i+1">@{{ pool.ownerSubjections[i+1] }}</option>
+    </select>
+</div>
 <div class="row mt-3">
     <label for="tax_rate" class="col-2">税率<span class="badge badge-secondary">%</span></label>
     <input type="number" v-model="owner.tax_rate" step="0.01" id="tax_rate" class="form-control form-control-sm col-3 mb-0" :class="errors.tax_rate ? 'is-invalid' : ''">
@@ -59,4 +65,4 @@
 <div class="row mt-3">
     <label for="description" class="col-2">项目描述</label>
     <textarea id="description" v-model="owner.description" class="form-control form-control-sm col-7"></textarea>
-</div>
+</div>

+ 1 - 1
routes/api.php

@@ -16,7 +16,7 @@ use Illuminate\Support\Facades\Route;
 Route::group(['prefix' => 'procurement','middleware'=>'procurement.auth.api'], function ($router) {
     Route::post('logout', 'api\procurement\wechat\AuthController@logout');
     Route::post('refresh', 'api\procurement\wechat\AuthController@refresh');
-    Route::post('me', 'api\procurement\wechat\AuthController@me');
+    Route::get('getQuotation', 'api\procurement\wechat\ProcurementController@getQuotation');
 });
 Route::group(['prefix' => 'procurement'], function ($router) {
     Route::post('login', 'api\procurement\wechat\AuthController@login');