News.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. class News extends Model{
  11. protected $pk = 'id';
  12. protected $table = 'ai_allwin_news';
  13. protected $autoWriteTimestamp = true;
  14. protected $createTime = false;
  15. //添加或编辑
  16. public function edit($member_miniapp_id,$param){
  17. $data['types'] = trim($param['types']);
  18. $data['cate_id'] = trim($param['cate_id']);
  19. $data['desc'] = trim($param['desc']);
  20. $data['img'] = trim($param['img']);
  21. $data['title'] = trim($param['title']);
  22. $data['cate_name'] = trim($param['cate_name']);
  23. $data['content'] = trim($param['content']);
  24. $data['update_time'] = time();
  25. if(isset($param['id'])){
  26. $condition['id'] = $param['id'];
  27. $condition['member_miniapp_id'] = $member_miniapp_id;
  28. return self::save($data,$condition);
  29. }else{
  30. $data['member_miniapp_id'] = $member_miniapp_id;
  31. return self::insert($data);
  32. }
  33. }
  34. }