更新委托商品审核

This commit is contained in:
yaooo 2023-09-06 10:02:56 +08:00
parent c6ad0df8a5
commit f3fb69bde6
2 changed files with 10 additions and 7 deletions

View File

@ -559,7 +559,7 @@ class Community extends BaseController
Db::name('store_product_attr_value')->where('product_id', $prod['product_id'])->where('unique', $prod['product_attr_unique'])->inc('stock', $prod['number'])->update(); Db::name('store_product_attr_value')->where('product_id', $prod['product_id'])->where('unique', $prod['product_attr_unique'])->inc('stock', $prod['number'])->update();
} }
Db::name('resale')->where('community_id', $id)->where('status', 0)->update(['is_del' => 1]); Db::name('resale')->where('community_id', $id)->where('status', 0)->update(['is_del' => 1]);
Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->where('is_del', 0)->update(['is_del' => 1, 'status' => $status, 'mer_status' => 2]); Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->where('is_del', 0)->update(['is_del' => 1, 'status' => -2, 'mer_status' => 2]);
Db::commit(); Db::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();
@ -602,7 +602,7 @@ class Community extends BaseController
Db::name('store_product_attr_value')->where('product_id', $prod['product_id'])->where('unique', $prod['product_attr_unique'])->inc('stock', $prod['number'])->update(); Db::name('store_product_attr_value')->where('product_id', $prod['product_id'])->where('unique', $prod['product_attr_unique'])->inc('stock', $prod['number'])->update();
} }
Db::name('resale')->where('community_id', $id)->where('status', 0)->update(['is_del' => 1]); Db::name('resale')->where('community_id', $id)->where('status', 0)->update(['is_del' => 1]);
Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->update(['is_del' => 1, 'status' => -1]); Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->update(['is_del' => 1, 'status' => -2]);
Db::commit(); Db::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();
@ -637,14 +637,17 @@ class Community extends BaseController
*/ */
public function checkEntrust($id) public function checkEntrust($id)
{ {
$communityInfo = Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->where('is_del', 0)->find(); $communityInfo = Db::name('community')->where('community_id', $id)->where('is_del', 0)->find();
if (!$communityInfo) { if (!$communityInfo) {
return app('json')->fail('委托商品不存在'); return app('json')->fail('委托商品不存在');
} }
if ($communityInfo['mer_status'] > 0) {
return app('json')->fail('该委托商品已审核');
}
$merchantId = Db::name('merchant')->where('uid', $this->request->uid())->value('mer_id'); $merchantId = Db::name('merchant')->where('uid', $this->request->uid())->value('mer_id');
$entrustInfo = Db::name('entrust')->where('community_id', $id)->where('entrust_mer_id', $merchantId)->where('is_del', 0)->where('status', 0)->fetchSql(false)->find(); $entrustInfo = Db::name('entrust')->where('community_id', $id)->where('entrust_mer_id', $merchantId)->where('is_del', 0)->where('status', 0)->fetchSql(false)->find();
if (!$entrustInfo) { if (!$entrustInfo) {
return app('json')->fail('户无审核此委托商品权限'); return app('json')->fail('当前商户无审核此委托商品权限');
} }
$status = $this->request->param('status'); $status = $this->request->param('status');
if (!$status) { if (!$status) {
@ -652,7 +655,7 @@ class Community extends BaseController
} }
// 同意 // 同意
if ($status == 1) { if ($status == 1) {
Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->where('is_del', 0)->update(['status' => $status, 'mer_status' => 1]); Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['status' => $status, 'mer_status' => 1]);
} }
// 拒绝 // 拒绝
if ($status == 2) { if ($status == 2) {
@ -664,7 +667,7 @@ class Community extends BaseController
Db::name('store_product_attr_value')->where('product_id', $prod['product_id'])->where('unique', $prod['product_attr_unique'])->inc('stock', $prod['number'])->update(); Db::name('store_product_attr_value')->where('product_id', $prod['product_id'])->where('unique', $prod['product_attr_unique'])->inc('stock', $prod['number'])->update();
} }
Db::name('entrust')->where('community_id', $id)->where('status', 0)->update(['is_del' => 1]); Db::name('entrust')->where('community_id', $id)->where('status', 0)->update(['is_del' => 1]);
Db::name('community')->where('uid', $this->request->uid())->where('community_id', $id)->where('is_del', 0)->update(['is_del' => 1, 'status' => $status, 'mer_status' => 2]); Db::name('community')->where('community_id', $id)->where('is_del', 0)->update(['is_del' => 1, 'status' => -2, 'mer_status' => 2]);
Db::commit(); Db::commit();
} catch (\Exception $e) { } catch (\Exception $e) {
Db::rollback(); Db::rollback();

View File

@ -118,7 +118,7 @@ class StoreOrder extends BaseController
if (!empty($hasCourierData) && is_string($hasCourierData)) { if (!empty($hasCourierData) && is_string($hasCourierData)) {
$courierData = json_decode($hasCourierData, true); $courierData = json_decode($hasCourierData, true);
if (empty($courierData['code']) || $courierData['code'] != 1) { if (empty($courierData['code']) || $courierData['code'] != 1) {
throw new ValidateException('该收货区域未配送快递员'); throw new ValidateException('该收货区域未设置快递员');
} }
} }
} }