<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 核销
 */
namespace app\allwin\model;
use think\Model;

class AllwinUnmarketBooking extends Model{

    protected $pk = 'id';
        
    //添加或编辑
    public static function edit(array $param){
        $data = [
            'union_id'   => trim($param['union_id']),
            'store_name' => trim($param['store_name']),
            'name'       => trim($param['name']),
            'telphone'   => trim($param['telphone']),
        ];
        if(isset($param['id'])){
            $condition['id']                = $param['id'];
            $condition['member_miniapp_id'] = $param['member_miniapp_id'];
            return self::where($condition)->update($data);
        }else{
            $data['create_time']      = time();
            $data['member_miniapp_id'] = $param['member_miniapp_id'];
            return self::insert($data);
        }
    }
}