更新商户申请

This commit is contained in:
yaooo 2023-09-19 10:55:01 +08:00
parent fa00a574e5
commit 7168f81644
4 changed files with 17 additions and 12 deletions

View File

@ -31,6 +31,8 @@ class MerchantIntentionDao extends BaseDao
$query->where('uid', $where['uid']);
})->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) {
$query->where('status', (int)$where['status']);
})->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) {
$query->where('type', (int)$where['type']);
})->when(isset($where['mer_intention_id']) && $where['mer_intention_id'] !== '', function ($query) use ($where) {
$query->where('mer_intention_id', $where['mer_intention_id']);
})->when(isset($where['category_id']) && $where['category_id'] !== '', function ($query) use ($where) {

View File

@ -1362,8 +1362,8 @@ class Auth extends BaseController
$repository = app()->make(MerchantIntentionRepository::class);
if (!$repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
return app('json')->fail('数据不存在');
$status = $this->request->params('status', 0);
$type = $this->request->params('type', 1);
$status = $this->request->post('status', 0);
$type = $this->request->post('type', 1);
if ($type == 1) {
//商户入驻申请
$data['status'] = $status;
@ -1383,7 +1383,13 @@ class Auth extends BaseController
public function businessAgree()
{
$repository = app()->make(CacheRepository::class);
$data = $repository->getResult('business_apply_agree');
//sys_intention_agree business_apply_agree
$type = $this->request->get('type', 'sys_intention_agree');
$typeArray = ['sys_intention_agree', 'business_apply_agree'];
if (!in_array($type, $typeArray)) {
return app('json')->fail('协议key错误');
}
$data = $repository->getResult($type);
return app('json')->success($data);
}
}

View File

@ -138,12 +138,7 @@ class MerchantIntention extends BaseController
Db::name('merchant')->where('uid', $this->userInfo->uid)->where('status', 1)->update(['business_status'=>1]);
$intenInfoArray = $intenInfo->toArray();
$intenInfoArray['type'] = 1;
$bussIntention = Db::name('merchant_intention')->where('mer_intention_id', $intenInfo['mer_intention_id'])->where('type', 2)->find();
if ($bussIntention) {
Db::name('merchant_intention')->where('mer_intention_id', $intenInfo['mer_intention_id'])->where('type', 2)->update($intenInfoArray);
}else {
Db::name('merchant_intention')->insert($intenInfoArray);
}
Db::name('merchant_intention')->insert($intenInfoArray);
return app('json')->success('申请成功');
}
@ -236,7 +231,8 @@ class MerchantIntention extends BaseController
public function lst()
{
[$page, $limit] = $this->getPage();
$data = $this->repository->getList(['uid' => $this->userInfo->uid], $page, $limit);
$type = $this->request->get('type', 1);
$data = $this->repository->getList(['uid' => $this->userInfo->uid, 'type'=>$type], $page, $limit);
return app('json')->success($data);
}

View File

@ -253,6 +253,8 @@ Route::group('api/', function () {
//申请商户
Route::get('intention/lst', 'api.store.merchant.MerchantIntention/lst');
//交易申请商户
Route::post('intention/business', 'api.store.merchant.MerchantIntention/businessApply');
Route::get('intention/detail/:id', 'api.store.merchant.MerchantIntention/detail');
Route::post('intention/update/:id', 'api.store.merchant.MerchantIntention/update');
Route::post('store/product/group/cancel', 'api.store.product.StoreProductGroup/cancel');
@ -555,8 +557,7 @@ Route::group('api/', function () {
Route::post('upload/video', 'merchant.Common/uploadVideo');
Route::get('excel/download/:id', 'merchant.store.order.Order/download');
//申请商户
Route::post('intention/business', 'api.store.merchant.MerchantIntention/businessApply');
Route::post('intention/create', 'api.store.merchant.MerchantIntention/create');
Route::get('intention/cate', 'api.store.merchant.MerchantIntention/cateLst');
Route::get('intention/v2/cate', 'api.store.merchant.MerchantIntention/v2CateLst');