OrderPaylog.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace app\common\model;
  3. use think\Exception;
  4. class OrderPaylog extends BaseModel
  5. {
  6. /**
  7. * @var string
  8. */
  9. protected $name = 'order_paylog';
  10. /**
  11. * @var array
  12. */
  13. protected $auto = [];
  14. /**
  15. * @var array
  16. */
  17. protected $insert = ['created_at','updated_at'];
  18. /**
  19. * @var array
  20. */
  21. protected $update = ['updated_at'];
  22. public function taxiOrder(): \think\model\relation\HasMany
  23. {
  24. return $this->hasMany('TaxiOrder', 'order_idx')
  25. ->field('id,price');
  26. }
  27. /**
  28. * @desc 实例化订单模型
  29. * motor(摩的)、skill(技能)、mission(配送)、goods(商品)
  30. *
  31. * @param string $name
  32. * @return $class|\app\xxx\model\$name|\think\Model
  33. * @throws Exception
  34. * @author weichuanbao<654745815@qq.com>
  35. * @date 2022/1/4 0004
  36. */
  37. public static function ascription($name = '')
  38. {
  39. $class = '\\app\\common\\model\\'.ucwords($name).'\\Order';
  40. if (class_exists($class)) {
  41. return model($class);
  42. }
  43. throw new Exception("Class $class is not exist");
  44. }
  45. }