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 process_rights($op_result, $type) { global $kekezu; global $_lang; $prom_obj = $objProm = keke_prom_class::get_instance(); $trans_name = $this->get_transrights_name($this->_report_type); $op_result = $this->op_result_format($op_result); $g_info = $this->user_role('gz'); $w_info = $this->user_role('wk'); switch ($op_result['action']) { case "pass": if ($this->_process_can['sharing']) { $total_cash = floatval($this->_obj_info['cash']); $gz_get = floatval(keke_curren_class::convert($op_result['gz_get'], 0, true)); $wk_get = floatval(keke_curren_class::convert($op_result['wk_get'], 0, true)); if ($total_cash != $gz_get + $wk_get) { kekezu::admin_show_msg($_lang['wain_you_give_cash_error_notice'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "error"); } else { $res = keke_finance_class::cash_in($g_info['uid'], $gz_get, 'rights_return'); $res .= keke_finance_class::cash_in($w_info['uid'], $wk_get, 'rights_return'); if ($res) { $this->process_unfreeze('pass', $op_result['process_result']); $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']); $objProm = keke_prom_class::get_instance(); $w_event = $objProm->get_prom_event($this->_obj_info['origin_id'], $w_info['uid'], "bid_task"); $objProm->set_prom_event_status($w_event['parent_uid'], $this->_gusername, $w_event['event_id'], '3'); $g_event = $objProm->get_prom_event($this->_obj_info['origin_id'], $g_info['uid'], "pub_task"); $objProm->set_prom_event_status($g_event['parent_uid'], $this->_gusername, $g_event['event_id'], '3'); } } $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", "", "success") or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning"); } else { kekezu::admin_show_msg($trans_name . $_lang['deal_fail_now_forbit_deal_cash'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning"); } break; case "nopass": $this->process_unfreeze('nopass', $op_result['reply']); $res = $this->change_status($this->_report_id, '3', $op_result, $op_result['reply']); $res1 = $this->reset_agreement($this->_task_obj->_task_id); $res && $res1 and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", "", "success") or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning"); break; } }
public static function changehongbao($task_id, $moneys, $uid, $money, $title, $g) { $result = db_factory::get_one('select * from ' . TABLEPRE . 'witkey_space where uid=' . $uid); if ($g) { $newbalance = $result['balance'] - $money + $moneys; db_factory::query('update ' . TABLEPRE . 'witkey_space set balance=' . $newbalance . ' where uid=' . $uid); keke_finance_class::insert_trust("in", "task_xg", $uid, -$money + $moneys, $newbalance); } else { $newbalance = $result['balance'] + $money; keke_finance_class::insert_trust("in", "finish_task", $uid, $money, $newbalance, $task_id); db_factory::query('update ' . TABLEPRE . 'witkey_space set balance=' . $newbalance . ' where uid=' . $uid); db_factory::query('update ' . TABLEPRE . 'witkey_space set is_hongbao=1 where uid=' . $uid); db_factory::query('update ' . TABLEPRE . 'witkey_task_work set work_status=4 where uid=' . $uid . ' and task_id=' . $task_id); } if (!$g) { $v_arr = array("红包任务" => '【' . $title . '】', "红包金额" => $money); keke_msg_class::notify_user($uid, $result['username'], 'select', '红包任务完成通知', $v_arr); } return true; }
public function add_auth($data, $is_jump = true) { global $kekezu, $user_info, $_lang; $data = $this->format_auth_apply($data); $arrAuthInfo = $this->get_user_auth_info($user_info[uid]); if ($arrAuthInfo) { $success = $this->_tab_obj->save($data, array($this->_primary_key => $arrAuthInfo[$this->_primary_key])); $this->set_auth_record_status($user_info['uid'], '0'); } else { $success = $this->_tab_obj->save($data); } if ($success) { db_factory::execute(sprintf(" update %switkey_space set truename='%s',idcard='%s' where uid ='%d'", TABLEPRE, $data[realname], $data[id_card], $data[uid])); $data['cash'] > 0 and keke_finance_class::cash_out($data['uid'], $data['cash'], $this->_auth_name, $data['cash'], $this->_auth_name, $success); $data['start_time'] == $data['end_time'] and $end_time = $data['end_time'] or $end_time = 0; $this->add_auth_record($data['uid'], $data['username'], $this->_auth_code, $end_time); return true; } return false; }
public function dispose_task() { global $kekezu, $_lang; $prom_obj = $objProm = keke_prom_class::get_instance(); $model_code = $this->_model_code; $agree_info = $this->_agree_info; $cash_info = db_factory::get_one(sprintf(" select task_cash,task_union,real_cash from %switkey_task where task_id = '%d'", TABLEPRE, $this->_task_id)); $this->plus_mark_num(); keke_user_mark_class::create_mark_log($model_code, '1', $agree_info['seller_uid'], $agree_info['buyer_uid'], $agree_info['work_id'], $cash_info['task_cash'], $this->_task_id, $this->_seller_username, $this->_buyer_username); keke_user_mark_class::create_mark_log($model_code, '2', $agree_info['buyer_uid'], $agree_info['seller_uid'], $agree_info['work_id'], $cash_info['real_cash'], $this->_task_id, $this->_buyer_username, $this->_seller_username); $site_profit = $cash_info['task_cash'] - $cash_info['real_cash']; $task_title = db_factory::get_count(sprintf(" select task_title from %switkey_task where task_id='%d'", TABLEPRE, $this->_task_id)); $data = array(':task_id' => $this->_task_id, ':task_title' => $task_title); keke_finance_class::init_mem('task_bid', $data); keke_finance_class::cash_in($agree_info['seller_uid'], $cash_info['real_cash'], 'task_bid', '', 'task', $this->_task_id, $site_profit); $feed_arr = array("feed_username" => array("content" => $this->_seller_uid, "url" => "index.php?do=seller&id={$this->_seller_uid}"), "action" => array("content" => $_lang['success_bid_haved'], "url" => ""), "event" => array("content" => $task_title, "url" => "index.php?do=task&id={$this->_task_id}", 'cash' => $cash_info['real_cash'])); kekezu::save_feed($feed_arr, $this->_seller_uid, $this->_seller_username, 'work_accept', $this->_task_id); $prom_obj->dispose_prom_event("bid_task", $agree_info['seller_uid'], $this->_task_id); $prom_obj->dispose_prom_event("pub_task", $agree_info['buyer_uid'], $this->_task_id); }
private function user_charge() { global $_K; global $_lang; $uid = $this->_uid; $order_id = $this->_order_id; $order_id = keke_order_class::update_order_charge($this->_out_trade_no, $this->_total_fee); $order_info = db_factory::get_one(sprintf(" select order_status,order_type from %switkey_order_charge where order_id='%d' and uid='%d'", TABLEPRE, $order_id, $uid)); if ($order_info['order_status'] == 'wait') { db_factory::execute(sprintf(" update %switkey_order_charge set order_status='ok' where order_id='%d'", TABLEPRE, $order_id)); $res = keke_finance_class::cash_in($uid, $this->_total_fee, $order_info['order_type'], $this->_charge_type, 'user_charge', $order_id); $v_arr = array($_lang['recharge_account'] => $this->_total_fee); keke_shop_class::notify_user($this->_uid, $this->_username, "pay_success", $_lang['online_recharge_success'], $v_arr, 2); } else { $res = true; } if ($res) { return $this->struct_response($_lang['operate_notice'], $_lang['online_recharge_success'], $url, 'success'); } else { return $this->struct_response($_lang['operate_notice'], $_lang['online_recharge_fail'], $url, 'warning'); } }
public function alipayjs_success_notify($detail_arr, $status = true) { global $_lang, $_K; $ids = implode(",", array_keys($detail_arr)); $info = kekezu::get_table_data("withdraw_id,uid,username,withdraw_status,withdraw_cash,pay_username,pay_account", "witkey_withdraw", " withdraw_id in ({$ids})", "", "", "", "withdraw_id"); foreach ($detail_arr as $k => $v) { if ($info[$k]['withdraw_status'] == 1) { switch ($v['status']) { case "S": $fee = $info[$k]['withdraw_cash'] - keke_finance_class::get_to_cash($info[$k]['withdraw_cash']); $res = db_factory::execute(sprintf(" update %switkey_withdraw set withdraw_status='2',fee=%.2f where withdraw_id ='%d'", TABLEPRE, $fee, $k)); $arr = array($_lang['sitename'] => $_K['sitename'], $_lang['tx_cash'] => $v['fee']); keke_msg_class::notify_user($info[$k]['uid'], $info[$k]['username'], 'draw_success', $_lang['tx_success'], $arr, 2); break; case "F": $res = db_factory::execute(sprintf(" update %switkey_withdraw set withdraw_status='3' where withdraw_id ='%d'", TABLEPRE, $k)); $v_arr = array('网站名称' => $_K['sitename'], '提现方式' => $pay_way[$withdraw_info[0]['pay_type']], '失败原因' => '未注明原因', '帐户' => $withdraw_info[0]['pay_account'], '提现金额' => $v['withdraw_cash']); keke_msg_class::notify_user($info[$k]['uid'], $info[$k]['username'], 'withdraw_fail', $_lang['tx_fail'], $v_arr, 2); break; } } } }
public function process_rights($op_result, $type) { global $_lang; $trans_name = $this->get_transrights_name($this->_report_type); $op_result = $this->op_result_format($op_result); $g_info = $this->user_role('gz'); $w_info = $this->user_role('wk'); switch ($op_result['action']) { case "pass": if ($this->_process_can['sharing']) { $total_cash = floatval($this->_obj_info['cash']); $gz_get = floatval($op_result['gz_get']); $wk_get = floatval($op_result['wk_get']); if ($total_cash != $gz_get + $wk_get) { kekezu::admin_show_msg($_lang['wain_you_give_cash_error_notice'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning"); } else { $res = keke_finance_class::cash_in($g_info['uid'], $gz_get, 'rights_return'); $res .= keke_finance_class::cash_in($w_info['uid'], $wk_get, 'rights_return'); if ($res) { $order_info = db_factory::get_one(sprintf("SELECT obj_id FROM `%switkey_report` WHERE obj = 'order' and report_id = %d", TABLEPRE, $this->_report_id)); db_factory::execute(sprintf("update %switkey_order set `order_status`='close' where order_id = '%d'", TABLEPRE, intval($order_info['obj_id']))); $this->process_unfreeze('pass', $op_result['process_result']); $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']); } } $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", '', 'success') or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning'); } else { kekezu::admin_show_msg($trans_name . $_lang['deal_fail_now_forbit_deal_cash'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning'); } break; case "nopass": $this->process_unfreeze('nopass', $op_result['reply']); $res = $this->change_status($this->_report_id, '3', $op_result, $op_result['reply']); $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", '', 'success') or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning'); break; } }
public function cancel_work($work_id, $type) { keke_lang_class::load_lang_class('preward_report_class'); global $_K, $kekezu; global $_lang; global $admin_info; $this->_task_info['task_status'] == 8 and kekezu::admin_show_msg('操作提示', "index.php?do=trans&view=report&type={$type}", "3", "当前任务不能取消中标", "warning"); $work_info = $this->_task_obj->get_task_work($work_id); $work_info['work_status'] != 6 and kekezu::admin_show_msg('操作提示', "index.php?do=trans&view=report&type={$type}", "3", "当前稿件未中标,不能取消中标状态", "warning"); if ($this->_task_obj->set_work_status($work_id, 8)) { $cash = floatval($this->_task_info['single_cash']) * (1 - floatval($this->_task_info['profit_rate'] / 100)); $data = array(':model_name' => $this->_task_obj->_model_name, ':task_id' => $this->_task_obj->_task_id, ':task_title' => $this->_task_obj->_task_title); keke_finance_class::init_mem('cancel_bid', $data); $cash > 0 and keke_finance_class::cash_out($work_info['uid'], $cash, 'cancel_bid'); $task_id = $this->_task_obj->_task_id; $task_title = $this->_task_obj->_task_title; $task_url = "<a href=\"{$_K[siteurl]}/index.php?do=task&id={$task_id}\">{$task_title}</a>"; kekezu::notify_user($_lang['cancel_bid_notice'], $_lang['you_in_task'] . $task_url . $_lang['de_hand_work_jh'] . $work_id . $_lang['by_site_kf_cancel_bid'], $work_info['uid']); } db_factory::execute(sprintf(" update %switkey_space set accepted_num = accepted_num-1 where uid = '%d'", TABLEPRE, $this->_obj_info['obj_uid'])); }
public static function task_audit_nopass($task_ids, $trust_response = false) { global $kekezu; global $_lang; if ($task_ids && is_array($task_ids)) { $ids = implode(',', $task_ids); $task_arr = db_factory::query(sprintf("select * from %switkey_task where task_id in(%s)", TABLEPRE, $ids)); foreach ($task_arr as $v) { if ($v['model_id'] == '4' || $v['model_id'] == 5) { $return_cash = $v['real_cash']; } else { $return_cash = $v['task_cash']; } $model_info = $kekezu->_model_list[$v['model_id']]; $class_name = $model_info['model_code'] . "_task_class"; $obj = new $class_name($v); $task_config = $obj->_task_config; $res = db_factory::execute(sprintf("update %switkey_task set task_status=10 where task_id ='%d' ", TABLEPRE, $v['task_id'])); $data = array(':model_name' => $kekezu->_model_list[$v['model_id']]['model_name'], ':task_id' => $v['task_id'], ':task_title' => $v['task_title']); keke_finance_class::init_mem('task_fail', $data); if ($v['task_status'] == 1) { PayitemClass::refundPayitem($v['task_id'], 'task'); keke_finance_class::cash_in($v['uid'], $return_cash, 'task_fail', 'admin', 'task', $v['task_id']); } kekezu::admin_system_log($_lang['audit_task'] . ":{$v['task_title']}" . $_lang['not_pass']); } } elseif ($task_ids) { $ids = $task_ids; $task_info = db_factory::get_one(sprintf("select task_id,task_title,task_status,task_cash,real_cash,model_id,uid,is_trust,trust_type,model_id from %switkey_task where task_id = '%d'", TABLEPRE, $ids)); if ($task_info) { if ($task_info['is_trust'] && $trust_response == false) { $trust_data['refund'] = array($ids, $task_info['task_cash']); $jump_url = keke_trust_fac_class::trust_task_request("pt_refund", $kekezu->_model_list[$task_info['model_id']]['model_dir'], $ids, $task_info['trust_type'], $trust_data); header("Location:" . $jump_url); die; } else { $res = db_factory::execute(sprintf("update %switkey_task set task_status=10 where task_id ='%d' ", TABLEPRE, $ids)); switch ($task_info['is_trust']) { case "1": $fina_cash = $task_info['task_cash']; $data = array("uid" => $task_info['uid'], "username" => $task_info['username'], "obj_id" => $ids, "fina_cash" => $fina_cash, "fina_time" => time(), "fina_action" => "task_fail"); keke_finance_class::finance_trust($data, $task_info['trust_type'], 'in'); break; case "0": if ($task_info['model_id'] == '4' || $task_info['model_id'] == 5) { $return_cash = $task_info['real_cash']; } else { $return_cash = $task_info['task_cash']; } $model_info = $kekezu->_model_list[$task_info['model_id']]; $class_name = $model_info['model_code'] . "_task_class"; $obj = new $class_name($task_info); $task_config = $obj->_task_config; $data = array(':model_name' => $kekezu->_model_list[$v['model_id']]['model_name'], ':task_id' => $task_info['task_id'], ':task_title' => $task_info['task_title']); keke_finance_class::init_mem('task_fail', $data); if ($task_info['task_status'] == 1) { PayitemClass::refundPayitem($task_info['task_id'], 'task'); keke_finance_class::cash_in($task_info['uid'], $return_cash, 'task_fail', 'admin', 'task', $task_info['task_id']); } break; } kekezu::admin_system_log($_lang['audit_task'] . ":{$task_info['task_title']}" . $_lang['not_pass']); } } } return $res; }
public static function init_mem($action, $data) { $action_arr = self::get_action_lang(); $action_str = $action_arr[$action]; if (!$action_str) { return false; } if (is_array($data)) { self::$_mem = strtr($action_str, $data); } else { self::$_mem = $data; } }
public function dispose_order($order_id, $action, $isApp = FALSE) { global $uid, $username, $_K, $kekezu, $_lang; $order_info = keke_order_class::get_order_info($order_id); if ($order_info) { $s_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>"; $b_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=transaction&op=orders&intModelId=" . $order_info['model_id'] . "&order_id=" . $order_id . "\">" . $order_info['order_name'] . "</a>"; if ($uid == $order_info['order_uid'] || $uid == $order_info['seller_uid']) { $service_info = keke_shop_class::get_service_info($order_info['obj_id']); switch ($action) { case "wait": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { if ($order_info['obj_type'] == 'gy') { self::sendNoticeToBuyer($order_info, '对方已经接受了你的雇佣要求'); } else { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => $_lang['recept_your_order'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_create", $_lang['goods_order_recept'], $v_arr); } if ($isApp) { app_class::response(array('ret' => 1008, 'orderid' => $order_id)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1009, 'orderid' => $order_id)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; case "ok": if ($order_info['obj_type'] == 'gy') { $data = array(':title' => $order_info['order_name']); } else { $data = array(':service_id' => $order_info['obj_id'], ':title' => $order_info['order_name']); $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => $_lang['recept_your_order'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_recept'], $v_arr); } keke_finance_class::init_mem('buy_' . $order_info['obj_type'], $data); if ($order_info['order_amount'] > 0) { $suc = keke_finance_class::cash_out($order_info['order_uid'], $order_info['order_amount'], 'buy_' . $order_info['obj_type'], '', 'service', $order_info['obj_id']); } else { $suc = 1; } if ($suc) { db_factory::execute("update " . TABLEPRE . "witkey_finance set order_id={$order_id} where fina_id={$suc}"); keke_order_class::set_order_status($order_id, $action); if ($order_info['obj_type'] == 'gy') { $complete_time = time() + 3600 * 24 * 7; } else { if ($service_info['unit_time']) { $unit_time = $service_info['unit_time']; switch ($unit_time) { case '小时': $complete_time = time() + intval($service_info['service_time']) * 3600; break; case '天': $complete_time = time() + intval($service_info['service_time']) * 3600 * 24; break; case '周': $complete_time = time() + intval($service_info['service_time']) * 3600 * 24 * 7; break; case '月': $complete_time = time() + intval($service_info['service_time']) * 3600 * 24 * 30; break; } } } db_factory::execute("update " . TABLEPRE . "witkey_order set service_end_time = {$complete_time} where order_id={$order_info['order_id']}"); if ($order_info['obj_type'] == 'gy') { self::sendNoticeToSeller($order_info, '对方已付款'); } else { $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => ' 已完成付款', $_lang['order_id'] => $order_id, $_lang['order_link'] => $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); } if ($isApp) { app_class::response(array('ret' => 1010, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1011, 'orderinfo' => $order_info)); } else { return '订单付款失败,您的账户余额不足以支付该订单<br />点击这里<a href="index.php?do=pay&id=' . $order_info['order_id'] . '&type=order">去充值</a>'; } } break; case "close": $res = keke_order_class::order_cancel_return($order_id); if ($res) { keke_order_class::set_order_status($order_id, $action); if ($order_info['obj_type'] == 'gy') { self::sendNoticeToSeller($order_info, '对方关闭订单'); } else { $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['close_order_have'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_close'], $v_arr); } if ($isApp) { app_class::response(array('ret' => 1012, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1013, 'orderinfo' => $order_info)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; case 'over_time_close': $res = keke_order_class::order_cancel_return($order_id); if ($res) { keke_order_class::set_order_status($order_id, 'close'); if ($order_info['obj_type'] == 'gy') { self::sendNoticeToSeller($order_info, '对方超时未完成服务'); } else { $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['close_order_have'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", '超时未完成服务', $v_arr); } } break; case "confirm_complete": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("service", $order_info[obj_id])) { $objProm->create_prom_event("service", $order_info['order_uid'], $order_info['obj_id'], $order_info['order_amount']); } if ($order_info['obj_type'] == 'gy') { self::sendNoticeToBuyer($order_info, '对方确认服务工作完成'); } else { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => '服务完成', $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", '服务完成', $v_arr); } if ($order_info['obj_type'] == 'gy') { $arrServiceConfig = unserialize($kekezu->_model_list[7]['config']); $cut_time = time() + intval($arrServiceConfig['confirm_max_day']) * 24 * 3600; } else { $cut_time = time() + $service_info['confirm_max'] * 24 * 3600; } db_factory::execute(sprintf("update %switkey_order set ys_end_time = %d where order_id=%d", TABLEPRE, $cut_time, $order_id)); if ($isApp) { app_class::response(array('ret' => 1014, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1015, 'orderinfo' => $order_info)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; case "accept": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("service", $order_info[obj_id])) { $objProm->create_prom_event("service", $order_info['order_uid'], $order_info['obj_id'], $order_info['order_amount']); } if ($order_info['obj_type'] == 'gy') { self::sendNoticeToBuyer($order_info, '对方确认接收订单'); } else { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => $_lang['recept_your_order'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_recept'], $v_arr); } if ($isApp) { app_class::response(array('ret' => 1016, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1017, 'orderinfo' => $order_info)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; case "working": $intRes = keke_order_class::set_order_status($order_id, $action); if ($order_info['obj_type'] == 'gy') { self::sendNoticeToBuyer($order_info, '对方已经开始工作'); } if ($intRes) { return true; } else { return '操作失败'; } break; case "send": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { if ($order_info['obj_type'] == 'gy') { self::sendNoticeToBuyer($order_info, '对方确认服务完成'); } else { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => $_lang['confirm_service_complete'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['service_order_confirm_complete'], $v_arr); } if ($isApp) { app_class::response(array('ret' => 1018, 'orderinfo' => $order_info)); } else { kekezu::keke_show_msg('', $_lang['order_deal_complete_and_order_comfirm'], '', 'json'); } } else { if ($isApp) { app_class::response(array('ret' => 1019, 'orderinfo' => $order_info)); } else { kekezu::keke_show_msg('', $_lang['order_deal_fail_and_link_kf'], 'error', 'json'); } } break; case "complete": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { $model_info = $kekezu->_model_list[$order_info['model_id']]; if ($order_info['obj_type'] == 'gy') { $arrServiceConfig = unserialize($kekezu->_model_list[7]['config']); $profit = floatval($arrServiceConfig['service_profit']) * $order_info['order_amount'] / 100; } else { $profit = $service_info['profit_rate'] * $order_info['order_amount'] / 100; } if ($order_info['obj_type'] == 'gy') { $data = array(':title' => $order_info['order_name']); } else { $data = array(':service_id' => $order_info['obj_id'], ':title' => $order_info['order_name']); } keke_finance_class::init_mem('sale_' . $order_info['obj_type'], $data); keke_finance_class::cash_in($order_info['seller_uid'], $order_info['order_amount'] - $profit, 'sale_' . $order_info['obj_type'], '', 'service', $order_info['obj_id'], $profit); keke_shop_class::plus_sale_num($order_info['obj_id'], $order_info['order_amount']); keke_user_mark_class::create_mark_log($model_info['model_code'], 2, $order_info['order_uid'], $order_info['seller_uid'], $order_id, $order_info['order_amount'] - $profit, $order_info['obj_id'], $order_info['order_username'], $order_info['seller_username']); keke_user_mark_class::create_mark_log($model_info['model_code'], 1, $order_info['seller_uid'], $order_info['order_uid'], $order_id, $order_info['order_amount'], $order_info['obj_id'], $order_info['seller_username'], $order_info['order_username']); keke_shop_class::plus_mark_num($order_info['obj_id']); $objProm = keke_prom_class::get_instance(); $objProm->dispose_prom_event("service", $order_info['order_uid'], $order_info['obj_id']); if ($order_info['obj_type'] == 'gy') { self::sendNoticeToSeller($order_info, '对方工作验收完成'); } else { $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['confirm_service_complete'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['service_order_confirm_complete'], $v_arr); } if ($isApp) { app_class::response(array('ret' => 1020, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1021, 'orderinfo' => $order_info)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; case "arbitral": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { if ($order_info['obj_type'] == 'gy') { if ($uid == $order_info['order_uid']) { self::sendNoticeToSeller($order_info, $_lang['sevice_order_arbitrate_submit']); } else { self::sendNoticeToBuyer($order_info, $_lang['sevice_order_arbitrate_submit']); } } else { if ($uid == $order_info['order_uid']) { $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['buyer_start_arbitrate'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['sevice_order_arbitrate_submit'], $v_arr); } else { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => $_lang['seller_start_arbitrate'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['sevice_order_arbitrate_submit'], $v_arr); } } if ($isApp) { app_class::response(array('ret' => 1022, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1023, 'orderinfo' => $order_info)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; case "delete": $res = keke_order_class::del_order($order_id); if ($isApp) { $res and app_class::response(array('ret' => 1006)) or app_class::response(array('ret' => 1007)); } else { $res and kekezu::keke_show_msg('', $_lang['order_delete_success'], "", 'json') or kekezu::keke_show_msg('', $_lang['order_delete_fail'], "error", 'json'); } break; } } else { if ($isApp) { app_class::response(array('ret' => 1024, 'orderinfo' => $order_info)); } else { return $_lang['error_order_num_notice']; } } } else { if ($isApp) { app_class::response(array('ret' => 1025, 'orderinfo' => $order_info)); } else { return $_lang['no_exist_goods_order']; } } }
<?php defined('ADMIN_KEKE') or exit('Access Denied'); $intTaskId = intval($task_id); $intModelId = intval($model_id); $arrTaskInfo = db_factory::get_one("select * from " . TABLEPRE . "witkey_task where task_id=" . $intTaskId); $arrWorkInfo = db_factory::get_one("select * from " . TABLEPRE . "witkey_task_work where task_id=" . $intTaskId . " and work_status=4"); if ($arrTaskInfo['task_status'] != 13) { kekezu::admin_show_msg($_lang['param_error'], 'index.php?do=model&model_id=' . $intModelId . '&view=list', 3, '', 'warning'); } $floatCash = $arrTaskInfo['task_cash'] * (1 - $arrTaskInfo['task_fail_rate'] / 100); $arrGinfo = keke_user_class::get_user_info($arrTaskInfo['uid']); $arrWinfo = keke_user_class::get_user_info($arrWorkInfo['uid']); if ($intSbtEdit == 1) { $floaTotalCash = floatval($floatCash); $floatGzGet = floatval(keke_curren_class::convert($op_result['gz_get'], 0, true)); $floatWkGet = floatval(keke_curren_class::convert($op_result['wk_get'], 0, true)); if ($floaTotalCash != $floatGzGet + $floatWkGet) { kekezu::admin_show_msg($_lang['wain_you_give_cash_error_notice'], "index.php?do=model&model_id={$model_id}&view=list", "3", "", "warning"); } else { $res = keke_finance_class::cash_in($arrGinfo['uid'], $floatGzGet, 'task_fail'); $res .= keke_finance_class::cash_in($arrWinfo['uid'], $floatWkGet, 'task_fail'); if ($res) { db_factory::execute("update " . TABLEPRE . "witkey_task set task_status=9 where task_id=" . $intTaskId); kekezu::admin_show_msg('处理成功', "index.php?do=model&model_id={$model_id}&view=list", "3", "", "success"); } else { kekezu::admin_show_msg('处理失败', "index.php?do=model&model_id={$model_id}&view=list", "3", "", "warning"); } } } require keke_tpl_class::template('task/' . $model_info['model_dir'] . '/admin/tpl/task_' . $view);
public function set_task_delay($delay_day, $delay_cash, $trust_response = false) { global $kekezu, $user_info; global $_lang; $basic_config = $kekezu->_sys_config; $task_info = $this->_task_info; $delay_obj = new Keke_witkey_task_delay_class(); $task_obj = $this->_task_obj; $mycredit = $this->_userinfo['credit']; $mycash = $this->_userinfo['balance']; $basic_config['credit_is_allow'] != 1 and $mycredit = '0'; if ($delay_cash > $mycredit + $mycash) { $repay_cash = $delay_cash - $mycredit - $mycash; return $_lang['your_account_balance_not_enough']; } else { $delay_obj->setDelay_cash($delay_cash); $delay_obj->setOn_time(time()); $delay_obj->setDelay_status(1); $delay_obj->setUid($this->_uid); $delay_obj->setDelay_day($delay_day); $delay_obj->setTask_id($this->_task_id); $delay_id = $delay_obj->create_keke_witkey_task_delay(); if ($delay_id) { $credit_cost = '0'; if ($basic_config['credit_is_allow'] == 1) { $mycredit < $delay_cash and $credit_cost = $mycredit or $credit_cost = $delay_cash; } $credit_cost < $delay_cash and $cash_cost = $delay_cash - $credit_cost or $cash_cost = '0'; $data = array(':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('task_delay', $data); $delay_cash > 0 and keke_finance_class::cash_out($this->_uid, $delay_cash, 'task_delay', $cash_cost * $this->_profit_rate, 'task', $this->_task_id); $add_time = $delay_day * 24 * 3600; $real_cash_add = $delay_cash * (100 - $this->_profit_rate) / 100; db_factory::execute(sprintf(" update %switkey_task set end_time=end_time+'%s',sub_time=sub_time+'%s',is_delay =ifnull(is_delay,0)+1\n\t\t\t\t\t\t\t,credit_cost=credit_cost+'%s',cash_cost=cash_cost+'%s',real_cash=real_cash+'%s',task_cash=task_cash+'%s' where task_id='%d'", TABLEPRE, $add_time, $add_time, $credit_cost, $cash_cost, $real_cash_add, $delay_cash, $this->_task_id)); db_factory::updatetable(TABLEPRE . "witkey_order", array("order_amount" => $task_info['task_cash'] + $delay_cash), array("order_id" => $task_info['order_id'])); if ($this->_model_id == 3) { $add_single = $delay_cash / intval($this->_task_info[work_count]); db_factory::execute(sprintf("update %switkey_task set single_cash = single_cash+'%s' where task_id='%d'", TABLEPRE, $add_single, $this->_task_id)); } if ($this->_model_code == 'mreward') { mreward_task_class::task_delay($this->_task_id, $task_info['task_cash'], $delay_cash); } return true; } else { return $_lang['task_delay_fail']; } } }
if ($gUserInfo['balance'] < floatval($intWithdrawCash)) { $tips['errors']['intWithdrawCash'] = '您的金额不足以提现'; kekezu::show_msg($tips, $strUrl . "&strStep=1&intReset=1", NULL, NULL, 'error'); } if (strtoupper(CHARSET) == 'GBK') { $pay_username = kekezu::utftogbk($pay_username); $pay_account = kekezu::utftogbk($pay_account); } $objWithdrawM->setWithdraw_cash(floatval($intWithdrawCash)); $objWithdrawM->setUid($uid); $objWithdrawM->setUsername($username); $objWithdrawM->setPay_username($pay_username); $objWithdrawM->setWithdraw_status(1); $objWithdrawM->setApplic_time(time()); $objWithdrawM->setPay_type($pay_type); $objWithdrawM->setPay_account($pay_account); $intWithdrawId = $objWithdrawM->create_keke_witkey_withdraw(); if ($intWithdrawId) { unset($_SESSION['withdraw_cash']); $arrPayway = array_merge(keke_glob_class::get_bank(), keke_glob_class::get_online_pay()); $data = array(':pay_way' => $arrPayway[$pay_type], ':pay_account' => $pay_account, ':pay_name' => $pay_username); keke_finance_class::init_mem('withdraw', $data); keke_finance_class::cash_out($uid, abs(floatval($intWithdrawCash)), 'withdraw', 0, 'withdraw', $intWithdrawId); kekezu::show_msg('提交成功等待审核', $strUrl . "&strStep=4&intWithdrawCash={$intWithdrawCash}&intWithdrawId={$intWithdrawId}&ver=1#userCenter", NULL, NULL, 'ok'); } else { kekezu::show_msg('提交失败', $strUrl . "&strStep=4&intWithdrawCash={$intWithdrawCash}#userCenter", NULL, NULL, 'error'); } } } break; }
public static function order_cancel_return($order_id) { $fina_info = db_factory::get_one(sprintf(" select uid,fina_cash,fina_credit from %switkey_finance where order_id ='%d'", TABLEPRE, $order_id)); if ($fina_info) { keke_finance_class::init_mem('order_cancel', array(':order_id' => $order_id)); return keke_finance_class::cash_in($fina_info['uid'], $fina_info['fina_cash'], "order_cancel", '', 'order', $order_id); } else { return true; } }
public static function payitem_cost($item_code, $use_num = '1', $obj_type = false, $use_type = 'buy', $obj_id = null, $origin_id = null) { global $uid, $username; global $_lang; $payitem_config = self::get_payitem_config(null, null, $item_code, 'item_code'); $use_cash = $payitem_config['item_cash'] * $use_num; if ($use_type == 'buy' && $use_cash) { $data = array(':item_name' => $payitem_config['item_name']); keke_finance_class::init_mem('payitem', $data); $use_cash > 0 and $fid_cash = keke_finance_class::cash_out($uid, $use_cash, 'payitem', $use_cash, '', 'payitem'); $fid_cash or kekezu::show_msg($_lang['friendly_notice'], 'index.php?do=user&view=finance&op=recharge', 3, $_lang['your_balance_not_enough']); } $record_obj = new Keke_witkey_payitem_record_class(); $record_obj->_record_id = null; $record_obj->setItem_code($item_code); $record_obj->setUid($uid); $record_obj->setUsername($username); $record_obj->setUse_type($use_type); $record_obj->setUse_cash($use_cash); $record_obj->setUse_num(intval($use_num)); $record_obj->setObj_type($obj_type); $record_obj->setObj_id($obj_id); $record_obj->setOrigin_id($origin_id); $record_obj->setOn_time(time()); $record_id = $record_obj->create_keke_witkey_payitem_record(); return $record_id; }
$start_time = date("Y-m-d H:i:s", $task_audit_arr['start_time']); $end_time = date("Y-m-d H:i:s", $task_audit_arr['end_time']); $url = "<a href =\"{$_K['siteurl']}/index.php?do=task&id={$task_audit_arr['task_id']}\" target=\"_blank\" >" . $task_audit_arr[task_title] . "</a>"; } switch ($ac) { case "del": $res = keke_task_config::task_del($task_id); kekezu::admin_show_msg($_lang['operate_notice'], $url_str, 2, $_lang['delete_success'], 'success'); break; case "settask": require $kekezu->_tpl_obj->template('task/' . $model_info['model_dir'] . '/admin/tpl/task_reason'); die; break; case "stoptask": $cash = $task_audit_arr[task_cash] * (100 - $task_config[task_fail_rate]) / 100; keke_finance_class::cash_in($task_audit_arr['uid'], $cash, 'task_fail', '', 'task_fail'); $work_info = db_factory::get_one("select * from " . TABLEPRE . "witkey_task_work where task_id='" . intval($task_id) . "' and work_status=4"); if ($work_info) { $objMsgM = new Keke_witkey_msg_class(); $objMsgM->setTo_uid($work_info['uid']); $objMsgM->setTo_username($work_info['username']); $objMsgM->setTitle(kekezu::str_filter(kekezu::escape("任务结束"))); $objMsgM->setContent(kekezu::str_filter(kekezu::escape($content))); $objMsgM->setOn_time(time()); $objMsgM->create_keke_witkey_msg(); db_factory::execute("update " . TABLEPRE . "witkey_task_work set work_status=0 where task_id='" . intval($task_id) . "' and work_status=4"); } db_factory::execute("update " . TABLEPRE . "witkey_task set task_status=9 where task_id=" . intval($task_id)); $v_arr = array("模型名称" => $model_info['model_name'], "任务标题" => '<a href="' . $kekezu->_sys_config['website_url'] . '/index.php?do=task&id=' . $task_audit_arr['task_id'] . '">' . $task_audit_arr['task_title'] . '</a>', "理由" => kekezu::str_filter(kekezu::escape($content))); keke_msg_class::notify_user($task_audit_arr['uid'], $task_audit_arr['username'], 'task_end_manually', '任务结束通知', $v_arr); kekezu::admin_show_msg($_lang['operate_notice'], $url_str, 2, $_lang['operate_success'], 'success');
$res = keke_task_config::task_del($task_id); kekezu::admin_show_msg($_lang['operate_notice'], $url_str, 2, $_lang['delete_success'], 'success'); break; case "settask": require $kekezu->_tpl_obj->template('task/' . $model_info['model_dir'] . '/admin/tpl/task_reason'); die; break; case "stoptask": $model_info = db_factory::get_one("select * from " . TABLEPRE . "witkey_model where model_id=3"); $config = unserialize($model_info[config]); $task_info = get_task_info($task_id); $sum = db_factory::get_one("select count(*) as sum from " . TABLEPRE . "witkey_task_work where task_id='" . intval($task_id) . "' and work_status=6"); if ($sum != $task_info[work_count]) { $singlecash = number_format($task_info[real_cash] / $task_info[work_count], 2); $cash = $singlecash * ($task_info[work_count] - $sum[sum]) * (100 - $config[task_fail_rate]) / 100; keke_finance_class::cash_in($task_info['uid'], $cash, 'task_fail', '', 'task_fail'); } $arrWorkInfo = db_factory::query("select * from " . TABLEPRE . "witkey_task_work where task_id='" . intval($task_id) . "' and work_status=6 group by uid"); foreach ($arrWorkInfo as $v) { if ($v) { $objMsgM = new Keke_witkey_msg_class(); $objMsgM->setTo_uid($v['uid']); $objMsgM->setTo_username($v['username']); $objMsgM->setTitle(kekezu::str_filter(kekezu::escape("任务结束"))); $objMsgM->setContent(kekezu::str_filter(kekezu::escape($content))); $objMsgM->setOn_time(time()); $objMsgM->create_keke_witkey_msg(); } } db_factory::execute("update " . TABLEPRE . "witkey_task set task_status=9 where task_id=" . intval($task_id)); $v_arr = array("模型名称" => $model_info['model_name'], "任务标题" => '<a href="' . $kekezu->_sys_config['website_url'] . '/index.php?do=task&id=' . $task_audit_arr['task_id'] . '">' . $task_audit_arr['task_title'] . '</a>', "理由" => kekezu::str_filter(kekezu::escape($content)));
<?php $referUrl = $_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : '-1'; $arrOnlinePayList = keke_finance_class::get_pay_config('', 'online'); $pay_open_status = 0; foreach ($arrOnlinePayList as $k => $v) { if ($v['pay_status'] == '1') { $pay_open_status = 1; } } $type = strval(trim($type)); $id = intval(trim($id)); switch ($type) { case 'hosted': $arrTaskInfo = db_factory::get_one(sprintf("select * from %switkey_task where task_id='%d'", TABLEPRE, $id)); $modelInfo = $kekezu->_model_list[$arrTaskInfo['model_id']]; $className = $modelInfo['model_code'] . "_task_class"; $arrOrderDetailInfo = db_factory::get_one(sprintf("select order_id from %switkey_order_detail where obj_id=%d and obj_type = 'hosted'", TABLEPRE, $id)); $orderId = intval($arrOrderDetailInfo['order_id']); $arrOrderInfo = db_factory::get_one(sprintf("select * from %switkey_order where order_id=%d ", TABLEPRE, $orderId)); $cash = $arrOrderInfo['order_amount']; $title = $arrTaskInfo['task_title']; $objId = $arrTaskInfo['task_id']; $modelId = $arrTaskInfo['model_id']; break; case 'task': $arrTaskInfo = db_factory::get_one(sprintf("select * from %switkey_task where task_id='%d'", TABLEPRE, $id)); $modelInfo = $kekezu->_model_list[$arrTaskInfo['model_id']]; $className = $modelInfo['model_code'] . "_task_class"; $arrOrderDetailInfo = db_factory::get_one(sprintf("select order_id from %switkey_order_detail where obj_id=%d and obj_type = 'task'", TABLEPRE, $id)); $orderId = intval($arrOrderDetailInfo['order_id']);
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'); } } }
keke_finance_class::init_mem('withdraw_fail', $data); keke_finance_class::cash_in($uid, $withdraw_cash, 0, 'withdraw_fail'); $v_arr = array('网站名称' => $_K['sitename'], '提现方式' => $pay_way[$withdraw_info['pay_type']], '帐户' => $withdraw_info['pay_account'], '失败原因' => $content ? kekezu::escape($content) : '未注明原因', '提现金额' => $withdraw_cash); keke_msg_class::notify_user($uid, $username, 'withdraw_fail', $_lang['fail_and_check_you_account'], $v_arr); } } $withdraw_obj->setWithdraw_status(3); $res = $withdraw_obj->edit_keke_witkey_withdraw(); kekezu::admin_system_log($_lang['delete_audit_withdraw'] . $ids); break; case $_lang['mulit_review']: $withdraw_obj->setWhere(' withdraw_id in (' . $ids . ') '); $withdraw_arr = $withdraw_obj->query_keke_witkey_withdraw(); foreach ($withdraw_arr as $k => $v) { if ($v[withdraw_status] == 1) { $fee = $v['withdraw_cash'] - keke_finance_class::get_to_cash($v['withdraw_cash']); db_factory::execute(sprintf(' update %switkey_withdraw set fee=%.2f where withdraw_id=%d', TABLEPRE, $fee, $v['withdraw_id'])); $v_arr = array('网站名称' => $_K['sitename'], '提现方式' => $pay_way[$v['pay_type']], '帐户' => $v['pay_account'], '提现金额' => $v['withdraw_cash']); keke_msg_class::notify_user($v['uid'], $v['username'], 'draw_success', $_lang['withdraw_success'], $v_arr); $feed_arr = array("feed_username" => array("content" => $v['username'], "url" => "index.php?do=seller&id=" . $space_info['uid']), "action" => array("content" => $_lang['withdraw'], "url" => ""), "event" => array("content" => $_lang['withdraw_le'] . $v['withdraw_cash'] . $_lang['yuan'], "url" => "")); kekezu::save_feed($feed_arr, $user_space_info['uid'], $user_space_info['username'], 'withdraw'); $withdraw_obj = new Keke_witkey_withdraw_class(); $withdraw_obj->setWhere(' withdraw_id in (' . $ids . ') '); $withdraw_obj->setWithdraw_status(2); $withdraw_obj->setProcess_uid($admin_info['uid']); $withdraw_obj->setProcess_username($admin_info['username']); $withdraw_obj->setProcess_time(time()); $withdraw_obj->edit_keke_witkey_withdraw(); } } kekezu::admin_system_log($_lang['audit_withdraw_apply'] . $ids);
die; } $config = $kekezu->_sys_config; if ($is_submit && kekezu::submitcheck(isset($formhash))) { $url = "index.php?do={$do}&view={$view}"; $user or kekezu::admin_show_msg($_lang['username_uid_can_not_null'], $url, 3, '', 'warning'); $info = get_info($user, $user_type); $cash = floatval($cash); $cash == 0 and kekezu::admin_show_msg($_lang['cash_can_not_null'], $url, 3, '', 'warning'); if ($cash_type == 1) { $res = keke_finance_class::cash_in($info['uid'], floatval($cash), 'admin_charge', '', 'admin_charge'); } else { if ($cash > $info['balance']) { kekezu::admin_show_msg($_lang['user_deduct_limit'] . $info['balance'] . $_lang['yuan'], $url, 3, '', 'warning'); } else { $res = keke_finance_class::cash_out($info['uid'], floatval($cash), 'admin_charge', '', 'admin_charge'); } } $charge_reason = kekezu::filter_input($charge_reason); $sql2 = "update " . TABLEPRE . "witkey_finance set fina_mem='{$charge_reason}' where fina_id = last_insert_id()"; db_factory::execute($sql2); if ($res) { if ($cash_type == 1) { $v_arr = array('用户名' => $info[username], '金额动作' => '充值', '金额' => $cash); keke_shop_class::notify_user($info[uid], $info[username], "admin_charge", '后台手动充值通知', $v_arr, 2); kekezu::admin_show_msg('手动充值现金成功', $url, 3, '', 'success'); } else { $v_arr = array('用户名' => $info[username], '金额动作' => '扣除', '金额' => $cash); keke_shop_class::notify_user($info[uid], $info[username], "admin_charge", '后台手动充值通知', $v_arr, 2); kekezu::admin_show_msg('手动扣除现金成功', $url, 3, '', 'success'); }
$totalmoney = $totalmoneyArr['quote']; $confModel = db_factory::get_one("select * from " . TABLEPRE . "witkey_model where model_id=12"); $ModelInfo = unserialize($confModel['config']); $floatCash = $totalmoney; $arrGinfo = keke_user_class::get_user_info($arrTaskInfo['uid']); $arrWinfo = keke_user_class::get_user_info($arrWorkInfo['uid']); if ($intSbtEdit == 1) { $floaTotalCash = floatval($floatCash); $floatGzGet = floatval(keke_curren_class::convert($op_result['gz_get'], 0, true)); $floatWkGet = floatval(keke_curren_class::convert($op_result['wk_get'], 0, true)); if ($floaTotalCash != $floatGzGet + $floatWkGet) { kekezu::admin_show_msg($_lang['wain_you_give_cash_error_notice'], "index.php?do=model&model_id={$model_id}&view=list", "3", "", "warning"); } else { $res = keke_finance_class::cash_in($arrGinfo['uid'], $floatGzGet, 'task_fail'); $res .= keke_finance_class::cash_in($arrWinfo['uid'], $floatWkGet, 'task_fail'); $confModel = db_factory::get_one("select * from " . TABLEPRE . "witkey_model where model_id=12"); $ModelInfo = unserialize($confModel['config']); $return_cash = $totalmoneyArr['wiki_deposit'] - $ModelInfo['deposit_rate']; if ($return_cash > 0) { keke_finance_class::cash_in($arrTaskInfo['uid'], $return_cash, 'deposit_return', '', 'task', $intTaskId); keke_finance_class::cash_in($arrWorkInfo['uid'], $return_cash, 'deposit_return', '', 'task', $intTaskId); } if ($res) { db_factory::execute("update " . TABLEPRE . "witkey_task set task_status=9 where task_id=" . $intTaskId); kekezu::admin_show_msg('处理成功', "index.php?do=model&model_id={$model_id}&view=list", "3", "", "success"); } else { kekezu::admin_show_msg('处理失败', "index.php?do=model&model_id={$model_id}&view=list", "3", "", "warning"); } } } require keke_tpl_class::template('task/' . $model_info['model_dir'] . '/admin/tpl/task_' . $view);
public function dispose_order($order_id, $action, $is_kf = null, $ht_url = null, $kefu_uid = NULL, $isApp = false) { global $_lang, $uid, $username, $_K, $kekezu; if ($is_kf && $is_kf != 'sys' && $kefu_uid) { $u_info = kekezu::get_user_info($kefu_uid); if ($u_info['group_id'] == 7) { $kefu = TRUE; } else { $kefu = false; } } else { $kefu = false; } if ($is_kf == 'sys') { $kefu = TRUE; } $order_info = keke_order_class::get_order_info($order_id); $service_info = keke_shop_class::get_service_info($order_info['obj_id']); if ($order_info) { $s_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=transaction&op=sold&intModelId=" . $service_info['model_id'] . "\">" . $order_info['order_name'] . "</a>"; $b_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=transaction&op=orders&intModelId=" . $service_info['model_id'] . "\">" . $order_info['order_name'] . "</a>"; if ($uid == $order_info['order_uid'] || $uid == $order_info['seller_uid'] || $uid == ADMIN_UID || $kefu) { if ($service_info['service_status'] == '2') { if ($action == 'delete') { $res = keke_order_class::del_order($order_id, '', 'json'); if ($isApp) { $res and app_class::response(array('ret' => 1006)) or app_class::response(array('ret' => 1007)); } } else { switch ($action) { case "ok": $data = array(':service_id' => $service_info['service_id'], ':title' => $service_info['title']); keke_finance_class::init_mem('buy_service', $data); if ($order_info['order_amount'] > 0) { $suc = keke_finance_class::cash_out($order_info['order_uid'], $order_info['order_amount'], 'buy_service', '', 'service', $order_info['obj_id']); } else { $suc = 1; } if ($suc) { db_factory::execute("update " . TABLEPRE . "witkey_finance set order_id={$order_id} where fina_id={$suc}"); keke_order_class::set_order_status($order_id, $action); $exec_time = time() + $service_info['confirm_max'] * 24 * 3600; db_factory::execute(sprintf(" update %switkey_order set ys_end_time='%d' where order_id='%d'", TABLEPRE, $exec_time, $order_id)); $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['haved_confirm_pay'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $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); $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("service", $order_info['obj_id'])) { $objProm->create_prom_event("service", $order_info['order_uid'], $order_info['obj_id'], $order_info['order_amount']); } if ($isApp) { app_class::response(array('ret' => 1010, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1011, 'orderinfo' => $order_info)); } else { return '订单付款失败,您的账户余额不足以支付该订单<br />点击这里<a href="index.php?do=pay&id=' . $order_info['order_id'] . '&type=order">去充值</a>'; } } break; case "close": $res = keke_order_class::order_cancel_return($order_id); if ($res) { keke_order_class::set_order_status($order_id, $action); $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['close_order_have'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_close'], $v_arr); if ($isApp) { app_class::response(array('ret' => 1012, 'orderinfo' => $order_info)); } else { kekezu::show_msg($_lang['system prompt'], "index.php?do=user&view=employer&op=shop&model_id=" . $service_info['model_id'], '1', $_lang['order_deal_complete_and_close'], 'alert_right'); } } else { if ($isApp) { app_class::response(array('ret' => 1013, 'orderinfo' => $order_info)); } else { kekezu::show_msg($_lang['system prompt'], "index.php?do=user&view=employer&op=shop&model_id=" . $service_info['model_id'], '1', $_lang['order_deal_fail_and_link_kf'], 'alert_error'); } } break; case "confirm": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { $model_info = $kekezu->_model_list[$order_info['model_id']]; $profit = $service_info['profit_rate'] * $order_info['order_amount'] / 100; $data = array(':service_id' => $service_info['service_id'], ':title' => $service_info['title']); keke_finance_class::init_mem('sale_service', $data); keke_finance_class::cash_in($order_info['seller_uid'], $order_info['order_amount'] - $profit, 'sale_service', '', 'service', $order_info['obj_id'], $profit); keke_shop_class::plus_sale_num($order_info['obj_id'], $order_info['order_amount']); keke_user_mark_class::create_mark_log($model_info['model_code'], 2, $order_info['order_uid'], $order_info['seller_uid'], $order_id, $order_info['order_amount'] - $profit, $order_info['obj_id'], $order_info['order_username'], $order_info['seller_username']); keke_user_mark_class::create_mark_log($model_info['model_code'], 1, $order_info['seller_uid'], $order_info['order_uid'], $order_id, $order_info['order_amount'], $order_info['obj_id'], $order_info['seller_username'], $order_info['order_username']); keke_shop_class::plus_mark_num($order_info['obj_id']); $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("service", $order_info[obj_id])) { $objProm->create_prom_event("service", $order_info['order_uid'], $order_info['obj_id'], $order_info['order_amount']); } $objProm->dispose_prom_event("service", $order_info['order_uid'], $order_info['obj_id']); if ($is_kf != null) { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => '客服协助作品已交付完成', $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['work_order_complete'], $v_arr); $v_arr1 = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => '客服协助作品已交付完成', $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['work_order_complete'], $v_arr1); return true; } else { $v_arr = array($_lang['user_msg'] => $order_info['order_username'], $_lang['action'] => $_lang['buy_work_coplete'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['work_order_complete'], $v_arr); if ($isApp) { app_class::response(array('ret' => 1022, 'orderinfo' => $order_info)); } else { return true; } } } else { if ($isApp) { app_class::response(array('ret' => 1023, 'orderinfo' => $order_info)); } else { kekezu::show_msg($_lang['system prompt'], "index.php?do=order&sid={$order_info['obj_id']}&orderId={$order_id}&steps=step3", '1', $_lang['order_deal_fail_and_link_kf'], 'alert_error'); } } break; case "arbitral": $res = keke_order_class::set_order_status($order_id, $action); if ($res) { if ($uid == $order_info['order_uid']) { $v_arr = array($_lang['user'] => $order_info['order_username'], $_lang['action'] => $_lang['buyer_start_arbitrate'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_id['seller_uid'], $order_info['seller_username'], "order_change", $_lang['sevice_order_arbitrate_submit'], $v_arr); } else { $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], $_lang['action'] => $_lang['seller_start_arbitrate'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['work_order_submit'], $v_arr); } if ($isApp) { app_class::response(array('ret' => 1022, 'orderinfo' => $order_info)); } else { return true; } } else { if ($isApp) { app_class::response(array('ret' => 1023, 'orderinfo' => $order_info)); } else { return $_lang['order_deal_fail_and_link_kf']; } } break; } } } else { $res = keke_order_class::set_order_status($order_id, 'close'); keke_order_class::order_cancel_return($order_id); $v_arr = array($_lang['user_msg'] => $_lang['system'], $_lang['action'] => $_lang['stop_your_order_and_your_cash_return'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $b_order_link); keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_close'], $v_arr); $v_arr = array($_lang['user_msg'] => $_lang['system'], $_lang['action'] => $_lang['stop_your_order_and_your_cash_return'], $_lang['order_id'] => $order_id, $_lang['order_link'] => $s_order_link); keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_close'], $v_arr); if ($isApp) { $res and app_class::response(array('ret' => 1006)) or app_class::response(array('ret' => 1007)); } else { $res and kekezu::keke_show_msg('', $_lang['order_delete_success'], "", 'json') or kekezu::keke_show_msg('', $_lang['order_delete_fail'], "error", 'json'); } } } else { if ($isApp) { app_class::response(array('ret' => 1024, 'orderinfo' => $order_info)); } else { kekezu::keke_show_msg('', $_lang['error_order_num_notice'], 'error', 'json'); } } } else { if ($isApp) { app_class::response(array('ret' => 1025, 'orderinfo' => $order_info)); } else { kekezu::keke_show_msg('', $_lang['no_exist_goods_order'], 'error', 'json'); } } }
if (isset($ac)) { $order_info = db_factory::get_one(" select * from " . TABLEPRE . "witkey_order_charge where order_id = " . intval($order_id)); $message_obj = new keke_msg_class(); $order_info or kekezu::admin_show_msg($_lang['charge_num_not_exist'], $url, 3, '', 'warning'); switch ($ac) { case 'pass': if ($order_info[order_status] == 'ok') { kekezu::admin_show_msg($_lang['payment_has_been_success_no_need_repeat'], $url, 3, '', 'warning'); } $recharge_obj->setWhere('order_id =' . $order_id); $recharge_obj->setOrder_status('ok'); $res = $recharge_obj->edit_keke_witkey_order_charge(); $user_info = kekezu::get_user_info($order_info[uid]); $v_arr = array('充值金额' => $order_info['pay_money'], '用户名' => $user_info[username], '网站名称' => $kekezu->_sys_config['website_name']); keke_shop_class::notify_user($user_info[uid], $user_info[username], "pay_success", $_lang['line_recharge_success'], $v_arr, 2); keke_finance_class::cash_in($user_info['uid'], $order_info['pay_money'], 'offline_charge', '', 'offline_charge'); kekezu::admin_system_log($_lang['confirm_payment_recharge'] . $order_id); kekezu::admin_show_msg($_lang['message_about_recharge_success'], $url, 3, '', 'success'); break; case 'del': $recharge_obj->setWhere(' order_id=' . $order_id); $res = $recharge_obj->del_keke_witkey_order_charge(); $user_info = kekezu::get_user_info($order_info[uid]); $v = array($_lang['recharge_single_num'] => $order_id, $_lang['recharge_cash'] => $order_info[pay_money]); $message_obj->send_message($user_info['uid'], $user_info['username'], 'recharge_fail', $_lang['recharge_fail'], $v, $user_info[email], $user_info['mobile']); kekezu::admin_system_log($_lang['delete_apply_forwithdraw'] . $order_id); kekezu::admin_show_msg($_lang['message_about_delete'], $url, 3, '', 'success'); break; } } elseif (isset($ckb)) { $ids = implode(',', $ckb);
function dispose_prom_event($action, $uid, $obj_id) { $p_relation = $this->get_prom_relation($uid, $action); if ($p_relation && $p_relation['realtion_status'] != 3) { $prom_event = $this->get_prom_event($obj_id, $uid, $action); } if ($prom_event) { if ($prom_event['action'] == 'reg') { if (!$this->_auth) { keke_finance_class::cash_in($prom_event['parent_uid'], $prom_event['rake_cash'], "prom_" . $action); $this->set_relation_status($p_relation['relation_id'], 2); $result = $this->set_prom_event_status($prom_event['parent_uid'], $prom_event['username'], $prom_event['event_id'], 2); } else { $auth = implode('","', $this->_auth); $count = db_factory::get_count(sprintf('select count(*) from %s where uid = %d and auth_code in ("%s") and auth_status = 1', TABLEPRE . 'witkey_auth_record', $prom_event['uid'], $auth)); if (intval($count) == count($this->_auth)) { keke_finance_class::cash_in($prom_event['parent_uid'], $prom_event['rake_cash'], "prom_" . $action); $this->set_relation_status($p_relation['relation_id'], 2); $result = $this->set_prom_event_status($prom_event['parent_uid'], $prom_event['username'], $prom_event['event_id'], 2); } } } else { keke_finance_class::cash_in($prom_event['parent_uid'], $prom_event['rake_cash'], "prom_" . $action); $this->set_relation_status($p_relation['relation_id'], 2); $result = $this->set_prom_event_status($prom_event['parent_uid'], $prom_event['username'], $prom_event['event_id'], 2); } return $result; } }
function process_rights($op_result, $type) { global $kekezu, $_K, $_lang; $prom_obj = $objProm = keke_prom_class::get_instance(); $trans_name = $this->get_transrights_name($this->_report_type); $op_result = $this->op_result_format($op_result); $g_info = $this->user_role('gz'); $w_info = $this->user_role('wk'); $match_task = $this->_match_task; $match_work = $this->_match_work; switch ($op_result['action']) { case "pass": if ($this->_process_can['sharing']) { $hire = $op_result['hire_deposit']; $wiki = $op_result['wiki_deposit']; $host = $op_result['host_amount']; switch ($hire) { case 1: $g_noti = $_lang['deposit_cash_all_refund']; $res = keke_finance_class::cash_in($g_info['uid'], $match_task['deposit_cash'], 'deposit_return', '', 'task', $match_task['task_id']); break; case 2: $g_noti = $_lang['deposit_cash_part_defund']; $rate = $match_task['deposit_rate']; $cash = floatval($match_task['deposit_cash'] - $rate); $profit = $rate; $res = keke_finance_class::cash_in($g_info['uid'], $cash, 'deposit_return', '', 'task', $match_task['task_id'], $profit); break; case 3: $g_noti = $_lang['deposit_cash_all_deduct']; $res = db_factory::execute(sprintf(" update %switkey_finance set site_profit='%.2f' where obj_id='%d' and fina_type='out' and fina_action='pub_task'", TABLEPRE, $match_task['hirer_deposit'], $match_task['task_id'])); break; } switch ($wiki) { case 1: $w_noti = $_lang['deposit_cash_all_refund']; $res = keke_finance_class::cash_in($w_info['uid'], $match_work['deposit_cash'], 'deposit_return', '', 'task', $match_task['task_id']); break; case 2: $w_noti = $_lang['deposit_cash_part_defund']; $rate = $match_task['deposit_rate']; $cash = floatval($match_work['deposit_cash'] - $rate); $profit = $rate; $res = keke_finance_class::cash_in($w_info['uid'], $cash, 'deposit_return', '', 'task', $match_task['task_id'], $profit); break; case 3: $w_noti = $_lang['deposit_cash_all_deduct']; $res = db_factory::execute(sprintf(" update %switkey_finance set site_profit='%.2f' where obj_id='%d' and fina_type='out' and fina_action='host_deposit'", TABLEPRE, $match_task['hirer_deposit'], $match_work['work_id'])); break; } switch ($host) { case 1: $g_noti .= $_lang['host_cash_has_all_been_refund']; $data = array(':task_id' => $match_task['task_id'], ':task_title' => $match_task['task_title']); keke_finance_class::init_mem('host_return', $data); $res .= keke_finance_class::cash_in($g_info['uid'], $match_task['host_cash'], 'host_return', '', 'task', $match_task['task_id']); break; case 2: $hire_get = floatval(keke_curren_class::convert($op_result['hire_get'], 0, true)); $wiki_get = floatval(keke_curren_class::convert($op_result['wiki_get'], 0, true)); $g_noti .= $_lang['host_cash_has_part_been_refund']; $data = array(':task_id' => $match_task['task_id'], ':task_title' => $match_task['task_title']); keke_finance_class::init_mem('host_split', $data); $res .= keke_finance_class::cash_in($g_info['uid'], $hire_get, 'host_split', '', 'task', $match_task['task_id']); $w_noti .= $_lang['get_part_host_cash']; $rate = db_factory::get_count(sprintf(" select profit_rate from %switkey_task where task_id ='%d'", TABLEPRE, $match_task['task_id'])); $profit = $wiki_get * $rate / 100; $wiki_get -= $profit; $data = array(':task_id' => $match_task['task_id'], ':task_title' => $match_task['task_title']); keke_finance_class::init_mem('host_split', $data); $res .= keke_finance_class::cash_in($w_info['uid'], $wiki_get, 'host_split', '', 'task', $match_task['task_id'], $profit); break; } if ($res) { $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']); $w_event = $objProm->get_prom_event($this->_obj_info['origin_id'], $w_info['uid'], "bid_task"); $objProm->set_prom_event_status($w_event['parent_uid'], $this->_gusername, $w_event['event_id'], '3'); $g_event = $objProm->get_prom_event($this->_obj_info['origin_id'], $g_info['uid'], "pub_task"); $objProm->set_prom_event_status($g_event['parent_uid'], $this->_gusername, $g_event['event_id'], '3'); $url = "<a href=\"{$_K['siteurl']}/index.php?do=task&id={$match_task['task_id']}\">{$this->_obj_info['origin_title']}</a>"; $msg_obj = new keke_msg_class(); $g_notify = array($_lang['description'] => $_lang['match_task_trans_result'] . $g_noti, $_lang['task_title'] => $url); $msg_obj->send_message($g_info['uid'], $g_info['username'], 'match_task', $_lang['match_website_deal_notice'], $g_notify, $g_info['email']); $w_notify = array($_lang['description'] => $_lang['match_task_trans_result'] . $w_noti, $_lang['task_title'] => $url); $msg_obj->send_message($w_info['uid'], $w_info['username'], 'match_task', $_lang['match_website_deal_notice'], $w_notify, $w_info['email']); db_factory::execute(sprintf(" update %switkey_task set task_status=9 where task_id='%d'", TABLEPRE, $match_task['task_id'])); } $res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", "", "success") or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning"); } else { kekezu::admin_show_msg($trans_name . $_lang['deal_fail_now_forbit_deal_cash'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning"); } break; case "nopass": break; } }
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 static function refundPayitem($objId, $objType) { if (TOOL === TRUE) { $payitemConfig = self::getPayitemConfig(); $strDetailType = "'" . implode("','", array_keys($payitemConfig)) . "'"; $arrOrderDetailLists = db_factory::query(sprintf("select * from " . TABLEPRE . "witkey_order_detail where obj_id =%d and obj_type = '%s' and detail_type in(%s) ", $objId, $objType, $strDetailType)); $orderId = intval($arrOrderDetailLists[0]['order_id']); if ($orderId > 0) { $arrOrderInfo = db_factory::get_one(sprintf("select order_id,order_uid from " . TABLEPRE . "witkey_order where order_id ='%d' and order_status = 'ok' limit 1", $orderId)); } if ($arrOrderInfo) { foreach ($arrOrderDetailLists as $k => $v) { $data = array(':payitem_refund_item' => $payitemConfig[$v['detail_type']]['item_name']); keke_finance_class::init_mem('payitem_refund', $data); keke_finance_class::cash_in($arrOrderInfo['order_uid'], $v['price'], $v['detail_type'], $payitemConfig[$v['detail_type']]['item_name'] . '退款', $objType, $objId); db_factory::execute("update " . TABLEPRE . "witkey_order set order_status = 'refunded' where order_id = '" . $orderId . "'"); if ($objType == 'goods') { db_factory::execute("update " . TABLEPRE . "witkey_service set goodstop = '0' where service_id = '" . $objId . "'"); } else { db_factory::execute("update " . TABLEPRE . "witkey_task set " . $v['detail_type'] . " = '0' where task_id = '" . $objId . "'"); } } } } }