AisVip.php 774 B

1234567891011121314151617181920212223242526
  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\ais\model;
  9. use think\Model;
  10. class AisVip extends Model{
  11. //编辑创客的关联的优惠券
  12. public static function editCoupon(int $id,$coupon_ids){
  13. $info = self::where(['id' => $id])->find();
  14. if(empty($info->coupon_ids)){
  15. $info->coupon_ids = implode(',',$coupon_ids);
  16. }else{
  17. $coupon_ida = explode(',',$info->coupon_ids);
  18. $ida = array_merge($coupon_ida,$coupon_ids);
  19. $info->coupon_ids = implode(',',$ida);
  20. }
  21. return $info->save();
  22. }
  23. }