正在显示
1 个修改的文件
包含
20 行增加
和
8 行删除
@@ -139,9 +139,9 @@ class Wxpay extends Api | @@ -139,9 +139,9 @@ class Wxpay extends Api | ||
139 | $porderModel = new Porder(); | 139 | $porderModel = new Porder(); |
140 | $porderModel->where(['pay_order_sn'=>$data['out_trade_no']])->update(['status'=>$this->order_status[1]]); | 140 | $porderModel->where(['pay_order_sn'=>$data['out_trade_no']])->update(['status'=>$this->order_status[1]]); |
141 | //下面这句必须要执行,且在此之前不能有任何输出 | 141 | //下面这句必须要执行,且在此之前不能有任何输出 |
142 | - echo $pay->success(); | 142 | + $this->success('成功',$pay->success()); |
143 | } | 143 | } |
144 | - return; | 144 | + $this->success(); |
145 | } | 145 | } |
146 | 146 | ||
147 | /** | 147 | /** |
@@ -156,10 +156,23 @@ class Wxpay extends Api | @@ -156,10 +156,23 @@ class Wxpay extends Api | ||
156 | $this->success("恭喜你!支付成功!"); | 156 | $this->success("恭喜你!支付成功!"); |
157 | return; | 157 | return; |
158 | } | 158 | } |
159 | - | 159 | + /** |
160 | + * @ApiTitle (充值) | ||
161 | + * @ApiSummary (充值) | ||
162 | + * @ApiMethod (POST) | ||
163 | + * @ApiRoute (/api/wxpay/toPay) | ||
164 | + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") | ||
165 | + * @ApiParams (name="o_id", type="integer", required=true, description="订单id") | ||
166 | + * @ApiReturn ({ | ||
167 | + "code": 1, | ||
168 | + "msg": "成功", | ||
169 | + "time": "1554184134", | ||
170 | + "data": null | ||
171 | + }) | ||
172 | + */ | ||
160 | public function payCharge(){ | 173 | public function payCharge(){ |
161 | if($this->request->isPost()){ | 174 | if($this->request->isPost()){ |
162 | - $amount = $this->request->request('amount'); | 175 | + $amount = $this->request->post('amount'); |
163 | $openid = $this->request->post('openid');//小程序传递openid | 176 | $openid = $this->request->post('openid');//小程序传递openid |
164 | if(empty($openid)){ | 177 | if(empty($openid)){ |
165 | $this->error("openid必填"); | 178 | $this->error("openid必填"); |
@@ -173,7 +186,6 @@ class Wxpay extends Api | @@ -173,7 +186,6 @@ class Wxpay extends Api | ||
173 | $order = [ | 186 | $order = [ |
174 | 'out_trade_no' => $pay_order_sn,//支付订单号 | 187 | 'out_trade_no' => $pay_order_sn,//支付订单号 |
175 | 'body' => '广西小纸皮再生资源回收有限公司', | 188 | 'body' => '广西小纸皮再生资源回收有限公司', |
176 | -// 'total_fee' => 1, | ||
177 | 'total_fee' => floatval($amount)*100,//单位:分 | 189 | 'total_fee' => floatval($amount)*100,//单位:分 |
178 | 'openid' => $openid, | 190 | 'openid' => $openid, |
179 | 'notify_url' => url('api/Wxpay/notifyCharge','','',true), | 191 | 'notify_url' => url('api/Wxpay/notifyCharge','','',true), |
@@ -203,11 +215,11 @@ class Wxpay extends Api | @@ -203,11 +215,11 @@ class Wxpay extends Api | ||
203 | $money = $data['total_fee']/100; | 215 | $money = $data['total_fee']/100; |
204 | $account = $accountModel::create(['uid'=>$user['id'],'type'=>config('site.pay_charge'),'money'=>$money]); | 216 | $account = $accountModel::create(['uid'=>$user['id'],'type'=>config('site.pay_charge'),'money'=>$money]); |
205 | $messageModel = new Message(); | 217 | $messageModel = new Message(); |
206 | - $messageModel::create(['aid'=>$account->id,'title'=>config('site.message')]); | 218 | + $messageModel::create(['account_id'=>$account->id,'title'=>config('site.message')]); |
207 | //下面这句必须要执行,且在此之前不能有任何输出 | 219 | //下面这句必须要执行,且在此之前不能有任何输出 |
208 | - echo $pay->success(); | 220 | + $this->success('成功',$pay->success()); |
209 | } | 221 | } |
210 | - return; | 222 | + $this->success(); |
211 | } | 223 | } |
212 | 224 | ||
213 | } | 225 | } |
-
请 注册 或 登录 后发表评论