GreenNewsCate.php 919 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 信息栏目
  7. */
  8. namespace app\green\model;
  9. use think\Model;
  10. use category\Tree;
  11. class GreenNewsCate extends Model{
  12. //添加或编辑
  13. public static function edit($param){
  14. $data['title'] = trim($param['title']);
  15. $data['name'] = trim($param['name']);
  16. $data['sort'] = trim($param['sort']);
  17. $data['picture'] = trim($param['picture']);
  18. $data['update_time'] = time();
  19. if(isset($param['id'])){
  20. return self::update($data,['id'=>(int)$param['id']]);
  21. }else{
  22. $data['create_time'] = time();
  23. $data['member_miniapp_id'] = $param['member_miniapp_id'];
  24. return self::create($data);
  25. }
  26. }
  27. }