示例#1
0
 public static function create_service_order($service_info, $isApp = false, $serviceOrderInfo = array(), $step = '')
 {
     global $uid, $username, $_K;
     global $_lang;
     if ($uid == $service_info['uid']) {
         if ($isApp) {
             app_class::response(array('ret' => 1003));
         } else {
             return $_lang['seller_can_not_order_self'];
         }
     }
     $oder_obj = new Keke_witkey_order_class();
     $order_detail = new Keke_witkey_order_detail_class();
     switch ($service_info['model_id']) {
         case "6":
             $type = $_lang['work'];
             $service_cash = $service_info['price'];
             break;
         case "7":
             $type = $_lang['service'];
             $service_cash = $serviceOrderInfo['price'];
             break;
     }
     $order_name = $service_info['title'];
     $order_body = $_lang['buy_goods'] . "<a href=\"index.php?do=goods&id={$service_info['service_id']}\">" . $order_name . "</a>";
     if ($service_info['model_id'] == 6) {
         $detail_type = 'goods';
         $order_status = 'wait';
     } else {
         $detail_type = 'service';
         $order_status = 'seller_confirm';
     }
     $order_id = keke_order_class::create_order($service_info['model_id'], $service_info['uid'], $service_info['username'], $order_name, $service_cash, $order_body, $order_status, $service_info['leave_message']);
     if ($order_id) {
         if ($service_info['model_id'] == 7) {
             $serviceOrderInfo['order_id'] = $order_id;
             keke_order_class::createServiceOrder($serviceOrderInfo);
         }
         keke_order_class::create_order_detail($order_id, $order_name, 'service', intval($service_info[service_id]), $service_cash);
         $msg_obj = new keke_msg_class();
         $service_url = "<a href=\"" . $_K[siteurl] . "/index.php?do=goods&id=" . $service_info[service_id] . "\">" . $order_name . "</a>";
         $strLeaveMessage = $service_info['leave_message'];
         $order_url = "<a href=\"" . $_K[siteurl] . "/index.php?do=order&sid=" . $service_info['service_id'] . "&orderId=" . $order_id . "#userCenter\">#" . $order_id . "</a>";
         $s_notice = array($_lang['user_action'] => $username . $_lang['order_buy'], $_lang['service_name'] => $service_url, $_lang['service_type'] => $type, $_lang['buyer_leave_message'] => $strLeaveMessage, $_lang['order_link'] => $order_url);
         if ($service_info['model_id'] == '7') {
             unset($s_notice[$_lang['buyer_leave_message']]);
             $msgAction = 'service_order';
             $shopMx = '服务';
         } else {
             $msgAction = 'goods_order';
             $shopMx = '作品';
         }
         $contact = db_factory::get_one(sprintf(" select mobile,email from %switkey_space where uid='%d'", TABLEPRE, $service_info[uid]));
         if ($service_info['model_id'] != '6' && $step != 'step1') {
             $order_info = keke_order_class::get_order_info($order_id);
             $b_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=transaction&op=sold&intModelId=" . $order_info['model_id'] . "&order_id=" . $order_id . "\">" . $order_info['order_name'] . "</a>";
             $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], '商品标题' => $order_info['order_name'], $_lang['order_link'] => $b_order_link, '商品模型名称' => $shopMx);
             $msg_obj->send_message($service_info['uid'], $service_info['username'], "order_create", $_lang['you_has_new'] . $type . $_lang['order'], $v_arr, $contact['email'], $contact['mobile']);
             $arrTaskInfo = db_factory::get_one("select * from " . TABLEPRE . "witkey_service where service_id=" . intval($service_info[service_id]));
             $feed_arr = array("feed_username" => array("content" => $arrTaskInfo['username'], "url" => "index.php?do=seller&id=" . $arrTaskInfo['uid']), "action" => array("content" => $_lang['buy'], "url" => ''), "event" => array("content" => $order_name, "url" => "index.php?do=goods&id={$service_info['service_id']}"));
             kekezu::save_feed($feed_arr, $uid, $username, 'buy_' . $detail_type, $service_info['service_id'], $service_url);
             $feed_arr = array("feed_username" => array("content" => $username, "url" => "index.php?do=seller&id=" . $uid), "action" => array("content" => $_lang['buy'], "url" => ''), "event" => array("content" => $order_name, "url" => "index.php?do=goods&id={$service_info['service_id']}"));
             kekezu::save_feed($feed_arr, $arrTaskInfo['uid'], $arrTaskInfo['username'], 'buy_' . $detail_type . '_bei', $service_info['service_id'], $service_url);
         }
         if ($isApp) {
             app_class::response(array('ret' => 0, 'orderid' => $order_id));
         } else {
             return $order_id;
         }
     } else {
         if ($isApp) {
             app_class::response(array('ret' => 1004));
         } else {
             return $_lang['order_produce_fail'];
         }
     }
 }
