|
@@ -2271,13 +2271,22 @@ class StoreOrder extends BaseModel
|
|
|
if (!$order) return self::setErrorInfo('找不到订单');
|
|
|
if (!$order['transaction_id']) return true;
|
|
|
$store = SystemStore::get($order['store_id']);
|
|
|
- if (!$store) return true;
|
|
|
+ if (!$store) {
|
|
|
+ MiniProgramService::profit_sharing_finish($order['transaction_id'], $order['order_id']);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
$store_leader = SystemAdmin::where('roles', sys_config('default_store_admin', 7))
|
|
|
->where('store_id', $store['id'])->where('is_del', 0)->where('status', 1)
|
|
|
->find();
|
|
|
- if (!$store_leader) return true;
|
|
|
+ if (!$store_leader) {
|
|
|
+ MiniProgramService::profit_sharing_finish($order['transaction_id'], $order['order_id']);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
$user = User::where('admin_id', $store_leader['id'])->find();
|
|
|
- if (!$user) return true;
|
|
|
+ if (!$user) {
|
|
|
+ MiniProgramService::profit_sharing_finish($order['transaction_id'], $order['order_id']);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
$p_user_info = WechatUser::get($user['uid']);
|
|
|
// 选择发起人的订单作为分账的账单
|
|
|
$transaction_id = $order['transaction_id']; // 微信订单号
|
|
@@ -2289,7 +2298,10 @@ class StoreOrder extends BaseModel
|
|
|
|
|
|
$p_separate_account_amount = floor($p_amount * 100); // 发起人分账金额,以分为单位
|
|
|
|
|
|
- if ($p_separate_account_amount <= 0) return true;
|
|
|
+ if ($p_separate_account_amount <= 0) {
|
|
|
+ MiniProgramService::profit_sharing_finish($order['transaction_id'], $order['order_id']);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
$receivers[] = array(
|
|
|
'type' => 'PERSONAL_OPENID',
|
|
@@ -2325,8 +2337,8 @@ class StoreOrder extends BaseModel
|
|
|
$value['end_time'] = time();
|
|
|
$value->save();
|
|
|
}
|
|
|
- MiniProgramService::profit_sharing_finish($order['transaction_id'], $order['order_id']);
|
|
|
}
|
|
|
+ MiniProgramService::profit_sharing_finish($order['transaction_id'], $order['order_id']);
|
|
|
}
|
|
|
return true;
|
|
|
}
|