This commit is contained in:
mkm 2024-05-23 09:57:19 +08:00
parent cd9eb33f8f
commit c911a4f951
8 changed files with 180 additions and 70 deletions

View File

@ -6,6 +6,7 @@ namespace app\admin\controller\merchat;
use app\admin\controller\BaseAdminController; use app\admin\controller\BaseAdminController;
use app\admin\lists\merchant\MerchantLists; use app\admin\lists\merchant\MerchantLists;
use app\admin\logic\merchant\MerchantLogic; use app\admin\logic\merchant\MerchantLogic;
use app\admin\validate\bank\BankValidate;
use app\admin\validate\merchant\MerchantValidate; use app\admin\validate\merchant\MerchantValidate;
use app\common\model\goods\Goods; use app\common\model\goods\Goods;
use app\common\model\goods\GoodsLabel; use app\common\model\goods\GoodsLabel;
@ -164,6 +165,19 @@ class MerchantController extends BaseAdminController
} }
return $this->fail('绑定失败'); return $this->fail('绑定失败');
} }
/**
* @notes 绑定银行卡
*/
public function bind_bank()
{
$params = (new BankValidate())->post()->goCheck('BindBank');
$result = MerchantLogic::bind_bank($params);
if (true === $result) {
return $this->success('设置成功', [], 1, 1);
}
return $this->fail(MerchantLogic::getError());
}
/** /**
* @notes 绑定商品 * @notes 绑定商品

View File

@ -3,12 +3,14 @@
namespace app\admin\logic\merchant; namespace app\admin\logic\merchant;
use app\admin\logic\user\UserLogic; use app\admin\logic\user\UserLogic;
use app\admin\service\JgPushService; use app\common\service\JgPushService;
use app\common\enum\OrderEnum; use app\common\enum\OrderEnum;
use app\common\model\merchant\Merchant; use app\common\model\merchant\Merchant;
use app\common\logic\BaseLogic; use app\common\logic\BaseLogic;
use app\common\model\financial\FinancialRecord; use app\common\model\financial\FinancialRecord;
use app\common\model\merchant\MerchantBank;
use app\common\model\user\User; use app\common\model\user\User;
use app\common\service\ThinkApi;
use think\facade\Db; use think\facade\Db;
use support\exception\BusinessException; use support\exception\BusinessException;
@ -195,7 +197,8 @@ class MerchantLogic extends BaseLogic
/** /**
* @notes 设置余额 * @notes 设置余额
*/ */
public static function set_money($id,$set_money,$type=1){ public static function set_money($id, $set_money, $type = 1)
{
Db::startTrans(); Db::startTrans();
try { try {
if ($type == 1) { if ($type == 1) {
@ -275,7 +278,68 @@ class MerchantLogic extends BaseLogic
return false; return false;
} }
} }
/**
* @notes 商户绑定银行卡
* @param array $params
* @return bool
* @date 2024/04/23 16:35
*/
public static function bind_bank(array $params): bool
{
$merchant = Merchant::where('mer_id', $params['mer_id'])->findOrEmpty();
$user=User::where('id',$merchant['uid'])->field('real_name','mobile')->find();
if (!$merchant) {
self::setError('商户不存在');
return false;
}
if(!$user){
self::setError('没有绑定用户');
return false;
}
if ($params['is_own'] == 0) {
$info = [
'name' => $params['name'],
'idNum' => $params['id_card'],
'cardNo' => $params['bank_code'],
'mobile' => $user['mobile'],
];
$thinkApi = new ThinkApi();
$result = $thinkApi->request('bankcard/auth', $info);
if ($result['code'] != 0 || empty($result['data'])) {
self::setError($result['message']);
return false;
}
//认证结果。01一致 02不一致 03认证不确定 04认证失败。01、02收费
if ($result['data']['result'] == 4 || $result['data']['result'] == 2) {
self::setError('认证失败,请检查姓名,身份证,银行卡,银行预留手机号码是否正确');
return false;
}
}
Db::startTrans();
try {
$save_data = [
'mer_id' => $params['mer_id'],
'name' => $params['name'],
'bank_id' => $params['bank_id'],
'bank_code' => $params['bank_code'],
'bank_branch' => $params['bank_branch'],
'phone' => $user['mobile'],
'id_card' => $params['id_card'] ?? '',
'financial_img' => $params['financial_img'],
'is_own' => $params['is_own'],
'is_check' => 1,
'create_time' => time()
];
//写入数据
(new MerchantBank)->save($save_data);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/** /**
* @notes 删除商户列表 * @notes 删除商户列表

View File

@ -3,7 +3,7 @@
namespace app\admin\logic\supplier; namespace app\admin\logic\supplier;
use app\admin\logic\user\UserLogic; use app\admin\logic\user\UserLogic;
use app\admin\service\JgPushService; use app\common\service\JgPushService;
use app\common\enum\OrderEnum; use app\common\enum\OrderEnum;
use app\common\model\goods\GoodsLabel; use app\common\model\goods\GoodsLabel;
use app\common\model\merchant\MerchantBank; use app\common\model\merchant\MerchantBank;

View File

@ -22,6 +22,10 @@ class BankValidate extends BaseValidate
'id' => 'require', 'id' => 'require',
'name' => 'require', 'name' => 'require',
'image' => 'require', 'image' => 'require',
'bank_id' => 'require',
'bank_code' => 'require',
'bank_branch' => 'require',
'financial_img' => 'require',
]; ];
@ -33,9 +37,22 @@ class BankValidate extends BaseValidate
'id' => 'id', 'id' => 'id',
'name' => '银行名称', 'name' => '银行名称',
'image' => '银行图片', 'image' => '银行图片',
'bank_id' => '开户银行',
'bank_code' => '银行账号',
'bank_branch' => '开户网点',
'financial_img' => '图片证明',
]; ];
/**
* @notes 状态场景
* @return MerchantValidate
* @author likeadmin
* @date 2024/04/23 16:35
*/
public function sceneBindBank()
{
return $this->only(['name', 'bank_code','bank_id','bank_branch','financial_img']);
}
/** /**
* @notes 添加场景 * @notes 添加场景
* @return BankValidate * @return BankValidate

View File

@ -56,7 +56,7 @@ class MerchantController extends BaseApiController
} }
/** /**
* 提现信息 * 提现总次数和金额
*/ */
public function taking_info() public function taking_info()
{ {

View File

@ -24,7 +24,7 @@ class IndexController extends BaseApiController{
} }
$res=ShopLogic::auth($token,$jg_register_id); $res=ShopLogic::auth($token,$jg_register_id);
if(ShopLogic::hasError()||$res==false){ if(ShopLogic::hasError()||$res==false){
return $this->fail('没有授权信息'); return $this->success('没有授权信息');
}else{ }else{
return $this->success('ok',['token'=>$res]); return $this->success('ok',['token'=>$res]);
} }
@ -112,7 +112,7 @@ class IndexController extends BaseApiController{
} }
} }
} }
return $this->fail('没有授权信息'); return $this->success('没有授权信息');
} }
/** /**
* 申请详情 * 申请详情

View File

@ -1,6 +1,6 @@
<?php <?php
namespace app\admin\service; namespace app\common\service;
use JPush\Client; use JPush\Client;
use support\Log; use support\Log;

View File

@ -3,13 +3,16 @@
namespace app\queue\redis; namespace app\queue\redis;
use app\admin\logic\operation\OpurchaseclassLogic; use app\admin\logic\operation\OpurchaseclassLogic;
use app\common\model\opurchase\OpurchaseGoodsOffer;
use app\common\model\opurchase\Opurchaseinfo; use app\common\model\opurchase\Opurchaseinfo;
use app\common\service\JgPushService;
use Webman\RedisQueue\Consumer; use Webman\RedisQueue\Consumer;
use Webman\Push\Api;
use support\exception\BusinessException;
use support\Log; use support\Log;
use think\facade\Db; use think\facade\Db;
/**
* 推送给供应商报价
*/
class PushSupplierProductsSend implements Consumer class PushSupplierProductsSend implements Consumer
{ {
// 要消费的队列名 // 要消费的队列名
@ -26,6 +29,18 @@ class PushSupplierProductsSend implements Consumer
foreach ($select as $key => $arr) { foreach ($select as $key => $arr) {
OpurchaseclassLogic::createSupplierGoods($arr); OpurchaseclassLogic::createSupplierGoods($arr);
} }
$supplier_id_arr=OpurchaseGoodsOffer::where('order',$order_id)->whereDay('create_time')->column('supplier_id');
if($supplier_id_arr){
$supplier_id_arr=array_unique($supplier_id_arr);
foreach($supplier_id_arr as $key => $supplier_id){
$jg_register_id=Db::name('user_auth_shop')-> where('pid',$supplier_id)->where('type',2)->value('jg_register_id');
if($jg_register_id){
(new JgPushService())->sendMsg($jg_register_id, '您有一笔新的报价清单,请及时处理', '/pages/quote/list',2);
}
}
}
} }
public function onConsumeFailure(\Throwable $e, $package) public function onConsumeFailure(\Throwable $e, $package)
{ {