You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ServicesTrait.php 1.8KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace crmeb\traits;
  3. use crmeb\basic\BaseModel;
  4. use think\Model;
  5. /**
  6. * Trait ServicesTrait
  7. * @method array|Model|null get($id, ?array $field = [], ?array $with = []) 获取一条数据
  8. * @method array|Model|null getOne(array $where, ?string $field = '*', ?array $with = []) 获取一条数据(不走搜素器)
  9. * @method string|null batchUpdate(array $ids, array $data, ?string $key = null) 批量修改
  10. * @method float sum(array $where, string $field, bool $search = false) 求和
  11. * @method mixed update($id, array $data, ?string $field = null) 修改数据
  12. * @method bool be($map, string $field = '') 查询一条数据是否存在
  13. * @method mixed value(array $where, string $field) 获取指定条件下的数据
  14. * @method int count(array $where = [], string $filed = '*') 读取数据条数
  15. * @method int getCount(array $where = []) 获取某些条件总数(不走搜素器)
  16. * @method array getColumn(array $where, string $field, string $key = '') 获取某个字段数组(不走搜素器)
  17. * @method mixed delete($id, ?string $key = null) 删除
  18. * @method BaseModel|Model save(array $data) 保存数据
  19. * @method mixed saveAll(array $data) 批量保存数据
  20. * @method bool bcInc($key, string $incField, string $inc, string $keyField = null, int $acc = 2) 高精度加法
  21. * @method bool bcDec($key, string $decField, string $dec, string $keyField = null, int $acc = 2) 高精度 减法
  22. * @method mixed decStockIncSales(array $where, int $num, string $stock = 'stock', string $sales = 'sales') 减库存加销量
  23. * @method mixed incStockDecSales(array $where, int $num, string $stock = 'stock', string $sales = 'sales') 加库存减销量
  24. * @method mixed incUpdate($where, string $field, int $number = 1) 自增单个数据
  25. * @method mixed decUpdate($where, string $field, int $number = 1) 自减单个数据
  26. */
  27. trait ServicesTrait
  28. {
  29. }