修复了在处理商户中间数据时可能出现的错误。

This commit is contained in:
mkm 2024-05-29 17:20:29 +08:00
parent d6d23b2fd0
commit 2e48b34364

View File

@ -92,8 +92,8 @@ class SupplierLogic extends BaseLogic
*/
public static function status(array $params): bool
{
$apply_info = Db::name('user_auth_shop')->where('id', $params['apply_id'])->find();
if(!$apply_info){
$auth_shop = Db::name('user_auth_shop')->where('id', $params['apply_id'])->find();
if(!$auth_shop){
self::setError('商户中间数据不存在');
return false;
}
@ -144,7 +144,7 @@ class SupplierLogic extends BaseLogic
];
Supplier::where('id', $params['id'])->update(['status' => 1, 'uid' => $res1['id']]);
Db::name('user_auth_shop')->where('id', $params['apply_id'])->update($data);
Db::name('user_auth_shop')->where('id', $auth_shop['id'])->update($data);
}
if ($params['status'] == 0) {
$data = [
@ -154,11 +154,11 @@ class SupplierLogic extends BaseLogic
Supplier::where('id', $params['id'])->update([
'status' => 0,
]);
Db::name('user_auth_shop')->where('id', $apply_info['id'])->update($data);
Db::name('user_auth_shop')->where('id', $auth_shop['id'])->update($data);
}
if (!empty($apply_info['jg_register_id'])) {
(new JgPushService())->sendMsg($apply_info['jg_register_id'], '您的供应入驻请求审核' . ($params['status'] == 1 ? '通过' : '被拒绝'), '/pages/bindSupplier/index');
if (!empty($auth_shop['jg_register_id'])) {
(new JgPushService())->sendMsg($auth_shop['jg_register_id'], '您的供应入驻请求审核' . ($params['status'] == 1 ? '通过' : '被拒绝'), '/pages/bindSupplier/index');
}
Db::commit();
return true;