更新结束审核操作

This commit is contained in:
yaooo 2023-09-07 12:47:10 +08:00
parent 8dedd90705
commit daebff05eb

View File

@ -745,7 +745,7 @@ class Community extends BaseController
} }
/** /**
* 申请结束商品委托 * 供应链商家申请结束商品委托
* @return mixed * @return mixed
*/ */
public function applyFinishEntrust($id) public function applyFinishEntrust($id)
@ -758,6 +758,11 @@ class Community extends BaseController
if ($merchantId != $communityInfo['entrust_mer_id']) { if ($merchantId != $communityInfo['entrust_mer_id']) {
return app('json')->fail('当前商户无申请结束此委托商品权限'); return app('json')->fail('当前商户无申请结束此委托商品权限');
} }
$entrustInfo = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find();
$limitTime = strtotime($entrustInfo['create_time']) + ($entrustInfo['entrust_day'] ?? 0) * 86400;
if (time() < $limitTime) {
return app('json')->fail('委托时间内不能申请结束委托');
}
$res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 3]); $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 3]);
if (!$res) { if (!$res) {
return app('json')->fail('申请操作失败'); return app('json')->fail('申请操作失败');
@ -784,16 +789,24 @@ class Community extends BaseController
} }
// 同意 // 同意
if ($status == 1) { if ($status == 1) {
$entrustInfo = Db::name('entrust')->where('community_id', $id)->where('is_del', 0)->find();
$limitTime = strtotime($entrustInfo['create_time']) + ($entrustInfo['entrust_day'] ?? 0) * 86400;
if (time() < $limitTime) {
return app('json')->fail('委托时间内不能结束委托');
}
$res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish' => 1]);
if (!$res) {
return app('json')->fail('结束操作失败');
}
} }
// 拒绝 // 拒绝
if ($status == 2) { if ($status == 2) {
$refusal = $this->request->param('refusal', ''); $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]); $res = Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['entrust_finish_refusal' => $refusal, 'entrust_finish' => 2]);
if (!$res) { if (!$res) {
return app('json')->fail('审核操作失败'); return app('json')->fail('结束操作失败');
} }
} }
return app('json')->success('审核操作成功'); return app('json')->success('结束操作成功');
} }
} }