|
|
@@ -9,6 +9,7 @@ use App\Components\AsyncResponse;
|
|
|
use App\Components\ErrorPush;
|
|
|
use App\ErrorTemp;
|
|
|
use App\Feature;
|
|
|
+use App\Http\ApiControllers\LoginController;
|
|
|
use App\Http\Requests\OrderDelivering;
|
|
|
use App\Jobs\CacheShelfTaskJob;
|
|
|
use App\Jobs\OrderCreateInstantBill;
|
|
|
@@ -54,6 +55,7 @@ use App\ValueStore;
|
|
|
use App\Waybill;
|
|
|
use Carbon\Carbon;
|
|
|
use Carbon\CarbonPeriod;
|
|
|
+use Firebase\JWT\JWT;
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
use Illuminate\Http\Request;
|
|
|
@@ -62,6 +64,7 @@ use Illuminate\Support\Facades\Auth;
|
|
|
use Illuminate\Support\Facades\Cookie;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
+use Illuminate\Support\Facades\URL;
|
|
|
use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
|
|
|
|
|
|
class TestController extends Controller
|
|
|
@@ -78,125 +81,54 @@ class TestController extends Controller
|
|
|
{
|
|
|
return call_user_func([$this, $method], $request);
|
|
|
}
|
|
|
- public function test1(){
|
|
|
- ini_set('max_execution_time',-1);
|
|
|
- $date = date("Y-m-d H:i:s");
|
|
|
- ErrorTemp::query()->truncate();
|
|
|
- OwnerFeeStorage::query()->truncate();
|
|
|
- OwnerFeeExpress::query()->truncate();
|
|
|
- OwnerFeeLogistic::query()->truncate();
|
|
|
- OwnerFeeOperation::query()->truncate();
|
|
|
- OwnerFeeOperationDetail::query()->truncate();
|
|
|
- foreach (Order::query()->where("wms_edittime",">=","2021-08-16 00:00:00")
|
|
|
- ->where("wms_status","订单完成")
|
|
|
- ->where("wms_edittime","<",$date)->get() as $order){
|
|
|
- $fee = OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first();
|
|
|
- if ($fee){
|
|
|
- OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$fee->id)->delete();
|
|
|
- $fee->delete();
|
|
|
- }
|
|
|
- $a = new Collection([$order]);
|
|
|
- $this->dispatch(new OrderCreateInstantBill($a));
|
|
|
- }
|
|
|
- foreach (Store::query()->where("updated_at",">=","2021-08-16 00:00:00")
|
|
|
- ->where("status","已入库")
|
|
|
- ->where("updated_at","<",$date)->get() as $store){
|
|
|
- OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->delete();
|
|
|
- $a = new Collection([$store]);
|
|
|
- $this->dispatch(new StoreCreateInstantBill($a));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public function test()
|
|
|
+ public function test4()
|
|
|
{
|
|
|
- ini_set('max_execution_time',-1);
|
|
|
- $day = (string)\request("day");
|
|
|
- $d = (int)$day+1;
|
|
|
- $d = $d<10 ? '0'.(string)$d : (string)$d;
|
|
|
- foreach (Order::query()->where("wms_edittime",">=","2021-08-{$day} 00:00:00")
|
|
|
- ->where("wms_status","订单完成")
|
|
|
- ->where("wms_edittime","<","2021-08-{$d} 00:00:00")->get() as $order){
|
|
|
- $fee = OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first();
|
|
|
- if ($fee){
|
|
|
- OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$fee->id)->delete();
|
|
|
- $fee->delete();
|
|
|
- }
|
|
|
- $a = new Collection([$order]);
|
|
|
- $this->dispatch(new OrderCreateInstantBill($a));
|
|
|
+ $user = User::query()->first();
|
|
|
+ $b = file_get_contents(base_path().'/public.pem');
|
|
|
+ $decoded = JWT::decode("eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJkYXRhIjp7ImZpZWxkMSI6MSwiZmllbGQyIjoic3RyaW5nIGRhdGEifSwiaXNzIjoiaHR0cDpcL1wvZXhhbXBsZS5vcmciLCJhdWQiOiJodHRwOlwvXC9leGFtcGxlLmNvbSIsImlhdCI6MTYyOTc3NDUxMywiZWF0IjoxNjI5NzgxNzEzfQ.Twl3_KPMLP4Pi4zaGZig8SKhE9M6nZlCI8bVifWjuYIWuqZtlujp35Zvv1oY0GnPIkUmq-PGJZLU96mmT-RTRDL-83sPF2l7PPTeriYMoiKP1r2rsI421BtrgLs0qP7QCPxH5BmHWXAVbwTtnwv8JagKzcZxkZJRH3Lj8blRapumnCk-tMfHz4xiXHIATfMS1I23vhJJLomC-KW4Ou3pjTu6X3HiiUGe9ZBGTu5mHfiKm25dxXO5Fm3JMg2-anLf_Gy6D6D7IQJ5pM5HFEN-HdD7FibeEMraMxbk5B_82L15OjhaoCV7b7ioXNSs2QAdlRfuRgx0XIE_toFwb_152a", $b, ['RS256']);
|
|
|
+ $payload = [
|
|
|
+ 'data' => ['field1' => 1, 'field2' => 'string data'],
|
|
|
+ "iss" => "http://example.org",
|
|
|
+ "aud" => "http://example.com",
|
|
|
+ "iat" => time(),
|
|
|
+ "eat" => time()+7200,
|
|
|
+ ];
|
|
|
+ try {
|
|
|
+ $token = JWT::encode($payload, $a, 'RS256');
|
|
|
+ }catch (\Exception $e){
|
|
|
+ $this->error("HTTP:409,资源异常,无法反馈");
|
|
|
}
|
|
|
- foreach (Store::query()->where("updated_at",">=","2021-08-{$day} 00:00:00")
|
|
|
- ->where("status","已入库")
|
|
|
- ->where("updated_at","<","2021-08-{$d} 00:00:00")->get() as $store){
|
|
|
- OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->delete();
|
|
|
- $a = new Collection([$store]);
|
|
|
- $this->dispatch(new StoreCreateInstantBill($a));
|
|
|
+ try {
|
|
|
+ $a = file_get_contents("test");
|
|
|
+ }catch (\Exception $e){
|
|
|
+ if (strpos($e->getMessage(),"No such file or directory")!==false)$this->error("HTTP:410,服务器异常,资源丢失");
|
|
|
+ else $this->error("HTTP:403,访问某些资源失败");
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- public function test3()
|
|
|
- {
|
|
|
- $sql = <<<SQL
|
|
|
-select * from DOC_ORDER_HEADER
|
|
|
-where ADDTIME>=to_date('2021-08-15 00:00:00','yyyy-mm-dd hh24:mi:ss') AND
|
|
|
- ADDTIME<=to_date('2021-08-20 16:00:00','yyyy-mm-dd hh24:mi:ss') and SOSTATUS >= '40'
|
|
|
- and CARRIERID in (
|
|
|
- 'BSZFC','BSZX','BSZFCDF','BSZXDF','DBWL','DBWLDF'
|
|
|
- )
|
|
|
-SQL;
|
|
|
- $s = new \App\Http\Controllers\api\thirdPart\flux\WaybillController();
|
|
|
- $arr = DB::connection("oracle")->select(DB::raw($sql));
|
|
|
- foreach ($arr as $ar){
|
|
|
- if (Waybill::query()->where("wms_bill_number",'like','%'.$ar->orderno.'%')
|
|
|
- ->where("created_at",">=",'2021-08-10 00:00:00')->first())continue;
|
|
|
- $sql = <<<SQL
|
|
|
-select * from DOC_ORDER_DETAILS left join bas_sku on DOC_ORDER_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID and DOC_ORDER_DETAILS.sku = BAS_SKU.SKU
|
|
|
-where ORDERNO = ?
|
|
|
-SQL;
|
|
|
- $details = [];
|
|
|
- foreach (DB::connection("oracle")->select(DB::raw($sql),[$ar->orderno]) as $item){
|
|
|
- $details[] = [
|
|
|
- "SKU_Descr_c" => $item->descr_c,
|
|
|
- "SKU" => $item->sku,
|
|
|
- "Alternate_sku1" => $item->alternate_sku1,
|
|
|
- "Qtyordered_each" => $item->qtyordered_each,
|
|
|
- "Cubic" => $item->cubic,
|
|
|
- "GrossWeight" => $item->grossweight,
|
|
|
- "NetWeight" => $item->netweight,
|
|
|
- "ReservedField01" => $ar->soreference1,
|
|
|
- "ReservedField02" => $ar->soreference2,
|
|
|
- "ReservedField03" => $ar->soreference3,
|
|
|
- "ReservedField04" => $ar->soreference4,
|
|
|
- "ReservedField05" => $ar->soreference5,
|
|
|
- ];
|
|
|
- }
|
|
|
- $r = new Request();
|
|
|
- $res = [
|
|
|
- "OrderNo" => $ar->orderno,
|
|
|
- "CustomerID" => $ar->customerid,
|
|
|
- "CarrierID" => $ar->carrierid,
|
|
|
- "ConsigneeName" => $ar->consigneename,
|
|
|
- "C_Tel1" => $ar->c_tel1,
|
|
|
- "C_Address1" => $ar->c_address1,
|
|
|
- "C_Province" => $ar->c_province,
|
|
|
- "C_City" => $ar->c_city,
|
|
|
- "C_District" => $ar->c_district,
|
|
|
- "ReservedField01" => $ar->soreference1,
|
|
|
- "ReservedField02" => $ar->soreference2,
|
|
|
- "ReservedField03" => $ar->soreference3,
|
|
|
- "ReservedField04" => $ar->soreference4,
|
|
|
- "ReservedField05" => $ar->soreference5,
|
|
|
- "order_list" => $details,
|
|
|
- ];
|
|
|
- $a = [$res];
|
|
|
- $r->offsetSet("request",$a);
|
|
|
- $s->new_($r);
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- public function test4()
|
|
|
- {
|
|
|
- $unit = Unit::query()->sql();
|
|
|
- dd($unit);
|
|
|
+ $payload = [
|
|
|
+
|
|
|
+ 'data' => ['field1' => 1, 'field2' => 'string data'],
|
|
|
+
|
|
|
+ "iss" => "http://example.org",
|
|
|
+
|
|
|
+ "aud" => "http://example.com",
|
|
|
+
|
|
|
+ "iat" => time(),
|
|
|
+
|
|
|
+ "eat" => time()+7200,
|
|
|
+
|
|
|
+ ];
|
|
|
+
|
|
|
+ $token = JWT::encode($payload, $a, 'RS256');
|
|
|
+
|
|
|
+ echo "Token:\n" . print_r($token, true) . "\n";
|
|
|
+
|
|
|
+ $decoded = JWT::decode($token, $b, ['RS256']);
|
|
|
+
|
|
|
+ $decoded_array = (array) $decoded;
|
|
|
+
|
|
|
+ echo "Decoded:\n" . print_r($decoded_array, true) . "\n";
|
|
|
}
|
|
|
public function OwnerStoreFeeReportService_recordReport()
|
|
|
{
|