NewsCate.php 980 B

1234567891011121314151617181920212223242526272829303132
  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\allwin\model;
  9. use think\Model;
  10. use category\Tree;
  11. class Newscate extends Model{
  12. protected $pk = 'id';
  13. protected $table = 'ai_allwin_news_cate';
  14. //添加或编辑
  15. public function edit($param){
  16. $data['title'] = trim($param['title']);
  17. $data['name'] = trim($param['name']);
  18. $data['sort'] = trim($param['sort']);
  19. $data['picture'] = trim($param['picture']);
  20. $data['update_time'] = time();
  21. if(isset($param['id'])){
  22. return self::update($data,['id'=>(int)$param['id']]);
  23. }else{
  24. $data['create_time'] = time();
  25. $data['member_miniapp_id'] = $param['member_miniapp_id'];
  26. return self::insert($data);
  27. }
  28. }
  29. }