示例#2
0
         }
         $serviceOrderInfo = array();
         $serviceOrderInfo['uid'] = $gUid;
         $serviceOrderInfo['username'] = $gUsername;
         $serviceOrderInfo['service_id'] = 0;
         $serviceOrderInfo['title'] = kekezu::escape($title);
         $serviceOrderInfo['indus_pid'] = intval($indus_pid);
         $serviceOrderInfo['indus_id'] = intval($indus_id);
         $serviceOrderInfo['content'] = kekezu::escape($content);
         $serviceOrderInfo['file_ids'] = $file_ids;
         $serviceOrderInfo['price'] = floatval($price);
         $orderId = keke_order_class::create_order(7, $arrSellerInfo['uid'], $arrSellerInfo['username'], $serviceOrderInfo['title'], $serviceOrderInfo['price'], '雇佣服务:' . $serviceOrderInfo['title'], 'seller_confirm');
         if ($orderId) {
             $serviceOrderInfo['order_id'] = $orderId;
             keke_order_class::create_order_detail($orderId, $serviceOrderInfo['title'], 'gy', $serviceOrderInfo['service_id'], $serviceOrderInfo['price']);
             keke_order_class::createServiceOrder($serviceOrderInfo);
             $order_url = "<a href=\"" . $_K['siteurl'] . "/index.php?do=gy&id=" . $arrSellerInfo['uid'] . "&orderId=" . $orderId . "\">" . $title . "</a>";
             $v_arr = array('用户名' => $arrSellerInfo['username'], '用户' => $username, '雇佣订单链接' => $order_url, '网站名称' => $kekezu->_sys_config['website_name']);
             $msg_obj = new keke_msg_class();
             $msg_obj->send_message($arrSellerInfo['uid'], $arrSellerInfo['username'], 'gy_order_notice', '雇佣订单消息', $v_arr);
             $feed_arr = array("feed_username" => array("content" => $arrSellerInfo['username'], "url" => "index.php?do=seller&id=" . $arrSellerInfo['uid']), "action" => array("content" => '雇佣', "url" => ''), "event" => array("content" => $serviceOrderInfo['title'], "url" => ""));
             kekezu::save_feed($feed_arr, $gUid, $gUsername, 'gy', $id, '');
             $feed_arr = array("feed_username" => array("content" => $gUsername, "url" => "index.php?do=seller&id=" . $gUid), "action" => array("content" => '雇佣', "url" => ''), "event" => array("content" => $serviceOrderInfo['title'], "url" => ""));
             kekezu::save_feed($feed_arr, $arrSellerInfo['uid'], $arrSellerInfo['username'], 'gy_bei', $id, '');
             kekezu::show_msg('订单创建成功', $strUrl . "&step=step2&orderId=" . $orderId, 3, null, 'ok');
         } else {
             kekezu::show_msg('创建订单失败', $strUrl, 3, null, 'fail');
         }
     }
     break;
 case 'step2':