初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model\order;
|
||||
|
||||
use think\Model;
|
||||
use think\Config;
|
||||
|
||||
class Pay extends Model
|
||||
{
|
||||
|
||||
/**
|
||||
* 获取支付方式
|
||||
* @return void
|
||||
*/
|
||||
public function getPayType(){
|
||||
|
||||
}
|
||||
|
||||
public function getDouyinPayParams($orderNo,$payNotifyUrl){
|
||||
|
||||
$data = (new \app\common\model\order\Order)->getOrderDetail($orderNo,['payment_json']);
|
||||
|
||||
if(!$data || $data['real_price'] == 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$amount = 0;
|
||||
foreach ($data['goodsList'] as $item){
|
||||
$amount += $item['count'];
|
||||
}
|
||||
|
||||
$skuDetail = [
|
||||
'skuId'=>(string)$data['goodsList'][0]['item_id'],//外部商品id,如:号卡商品id、会员充值套餐id、某类服务id、付费工具id等
|
||||
'price'=>(int)($data['real_price'] * 100),//价格,单位:分
|
||||
'quantity'=>$amount,//购买数量
|
||||
'title'=>$data['goodsList'][0]['snapshoot']['name'],//商品标题,长度 <= 256字节
|
||||
'imageList'=>[
|
||||
$data['goodsList'][0]['snapshoot']['cover']
|
||||
],//商品图片链接,长度 <= 512 字节注意:目前只支持传入一项
|
||||
'type'=>401,//商品类型
|
||||
'tagGroupId'=>'tag_group_7272625659888041996'//交易规则标签组
|
||||
];
|
||||
|
||||
$data = [
|
||||
'skuList'=>[
|
||||
$skuDetail
|
||||
],
|
||||
'payNotifyUrl'=>$payNotifyUrl,//支付结果通知地址,必须是 HTTPS 类型,传入后该笔订单将通知到此地址。
|
||||
'outOrderNo'=>$data['order_no'],//外部订单号
|
||||
'totalAmount'=>(int)($data['real_price'] * 100),//订单总金额单位:分
|
||||
'orderEntrySchema'=>[
|
||||
'path'=>'pages/order/detail/detail',//小程序xxx详情页跳转路径,没有前导的“/”,路径后不可携带query参数,路径中不可携带『?: & *』等特殊字符
|
||||
'params'=>json_encode([
|
||||
'order_no'=>$data['order_no']
|
||||
])//xx情页路径参数,自定义的json结构,内部为k-v结构,序列化成字符串存入该字段,平台不限制
|
||||
]//订单详情页
|
||||
];
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user