| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- /**
- * 会员订单相关队列
- */
- namespace jobs;
- use app\common\model\ShopOrderModel;
- use think\facade\Db;
- class ShopOrderJob extends BaseJob
- {
- protected $model = null;
- public function __construct (ShopOrderModel $model)
- {
- $this->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;
- }
- }
|