Banner.php 1.2 KB

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