链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Support\Facades\DB;
  6. class ImsCjdcOrderMain extends Model
  7. {
  8. use HasDateTimeFormatter;
  9. //protected $table = 'ims_cjdc_order_main';
  10. protected $table = 'lanzu_order_main';
  11. public $timestamps = false;
  12. public function imsCjdcUser()
  13. {
  14. return $this->hasOne('\App\Models\ImsCjdcUser','id','user_id');
  15. }
  16. public function market()
  17. {
  18. return $this->hasOne('\App\Models\ImsCjdcMarket','id','market_id');
  19. }
  20. /**
  21. * 变更订单状态,
  22. * @param $oid //主订单id
  23. * @param $state //订单状态
  24. */
  25. public function modifyState($oid,$state)
  26. {
  27. $where = [];
  28. $where['state'] = $state;
  29. if ($state==3) {
  30. $where['receive_time'] = time();
  31. }elseif ($state==4){
  32. $where['complete_time'] = time();
  33. }elseif ($state==6){
  34. $where['cancel_time'] = time();
  35. }
  36. return self::where('id',$oid)->update($where);
  37. }
  38. public function updateShippingType($oid,$type)
  39. {
  40. return self::where('id',$oid)->update(['shipping_type'=>$type]);
  41. }
  42. }