Exemplo n.º 1
0
 public function update(Request $request, $id)
 {
     $express = OrderExpress::find($id);
     if (empty($express)) {
         return $this->failure_noexists();
     }
     if ($express->express_type == 39) {
         $keys = 'express_name,no';
         $table = "order.deliver";
     } else {
         $keys = 'sid';
         $table = "order.express_store";
     }
     $data = $this->autoValidate($request, $table, $keys, $express);
     $express->update($data);
     return $this->success();
 }
Exemplo n.º 2
0
 public function express($express_name, $express_no, $transaction = TRUE)
 {
     $transaction && DB::beginTransaction();
     $order = static::where($this->getKeyName(), $this->getKey())->lockForUpdate()->first();
     if ($order->status != static::PAID) {
         $transaction && DB::rollback();
         return false;
     }
     $express = OrderExpress::where($this->getKeyName(), $this->getKey())->lockForUpdate()->first();
     $express->update(['express_name' => $express_name, 'no' => $express_no]);
     $order->status = static::DELIVERED;
     $order->save();
     $transaction && DB::commit();
     return true;
 }