PaySupconModel.php 835 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\common\model;
  3. use think\Cache;
  4. use think\Model;
  5. class PaySupconModel extends Model
  6. {
  7. protected $pk = 'id';
  8. protected $table = 'cy_pay_supcon';
  9. protected $resultSetType = 'collection';
  10. protected static function init()
  11. {
  12. self::afterInsert(function () {
  13. Cache::clear('pay_supcon_list');
  14. });
  15. self::afterUpdate(function () {
  16. Cache::clear('pay_supcon_list');
  17. });
  18. self::afterDelete(function () {
  19. Cache::clear('pay_supcon_list');
  20. });
  21. }
  22. public function getCacheList ($where = [], $field = 'id,paytype_name,probability,pay_scene,pay_mark,sort')
  23. {
  24. return $this->cache(true, 300, "pay_supcon_list")->where($where)->field($field)->select()->toArray();
  25. }
  26. }