StoreService.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. *
  4. * @author: xaboy<365615158@qq.com>
  5. * @day: 2017/12/23
  6. */
  7. namespace app\models\store;
  8. use crmeb\basic\BaseModel;
  9. use crmeb\traits\ModelTrait;
  10. /**
  11. * TODO 客服Model
  12. * Class StoreService
  13. * @package app\models\store
  14. */
  15. class StoreService extends BaseModel
  16. {
  17. /**
  18. * 数据表主键
  19. * @var string
  20. */
  21. protected $pk = 'id';
  22. /**
  23. * 模型名称
  24. * @var string
  25. */
  26. protected $name = 'store_service';
  27. use ModelTrait;
  28. /**
  29. * 获取客服列表
  30. * @param $page
  31. * @param $limit
  32. * @return array
  33. */
  34. public static function lst($page, $limit)
  35. {
  36. // if(!$page || !$limit) return [];
  37. $model = new self;
  38. $model = $model->where('status', 1);
  39. // $model = $model->page($page, $limit);
  40. return $model->select();
  41. }
  42. /**
  43. * 获取客服信息
  44. * @param $uid
  45. * @param string $field
  46. * @return array|null|\think\Model
  47. * @throws \think\db\exception\DataNotFoundException
  48. * @throws \think\db\exception\ModelNotFoundException
  49. * @throws \think\exception\DbException
  50. */
  51. public static function getServiceInfo($uid, $field = '*')
  52. {
  53. return self::where('uid', $uid)->where('status', 1)->field($field)->find();
  54. }
  55. /**
  56. * 判断是否客服
  57. * @param $uid
  58. * @return int
  59. */
  60. public static function orderServiceStatus($uid)
  61. {
  62. return self::where('uid', $uid)->where('status', 1)->where('customer', 1)->count();
  63. }
  64. /**
  65. * 获取接受通知的客服
  66. *
  67. * @return array
  68. */
  69. public static function getStoreServiceOrderNotice(){
  70. return self::where('status',1)->where('notify',1)->column('uid','uid');
  71. }
  72. }