Worker.php 856 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. namespace app\common\model;
  4. use app\common\model\base\BaseModel;
  5. class Worker extends BaseModel
  6. {
  7. //客户
  8. public function customer()
  9. {
  10. return $this->hasOne(Customer::class,'id','customer_id');
  11. }
  12. public function staff()
  13. {
  14. return $this->hasOne(User::class,'id','staff_id');
  15. }
  16. //获取店铺,规格id
  17. public static function getSpecsIdByShopId(string $shop_id): object
  18. {
  19. return self::where('shop_id', $shop_id)->findOrEmpty();
  20. }
  21. //获取店铺客户信息
  22. public static function getCustomerByShopId(int $shop_id): object
  23. {
  24. return self::alias('a')
  25. ->where('a.id', $shop_id)
  26. ->leftjoin('customer b', 'a.customer_id = b.id')
  27. ->field('b.id, b.account_term,b.cycle')
  28. ->find();
  29. }
  30. }