Times.php 877 B

1234567891011121314151617181920212223242526272829
  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 Times extends Model{
  11. protected $pk = 'id';
  12. protected $table = 'ai_fastshop_times';
  13. //添加或编辑
  14. public function edit($param){
  15. $data['name'] = trim($param['name']);
  16. $data['sort'] = trim($param['sort']);
  17. $data['start_time'] = $param['start_time'];
  18. $data['end_time'] = $param['end_time'];
  19. if(isset($param['id'])){
  20. return self::update($data,['id'=>(int)$param['id']]);
  21. }else{
  22. $data['member_miniapp_id'] = $param['member_miniapp_id'];
  23. return self::insert($data);
  24. }
  25. }
  26. }