更新委托订单审核
This commit is contained in:
parent
7bc8a15f70
commit
8dedd90705
@ -63,7 +63,7 @@ class Community extends BaseController
|
|||||||
$where = $this->request->params(['keyword','topic_id','is_hot','category_id','spu_id', 'is_type', 'resale_type']);
|
$where = $this->request->params(['keyword','topic_id','is_hot','category_id','spu_id', 'is_type', 'resale_type']);
|
||||||
if (!$where['category_id']) {
|
if (!$where['category_id']) {
|
||||||
unset($where['category_id']);
|
unset($where['category_id']);
|
||||||
} else if ($where['category_id'] == -1) {
|
} else if ($where['category_id'] == -1) {
|
||||||
$where['is_type'] = $this->repository::COMMUNIT_TYPE_VIDEO;
|
$where['is_type'] = $this->repository::COMMUNIT_TYPE_VIDEO;
|
||||||
unset($where['category_id']);
|
unset($where['category_id']);
|
||||||
}
|
}
|
||||||
@ -727,7 +727,7 @@ class Community extends BaseController
|
|||||||
$queryBuilder->where('c.mer_status', 2);
|
$queryBuilder->where('c.mer_status', 2);
|
||||||
}
|
}
|
||||||
$count = $queryBuilder->count();
|
$count = $queryBuilder->count();
|
||||||
$list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.uid', 'c.title', 'c.image', 'c.entrust_mer_id', 'm.credit_buy', 'm.settle_cycle', 'm.interest_rate', 'm.mer_name', 'm.mer_avatar', 'c.mer_status'])->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select();
|
$list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.uid', 'c.title', 'c.image', 'c.entrust_mer_id', 'm.credit_buy', 'm.settle_cycle', 'm.interest_rate', 'm.mer_name', 'm.mer_avatar', 'c.mer_status', 'c.entrust_finish'])->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select();
|
||||||
if ($list) $list = $list->toArray();
|
if ($list) $list = $list->toArray();
|
||||||
foreach($list as $k => $v) {
|
foreach($list as $k => $v) {
|
||||||
// type:1发起的委托 2收到的委托
|
// type:1发起的委托 2收到的委托
|
||||||
@ -743,4 +743,57 @@ class Community extends BaseController
|
|||||||
}
|
}
|
||||||
return app('json')->success(compact('count', 'list'));
|
return app('json')->success(compact('count', 'list'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请结束商品委托
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function applyFinishEntrust($id)
|
||||||
|
{
|
||||||
|
$communityInfo = Db::name('community')->where('community_id', $id)->where('mer_status', 1)->whereIn('entrust_finish', [0, 2])->where('is_del', 0)->find();
|
||||||
|
if (!$communityInfo) {
|
||||||
|
return app('json')->fail('当前状态委托商品不存在');
|
||||||
|
}
|
||||||
|
$merchantId = Db::name('merchant')->where('uid', $this->request->uid())->value('mer_id');
|
||||||
|
if ($merchantId != $communityInfo['entrust_mer_id']) {
|
||||||
|
return app('json')->fail('当前商户无申请结束此委托商品权限');
|
||||||
|
}
|
||||||
|
$res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 3]);
|
||||||
|
if (!$res) {
|
||||||
|
return app('json')->fail('申请操作失败');
|
||||||
|
}
|
||||||
|
return app('json')->success('申请操作成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结束商品委托
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function finishEntrust($id)
|
||||||
|
{
|
||||||
|
$communityInfo = Db::name('community')->where('community_id', $id)->where('mer_status', 1)->where('entrust_finish', 3)->where('is_del', 0)->find();
|
||||||
|
if (!$communityInfo) {
|
||||||
|
return app('json')->fail('当前状态委托商品不存在');
|
||||||
|
}
|
||||||
|
if ($this->request->uid() != $communityInfo['uid']) {
|
||||||
|
return app('json')->fail('当前商户无结束此委托商品权限');
|
||||||
|
}
|
||||||
|
$status = $this->request->param('status');
|
||||||
|
if (!$status) {
|
||||||
|
return app('json')->fail('请设置状态');
|
||||||
|
}
|
||||||
|
// 同意
|
||||||
|
if ($status == 1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
// 拒绝
|
||||||
|
if ($status == 2) {
|
||||||
|
$refusal = $this->request->param('refusal', '');
|
||||||
|
$res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish_refusal' => $refusal, 'entrust_finish' => 2]);
|
||||||
|
if (!$res) {
|
||||||
|
return app('json')->fail('审核操作失败');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return app('json')->success('审核操作成功');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -382,6 +382,8 @@ Route::group('api/', function () {
|
|||||||
Route::get('/entrust/list', 'Community/entrustList');
|
Route::get('/entrust/list', 'Community/entrustList');
|
||||||
Route::post('/entrust/check/:id', 'Community/checkEntrust');
|
Route::post('/entrust/check/:id', 'Community/checkEntrust');
|
||||||
Route::post('/entrust/addEntrustCart', 'Community/addEntrustCart');
|
Route::post('/entrust/addEntrustCart', 'Community/addEntrustCart');
|
||||||
|
Route::post('/entrust/apply/finish/:id', 'Community/applyFinishEntrust');
|
||||||
|
Route::post('/entrust/finish/:id', 'Community/finishEntrust');
|
||||||
|
|
||||||
})->prefix('api.community.');
|
})->prefix('api.community.');
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user