Search.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 app\admin\model\article;
  12. use traits\ModelTrait;
  13. use basic\ModelBasic;
  14. /**
  15. * 关键词 Model
  16. * Class WechatNews
  17. * @package app\admin\model\article
  18. */
  19. class Search extends ModelBasic
  20. {
  21. use ModelTrait;
  22. public static function saveSearch($name){
  23. if(!self::be(['name'=>$name])){
  24. if($res=self::set(['name'=>$name,'add_time'=>time()]))
  25. return $res;
  26. else
  27. return self::setErrorInfo('添加失败');
  28. }else
  29. return self::setErrorInfo('请勿重复添加');
  30. }
  31. public static function getAll(){
  32. return self::order('add_time desc')->select()->toArray();
  33. }
  34. }