本文整理汇总了PHP中Order::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::find方法的具体用法?PHP Order::find怎么用?PHP Order::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionModify
function actionModify()
{
$id = (int) $this->_context->get('id');
$rs = Account::find('user_id = ?', $id)->getOne();
if (!$rs->id()) {
return $this->msg($tip = '参数错误', url('manage::account'));
}
$form = Form_Common::createForm('', 'manage/profile');
if ($this->_context->isPOST() && $form->validate($_POST)) {
$post = $form->values();
$user_mail = $post['user_mail'];
$user_pass = $post['user_pass'];
$is_locked = $post['is_locked'] ? '1' : '0';
#dump($post);
if ($user_pass) {
$user_pass = sha1(md5('sike' . $post['user_pass'] . Q::ini('appini/secret_key')));
$rs->user_pass;
}
$rs->user_mail = $user_mail;
$rs->is_locked = $is_locked;
$rs->save();
return $this->msg($tip = '修改成功', url('manage::account/modify', array('id' => $id)));
}
$form->import($rs->toArray());
$form->element('user_pass')->value = '';
$form->element('is_locked')->checked = $rs->is_locked;
#dump($form->element('is_locked'));
$this->_view['form'] = $form;
$this->_view['rs'] = $rs;
$order = Order::find('user_id = ?', $id)->order('created DESC')->getAll();
$this->_view['order'] = $order;
$this->_view['_UDI'] = 'manage::account/index';
}
示例2: show
public function show()
{
if (!isset($_SESSION['id'])) {
return false;
}
$order = null;
require 'models/product.php';
require_once 'models/order_detail.php';
if (isAdmin()) {
if (!isset($_GET['id'])) {
return call('pages', 'error');
}
$order = Order::find($_GET['id']);
} else {
if (isset($_SESSION['orderID'])) {
if (!isset($_GET['id'])) {
$order = Order::find($_SESSION['orderID']);
} else {
if (Order::isSaved($_GET['id'])) {
$order = Order::find($_GET['id']);
} else {
return call('pages', 'error');
}
}
} else {
if (isset($_GET['id'])) {
if (Order::isSaved($_GET['id'])) {
$order = Order::find($_GET['id']);
}
}
}
}
require_once 'views/orders/show.php';
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
Log::debug('IPN receiver - $_POST array: ' . print_r($_POST, TRUE));
$ipnOrder = IPN::getOrder();
Log::debug('IPN receiver - After processing... IPN order: ' . print_r($ipnOrder, TRUE));
$orderItem = $ipnOrder->items->first();
$order = Order::find((int) $orderItem->item_number);
$order->paypal_txn_id = $ipnOrder->txn_id;
$order->paypal_fee = $ipnOrder->mc_fee;
$order->ipn_order_id = $ipnOrder->id;
//$order->id = (int) $orderItem->item_number;
if ($ipnOrder->memo) {
$order->order_notes .= "\n\n" . $ipnOrder->memo;
}
if ($order->delivery_terms == 'mp3_only') {
$order->order_status = 'Completed';
} else {
$order->order_status = 'Payment Received';
}
$order->save();
// After the order is persisted to IPN tables,
// we send e-mail notification to customer.
// This ensures that e-mail confirmation is sent,
// if customer does NOT return to our site.
$result = OrdersController::sendEmailConfirmationExternal($order);
}
示例4: getItems
public function getItems($id)
{
$order = Order::find($id);
if ($order) {
$Orderitem = Orderitem::where('order_id', $id)->get();
return View::make('items')->with('Orderitem', $Orderitem);
}
}
示例5: actionVisit
public function actionVisit($id)
{
$model = Order::find()->where(['id' => $id])->one();
$model->is_new = 1;
$model->save();
//return $this->redirect('/order/index',302);
$this->redirect(\Yii::$app->urlManager->createUrl("order/index"));
}
示例6: delete
public function delete($id)
{
$table = Order::find($id);
if ($table->delete()) {
$name = trans("name.{$this->name}");
return Redirect::to("admin/{$this->name}")->with('success', trans("message.{$this->action}", ['name' => $name]));
}
return Redirect::to("admin/{$this->name}")->with('error', trans('message.error'));
}
示例7: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id)
{
//
$order = Order::find($id);
$order->cliente = 'Stefano';
$order->indirizzo = 'via Rossi, 150';
$order->totale = '45';
$order->save();
}
示例8: postCheckOut
/**
* postCheckOut
*/
public function postCheckOut()
{
$customer = Input::get('customer');
$customer = Customer::find($customer);
$customer_address = CustomerReceivedAddress::where('customer_id', $customer->id)->where('default', 1)->first();
//订单编号
$orderno = OrderGeneration::where('customer_no', $customer->customer_no)->where('used', 0)->first();
if (!$orderno) {
foreach (range(1001, 9998) as $index) {
if ($index == 1111 || $index == 2222 || $index == 3333 || $index == 4444 || $index == 5555 || $index == 6666 || $index == 7777 || $index == 8888) {
continue;
}
OrderGeneration::create(['customer_no' => $customer->customer_no, 'order_no' => $index, 'used' => 0]);
}
$order_no = $index;
$no = $order_no . $customer->customer_no;
} else {
$order_no = $orderno->order_no;
$no = $order_no . $customer->customer_no;
}
$order = new Order();
$order->no = $no;
$order->customer_id = $customer->id;
$order->customer_address_id = $customer_address->id;
$order->payment_method_id = 1;
$order->shipping_method_id = 1;
$order->order_status = 'order_price_confirmed';
$order->item_fee = 0.0;
$order->shipping_fee = 0;
$order->amount_fee = 0.0;
$order->point_fee = 0;
$order->credit_fee = 0;
$order->pay_fee = 0.0;
$order->caution_money = 0;
$order->save();
$ordergeneration = OrderGeneration::where('order_no', $order_no)->where('customer_no', $customer->customer_no)->first();
$ordergeneration->used = 1;
$ordergeneration->save();
//orderdetail
$carts = Cart::where('customer_id', $customer->id)->get();
$sum = 0;
foreach ($carts as $cart) {
$total = 0;
if ($cart->confirm_price == 0.0) {
$cart->confirm_price = $cart->item->price_market;
}
OrderDetail::create(['order_id' => $order->id, 'item_id' => $cart->item_id, 'craft_description' => $cart->craft_description, 'quantity' => $cart->quantity, 'confirm_price' => $cart->confirm_price, 'confirm_quantity' => 0, 'delivery_quantity' => 0]);
$total = $cart->confirm_price * $cart->quantity;
$sum += $total;
}
$order = Order::find($order->id);
$order->item_fee = $sum;
$order->save();
//查看订单详细页面
return Redirect::to('admin/orders');
}
示例9: remove
function remove($cp_id, $order_id)
{
$val = Validation::own_cus_product($cp_id, $_SESSION["user_id"]);
if ($val) {
$cus_pro = CusProduct::find($cp_id);
$order = Order::find($order_id);
$order->remove_product($cus_pro);
$order->update();
}
}
示例10:
function admin_report_pdf()
{
$orders = $this->Order->find('all');
//pr($orders);
//die;
//Configure::write('debug', 0);
$this->layout = 'pdf';
$this->set('orders', $orders);
$this->render();
}
示例11: postChangePaid
/**
* change the paid status of an order
*
* @param integer $orderId
* @internal param bool $paid
* @return \Illuminate\Http\RedirectResponse
*/
public function postChangePaid($orderId)
{
$order = Order::find($orderId);
// if order not loaded or user is not the delivery owner
if (!$order || !$order->allowedToChangePaid(Auth::user())) {
return Redirect::back()->with('errors', new MessageBag(['An error has occurred.']));
}
$order->paid = (bool) (!$order->paid);
$order->save();
return Redirect::back();
}
示例12: delete
public function delete($id)
{
$order = Order::find($id);
foreach ($order->detail()->getResults() as $detail) {
$detail->softDeletes();
}
$order->softDeletes();
// redirect
Session::flash('message', 'Successfully deleted the product!');
return Redirect::to('orders');
}
示例13: noQueueFlagged
/**
* Is order flagged to not queue
*
* @param Order $Model
* @param $id
* @return array|bool
*/
public function noQueueFlagged(Order $Model, $id)
{
if (empty($id)) {
$id = $Model->id;
}
$r = $Model->find('first', ['conditions' => ['id' => $id, 'NOT' => ['order_status_id' => Order::STATUS_PENDINGPAYMENT], 'OR' => ['secondary_order_status_id' => [Order::SECONDARY_HOLD_FOR_REVIEW, Order::SECONDARY_NETSUITE_SKIP]]]]);
if (empty($r)) {
return false;
} else {
return true;
}
}
示例14: actionIndex
function actionIndex()
{
//新进订单
$order = Order::find()->order('order_id DESC')->get(5);
//新进帐号
#$users = Account::find()->order('user_id DESC')->get(5);
$this->_view['order'] = $order;
#$this->_view['users'] = $users;
$sql = "SELECT SUM( acctinputoctets + acctoutputoctets ) as total FROM radacct WHERE 1";
$traffic_total = QDB::getConn()->getOne($sql);
$this->_view['traffic_total'] = $traffic_total;
/*
$ttt = Invoice::find('trade_status = ?','TRADE_FINISHED')->getAll();
foreach($ttt as $t)
{
$t->due_time = ($t->per_day * 24 * 3600) + $t->trade_time;
$t->save();
}
*/
$nowt = time();
$dayt = 24 * 3600;
$tips = $nowt - 25 * $dayt;
$sql = "SELECT i.`order_id`,i.`total_fee`,i.`per_day`,i.`due_time`,i.`order_number` FROM `vpn_invoice` i, `vpn_order` o WHERE i.`order_id` = o.`order_id` AND o.`status` IN ('expired','approve') AND i.`is_expired` = '0' AND i.`trade_status` = 'TRADE_FINISHED' AND i.`due_time` < " . $tips;
$niv = QDB::getConn()->getAll($sql);
// 这里的 due_time 其实不用设置,因为这系统账单不会过期。。。当用户付款后,自动更新下期账单时间。
foreach ($niv as $new) {
$old = $new['order_number'];
$due_time = $nowt > $new['due_time'] ? $nowt : $new['due_time'];
$new['due_time'] = $due_time + $new['per_day'] * $dayt;
$new['order_number'] = 'x' . date('YmdHis') . rand(111, 999);
$test = QDB::getConn()->getOne("SELECT `order_number` FROM `vpn_invoice` WHERE `order_id` = {$new['order_id']} AND `trade_status` LIKE 'WAIT_BUYER_PAY'");
// 如果不存在未支付的账单,则生成之。
if (!$test) {
$new_sql = "INSERT INTO `vpn_invoice` (`order_id`, `order_number`, `buyer_email`, `total_fee`, `trade_time`, `trade_status`, `trade_no`, `trade_ip`, `per_day`, `due_time`, `created`, `updated`) VALUES ({$new['order_id']}, '{$new['order_number']}', '0', {$new['total_fee']}, 0, 'WAIT_BUYER_PAY', '0', '0', {$new['per_day']}, {$new['due_time']}, {$nowt}, 0);";
#QDB::getConn()->execute($new_sql);
//设置上一账单失效。
$ext_sql = "UPDATE `vpn_invoice` SET `is_expired` = '1' WHERE `order_number` = '{$old}'";
QDB::getConn()->execute($ext_sql);
#dump($ext_sql);
}
}
#exit;
// 过期用户
$exts = $nowt - 30 * $dayt;
$sql = "SELECT o.`username`,o.`order_id` FROM `vpn_invoice` i, `vpn_order` o WHERE i.`order_id` = o.`order_id` AND i.`is_expired` = '0' AND i.`trade_status` = 'TRADE_FINISHED' AND o.`status` != 'expired' AND i.`due_time` < " . $exts;
$ext = QDB::getConn()->getAll($sql);
foreach ($ext as $tmp) {
$old_sql = "UPDATE `vpn_order` SET `status` = 'expired' WHERE `order_id` = {$tmp['order_id']}";
$nop_sql = "UPDATE `radusergroup` SET `groupname` = 'NOP' WHERE `username` = '{$tmp['username']}'";
QDB::getConn()->execute($old_sql);
QDB::getConn()->execute($nop_sql);
}
}
示例15: backorderNotice
/**
* Backorder Notice Orders 30 days old
*
* @param Order $Model
* @param int $days
* @param bool|true $count
* @return mixed
*/
public function backorderNotice(Order $Model, $days = 30, $count = false)
{
$Model->useDbConfig = 'replicated';
if ($count == true) {
$find = 'count';
$fields = ['COUNT(DISTINCT Order.id) as count'];
} else {
$find = 'all';
$fields = ['DISTINCT date(Order.date_completed)', 'User.first_name', 'User.last_name', 'User.user_default_locale', 'Order.id', 'Order.order_market_id', 'Email.email', 'OrderItem.quantity', 'OrderItem.ns_warehouse_id', 'Item.sku'];
}
$result = $Model->find($find, ['fields' => $fields, 'joins' => [['table' => 'order_customers', 'alias' => 'OrderCustomer', 'type' => 'INNER', 'conditions' => ['OrderCustomer.order_id = Order.id']], ['table' => 'order_items', 'alias' => 'OrderItem', 'type' => 'INNER', 'conditions' => ['OrderItem.order_customer_id = OrderCustomer.id']], ['table' => 'items', 'alias' => 'Item', 'type' => 'INNER', 'conditions' => ['Item.id = OrderItem.item_id']], ['table' => 'users', 'alias' => 'User', 'type' => 'INNER', 'conditions' => ['User.id = Order.user_id']], ['table' => 'emails', 'alias' => 'Email', 'type' => 'INNER', 'conditions' => ['Email.user_id = User.id', 'Email.email_type_id' => 1]]], 'conditions' => ['Order.order_status_id' => [Order::STATUS_ENTERED, Order::STATUS_PROCESSING, Order::STATUS_SHIPPED], 'NOT' => ['Order.order_type_id' => Order::TYPE_REPLACEMENT], 'OrderItem.order_item_hold_code_id' => OrderItemHoldCode::BACKORDERED, "date(Order.date_completed) > '2015-11-01'", "TIMESTAMPDIFF(DAY, Order.date_completed, NOW()) = {$days}"]]);
return $result;
}