ServicesTrait.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace crmeb\traits;
  12. use crmeb\basic\BaseModel;
  13. use think\Model;
  14. /**
  15. * Trait ServicesTrait
  16. * @package crmeb\traits
  17. * @method array|Model|null get($id, ?array $field = [], ?array $with = []) 获取一条数据
  18. * @method array|Model|null getOne(array $where, ?string $field = '*', ?array $with = []) 获取一条数据(不走搜素器)
  19. * @method string|null batchUpdate(array $ids, array $data, ?string $key = null) 批量修改
  20. * @method float sum(array $where, string $field, bool $search = false) 求和
  21. * @method mixed update($id, array $data, ?string $field = null) 修改数据
  22. * @method bool be($map, string $field = '') 查询一条数据是否存在
  23. * @method mixed value(array $where, string $field) 获取指定条件下的数据
  24. * @method int count(array $where = [], string $filed = '*') 读取数据条数
  25. * @method int getCount(array $where = []) 获取某些条件总数(不走搜素器)
  26. * @method array getColumn(array $where, string $field, string $key = '') 获取某个字段数组(不走搜素器)
  27. * @method mixed delete($id, ?string $key = null) 删除
  28. * @method BaseModel|Model save(array $data) 保存数据
  29. * @method mixed saveAll(array $data) 批量保存数据
  30. * @method bool bcInc($key, string $incField, string $inc, string $keyField = null, int $acc = 2) 高精度加法
  31. * @method bool bcDec($key, string $decField, string $dec, string $keyField = null, int $acc = 2) 高精度 减法
  32. * @method mixed decStockIncSales(array $where, int $num, string $stock = 'stock', string $sales = 'sales') 减库存加销量
  33. * @method mixed incStockDecSales(array $where, int $num, string $stock = 'stock', string $sales = 'sales') 加库存减销量
  34. * @method mixed incUpdate($where, string $field, int $number = 1) 自增单个数据
  35. * @method mixed decUpdate($where, string $field, int $number = 1) 自减单个数据
  36. */
  37. trait ServicesTrait
  38. {
  39. }