示例#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'];
         }
     }
 }
 public function create_task_order($task_id, $model_id, $release_info, $order_status = 'ok')
 {
     global $uid, $username;
     global $_lang;
     $oder_obj = new Keke_witkey_order_class();
     $order_detail = new Keke_witkey_order_detail_class();
     $task_cash = floatval($release_info['txt_task_cash']);
     $att_cash = floatval($release_info['hdn_total_costs']);
     $order_name = $release_info['txt_title'];
     if ($att_cash > 0) {
         $order_amount = $task_cash + $att_cash;
         $model_id == 16 and $order_amount = $att_cash;
     } else {
         $order_amount = $task_cash;
         $model_id == 16 and $order_amount = 0;
     }
     if ($model_id == 16) {
         $config = $this->_task_config;
         intval($config['examine']) == 2 and $status = 2 or $status = 1;
         db_factory::updatetable(TABLEPRE . 'witkey_task', array('task_status' => $status), array('task_id' => $task_id));
     }
     $order_body = $_lang['pub_task'] . "<a href=\"index.php?do=task&id={$task_id}\">" . $order_name . "</a>";
     $order_amount > 0 and $order_id = keke_order_class::create_order($model_id, $uid, $username, $order_name, $order_amount, $order_body, $order_status);
     if ($order_id) {
         $model_id == 16 and $task_cash = 0;
         $task_cash > 0 and keke_order_class::create_order_detail($order_id, $release_info['txt_title'], 'task', intval($task_id), $task_cash);
         if ($this->_task_obj->getTask_status() != 0) {
             $this->_model_info['model_code'] == 'tender' and $site_profit = $task_cash;
             $taskinfo = $this->_task_obj;
         }
         return $order_id;
     }
 }
示例#3
0
 public function hosted_amount()
 {
     global $_K, $_lang, $kekezu;
     if ($this->_bid_info) {
         $real_cash = floatval($this->_task_info['real_cash']);
         $quote = floatval($this->_bid_info['quote']);
         $amount = $real_cash - $quote;
         $exist_id = db_factory::get_count(sprintf("select b.order_id from %switkey_order_detail a left join %switkey_order b on a.order_id=b.order_id left join %switkey_task c on a.obj_id=c.task_id where b.order_status='wait' and a.obj_type='hosted' and c.task_id='%d'", TABLEPRE, TABLEPRE, TABLEPRE, $this->_task_id));
         if ($amount >= 0) {
             if ($amount > 0) {
                 $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title);
                 keke_finance_class::init_mem('task_hosted_return', $data);
                 $res = keke_finance_class::cash_in($this->_uid, $amount, 'task_hosted_return', 0, 'task', $this->_task_id) or $res = 1;
             }
         } else {
             $amount = abs($amount);
             $balance = floatval($this->_g_userinfo['balance']);
             if ($balance - $amount >= 0) {
                 $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title);
                 keke_finance_class::init_mem('hosted_reward', $data);
                 $amount > 0 and $res = keke_finance_class::cash_out($this->_uid, $amount, 'hosted_reward', 0, 'task', $this->_task_id);
                 $order_status = 'ok';
             } else {
                 $order_id = keke_order_class::create_order($this->_model_id, '', '', $this->_task_title . $_lang['jh_task'], $amount, $_lang['task'] . "{$this->_task_url}" . $_lang['reward_cash_trust'], 'wait');
                 $order_id and keke_order_class::create_order_detail($order_id, $this->_task_title, 'hosted', $this->_task_id, $amount);
                 $order_status = 'wait';
                 return '托管失败,您的账户余额不足!点击这里<a href="index.php?do=pay&type=hosted&id=' . intval($this->_task_id) . "&cash=" . $amount . '">去充值</a>';
             }
             if ($exist_id) {
                 $order_status == 'ok' and db_factory::execute(sprintf("update %switkey_order set order_status='ok' where order_id='%d'", TABLEPRE, $exist_id));
             }
         }
         if ($res || $amount == 0) {
             $this->set_task_status(6);
             db_factory::execute(sprintf("update %switkey_task set single_cash='%d',credit_cost = credit_cost+'%d',cash_cost = cash_cost+'%d' where task_id='%d'", TABLEPRE, floatval($this->_bid_info['quote']), $credit_cost, $cash_cost, $this->_task_id));
             $v_arr = array($_lang['username'] => $this->_gusername, $_lang['model_name'] => $this->_model_name, $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $this->_task_title, $_lang['cash_msg'] => $amount);
             keke_msg_class::notify_user($this->_guid, $this->_gusername, 'reward_cash_trust', $_lang['reward_cash_trust_notice'], $v_arr, 1);
             $v_arr = array($_lang['model_name'] => $this->_model_name, $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $this->_task_title, "金额" => $amount);
             keke_msg_class::notify_user($this->_bid_info['uid'], $this->_bid_info['username'], 'dtend_amount', '雇主已托管赏金', $v_arr, 1);
             return true;
         } else {
             return $_lang['reward_cash_trust_fail'];
         }
     } else {
         return $_lang['you_not_choose_and_not_bid_work'];
     }
 }
示例#4
0
 if (isset($formhash) && kekezu::submitcheck($formhash)) {
     if (strtoupper(CHARSET) == 'GBK') {
         $title = kekezu::utftogbk($title);
         $content = kekezu::utftogbk($content);
     }
     $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');
示例#5
0
 public static function creatPayitemOrder($arrPayitemBuy, $type, $objId, $taskOrderId = '0')
 {
     if (TOOL === TRUE) {
         $taskOrderId = intval($taskOrderId);
         $floatCash = self::getPayitemCash($arrPayitemBuy, $type);
         $arrPayitemLists = self::getPayitemList($type);
         $arrObjInfo = self::getObjInfo($type, $objId);
         if ($taskOrderId > 0) {
             $intOrderId = $taskOrderId;
         } else {
             $intOrderId = keke_order_class::create_order($arrObjInfo['model_id'], '', '', '购买增值服务', $floatCash, '购买增值服务', 'wait');
         }
         if ($intOrderId) {
             foreach ($arrPayitemBuy as $k => $v) {
                 $cash = $v * $arrPayitemLists[$k]['item_cash'];
                 keke_order_class::create_order_detail($intOrderId, '购买增值服务' . $arrPayitemLists[$k]['item_name'], $type, $arrObjInfo['id'], $cash, $v, $k);
             }
         }
         return $intOrderId;
     }
 }