| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Http\Controllers;
- use App\Components\AsyncResponse;
- use App\Components\Database;
- use App\Components\ErrorPush;
- use App\Services\WaybillService;
- use App\Waybill;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\DB;
- class TestController extends Controller
- {
- use AsyncResponse, ErrorPush, Database;
- const ASNREFERENCE_2 = 'ASNREFERENCE2';
- public function __construct()
- {
- $this->data["active_test"] = "active";
- }
- public function method(Request $request, $method)
- {
- try {
- return call_user_func([$this, $method], $request);
- }catch (\BadMethodCallException $e){
- dd("方法不存在");
- }
- }
- public function test(){
- $sql = <<<SQL
- select * from equipment where id in (
- select parent_id from equipment where parent_id in (select id from equipment where info like '%"id":2%' and code like 'H%')
- group by parent_id having (count(*)<5)
- );
- SQL;
- $arr = DB::connection("aliyunMysql")->select(DB::raw($sql));
- $insert = <<<SQL
- insert into equipment(repository_id, code, parent_id, info, depth, width, height, containers, location_tab, created_at, updated_at, tandem)
- values (?,?,?,null,?,?,1.8,null,'0-0','2022-01-13 16:08:00','2022-01-13 16:08:00',null)
- SQL;
- foreach ($arr as $item){
- DB::connection("aliyunMysql")->insert($insert, [$item->repository_id,$item->code."-1",$item->id,$item->depth,$item->width]);
- }
- }
- }
|