diff --git a/app/common/dao/system/merchant/MerchantIntentionDao.php b/app/common/dao/system/merchant/MerchantIntentionDao.php index 67a4a579..e74f2de1 100644 --- a/app/common/dao/system/merchant/MerchantIntentionDao.php +++ b/app/common/dao/system/merchant/MerchantIntentionDao.php @@ -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) { diff --git a/app/controller/api/Auth.php b/app/controller/api/Auth.php index c70cd9ad..fbe60792 100644 --- a/app/controller/api/Auth.php +++ b/app/controller/api/Auth.php @@ -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); } } diff --git a/app/controller/api/store/merchant/MerchantIntention.php b/app/controller/api/store/merchant/MerchantIntention.php index db9c0a39..15125759 100644 --- a/app/controller/api/store/merchant/MerchantIntention.php +++ b/app/controller/api/store/merchant/MerchantIntention.php @@ -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); } diff --git a/route/api.php b/route/api.php index 45b7185a..7c5d18e0 100644 --- a/route/api.php +++ b/route/api.php @@ -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');