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

修改支付接口

... ... @@ -472,7 +472,7 @@ class Common
$data1['total_goods_price'] = $data['total_goods_price'];//商品金额
$data1['discount_price'] = $data['discount_price'];//优惠金额
$data1['total_expense_price'] = $data['total_expense_price'];//运费总金额
$data1['total_price'] = $data['total_goods_price'] + $data['total_expense_price'] - $data['discount_price'];//商+运-优惠
$data1['total_price'] = $data['total_price'];//商+运-优惠
$orderModel = new Order();
$res1 = $orderModel->create($data1);
//写入订单附加表
... ...
... ... @@ -138,6 +138,7 @@ class Pay extends Api
* @ApiParams (name="total_goods_price", type="inter", required=true, description="商品总金额")
* @ApiParams (name="discount_price", type="inter", required=true, description="优惠金额")
* @ApiParams (name="total_expense_price", type="inter", required=true, description="运费总金额")
* @ApiParams (name="total_price", type="inter", required=true, description="运费总金额")
*/
public function purchase(){
if($this->request->isPost()){
... ... @@ -159,7 +160,7 @@ class Pay extends Api
$result = $app->order->unify([
'body' => '佛山市理想中网络科技有限公司',
'out_trade_no' => $pay_order_sn,//支付订单号
'total_fee' => $data['security_price']*100,//单位分
'total_fee' => $data['total_price']*100,//单位分
'notify_url' => $ffg_host.'/api/pay/purchaseNotify', // 支付结果通知网址,如果不设置则会使用配置里的默认地址
'trade_type' => 'JSAPI', // 请对应换成你的支付方式对应的值类型
'openid' => $data['openid'],
... ...
... ... @@ -187,6 +187,7 @@ return [
'total_goods_price' => 'require|number',
'discount_price' => 'require|number',
'total_expense_price'=> 'require|number',
'total_price' => 'require|number',
],
'msg' => [
'receive_name.require' => '收货人不能为空',
... ... @@ -203,6 +204,8 @@ return [
'discount_price.number' => '优惠金额必须为数字',
'total_expense_price.require' => '运费总金额不能为空',
'total_expense_price.number' => '运费总金额必须为数字',
'total_price.require' => '支付金额不能为空',
'total_price.number' => '支付金额必须为数字',
]
],
//支付订单
... ...
... ... @@ -5806,6 +5806,12 @@
<td></td>
<td>运费总金额</td>
</tr>
<tr>
<td>total_price</td>
<td>inter</td>
<td></td>
<td>运费总金额</td>
</tr>
</tbody>
</table>
</div>
... ... @@ -5888,6 +5894,10 @@
<input type="inter" class="form-control input-sm" id="total_expense_price" required placeholder="运费总金额" name="total_expense_price">
</div>
<div class="form-group">
<label class="control-label" for="total_price">total_price</label>
<input type="inter" class="form-control input-sm" id="total_price" required placeholder="运费总金额" name="total_price">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="36">提交</button>
<button type="reset" class="btn btn-info" rel="36">重置</button>
</div>
... ... @@ -7375,7 +7385,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2019-12-07 14:29:51 </div>
Generated on 2019-12-07 15:25:46 </div>
<div class="col-md-6" align="right">
<a href="https://www.fastadmin.net" target="_blank">FastAdmin</a>
</div>
... ...