Article.php 1.0 KB

123456789101112131415161718192021222324252627282930313233
  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\fastshop\model;
  9. use think\Model;
  10. class Article extends Model{
  11. protected $pk = 'id';
  12. protected $table = 'ai_fastshop_article';
  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['title'] = trim($param['title']);
  19. $data['content'] = trim($param['content']);
  20. $data['update_time'] = time();
  21. if(isset($param['id'])){
  22. $condition['id'] = $param['id'];
  23. $condition['member_miniapp_id'] = $member_miniapp_id;
  24. return self::save($data,$condition);
  25. }else{
  26. $data['member_miniapp_id'] = $member_miniapp_id;
  27. return self::insert($data);
  28. }
  29. }
  30. }