后台审核商户更新身份
This commit is contained in:
parent
4057040ce6
commit
0c664395bc
@ -41,6 +41,8 @@ class MerchantIntentionDao extends BaseDao
|
||||
$query->where('mer_name|phone|mark', 'like', '%' . $where['keyword'] . '%');
|
||||
})->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
||||
getModelTime($query, $where['date']);
|
||||
})->when(isset($where['is_change']) && $where['is_change'] !== '', function ($query) use ($where) {
|
||||
$query->where('is_change', $where['is_change']);
|
||||
})->where('is_del', 0);
|
||||
|
||||
return $query;
|
||||
|
@ -102,6 +102,40 @@ class MerchantIntentionRepository extends BaseRepository
|
||||
return $form->setTitle('修改审核状态');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 更新身份
|
||||
* @param $id
|
||||
* @param $data
|
||||
* @return void
|
||||
* @throws \think\db\exception\DbException
|
||||
*/
|
||||
public function updateIdent($id, $data)
|
||||
{
|
||||
$wholesale = $data['wholesale'];
|
||||
$uid = $data['uid'];
|
||||
unset($data['mer_type_id']);
|
||||
unset($data['wholesale']);
|
||||
unset($data['uid']);
|
||||
|
||||
if($wholesale){
|
||||
$check = Merchant::getDB()->where('uid', $uid)->value('mer_id');//商户
|
||||
if($check){
|
||||
Merchant::getDB()->where('mer_id',$check)->update(['wholesale'=>$wholesale]);
|
||||
}else{
|
||||
throw new ValidateException('先成为商户');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$intention = $this->search(['mer_intention_id' => $id])->find();
|
||||
if (!$intention)
|
||||
throw new ValidateException('信息不存在');
|
||||
$intention->save($data);
|
||||
}
|
||||
|
||||
public function updateStatus($id, $data)
|
||||
{
|
||||
$data['create_mer'] = !empty($data['create_mer']) ? $data['create_mer'] : 2;
|
||||
|
@ -38,7 +38,7 @@ class MerchantIntention extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type']);
|
||||
$where = $this->request->params(['mer_name', 'status', 'date', 'keyword', 'mer_intention_id', 'category_id', 'type_id', 'type','is_change']);
|
||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||
}
|
||||
|
||||
@ -75,6 +75,33 @@ class MerchantIntention extends BaseController
|
||||
return app('json')->success('修改成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function switchIdentity($id)
|
||||
{
|
||||
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
||||
return app('json')->fail('数据不存在');
|
||||
|
||||
$data = $this->request->params(['status','mer_type_id','uid']);
|
||||
if(empty($data['status']) || empty($data['mer_type_id']) || empty($data['uid']) ) return app('json')->fail('缺失参数');
|
||||
$data['wholesale'] = 0;
|
||||
if($data['status'] == 1){
|
||||
if($data['mer_type_id'] == 23){
|
||||
//批发
|
||||
$data['wholesale'] =1;
|
||||
}else{
|
||||
$data['wholesale'] =2;//零售
|
||||
}
|
||||
}
|
||||
$this->repository->updateIdent($id, $data);
|
||||
return app('json')->success('修改身份成功');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
||||
|
@ -62,6 +62,12 @@ Route::group(function () {
|
||||
Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([
|
||||
'_alias' => '审核',
|
||||
]);
|
||||
|
||||
Route::post('change/:id', '/switchIdentity')->name('systemMerchantIntentionIdent')->option([
|
||||
'_alias' => '更改身份',
|
||||
]);
|
||||
|
||||
|
||||
Route::delete('delete/:id', '/delete')->name('systemMerchantIntentionDelete')->option([
|
||||
'_alias' => '删除',
|
||||
]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user