作者 郭盛
1 个管道 的构建 通过 耗费 1 秒

修改订单

@@ -123,49 +123,51 @@ class Iphone extends Backend @@ -123,49 +123,51 @@ class Iphone extends Backend
123 $row->validateFailException(true)->validate($validate); 123 $row->validateFailException(true)->validate($validate);
124 } 124 }
125 125
126 -  
127 - //未支付状态下才变更用户余额  
128 - if($data['status'] == 1){  
129 - if($params['status'] == 2){  
130 - //判断金额是否充足  
131 - if($user_info['money'] < $data['total']){  
132 - $this->error('您的余额不足,请充值后购买');  
133 - }else{  
134 -  
135 -  
136 - //用户购买的什么素材  
137 - if(empty($data['video_id'])){  
138 - $pic = Db::name('pic')->where('id',$data['pic_id'])->find();  
139 -  
140 - //发送短信,通知客户  
141 - $mobile = $user_info['mobile'];  
142 - $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。图片标题:$pic[title],云盘地址:$pic[url]";  
143 - //发送短信  
144 -  
145 - $this->sms($mobile,$content);  
146 -  
147 - }elseif (empty($data['pic_id'])){  
148 - $video_id = unserialize($data['video_id']);  
149 - $video = Db::name('video')->where('id',$video_id['id'])->find();  
150 - //发送短信,通知客户  
151 - $mobile = $user_info['mobile'];  
152 - if($video_id['attr'] == 1){  
153 - $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[two_url]";  
154 - }elseif ($video_id['attr'] == 2){  
155 - $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[four_url]";  
156 - }elseif ($video_id['attr'] == 3){  
157 - $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[eight_url]"; 126 + if($user_info['is_vip'] == 1){
  127 + //未支付状态下才变更用户余额
  128 + if($data['status'] == 1){
  129 + if($params['status'] == 2){
  130 + //判断金额是否充足
  131 + if($user_info['money'] < $data['total']){
  132 + $this->error('您的余额不足,请充值后购买');
  133 + }else{
  134 +
  135 +
  136 + //用户购买的什么素材
  137 + if(empty($data['video_id'])){
  138 + $pic = Db::name('pic')->where('id',$data['pic_id'])->find();
  139 +
  140 + //发送短信,通知客户
  141 + $mobile = $user_info['mobile'];
  142 + $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。图片标题:$pic[title],云盘地址:$pic[url]";
  143 + //发送短信
  144 +
  145 + $this->sms($mobile,$content);
  146 +
  147 + }elseif (empty($data['pic_id'])){
  148 + $video_id = unserialize($data['video_id']);
  149 + $video = Db::name('video')->where('id',$video_id['id'])->find();
  150 + //发送短信,通知客户
  151 + $mobile = $user_info['mobile'];
  152 + if($video_id['attr'] == 1){
  153 + $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[two_url]";
  154 + }elseif ($video_id['attr'] == 2){
  155 + $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[four_url]";
  156 + }elseif ($video_id['attr'] == 3){
  157 + $content = "【仁甲看见SHOP】,感谢您购买仁甲看见SHOP素材。视频标题:$video[title],云盘地址:$video[eight_url]";
  158 + }
  159 + //发送短信
  160 + $this->sms($mobile,$content);
158 } 161 }
159 - //发送短信  
160 - $this->sms($mobile,$content); 162 + $update = $user_info['money'] - $data['total'];
  163 + Db::name('user')->where('id',$user_info['id'])->update(['money'=>$update]);
161 } 164 }
162 - $update = $user_info['money'] - $data['total'];  
163 - Db::name('user')->where('id',$user_info['id'])->update(['money'=>$update]);  
164 } 165 }
165 } 166 }
166 } 167 }
167 168
168 169
  170 +
169 $result = $row->allowField(true)->save($params); 171 $result = $row->allowField(true)->save($params);
170 Db::commit(); 172 Db::commit();
171 } catch (ValidateException $e) { 173 } catch (ValidateException $e) {