request->post(); $current = time(); $list = ClearClass::getAllByCondition([ 'clearStyle' => dict::getDict('clearStyle', 'gys2KmGys'), 'shopId' => $this->shopId, 'status' => PurchaseClearClass::STATUS_AWAIT_PAY ], null, '*', null, true); if (!empty($list)) { foreach ($list as $item) { $deadline = $item->deadline; $deadTime = strtotime($deadline); if ($current > $deadTime) { $item->status = PurchaseClearClass::STATUS_EXPIRE; $item->save(); } else { util::fail('还有待付款的结账单'); } } } if (getenv('YII_ENV') == 'production') { //小向花卉采购的结账确认,有多处,关键词ghs_cg_clear_confirm if (in_array($this->mainId, [23390, 24516])) { if (!in_array($this->adminId, [24655])) { util::fail('不能操作哈'); } } //花大苪 洋桔梗,只有叶荷姐才能销账,多处请搜索关键词hdb_clear_control if (in_array($this->shopId, [16070])) { if (!in_array($this->adminId, [9303, 4])) { util::fail('暂无权限'); } } //中山淘花里,销账权限控制,多处请搜索 thl_clear_control if (in_array($this->shopId, [17118])) { if (!in_array($this->adminId, [55494, 55445, 17908, 55459, 55707, 55709])) { util::fail('你不能销单!'); } } //小齐鲜花总店和出车,多处请搜索关键词 xq_clear_control if (in_array($this->shopId, [41467, 42946])) { if (!in_array($this->adminId, [40144,42912,42023])) { util::fail('不能操作哈。。'); } } //恋善好多花控制销账权限 if (in_array($this->shopId, [55238,56609,56611])) { if (!in_array($this->adminId, [43856, 54620])) { util::fail('暂无权限,请联系老板或财务'); } } } else { if (in_array($this->shopId, [36523])) { // if (!in_array($this->adminId, [919])) { // util::fail('不能操作...'); // } } } $post['sjId'] = $this->sjId; $post['shopId'] = $this->shopId; $post['clearStyle'] = dict::getDict('clearStyle', 'gys2KmGys'); $post['customShopAdminId'] = $this->shopAdminId; $post['customShopId'] = $this->shopId ?? 0; $shopAdmin = $this->shopAdmin; $shopAdminName = $shopAdmin['name'] ?? ''; $post['customShopAdminName'] = $shopAdminName; $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { $respond = ClearClass::addOrder($post); $transaction->commit(); util::success($respond); } catch (\Exception $e) { $transaction->rollBack(); Yii::info("下单失败原因:" . $e->getMessage()); util::fail('下单失败'); } } }