/** * 创作的渲染订单 */ public function getApply($productid, $renderMoney, $totalMoney) { if (!$productid || !$renderMoney || !$totalMoney) { echo "<script>alert('参数有误!');history.go(-1);</script>"; exit; } $formats = array_flip($this->orderProModel['formatMoneys']); $serial = date('YmdHis', time()) . rand(0, 10000); $data = ['productid' => $productid, 'serial' => $serial, 'uid' => $this->userid, 'uname' => \Session::get('user.username'), 'format' => $formats[$renderMoney], 'created_at' => time()]; OrderProductModel::create($data); $orderModel = OrderProductModel::where('serial', $serial)->first(); $pay = ['genre' => 3, 'order_id' => $orderModel->id, 'money' => $totalMoney, 'created_at' => time()]; PayModel::create($pay); return redirect(DOMAIN . 'online/u/order'); }
/** * 获取对应支付信息 */ public function getPay() { $payModel = PayModel::where('genre', 3)->where('order_id', $this->id)->first(); return $payModel ? $payModel : ''; }
/** * 获取对应支付信息,视频专用 */ public function getPays() { $payModel = PayModel::where('genre', 1)->where('order_id', $this->id)->orderBy('id', 'asc')->get(); return $payModel ? $payModel : []; }
/** * 卖方确定已到款,下一步办理 */ public function setPayStatus($id, $cate, $status) { $orderModel = OrderModel::find($id); if (!in_array($orderModel->genre, [5, 6])) { PayModel::where('order_id', $id)->update(['ispay' => $status, 'updated_at' => time()]); } else { $payModels = PayModel::where('order_id', $id)->get(); PayModel::where('id', $payModels[$cate - 1])->update(['ispay' => $status, 'updated_at' => time()]); } return redirect(DOMAIN . 'member/order/' . $id); }
/** * 设置定价 */ public function setMoney($id, $money) { $orderProModel = OrderProductModel::find($id); $formatMoney = $orderProModel->getFormatMoney(); $data = ['genre' => 3, 'order_id' => $id, 'money' => $formatMoney + $money, 'weal' => $formatMoney, 'created_at' => time()]; PayModel::create($data); //创作订单表状态更新 OrderProductModel::where('id', $id)->update(['status' => 2]); return redirect(DOMAIN . 'admin/orderpro'); }