Nessuna descrizione

SendOrder.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. use Symfony\Component\Console\Input\InputOption;
  5. use Symfony\Component\Console\Input\InputArgument;
  6. use TopClient;
  7. use DB;
  8. use YPSMS;
  9. class SendOrder extends Command {
  10. protected $signature = 'SendOrder';
  11. /**
  12. * The console command description.
  13. *
  14. * @var string
  15. */
  16. protected $description = '提醒仓管新订单短信';
  17. public function handle()
  18. {
  19. $this->SendOrder();
  20. }
  21. public function SendOrder(){
  22. #今日
  23. $today = date('Y-m-d');
  24. $_start = '2019-09-18';
  25. //A仓
  26. $orders = DB::table('order')->where('status', 2)->where('delivery_date', '<=', $today)->where('createTime', '>=', $_start)->where('warehouse', 1)->where(function($query) use($today){
  27. $query->where('logistics_id','=','')->orWhere('logistics_id','is',null);
  28. })->lists('id');
  29. if(!empty($orders)){
  30. $orders = json_decode(json_encode($orders), true);
  31. $order_ids = implode(',',$orders);
  32. $res = YPSMS::sendMsg('15695966629', 2, $order_ids, $today.'前');
  33. $res = YPSMS::sendMsg('13511074691', 2, $order_ids, $today.'前');
  34. //$res = YPSMS::sendMsg('18501257479', 2, $order_ids, $today.'前');
  35. var_dump($res);
  36. }
  37. //B仓
  38. $orders = DB::table('order')->where('status', 2)->where('delivery_date', '<=', $today)->where('createTime', '>=', $_start)->where('warehouse', 2)->where(function($query) use($today){
  39. $query->where('logistics_id','=','')->orWhere('logistics_id','is',null);
  40. })->lists('id');
  41. if(!empty($orders)){
  42. $orders = json_decode(json_encode($orders), true);
  43. $order_ids = implode(',',$orders);
  44. $res = YPSMS::sendMsg('13055396000', 2, $order_ids, $today.'前');
  45. $res = YPSMS::sendMsg('13511074691', 2, $order_ids, $today.'前');
  46. //$res = YPSMS::sendMsg('18501257479', 2, $order_ids, $today.'前');
  47. var_dump($res);
  48. }
  49. }
  50. }