public function dispose_order($order_id, $trust_response = false) { global $kekezu, $uid, $username, $_K; global $_lang; $response = array(); $task_config = $this->_task_config; $task_info = $this->_task_info; $url = $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id; $task_status = $this->_task_status; $order_info = db_factory::get_one("select * from " . TABLEPRE . "witkey_order where order_id=" . intval($order_id)); $order_amount = $order_info['order_amount']; if ($order_info['order_status'] == 'ok') { $task_status == 1 && ($notice = $_lang['task_pay_success_and_wait_admin_audit']); $task_status == 2 && ($notice = $_lang['task_pay_success_and_task_pub_success']); return pay_return_fac_class::struct_response($_lang['operate_notice'], $notice, $url, 'success'); } else { $arrOrderDetail = keke_order_class::get_order_detail($order_id); foreach ($arrOrderDetail as $k => $v) { if ($v['obj_type'] == 'task' && $v['detail_type'] == null) { $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('pub_task', $data); $res = keke_finance_class::cash_out($task_info['uid'], $v['price'], 'pub_task', 0, 'task', $this->_task_id); } if ($v['obj_type'] == 'task' && $v['detail_type']) { PayitemClass::createPayitemRecord($v['detail_type'], $v['num'], $v['obj_type'], $v['obj_id']); } } switch ($res == true) { case "1": $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("pub_task", $this->_task_id)) { $objProm->create_prom_event("pub_task", $this->_guid, $task_info['task_id'], $task_info['task_cash']); } db_factory::updatetable(TABLEPRE . "witkey_order", array("order_status" => "ok"), array("order_id" => "{$order_id}")); keke_order_class::update_fina_order($res, $order_id); $consume = kekezu::get_cash_consume($task_info['task_cash']); db_factory::execute(sprintf(" update %switkey_task set cash_cost='%s',credit_cost='%s' where task_id='%d'", TABLEPRE, $consume['cash'], $consume['credit'], $this->_task_id)); if ($task_info['task_cash'] < $task_config['audit_cash'] && !$this->_trust_mode) { $this->set_task_status(1); return pay_return_fac_class::struct_response($_lang['operate_notice'], $_lang['task_pay_success_and_wait_admin_audit'], $url, 'alert_right'); } else { $this->set_task_status(2); $feed_arr = array("feed_username" => array("content" => $task_info['username'], "url" => "index.php?do=seller&id={$task_info['uid']}"), "action" => array("content" => $_lang['pub_task'], "url" => ""), "event" => array("content" => "{$task_info['task_title']}", "url" => "index.php?do=task&id={$task_info['task_id']}", "cash" => $task_info['task_cash_coverage'] ? $task_info['task_cash_coverage'] : $task_info['task_cash'], "model_id" => "{$this->_model_id}")); kekezu::save_feed($feed_arr, $task_info['uid'], $task_info['username'], 'pub_task', $task_info['task_id']); $status_arr = self::get_task_status(); $url = '<a href="' . $_K['siteurl'] . '/index.php?do=task&id=' . $task_info['task_id'] . '" target="_blank">' . $task_info['task_title'] . '</a>'; $v = array('model_name' => $this->_model_name, 'task_id' => $task_info['task_id'], $_lang['task_title'] => $task_info['task_title'], $_lang['task_id'] => $task_info['task_id'], $_lang['task_link'] => $url, $_lang['task_status'] => $status_arr[2], '开始时间' => date('Y-m-d H:i:s', $task_info['start_time']), '投稿结束时间' => date('Y-m-d H:i:s', $task_info['sub_time']), '选稿结束时间' => date('Y-m-d H:i:s', $task_info['end_time'])); $this->notify_user("task_pub", '任务发布通知', $v, $notify_type = 1, $task_info['uid']); return pay_return_fac_class::struct_response($_lang['operate_notice'], $_lang['task_pay_success_and_task_pub_success'], $url, 'alert_right'); } break; case "0": $pay_url = $_K['siteurl'] . "/index.php?do=pay&order_id={$order_id}"; return pay_return_fac_class::struct_response($_lang['operate_notice'], $_lang['task_pay_error_and_please_repay'], $pay_url, 'alert_error'); break; } } }
public function work_bid($contact, $quote, $tar_content, $cycle, $work_hidden = '0') { global $_lang; if (true) { $strNotice = $this->check_user_can_hand($url, $output); if ($strNotice === true) { $work_obj = new Keke_witkey_task_work_class(); $work_obj->setTask_id($this->_task_id); $work_obj->setUid($this->_uid); $work_obj->setUsername($this->_username); $work_obj->setWork_status(4); $work_obj->setWork_title($this->_task_title); $work_obj->setWork_hidden($work_hidden); $work_obj->setWork_time(time()); if ($this->_task_info['workhide'] == 1) { $work_obj->setWorkhide(1); } $work_id = $work_obj->create_keke_witkey_task_work(); $consume = kekezu::get_cash_consume($this->_task_config['deposit']); if ($work_id && $this->host_deposit_cash($work_id)) { $this->set_task_status(3); $this->plus_work_num(); $this->plus_take_num(); $match_obj = new Keke_witkey_task_match_work_class(); $match_obj->_mw_id = null; $match_obj->setWork_id($work_id); $match_obj->setWiki_deposit($this->_task_config['deposit']); $match_obj->setDeposit_cash($this->_task_config['deposit']); $match_obj->setWitkey_contact($contact); $match_obj->setQuote($quote); CHARSET == 'gbk' and $tar_content = kekezu::utftogbk($tar_content); $match_obj->setQuote_desc(kekezu::escape($tar_content)); $match_obj->setCycle(intval($cycle)); $mw_id = $match_obj->create_keke_witkey_task_match_work(); db_factory::execute(sprintf("update %switkey_task set end_time = %d where task_id = %d", TABLEPRE, time() + 3600 * $this->_task_config['tuoguan_hour'], $this->_task_id)); $g_notice = array($_lang['description'] => $_lang['hav_new_bid_work'], $_lang['task_title'] => $this->_notice_url); $this->notify_user('match_task', $_lang['work_hand_notice'], $g_notice); return true; } else { $work_obj->setWhere(" work_id = {$work_id}"); $work_obj->del_keke_witkey_task_work(); return $_lang['hand_work_fail_and_operate_agian']; } } else { return $strNotice; } } else { return $strText; } }