Merge branch 'dev' of https://gitea.lihaink.cn/mkm/shop-new into dev
This commit is contained in:
commit
5b08a9618b
@ -41,6 +41,8 @@ class MerchantIntentionDao extends BaseDao
|
|||||||
$query->where('mer_name|phone|mark', 'like', '%' . $where['keyword'] . '%');
|
$query->where('mer_name|phone|mark', 'like', '%' . $where['keyword'] . '%');
|
||||||
})->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
})->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
|
||||||
getModelTime($query, $where['date']);
|
getModelTime($query, $where['date']);
|
||||||
|
})->when(isset($where['type']) && $where['type'] !== '', function ($query) use ($where) {
|
||||||
|
$query->whereIn('type', $where['type']);
|
||||||
})->where('is_del', 0);
|
})->where('is_del', 0);
|
||||||
|
|
||||||
return $query;
|
return $query;
|
||||||
|
@ -45,6 +45,18 @@ class MerchantIntentionRepository extends BaseRepository
|
|||||||
return compact('count', 'list');
|
return compact('count', 'list');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getMoreList(array $where, $page, $limit)
|
||||||
|
{
|
||||||
|
$query = $this->dao->search($where);
|
||||||
|
$count = $query->count();
|
||||||
|
$list = $query->page($page, $limit)
|
||||||
|
->order('create_time DESC , status ASC')->with(['merchantCategory', 'merchantType'])
|
||||||
|
->select();
|
||||||
|
return compact('count', 'list');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function detail($id, ?int $uid)
|
public function detail($id, ?int $uid)
|
||||||
{
|
{
|
||||||
$where = ['mer_intention_id' => $id];
|
$where = ['mer_intention_id' => $id];
|
||||||
@ -102,6 +114,40 @@ class MerchantIntentionRepository extends BaseRepository
|
|||||||
return $form->setTitle('修改审核状态');
|
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)
|
public function updateStatus($id, $data)
|
||||||
{
|
{
|
||||||
$data['create_mer'] = !empty($data['create_mer']) ? $data['create_mer'] : 2;
|
$data['create_mer'] = !empty($data['create_mer']) ? $data['create_mer'] : 2;
|
||||||
|
@ -42,6 +42,17 @@ class MerchantIntention extends BaseController
|
|||||||
return app('json')->success($this->repository->getList($where, $page, $limit));
|
return app('json')->success($this->repository->getList($where, $page, $limit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//批发零售列表
|
||||||
|
public function list()
|
||||||
|
{
|
||||||
|
[$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));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function form($id)
|
public function form($id)
|
||||||
{
|
{
|
||||||
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
||||||
@ -75,6 +86,32 @@ class MerchantIntention extends BaseController
|
|||||||
return app('json')->success('修改成功');
|
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)
|
public function delete($id)
|
||||||
{
|
{
|
||||||
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
if (!$this->repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
|
||||||
|
@ -308,6 +308,33 @@ class MerchantIntention extends BaseController
|
|||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function changeIdentity()
|
||||||
|
{
|
||||||
|
$data = $this->request->params([
|
||||||
|
'phone',
|
||||||
|
'mer_name',
|
||||||
|
'mer_type_id',
|
||||||
|
'merchant_category_id',
|
||||||
|
'type',
|
||||||
|
'name'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if(empty($data['phone'])||empty($data['mer_name'])||empty($data['mer_type_id'])||empty($data['merchant_category_id'])||empty($data['type'])||empty($data['name'])){
|
||||||
|
return app('json')->fail('参数缺失请检查');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->userInfo) $data['uid'] = $this->userInfo->uid;
|
||||||
|
$data['status'] = 0;
|
||||||
|
$intention = $this->repository->create($data);
|
||||||
|
if ($intention) {
|
||||||
|
return app('json')->success('申请更改商户身份成功');
|
||||||
|
} else {
|
||||||
|
return app('json')->fail('申请更改商户身份失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected function checkParams()
|
protected function checkParams()
|
||||||
{
|
{
|
||||||
$data = $this->request->params([
|
$data = $this->request->params([
|
||||||
|
@ -59,9 +59,19 @@ Route::group(function () {
|
|||||||
Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([
|
Route::get('lst', '/lst')->name('systemMerchantIntentionLst')->option([
|
||||||
'_alias' => '列表',
|
'_alias' => '列表',
|
||||||
]);
|
]);
|
||||||
|
Route::get('list', '/list')->name('systemMerchantIntentionList')->option([
|
||||||
|
'_alias' => '批发和零售申请列表',
|
||||||
|
]);
|
||||||
|
|
||||||
Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([
|
Route::post('status/:id', '/switchStatus')->name('systemMerchantIntentionStatus')->option([
|
||||||
'_alias' => '审核',
|
'_alias' => '审核',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
Route::post('change/:id', '/switchIdentity')->name('systemMerchantIntentionIdent')->option([
|
||||||
|
'_alias' => '更改身份',
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
Route::delete('delete/:id', '/delete')->name('systemMerchantIntentionDelete')->option([
|
Route::delete('delete/:id', '/delete')->name('systemMerchantIntentionDelete')->option([
|
||||||
'_alias' => '删除',
|
'_alias' => '删除',
|
||||||
]);
|
]);
|
||||||
|
@ -558,6 +558,8 @@ Route::group('api/', function () {
|
|||||||
Route::post('intention/create', 'api.store.merchant.MerchantIntention/create');
|
Route::post('intention/create', 'api.store.merchant.MerchantIntention/create');
|
||||||
Route::get('intention/cate', 'api.store.merchant.MerchantIntention/cateLst');
|
Route::get('intention/cate', 'api.store.merchant.MerchantIntention/cateLst');
|
||||||
Route::get('intention/type', 'api.store.merchant.MerchantIntention/typeLst');
|
Route::get('intention/type', 'api.store.merchant.MerchantIntention/typeLst');
|
||||||
|
|
||||||
|
Route::post('intention/change', 'api.store.merchant.MerchantIntention/changeIdentity');//更新身份
|
||||||
//浏览
|
//浏览
|
||||||
Route::post('common/visit', 'api.Common/visit');
|
Route::post('common/visit', 'api.Common/visit');
|
||||||
Route::get('store/product/assist/count', 'api.store.product.StoreProductAssist/userCount');
|
Route::get('store/product/assist/count', 'api.store.product.StoreProductAssist/userCount');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user