function order_charge() { global $_K; $order_id = $this->_order_id; $sid = $this->_obj_id; $uid = $this->_uid; $user_info = $this->_userinfo; $order_info = db_factory::get_one(sprintf(" select order_status,order_uid,order_username,seller_uid,seller_username from %switkey_order where order_id='%d'", TABLEPRE, $order_id)); $url = $_K['siteurl'] . "/index.php?do=user&view=finance&op=order&obj_type=service&role=2&order_id=" . $order_id; $s_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=finance&op=order&obj_type=service&role=1&order_id=" . $order_id . "\">" . $order_info['order_name'] . "</a>"; $b_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=finance&op=order&obj_type=service&role=2&order_id=" . $order_id . "\">" . $order_info['order_name'] . "</a>"; if ($order_info['order_status'] == 'wait') { $service_info = keke_shop_class::get_service_info($sid); $service_status = db_factory::get_count(sprintf(" select service_status from %switkey_service where service_id='%d'", TABLEPRE, $sid)); if ($service_status == '2') { $data = array(':service_id' => $service_info['service_id'], ':title' => $service_info['title']); keke_finance_class::init_mem('buy_service', $data); $this->_total_fee > 0 and $res = keke_finance_class::cash_out($uid, $this->_total_fee, 'buy_service', '0', 'service', $order_id); if ($res) { db_factory::execute(sprintf(" update %switkey_order set order_status='ok' where order_id='%d'", TABLEPRE, $order_id)); $v_arr = array('用户名' => $order_info['order_username'], '网站名称' => $kekezu->_sys_config['website_name'], '用户' => $_lang['you'], '动作' => $_lang['haved_confirm_pay'], '订单编号' => $order_id, '订单链接' => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_confirm_pay'], $v_arr); $v_arr = array('用户名' => $order_info['order_username'], '网站名称' => $kekezu->_sys_config['website_name'], '用户' => $order_info['order_username'], '动作' => $_lang['haved_confirm_pay'], '订单编号' => $order_id, '订单链接' => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_confirm_pay'], $v_arr); $notice = $_lang['goods_pay_success']; $type = 'success'; } else { $notice = $_lang['goods_pay_fail']; $type = 'warning'; } } else { db_factory::execute(sprintf(" update %switkey_order set order_status='close' where order_id='%d'", TABLEPRE, $order_id)); $v_arr = array('用户名' => $order_info['seller_username'], '网站名称' => $kekezu->_sys_config['website_name'], "用户" => $_lang['system'], '动作' => $_lang['stop_your_order_and_your_cash_return'], '订单编号' => $order_id, '订单链接' => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_close'], $v_arr); $v_arr = array('用户名' => $order_info['order_username'], '网站名称' => $kekezu->_sys_config['website_name'], "用户" => $_lang['system'], '动作' => $_lang['stop_your_order_and_your_cash_return'], '订单编号' => $order_id, '订单链接' => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_close'], $v_arr); $notice = $_lang['goods_pay_fail']; $type = 'warning'; } } else { $notice = $_lang['goods_pay_success']; $type = 'success'; } return pay_return_fac_class::struct_response($_lang['operate_notice'], $notice, $url, $type); }
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 dispose_order($order_id) { global $kekezu, $_K; global $_lang; $task_info = $this->_task_info; $task_status = $this->_task_status; $url = $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id; $order_info = db_factory::get_one(sprintf("select * from %switkey_order where order_id='%d'", TABLEPRE, $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 { $balance = floatval($this->_g_userinfo['balance']); $order_amount = floatval($order_info['order_amount']); $leave_cash = $balance - $order_amount; if ($leave_cash >= 0) { $order_type = db_factory::get_count(sprintf("select obj_type from %switkey_order_detail where order_id='%d' and obj_type in('hosted','task') ", TABLEPRE, $order_id)); if ($order_type == 'hosted') { $action = 'hosted_margin'; $to_status = 6; $msg = $_lang['order_pay_success_and_task_cash_trust_succss']; } else { $action = 'pub_task'; if ($this->_task_config['open_audit'] == 'close') { $to_status = 2; $msg = $_lang['order_pay_success_and_your_task_success']; } else { $to_status = 1; $msg = $_lang['order_pay_success_and_wait_amin_audit']; } } $arrOrderDetail = keke_order_class::get_order_detail($order_id); foreach ($arrOrderDetail as $k => $v) { if (($v['obj_type'] == 'task' || $v['obj_type'] == 'hosted') && $v['detail_type'] == null) { $data = array($kekezu->_model_list[$task_info['model_id']]['model_name'], $task_info['task_id'], $task_info['task_title']); keke_finance_class::init_mem($action, $data); $res = keke_finance_class::cash_out($this->_guid, $v['price'], $action, 0, 'task', $this->_task_id); } else { PayitemClass::createPayitemRecord($v['detail_type'], $v['num'], $v['obj_type'], $v['obj_id']); } } if ($res) { $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("pub_task", $this->_task_id)) { $objProm->create_prom_event("pub_task", $this->_guid, $this->_task_id, $this->_task_info['real_cash']); } keke_order_class::update_fina_order($res, $order_id); if ($action == 'pub_task') { if ($to_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']); } db_factory::execute(sprintf(" update %switkey_task set cash_cost='%s' where task_id='%d'", TABLEPRE, $task_info['task_cash'], $this->_task_id)); } $this->set_task_status($to_status); keke_order_class::set_order_status($order_id, 'ok'); return pay_return_fac_class::struct_response($_lang['operate_notice'], $_lang['order_pay_success'], $url, 'success'); } else { $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'], $url, 'warning'); } } else { $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, 'warning'); } } }