<?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\ais\model;
use think\Model;

class AisVip extends Model{
    
    //编辑创客的关联的优惠券
    public static function editCoupon(int $id,$coupon_ids){
        $info = self::where(['id' => $id])->find();
        if(empty($info->coupon_ids)){
            $info->coupon_ids = implode(',',$coupon_ids);
        }else{
            $coupon_ida = explode(',',$info->coupon_ids);
            $ida        = array_merge($coupon_ida,$coupon_ids);
            $info->coupon_ids = implode(',',$ida);
        }
        return $info->save();
    }
    
}