/** * 店铺产生订单后进行提醒操作 */ public static function createNoitfy($store_id, $order_id) { return; // 各种提醒参数没有直接跳出 if (empty($store_id) || empty($order_id)) { return; } $appid = option('config.notify_appid'); $key = option('config.notify_appkey'); if (empty($appid) || empty($key)) { return; } $trade_setting_model = M('Trade_setting'); $trade_setting = $trade_setting_model->get_setting($store_id); // 店铺没有设置提醒,直接跳出 if (empty($trade_setting)) { return; } // 没有提醒时间,直接跳出 if (empty($trade_setting['pay_cancel_time']) && empty($trade_setting['pay_alert_time'])) { return; } $data = array(); $data['order_id'] = $order_id; $data['alert_time'] = $trade_setting['pay_alert_time']; $data['cancel_time'] = $trade_setting['pay_cancel_time']; $data['domain'] = option('config.site_url'); $data['appid'] = $appid; $md5 = Notify::encrypt_key($data, $key); // 提醒订单服务器地址 $scheme = 'http://'; $host = 'www.weidian.com'; $params = '/notify/create_notify.php?order_id=' . $order_id . '&alert_time=' . $trade_setting['pay_alert_time'] . '&cancel_time=' . $trade_setting['pay_cancel_time'] . '&domain=' . option('config.site_url') . '&appid=' . $appid . '&auth_key=' . $md5; $url = $scheme . $host . $params; // 服务器通知 Notify::fsock($host, $params); //Notify::getCurl($url); return; }
exit; } // 通知的app参数 $notify_appid = option('config.notify_appid'); $notify_key = option('config.notify_appkey'); if ($appid != $notify_appid) { echo 'auth appid error'; exit; } import('source.class.Notify'); // md5进行验证 $data = array(); $data['order_id'] = $order_id; $data['type'] = $type; $data['appid'] = $appid; $md5 = Notify::encrypt_key($data, $notify_key); if ($md5 != $auth_key) { echo 'auth error'; exit; } $order_model = M('Order'); // 查找订单 $order = $order_model->find($order_id); if (empty($order)) { echo 'no_order'; exit; } if ($order['status'] > 1) { echo 'type_error'; exit; }