| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace app\models\store;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- /**
- * TODO 客服Model
- * Class StoreService
- * @package app\models\store
- */
- class StoreService extends BaseModel
- {
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'store_service';
- use ModelTrait;
- /**
- * 获取客服列表
- * @param $page
- * @param $limit
- * @return object
- */
- public static function lst(int $page, int $limit)
- {
- $model = new self;
- $model = $model->where('status', SHOW);
- $model = $model->page($page, $limit);
- return $model->select();
- }
- /**
- * 获取客服信息
- * @param $uid
- * @param string $field
- * @return array|null|\think\Model
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public static function getServiceInfo($uid, $field = '*')
- {
- return self::where('uid', $uid)->where('status', SHOW)->field($field)->find();
- }
- /**
- * 判断是否客服
- * @param $uid
- * @return int
- */
- public static function orderServiceStatus($uid)
- {
- return self::where('uid', $uid)->where('status', SHOW)->where('customer', YES)->count();
- }
- /**
- * 获取接受通知的客服
- *
- * @return array
- */
- public static function getStoreServiceOrderNotice()
- {
- return self::where('status', SHOW)->where('notify', ENABLED)->column('uid', 'uid');
- }
- }
|