model = $model; } public function ShopOrderExpired ($data) { Db::startTrans(); try { // foreach ($data as $k => $v) { $order_info = Db::name('shop_order')->where('order_sn', $data)->find(); if ($order_info && $order_info['status'] == 0){ Db::name('shop_order')->where('order_sn', $data)->save(['status'=>3]); } // $this->model::where(['order_sn' => array_column($data, 'order_sn'), 'status' => 0])->save(['status' => 3,'updated_time' => $nowTime]); // if (!$this->model::where(['order_sn' => $v['order_sn']])->value('status')) { // foreach ($v['order_data'] as $kk => $vv) { // Db::name('shop_goods_spec')->where(['goods_spec_id' => $vv['spec_data']['goods_spec_id']])->inc('stock', $vv['num'])->update(); // } // } // } // $nowTime = date('Y-m-d H:i:s', time()); // $this->model::where(['order_sn' => array_column($data, 'order_sn'), 'status' => 0])->save(['status' => 3,'updated_time' => $nowTime]); Db::commit(); }catch (\Exception $e){ Db::rollback(); sr_log('aaa'); return true; } return true; } }