本文整理匯總了PHP中Notify::createNoitfy方法的典型用法代碼示例。如果您正苦於以下問題:PHP Notify::createNoitfy方法的具體用法?PHP Notify::createNoitfy怎麽用?PHP Notify::createNoitfy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Notify
的用法示例。
在下文中一共展示了Notify::createNoitfy方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: two
//.........這裏部分代碼省略.........
exit;
}
}
$sku = array();
// 查找庫存
if ($product['has_property'] == 0) {
if ($product['quantity'] < $user_cart['pro_num']) {
echo json_encode(array('status' => false, 'msg' => $product['name'] . '的庫存不足'));
exit;
}
} else {
$sku = D('Product_sku')->where(array('sku_id' => $user_cart['sku_id']))->find();
if ($sku['quantity'] < $user_cart['pro_num']) {
echo json_encode(array('status' => false, 'msg' => $product['name'] . '的庫存不足'));
exit;
}
}
$product_list[$product['product_id']] = $product['product_id'];
$total += $user_cart['pro_num'];
$total_money += $user_cart['pro_price'] * $user_cart['pro_num'];
$user_cart['product'] = $product;
$user_cart['sku'] = $sku;
$user_cart['sku_data'] = $user_cart['sku_data'];
}
$store = M('Store')->getStore($store_id);
if (empty($store['buyer_selffetch']) && empty($store['open_logistics'])) {
echo json_encode(array('status' => false, 'msg' => '店鋪未設置物流配送方式,暫時不能購買'));
exit;
}
//-----------------------------------------------------
// 在提交購物車的內容手就產生訂單,無須到第二步確認訂單
// 生成訂單
$order_no = date('YmdHis', $_SERVER['REQUEST_TIME']) . mt_rand(100000, 999999);
$data_order['store_id'] = $store_id;
$data_order['order_no'] = $data_order['trade_no'] = $order_no;
$data_order['uid'] = $this->user_session['uid'];
$data_order['sub_total'] = $total_money;
$data_order['pro_num'] = $total;
$data_order['pro_count'] = count($product_list);
$data_order['add_time'] = $_SERVER['REQUEST_TIME'];
$database = D('Order');
$order_id = $database->data($data_order)->add();
if (empty($order_id)) {
echo json_encode(array('status' => false, 'msg' => '訂單產生失敗'));
exit;
}
M('Store_user_data')->upUserData($data_order['store_id'], $this->user_session['uid'], 'unpay');
$database_order_product = D('Order_product');
$database_product = D('Product');
$data_order_product['order_id'] = $order_id;
$suppliers = array();
foreach ($user_cart_list as $value) {
$product_info = $database_product->field('store_id, original_product_id, weight')->where(array('product_id' => $value['product_id']))->find();
if (!empty($product_info['original_product_id'])) {
$tmp_product_info = $database_product->field('store_id')->where(array('product_id' => $product_info['original_product_id']))->find();
$supplier_id = $tmp_product_info['store_id'];
$original_product_id = $product_info['original_product_id'];
} else {
$supplier_id = $product_info['store_id'];
$original_product_id = $value['product_id'];
}
$data_order_product['supplier_id'] = $supplier_id;
$data_order_product['original_product_id'] = $original_product_id;
$data_order_product['user_order_id'] = $order_id;
$suppliers[] = $supplier_id;
$data_order_product['product_id'] = $value['product_id'];
$data_order_product['sku_id'] = $value['sku_id'];
$data_order_product['sku_data'] = $value['sku_data'];
$data_order_product['pro_num'] = $value['pro_num'];
$data_order_product['pro_price'] = $value['pro_price'];
$data_order_product['comment'] = !empty($value['comment']) ? $value['comment'] : '';
$data_order_product['is_fx'] = $value['is_fx'];
//是否是分銷商品
$data_order_product['pro_weight'] = $product_info['weight'];
$database_order_product->data($data_order_product)->add();
}
$suppliers = array_unique($suppliers);
//分銷商
$suppliers = implode(',', $suppliers);
if (!empty($suppliers)) {
//修改訂單,設置分銷商
$database->where(array('order_id' => $order_id))->data(array('suppliers' => $suppliers))->save();
}
$condition_user_cart = array('uid' => $this->user_session['uid'], 'pigcms_id' => array('in', $id));
D('User_cart')->where($condition_user_cart)->delete();
// 產生提醒
import('source.class.Notify');
Notify::createNoitfy($product['store_id'], option('config.orderid_prefix') . $order_no);
//redirect(url('order:address', array('order_id' => option('config.orderid_prefix') . $order_no)));
echo json_encode(array('status' => true, 'data' => array('order_no' => option('config.orderid_prefix') . $order_no)));
exit;
//----------------------------------------------------
$user_address_list = M('User_address')->select('', $this->user_session['uid']);
$this->assign('user_address_list', $user_address_list);
$this->assign('user_cart_list', $user_cart_list);
$this->assign('total', $total);
$this->assign('total_money', $total_money);
$this->assign('step', 'two');
$this->display();
}
示例2: add
//.........這裏部分代碼省略.........
$address = $address_list[0];
}
$address_arr = array();
if (!empty($address)) {
$address_arr['address'] = $address['address'];
$address_arr['province'] = $address['province_txt'];
$address_arr['province_code'] = $address['province'];
$address_arr['city'] = $address['city_txt'];
$address_arr['city_code'] = $address['city'];
$address_arr['area'] = $address['area_txt'];
$address_arr['area_code'] = $address['area'];
}
$data_order['address'] = serialize($address_arr);
$data_order['address_user'] = $address['name'];
$data_order['address_tel'] = $address['tel'];*/
$order_id = D('Order')->data($data_order)->add();
if (empty($order_id)) {
echo json_encode(array('status' => false, 'msg' => '訂單產生失敗,請重試'));
exit;
}
$data_order_product['order_id'] = $order_id;
$data_order_product['product_id'] = $product['product_id'];
$data_order_product['sku_id'] = $sku_id;
$data_order_product['sku_data'] = $propertiesStr;
$data_order_product['pro_num'] = $quantity;
$data_order_product['pro_price'] = $product_price;
$data_order_product['comment'] = !empty($_POST['custom']) ? serialize($_POST['custom']) : '';
$data_order_product['pro_weight'] = $product['weight'];
//分銷商品
if (!empty($product['supplier_id'])) {
$data_order_product['is_fx'] = 1;
}
$product_info = D('Product')->field('product_id,store_id,original_product_id')->where(array('product_id' => $product['product_id']))->find();
if (!empty($product_info['original_product_id'])) {
$tmp_product_info = D('Product')->field('store_id')->where(array('product_id' => $product_info['original_product_id']))->find();
$supplier_id = $tmp_product_info['store_id'];
$original_product_id = $product_info['original_product_id'];
} else {
$supplier_id = $product_info['store_id'];
$original_product_id = $product_info['product_id'];
}
$data_order_product['supplier_id'] = $supplier_id;
$data_order_product['original_product_id'] = $original_product_id;
$data_order_product['user_order_id'] = $order_id;
if (D('Order_product')->data($data_order_product)->add()) {
if (!empty($this->user_session['uid'])) {
M('Store_user_data')->upUserData($product['store_id'], $this->user_session['uid'], 'unpay');
}
if (!empty($supplier_id)) {
//修改訂單,設置分銷商
D('Order')->where(array('order_id' => $order_id))->data(array('suppliers' => $supplier_id))->save();
}
echo json_encode(array('status' => true, 'msg' => '訂單添加成功', 'data' => array('order_no' => option('config.orderid_prefix') . $order_no)));
// 產生提醒
import('source.class.Notify');
Notify::createNoitfy($product['store_id'], option('config.orderid_prefix') . $order_no);
exit;
} else {
echo json_encode(array('status' => false, 'msg' => '訂單產生失敗,請重試'));
exit;
}
} else {
// 查找購物車裏是否有相應的產品
$user_cart = D('User_cart')->where(array('uid' => $this->user_session['uid'], 'product_id' => $product['product_id'], 'store_id' => $product['store_id'], 'sku_id' => $sku_id))->find();
if (!empty($user_cart)) {
if (D('User_cart')->where(array('pigcms_id' => $user_cart['pigcms_id']))->setInc('pro_num', $quantity)) {
// 查找購物車數量
$pro_num = D('User_cart')->where(array('uid' => $this->user_session['uid']))->sum('pro_num');
echo json_encode(array('status' => true, 'msg' => '添加購物車成功', 'data' => array('number' => $pro_num)));
exit;
} else {
echo json_encode(array('status' => false, 'msg' => '添加購物車失敗'));
exit;
}
}
$data_user_cart['uid'] = $this->user_session['uid'];
$data_user_cart['product_id'] = $product['product_id'];
$data_user_cart['store_id'] = $product['store_id'];
$data_user_cart['sku_id'] = $sku_id;
$data_user_cart['sku_data'] = $propertiesStr;
$data_user_cart['pro_num'] = $quantity;
$data_user_cart['pro_price'] = $product_price;
$data_user_cart['add_time'] = $_SERVER['REQUEST_TIME'];
$data_user_cart['comment'] = !empty($_POST['custom']) ? serialize($_POST['custom']) : '';
if (!empty($product['supplier_id'])) {
$data_user_cart['is_fx'] = 1;
}
if (D('User_cart')->data($data_user_cart)->add()) {
// 查找購物車數量
$pro_num = D('User_cart')->where(array('uid' => $this->user_session['uid']))->sum('pro_num');
echo json_encode(array('status' => true, 'msg' => '添加購物車成功', 'data' => array('number' => $pro_num)));
exit;
} else {
echo json_encode(array('status' => false, 'msg' => '添加購物車失敗'));
exit;
}
}
}
示例3: array_unique
$database_order_product->data($data_order_product)->add();
}
$suppliers = array_unique($suppliers);
//分銷商
$suppliers = implode(',', $suppliers);
if (!empty($suppliers)) {
//修改訂單,設置分銷商
$data = array();
$data['suppliers'] = $suppliers;
if (!empty($suppliers) && $suppliers != $_POST['storeId']) {
$data['is_fx'] = 1;
}
$database->where(array('order_id' => $order_id))->data($data)->save();
}
//刪除購物車商品
$condition_user_cart['pigcms_id'] = array('in', $_POST['ids']);
if (!empty($wap_user['uid'])) {
$condition_user_cart['uid'] = $wap_user['uid'];
} else {
$condition_user_cart['session_id'] = session_id();
}
D('User_cart')->where($condition_user_cart)->delete();
// 產生提醒
import('source.class.Notify');
Notify::createNoitfy($_POST['storeId'], option('config.orderid_prefix') . $order_no);
json_return(0, $config['orderid_prefix'] . $order_no);
}
}
}
}
echo ob_get_clean();
示例4: M
if (D('Order_product')->data($data_order_product)->add()) {
if (!empty($wap_user['uid'])) {
M('Store_user_data')->upUserData($nowProduct['store_id'], $wap_user['uid'], 'unpay');
}
if (!empty($supplier_id)) {
//修改訂單,設置分銷商
$data = array();
$data['suppliers'] = $supplier_id;
if (!empty($supplier_id) && $supplier_id != $nowProduct['store_id']) {
$data['is_fx'] = 1;
}
D('Order')->where(array('order_id' => $order_id))->data($data)->save();
}
// 產生提醒
import('source.class.Notify');
Notify::createNoitfy($nowProduct['store_id'], option('config.orderid_prefix') . $order_no);
json_return(0, $config['orderid_prefix'] . $order_no);
} else {
D('Order')->where(array('order_id' => $order_id))->delete();
json_return(1005, '訂單產生失敗,請重試');
}
} else {
if (!empty($wap_user['uid'])) {
$data_user_cart['uid'] = $wap_user['uid'];
} else {
$data_user_cart['session_id'] = session_id();
}
$data_user_cart['product_id'] = $nowProduct['product_id'];
$data_user_cart['store_id'] = $nowProduct['store_id'];
$data_user_cart['sku_id'] = $skuId;
$data_user_cart['sku_data'] = $propertiesStr;