This commit is contained in:
luofei 2024-03-21 10:23:49 +08:00
commit ff2d4582b2
4 changed files with 44 additions and 2 deletions

View File

@ -45,4 +45,10 @@ class Enum
self::SALE_TYPE_WHOLESALE => '批发',
];
/**
* 申请商户身份
*/
const RetailMerchants = 24;//批发零售商户
const TypeSupplyChain = 12;//批发商户
}

View File

@ -47,7 +47,6 @@ class MerchantIntention extends BaseController
{
[$page, $limit] = $this->getPage();
$where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type']);
$where['type'] = [3,4];//批发零售
return app('json')->success($this->repository->getMoreList($where, $page, $limit));
}

View File

@ -12,6 +12,7 @@
namespace app\controller\api\store\merchant;
use app\common\Enum;
use app\common\model\system\merchant\Merchant;
use app\common\repositories\system\merchant\MerchantAdminRepository;
use app\common\repositories\system\merchant\MerchantCategoryRepository;
@ -316,6 +317,17 @@ class MerchantIntention extends BaseController
if(empty($data['type'])){
return app('json')->fail('参数缺失请检查');
}
if($data['type'] == 3){
$data['type'] = Enum::TypeSupplyChain;
}else{
$data['type'] = Enum::RetailMerchants;
}
$checkIntention = \app\common\model\system\merchant\MerchantIntention::getDB()->where('mer_id',$data['mer_id'])->where('status',0)->count();
if($checkIntention){
return app('json')->fail('有尚未通过的申请');
}
$merchantInfo = Merchant::getDB()->where('mer_id',$data['mer_id'])->find();
if(empty($merchantInfo)) return app('json')->fail('没有该商户');
$data['uid'] = $merchantInfo->uid;
@ -327,14 +339,37 @@ class MerchantIntention extends BaseController
$data['status'] = 0;
$data['create_time'] = date('Y-m-d H:i:s',time());
$intention = $this->repository->create($data);
if ($intention) {
return app('json')->success('申请更改商户身份成功');
return app('json')->success('申请更改商户身份成功,等待审核');
} else {
return app('json')->fail('申请更改商户身份失败');
}
}
public function deatail()
{
$id = $this->request->params([
'uid'
]);
$list = \app\common\model\system\merchant\MerchantIntention::getDB()->alias('i')
->leftjoin('merchant_type m','m.mer_type_id = i.mer_type_id')
->where('uid',$id['uid'])
->whereIn('type',[3,4])
->field('i.mer_intention_id,i.uid,i.mer_name,i.name,i.create_time,i.status,i.fail_msg,i.update_time,m.type_name')
->select();
//后期看改
foreach ($list as $k => &$v){
$v['check_name'] = "小方";
$v['check_num'] = "18715236963";
}
return app('json')->success($list);
}
protected function checkParams()
{

View File

@ -583,6 +583,8 @@ Route::group('api/', function () {
Route::get('intention/type', 'api.store.merchant.MerchantIntention/typeLst');
Route::post('intention/change', 'api.store.merchant.MerchantIntention/changeIdentity');//更新身份
Route::get('intention/detail', 'api.store.merchant.MerchantIntention/deatail');//审核列表
//浏览
Route::post('common/visit', 'api.Common/visit');
Route::get('store/product/assist/count', 'api.store.product.StoreProductAssist/userCount');