91 lines
2.6 KiB
PHP
91 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\logic\merchant;
|
|
|
|
|
|
use app\common\logic\BaseLogic;
|
|
use app\common\model\auth\Admin;
|
|
use app\common\model\bank\Bank;
|
|
use app\common\model\merchant\MerchantBank;
|
|
use app\common\service\JgPushService;
|
|
use think\facade\Db;
|
|
|
|
|
|
/**
|
|
* MerchantBank逻辑
|
|
* Class MerchantBankLogic
|
|
* @package app\admin\logic\merchant
|
|
*/
|
|
class MerchantBankLogic extends BaseLogic
|
|
{
|
|
/**
|
|
* @notes 审核
|
|
* @param array $params
|
|
* @return bool
|
|
* @author likeadmin
|
|
* @date 2024/05/13 15:06
|
|
*/
|
|
public static function check($params,$admin_id){
|
|
$data = MerchantBank::where('id',$params['id'])->findOrEmpty();
|
|
if($data['is_check'] != 0){
|
|
self::setError("已审核,无需重新审核");
|
|
return false;
|
|
}
|
|
if(!empty($data['supplier_id'])){
|
|
$user_auth_shop = Db::name('user_auth_shop')->field('jg_register_id')->where('pid',$data['supplier_id'])->where('type',2)->findOrEmpty();
|
|
}else{
|
|
$user_auth_shop = Db::name('user_auth_shop')->field('jg_register_id')->where('pid',$data['mer_id'])->where('type',1)->findOrEmpty();
|
|
}
|
|
Db::startTrans();
|
|
try {
|
|
MerchantBank::where('id',$params['id'])->update([
|
|
'is_check' => $params['is_check'],
|
|
'fail_msg' => $params['fail_msg'],
|
|
'admin_id' => $admin_id,
|
|
'update_time' => time()
|
|
]);
|
|
if(!empty($user_auth_shop['jg_register_id'])){
|
|
(new JgPushService()) -> sendMsg($user_auth_shop['jg_register_id'],'您的银行卡绑定申请'.($params['is_check']==1?'已审核通过':'审核未通过'),'/pages/quote/supplierFinancialy');
|
|
}
|
|
Db::commit();
|
|
return true;
|
|
} catch (\Exception $e) {
|
|
Db::rollback();
|
|
self::setError($e->getMessage());
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除
|
|
* @param array $params
|
|
* @return bool
|
|
* @author likeadmin
|
|
* @date 2024/05/13 15:06
|
|
*/
|
|
public static function delete(array $params): bool
|
|
{
|
|
return MerchantBank::destroy($params['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取详情
|
|
* @param $params
|
|
* @return array
|
|
* @author likeadmin
|
|
* @date 2024/05/13 15:06
|
|
*/
|
|
public static function detail($params): array
|
|
{
|
|
$data = MerchantBank::findOrEmpty($params['id']);
|
|
$admin = Admin::field('name')->where('id',$data['admin_id'])->findOrEmpty();
|
|
$bank = Bank::field('name,image')->where('id',$data['bank_id'])->findOrEmpty();
|
|
$data['admin_name'] = !$admin->isEmpty() ? $admin['name'] : '';
|
|
$data['bank_info'] = $bank;
|
|
$data['is_own_text'] = $data['is_own'] == 0 ? '个人账户' : '对公账户';
|
|
$data['is_check_text'] = $data->is_check_text;
|
|
return $data->toArray();
|
|
}
|
|
} |