1. // 优惠卷修改
    2. public function foodcouponEdit()
    3. {
    4. // 获取所有的数据
    5. $couponEdit = I();
    6. // 接收优惠卷id
    7. $coupon_id = $_GET['id'];
    8. if(IS_POST){
    9. // 优惠卷名称
    10. $data['coupon_name'] = $couponEdit['coupon_name'];
    11. // 满减条件
    12. $data['coupon_condition'] = $couponEdit['coupon_condition'];
    13. // 面额
    14. $data['coupon_denomination'] = $couponEdit['coupon_denomination'];
    15. // 发布数量
    16. $data['coupon_num'] = $couponEdit['coupon_num'];
    17. // 发布时间
    18. $data['start_time'] = strtotime($couponEdit['year'].'/'.$couponEdit['month'].'/'.$couponEdit['day']);
    19. // 结束时间
    20. $data['end_time'] = strtotime($couponEdit['year1'].'/'.$couponEdit['month1'].'/'.$couponEdit['day1']);
    21. // 存表
    22. $couponEdits = D('foodcoupon')->where([
    23. 'id'=>$coupon_id
    24. ])->save($data);
    25. // 判断是否添加成功
    26. if($couponEdits !== false){
    27. $this->success('优惠卷修改成功',U('/addon/WeiuidDeit/web/foodcouponIndex'));
    28. } else {
    29. $this->error('优惠卷修改失败');
    30. }
    31. }