GreenAdwords.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. class GreenAdwords extends Model{
  11. protected $autoWriteTimestamp = true;
  12. protected $updateTime = false;
  13. //联盟城市
  14. public function operate(){
  15. return $this->hasOne('operate','id','operate_id');
  16. }
  17. //添加或编辑
  18. public function edit($param){
  19. $data['group'] = trim($param['group']);
  20. $data['title'] = trim($param['title']);
  21. $data['link'] = trim($param['link']);
  22. $data['picture'] = trim($param['picture']);
  23. $data['open_type'] = trim($param['open_type']);
  24. $data['update_time'] = time();
  25. if(isset($param['id'])){
  26. $condition['id'] = $param['id'];
  27. $condition['member_miniapp_id'] = $param['member_miniapp_id'];
  28. return self::save($data,$condition);
  29. }else{
  30. $data['create_time'] = time();
  31. $data['member_miniapp_id'] = $param['member_miniapp_id'];
  32. return self::insert($data);
  33. }
  34. }
  35. }