|
|
@@ -22,7 +22,7 @@ use think\facade\Log;
|
|
|
class DouYinService
|
|
|
{
|
|
|
protected static int $terminal = \app\common\enum\user\UserTerminalEnum::DOUYIN;
|
|
|
- protected static int $external_platform_id = 7;
|
|
|
+ protected static int $external_platform_id = 6;
|
|
|
public static function register(array $params)
|
|
|
{
|
|
|
$userSn = User::createUserSn();
|
|
|
@@ -95,7 +95,7 @@ class DouYinService
|
|
|
throw new \Exception('请先补充您的联系方式后在提交订单');
|
|
|
}
|
|
|
// TODO tmp防抖1m
|
|
|
- $isExist = DouyinOrder::where(['user_id'=>$params['user_id'],'goods_id'=>$goods['goods_id']])->where('create_time','>',(time() - 60))->findOrEmpty();
|
|
|
+ $isExist = DouyinOrder::where(['user_id'=>$params['user_id'],'goods_id'=>$goods['id']])->where('create_time','>',(time() - 60))->findOrEmpty();
|
|
|
if(!$isExist->isEmpty()){
|
|
|
throw new \Exception('请勿重复下单!');
|
|
|
}
|
|
|
@@ -106,7 +106,7 @@ class DouYinService
|
|
|
'mobile' => $params['user_info']['mobile'],
|
|
|
'title' => $goods['goods_name'],
|
|
|
|
|
|
- 'goods_id'=>$goods['goods_id'],
|
|
|
+ 'goods_id'=>$goods['id'],
|
|
|
'unit_price' => $goods['service_fee'],
|
|
|
'quantity' => $quantity,
|
|
|
'total_amount' => $goods['service_fee'] * $quantity,
|
|
|
@@ -123,13 +123,13 @@ class DouYinService
|
|
|
|
|
|
public static function payNotify($params)
|
|
|
{
|
|
|
- Log::write($params,JSON_UNESCAPED_UNICODE);
|
|
|
+ //Log::write(json_encode($params));
|
|
|
|
|
|
// 查询抖音订单是否完成支付
|
|
|
|
|
|
if ($params['trade_state'] === 'SUCCESS') {
|
|
|
- $transaction_id = '';
|
|
|
- $paid_amount = '';
|
|
|
+ $transaction_id = $params['transaction_id']??'';
|
|
|
+ $paid_amount = $params['paid_amount']??0;
|
|
|
$out_trade_no = $params['out_trade_no'];
|
|
|
$order = DouyinOrder::where('order_number', $out_trade_no)->findOrEmpty();
|
|
|
if(!$order->isEmpty()){
|
|
|
@@ -149,13 +149,13 @@ class DouYinService
|
|
|
];
|
|
|
$consultation = ExternalConsultation::create([
|
|
|
'external_platform_id' => self::$external_platform_id,
|
|
|
- 'form_detail' => $form_detail,
|
|
|
+ 'form_detail' => json_encode($form_detail),
|
|
|
'user_name' => $user['real_name']??'',
|
|
|
'mobile' => $user['mobile'],
|
|
|
'goods_id' => $order->goods_id,
|
|
|
'amount' => $paid_amount
|
|
|
]);
|
|
|
- $order->consultation_id = $consultation['id'];
|
|
|
+ $order->consultation_id = $consultation->id;
|
|
|
$order->save();
|
|
|
return true;
|
|
|
}
|
|
|
@@ -164,6 +164,10 @@ class DouYinService
|
|
|
}
|
|
|
public static function reservation($params)
|
|
|
{
|
|
|
+ $lon_lat = get_address_lat_lng($params['user_address']);
|
|
|
+ $params['lon'] = $lon_lat['lon'];
|
|
|
+ $params['lat'] = $lon_lat['lat'];
|
|
|
+
|
|
|
// $params['order_number']
|
|
|
Db::startTrans();
|
|
|
try {
|