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

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