本文整理汇总了PHP中Logic函数的典型用法代码示例。如果您正苦于以下问题:PHP Logic函数的具体用法?PHP Logic怎么用?PHP Logic使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Logic函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexOp
public function indexOp()
{
if (ob_get_level()) {
ob_end_clean();
}
$logic_queue = Logic('queue');
$worker = new QueueServer();
$queues = $worker->scan();
while (true) {
$content = $worker->pop($queues, 1800);
if (is_array($content)) {
$method = key($content);
$arg = current($content);
$result = $logic_queue->{$method}($arg);
if (!$result['state']) {
$this->log($result['msg'], false);
}
// echo date('Y-m-d H:i:s',time()).' '.$method."\n";
// flush();
// ob_flush();
} else {
$model = Model();
$model->checkActive();
unset($model);
// echo date('Y-m-d H:i:s',time())." ---\n";
// flush();
// ob_flush();
}
}
}
示例2: image_uploadOp
public function image_uploadOp()
{
$logic_goods = Logic('goods');
$result = $logic_goods->uploadGoodsImage($_POST['name'], $this->seller_info['store_id'], $this->store_grade['sg_album_limit']);
if (!$result['state']) {
output_error($result['msg']);
}
output_data(array('image_name' => $result['data']['name']));
}
示例3: push
/**
* 入列
* @param string $key
* @param array $value
*/
public static function push($key, $value) {
if (!C('queue.open')) {
Logic('queue')->$key($value);return;
}
if (!is_object(self::$queuedb)) {
self::$queuedb = new QueueDB();
}
return self::$queuedb->push(serialize(array($key=>$value)));
}
示例4: buy_step3Op
/**
* 虚拟商品购买第三步
*/
public function buy_step3Op() {
$logic_buy_virtual = Logic('buy_virtual');
$_POST['order_from'] = 1;
$result = $logic_buy_virtual->buyStep3($_POST,$_SESSION['member_id']);
if (!$result['state']) {
showMessage($result['msg'], 'index.php', 'html', 'error');
}
//转向到商城支付页面
redirect('index.php?act=buy_virtual&op=pay&order_id='.$result['data']['order_id']);
}
示例5: changeOrderStateCancel
/**
* 取消订单
* @param array $order_info
* @param string $role 操作角色 buyer、seller、admin、system 分别代表买家、商家、管理员、系统
* @param string $msg 操作备注
* @param boolean $if_queue 是否使用队列
* @return array
*/
public function changeOrderStateCancel($order_info, $role, $msg, $if_queue = true)
{
try {
$model_vr_order = Model('vr_order');
$model_vr_order->beginTransaction();
//库存、销量变更
if ($if_queue) {
QueueClient::push('cancelOrderUpdateStorage', array($order_info['goods_id'] => $order_info['goods_num']));
} else {
Logic('queue')->cancelOrderUpdateStorage(array($order_info['goods_id'] => $order_info['goods_num']));
}
$model_pd = Model('predeposit');
//解冻充值卡
$pd_amount = floatval($order_info['rcb_amount']);
if ($pd_amount > 0) {
$data_pd = array();
$data_pd['member_id'] = $order_info['buyer_id'];
$data_pd['member_name'] = $order_info['buyer_name'];
$data_pd['amount'] = $pd_amount;
$data_pd['order_sn'] = $order_info['order_sn'];
$model_pd->changeRcb('order_cancel', $data_pd);
}
//解冻预存款
$pd_amount = floatval($order_info['pd_amount']);
if ($pd_amount > 0) {
$data_pd = array();
$data_pd['member_id'] = $order_info['buyer_id'];
$data_pd['member_name'] = $order_info['buyer_name'];
$data_pd['amount'] = $pd_amount;
$data_pd['order_sn'] = $order_info['order_sn'];
$model_pd->changePd('order_cancel', $data_pd);
}
//更新订单信息
$update_order = array('order_state' => ORDER_STATE_CANCEL, 'pd_amount' => 0, 'close_time' => TIMESTAMP, 'close_reason' => $msg);
$update = $model_vr_order->editOrder($update_order, array('order_id' => $order_info['order_id']));
if (!$update) {
throw new Exception('保存失败');
}
$model_vr_order->commit();
return callback(true, '更新成功');
} catch (Exception $e) {
$model_vr_order->rollback();
return callback(false, $e->getMessage());
}
}
示例6: order_cancelOp
/**
* 取消订单
*/
public function order_cancelOp()
{
$model_vr_order = Model('vr_order');
$condition = array();
$condition['order_id'] = intval($_POST['order_id']);
$condition['buyer_id'] = $this->member_info['member_id'];
$order_info = $model_vr_order->getOrderInfo($condition);
$if_allow = $model_vr_order->getOrderOperateState('buyer_cancel', $order_info);
if (!$if_allow) {
output_data('无权操作');
}
$logic_vr_order = Logic('vr_order');
$result = $logic_vr_order->changeOrderStateCancel($order_info, 'buyer', '其它原因');
if (!$result['state']) {
output_data($result['msg']);
} else {
output_data('1');
}
}
示例7: vr_payOp
/**
* 虚拟订单支付
*/
public function vr_payOp()
{
$order_sn = $_GET['pay_sn'];
$model_mb_payment = Model('mb_payment');
$logic_payment = Logic('payment');
$condition = array();
$condition['payment_code'] = $this->payment_code;
$mb_payment_info = $model_mb_payment->getMbPaymentOpenInfo($condition);
if (!$mb_payment_info) {
output_error('系统不支持选定的支付方式');
}
//重新计算所需支付金额
$result = $logic_payment->getVrOrderInfo($order_sn, $this->member_info['member_id']);
if (!$result['state']) {
output_error($result['msg']);
}
//第三方API支付
$this->_api_pay($result['data'], $mb_payment_info);
}
示例8: buy_step3Op
/**
* 虚拟订单第三步,产生订单
* POST
* 传入:goods_id:商品ID,quantity:购买数量,buyer_phone:接收手机,buyer_msg:下单留言,pd_pay:是否使用预存款支付0否1是,password:支付密码
*/
public function buy_step3Op()
{
$logic_buy_virtual = Logic('buy_virtual');
$input = array();
$input['goods_id'] = $_POST['goods_id'];
$input['quantity'] = $_POST['quantity'];
$input['buyer_phone'] = $_POST['buyer_phone'];
$input['buyer_msg'] = $_POST['buyer_msg'];
//支付密码
$input['password'] = $_POST['password'];
//是否使用充值卡支付0是/1否
$input['rcb_pay'] = intval($_POST['rcb_pay']);
//是否使用预存款支付0是/1否
$input['pd_pay'] = intval($_POST['pd_pay']);
$input['order_from'] = 2;
$result = $logic_buy_virtual->buyStep3($input, $this->member_info['member_id']);
if (!$result['state']) {
output_error($result['msg']);
} else {
output_data($result['data']);
}
}
示例9: dowxpay
private function dowxpay($openid, $order_sn)
{
$order_type = substr($order_sn, 0, 1);
$pay_sn = substr($order_sn, 1);
$model_mb_payment = Model('mb_payment');
$logic_payment = Logic('payment');
$condition = array();
$condition['payment_code'] = $this->payment_code;
$mb_payment_info = $model_mb_payment->getMbPaymentOpenInfo($condition);
if ($order_type == 'r') {
$result = $logic_payment->getRealOrderInfo($pay_sn);
} else {
$result = $logic_payment->getVrOrderInfo($pay_sn);
}
$total_fee = $result['data']['api_pay_amount'];
$this->parameters['appid'] = $this->appid;
$this->parameters['mch_id'] = $this->mch_id;
$this->parameters['nonce_str'] = $this->createNoncestr(32);
//$this->parameters['sign']='';
$this->parameters['body'] = $order_sn;
$this->parameters['attach'] = $order_type . '|' . $pay_sn;
$this->parameters['out_trade_no'] = $pay_sn;
$this->parameters['fee_type'] = 'CNY';
$this->parameters['total_fee'] = $total_fee * 100;
$this->parameters['spbill_create_ip'] = $_SERVER["REMOTE_ADDR"];
$this->parameters['notify_url'] = $this->notify_url;
$this->parameters['trade_type'] = 'JSAPI';
$this->parameters['openid'] = $openid;
$prepay_id = $this->getPrepayId();
$this->setPrepayId($prepay_id);
$jsApiParameters = $this->getParameters();
//return $jsApiParameters;
$html = $this->showpay($jsApiParameters);
//file_put_contents('html',$html);
echo $html;
}
示例10: sendOp
/**
* 发货
*/
public function sendOp()
{
$order_id = intval($_GET['order_id']);
if ($order_id <= 0) {
showMessage(Language::get('wrong_argument'), '', 'html', 'error');
}
$model_order = Model('order');
$condition = array();
$condition['order_id'] = $order_id;
$condition['store_id'] = $_SESSION['store_id'];
$order_info = $model_order->getOrderInfo($condition, array('order_common', 'order_goods'));
$if_allow_send = intval($order_info['lock_state']) || !in_array($order_info['order_state'], array(ORDER_STATE_PAY, ORDER_STATE_SEND));
if ($if_allow_send) {
showMessage(Language::get('wrong_argument'), '', 'html', 'error');
}
if (chksubmit()) {
$logic_order = Logic('order');
$_POST['reciver_info'] = $this->_get_reciver_info();
$result = $logic_order->changeOrderSend($order_info, 'seller', $_SESSION['member_name'], $_POST);
if (!$result['state']) {
showMessage($result['msg'], '', 'html', 'error');
} else {
showDialog($result['msg'], $_POST['ref_url'], 'succ');
}
}
Tpl::output('order_info', $order_info);
//取发货地址
$model_daddress = Model('daddress');
if ($order_info['extend_order_common']['daddress_id'] > 0) {
$daddress_info = $model_daddress->getAddressInfo(array('address_id' => $order_info['extend_order_common']['daddress_id']));
} else {
//取默认地址
$daddress_info = $model_daddress->getAddressList(array('store_id' => $_SESSION['store_id']), '*', 'is_default desc', 1);
$daddress_info = $daddress_info[0];
//写入发货地址编号
$this->_edit_order_daddress($daddress_info['address_id'], $order_id);
}
Tpl::output('daddress_info', $daddress_info);
$express_list = rkcache('express', true);
//如果是自提订单,只保留自提快递公司
if (isset($order_info['extend_order_common']['reciver_info']['dlyp'])) {
foreach ($express_list as $k => $v) {
if ($v['e_zt_state'] == '0') {
unset($express_list[$k]);
}
}
$my_express_list = array_keys($express_list);
} else {
//快递公司
$my_express_list = Model()->table('store_extend')->getfby_store_id($_SESSION['store_id'], 'express');
if (!empty($my_express_list)) {
$my_express_list = explode(',', $my_express_list);
}
}
Tpl::output('my_express_list', $my_express_list);
Tpl::output('express_list', $express_list);
Tpl::showpage('store_deliver.send');
}
示例11: add_combOp
/**
* 推荐组合加入购物车
*/
public function add_combOp()
{
if (!preg_match('/^[\\d|]+$/', $_GET['goods_ids'])) {
exit(json_encode(array('state' => 'false')));
}
$model_goods = Model('goods');
$logic_buy_1 = Logic('buy_1');
if (!$_SESSION['member_id']) {
exit(json_encode(array('msg' => '请先登录', 'UTF-8')));
}
$goods_id_array = explode('|', $_GET['goods_ids']);
$model_goods = Model('goods');
$goods_list = $model_goods->getGoodsOnlineListAndPromotionByIdArray($goods_id_array);
foreach ($goods_list as $goods) {
$this->_check_goods($goods, 1);
}
//抢购
$logic_buy_1->getGroupbuyCartList($goods_list);
//限时折扣
$logic_buy_1->getXianshiCartList($goods_list);
$model_cart = Model('cart');
foreach ($goods_list as $goods_info) {
$cart_info = array();
$cart_info['store_id'] = $goods_info['store_id'];
$cart_info['goods_id'] = $goods_info['goods_id'];
$cart_info['goods_name'] = $goods_info['goods_name'];
$cart_info['goods_price'] = $goods_info['goods_price'];
$cart_info['goods_num'] = 1;
$cart_info['goods_image'] = $goods_info['goods_image'];
$cart_info['store_name'] = $goods_info['store_name'];
$quantity = 1;
//已登录状态,存入数据库,未登录时,存入COOKIE
if ($_SESSION['member_id']) {
$save_type = 'db';
$cart_info['buyer_id'] = $_SESSION['member_id'];
} else {
$save_type = 'cookie';
}
$insert = $model_cart->addCart($cart_info, $save_type, $quantity);
if ($insert) {
//购物车商品种数记入cookie
setNcCookie('cart_goods_num', $model_cart->cart_goods_num, 2 * 3600);
$data = array('state' => 'true', 'num' => $model_cart->cart_goods_num, 'amount' => ncPriceFormat($model_cart->cart_all_price));
} else {
$data = array('state' => 'false');
exit(json_encode($data));
}
}
exit(json_encode($data));
}
示例12: _order_receive_pay
/**
* 系统收到货款
* @param unknown $order_info
* @throws Exception
*/
private function _order_receive_pay($order_info, $post)
{
$model_vr_order = Model('vr_order');
$logic_vr_order = Logic('vr_order');
$if_allow = $model_vr_order->getOrderOperateState('system_receive_pay', $order_info);
if (!$if_allow) {
return callback(false, '无权操作');
}
if (!chksubmit()) {
Tpl::output('order_info', $order_info);
//显示支付接口
$payment_list = Model('payment')->getPaymentOpenList();
//去掉预存款和货到付款
foreach ($payment_list as $key => $value) {
if ($value['payment_code'] == 'predeposit' || $value['payment_code'] == 'offline') {
unset($payment_list[$key]);
}
}
Tpl::output('payment_list', $payment_list);
Tpl::showpage('order.receive_pay');
exit;
} else {
$this->log('将虚拟订单改为已收款状态,' . L('order_number') . ':' . $order_info['order_sn'], 1);
return $logic_vr_order->changeOrderStatePay($order_info, 'system', $post);
}
}
示例13: changeOrderStateCancel
/**
* 取消订单
* @param array $order_info
* @param string $role 操作角色 buyer、seller、admin、system 分别代表买家、商家、管理员、系统
* @param string $user 操作人
* @param string $msg 操作备注
* @param boolean $if_update_account 是否变更账户金额
* @param boolean $if_queue 是否使用队列
* @return array
*/
public function changeOrderStateCancel($order_info, $role, $user = '', $msg = '', $if_update_account = true, $if_quque = true)
{
try {
$model_order = Model('order');
$model_order->beginTransaction();
$order_id = $order_info['order_id'];
//库存销量变更
$goods_list = $model_order->getOrderGoodsList(array('order_id' => $order_id));
$data = array();
foreach ($goods_list as $goods) {
$data[$goods['goods_id']] = $goods['goods_num'];
}
if ($if_quque) {
QueueClient::push('cancelOrderUpdateStorage', $data);
} else {
Logic('queue')->cancelOrderUpdateStorage($data);
}
if ($if_update_account) {
$model_pd = Model('predeposit');
//解冻充值卡
$rcb_amount = floatval($order_info['rcb_amount']);
if ($rcb_amount > 0) {
$data_pd = array();
$data_pd['member_id'] = $order_info['buyer_id'];
$data_pd['member_name'] = $order_info['buyer_name'];
$data_pd['amount'] = $rcb_amount;
$data_pd['order_sn'] = $order_info['order_sn'];
$model_pd->changeRcb('order_cancel', $data_pd);
}
//解冻预存款
$pd_amount = floatval($order_info['pd_amount']);
if ($pd_amount > 0) {
$data_pd = array();
$data_pd['member_id'] = $order_info['buyer_id'];
$data_pd['member_name'] = $order_info['buyer_name'];
$data_pd['amount'] = $pd_amount;
$data_pd['order_sn'] = $order_info['order_sn'];
$model_pd->changePd('order_cancel', $data_pd);
}
}
//更新订单信息
$update_order = array('order_state' => ORDER_STATE_CANCEL, 'pd_amount' => 0);
$update = $model_order->editOrder($update_order, array('order_id' => $order_id));
if (!$update) {
throw new Exception('保存失败');
}
//添加订单日志
$data = array();
$data['order_id'] = $order_id;
$data['log_role'] = $role;
$data['log_msg'] = '取消了订单';
$data['log_user'] = $user;
if ($msg) {
$data['log_msg'] .= ' ( ' . $msg . ' )';
}
$data['log_orderstate'] = ORDER_STATE_CANCEL;
$model_order->addOrderLog($data);
$model_order->commit();
return callback(true, '操作成功');
} catch (Exception $e) {
$this->rollback();
return callback(false, '操作失败');
}
}
示例14: getReasonInfoOp
/**
* 获取售后原因
* @return [type] [description]
*/
public function getReasonInfoOp()
{
$order_id = intval($_GET['order_id']);
$goods_id = intval($_GET['goods_id']);
$model_order = Model("order");
$model_refund = Model('refund_return');
$reason_list = $model_refund->getReasonList();
// 查询条件
$condition = array();
$condition['order_id'] = $order_id;
$condition['buyer_id'] = $this->member_info['member_id'];
$order = $model_refund->getRightOrderList($condition, $goods_id);
$is_return = $model_refund->getRefundState($order);
if ($is_return == 0) {
output_error("当前订单无法申请售后");
}
if ($order['order_amount'] < $order['goods_list'][0]['goods_pay_price'] + $order['refund_amount']) {
$order['goods_list'][0]['goods_pay_price'] = $order['order_amount'] - $order['refund_amount'];
}
if ($goods_id == 0) {
//禁止退款金额
$lock_amount = Logic('order_book')->getDepositAmount($order);
$order['allow_refund_amount'] = $order['order_amount'] - $lock_amount;
unset($order['goods_list']);
$order['goods_list']['rec_id'] = 0;
} else {
$temp = $order['goods_list'][0];
unset($order['goods_list']);
$order['goods_list'] = $temp;
}
output_data(array('data' => array('reason' => $reason_list, 'order_info' => $order)));
}
示例15: _exchange
/**
* 兑换码消费
*/
private function _exchange()
{
if (chksubmit()) {
if (!preg_match('/^[a-zA-Z0-9]{15,18}$/', $_GET['vr_code'])) {
return array('error' => '兑换码格式错误,请重新输入');
}
$model_vr_order = Model('vr_order');
$vr_code_info = $model_vr_order->getOrderCodeInfo(array('vr_code' => $_GET['vr_code']));
if (empty($vr_code_info) || $vr_code_info['store_id'] != $_SESSION['store_id']) {
return array('error' => '该兑换码不存在');
}
if ($vr_code_info['vr_state'] == '1') {
return array('error' => '该兑换码已被使用');
}
if ($vr_code_info['vr_indate'] < TIMESTAMP) {
return array('error' => '该兑换码已过期,使用截止日期为: ' . date('Y-m-d H:i:s', $vr_code_info['vr_indate']));
}
if ($vr_code_info['refund_lock'] > 0) {
//退款锁定状态:0为正常,1为锁定(待审核),2为同意
return array('error' => '该兑换码已申请退款,不能使用');
}
//更新兑换码状态
$update = array();
$update['vr_state'] = 1;
$update['vr_usetime'] = TIMESTAMP;
$update = $model_vr_order->editOrderCode($update, array('vr_code' => $_GET['vr_code']));
//如果全部兑换完成,更新订单状态
Logic('vr_order')->changeOrderStateSuccess($vr_code_info['order_id']);
if ($update) {
//取得返回信息
$order_info = $model_vr_order->getOrderInfo(array('order_id' => $vr_code_info['order_id']));
if ($order_info['use_state'] == '0') {
$model_vr_order->editOrder(array('use_state' => 1), array('order_id' => $vr_code_info['order_id']));
}
$order_info['img_60'] = thumb($order_info, 60);
$order_info['img_240'] = thumb($order_info, 240);
$order_info['goods_url'] = urlShop('goods', 'index', array('goods_id' => $order_info['goods_id']));
$order_info['order_url'] = urlShop('store_vr_order', 'show_order', array('order_id' => $order_info['order_id']));
return array('error' => '', 'data' => $order_info);
}
} else {
self::profile_menu('exchange', 'exchange');
Tpl::showpage('store_vr_order.exchange');
}
}