QueryInterface.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace logistics;
  3. use app\common\model\LogisticsCompany;
  4. use fast\Arr;
  5. abstract class QueryInterface{
  6. protected $no;
  7. protected $username;
  8. protected $phone;
  9. /** @var LogisticsCompany */
  10. protected $logistics;
  11. abstract public function query();
  12. public function setNo($value){
  13. $this->no=$value;
  14. return $this;
  15. }
  16. public function setUserName($value){
  17. $this->username=$value;
  18. return $this;
  19. }
  20. public function setPhone($phone)
  21. {
  22. $this->phone = $phone;
  23. return $this;
  24. }
  25. /**
  26. * @return mixed
  27. */
  28. public function getNo()
  29. {
  30. return $this->no;
  31. }
  32. /**
  33. * @return mixed
  34. */
  35. public function getUsername()
  36. {
  37. return $this->username;
  38. }
  39. /**
  40. * @return mixed
  41. */
  42. public function getPhone()
  43. {
  44. return $this->phone;
  45. }
  46. /**
  47. * @param LogisticsCompany $logistics
  48. */
  49. public function setLogistics(LogisticsCompany $logistics)
  50. {
  51. $this->logistics = $logistics;
  52. return $this;
  53. }
  54. /**
  55. * @return LogisticsCompany
  56. */
  57. public function getLogistics($field=null)
  58. {
  59. if(is_null($field)) {
  60. return $this->logistics;
  61. }
  62. return Arr::get($this->logistics,$field);
  63. }
  64. public static function init():self{
  65. $provider=[
  66. 'kd100'=>Kd100::class,
  67. ];
  68. return new $provider['kd100'];
  69. }
  70. }