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 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 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 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; }
<?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 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']; } } }
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 . "'"); } } } } }
$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 task_host_timeout() { global $_lang; $task_info = $this->_task_info; if ($this->_task_status == 3 && time() > $task_info['end_time']) { 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, $task_info['hirer_deposit'], $this->_task_id)); $g_notify = array($_lang['description'] => $_lang['host_reward_expired_and_task_failed'], $_lang['task_title'] => $this->_notice_url); $this->notify_user('match_task', $_lang['host_expired_notice'], $g_notify); $work_info = $this->work_exists(); $match_info = $this->get_match_work($work_info['work_id']); if (intval($match_info['wiki_deposit'])) { keke_finance_class::cash_in($work_info['uid'], $match_info['deposit_cash'], 'deposit_return', '', 'task', $this->_task_id); } $w_notify = array($_lang['description'] => $_lang['hirer_host_reward_expired_and_task_failed'], $_lang['task_title'] => $this->_notice_url); $this->notify_user('match_task', $_lang['host_expired_notice'], $w_notify, 2, $work_info['uid']); $this->set_task_status(9); } }
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; } }
$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)));
$msg = "UID不存在"; } else { $msg = "用户名不存在"; } $info and kekezu::echojson('', 1, $info) or kekezu::echojson($msg, 0); 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');
public function dispose_task_return() { global $kekezu; $config = $this->_task_config; $task_info = $this->_task_info; $task_cash = $task_info['real_cash']; $real_cash = $task_info['real_cash']; $task_info['single_cash'] and $totle_cash = floatval($task_info['single_cash']) or $totle_cash = floatval($task_info['real_cash']); $fail_rate = floatval($task_info['task_fail_rate']) / 100; $profit = $totle_cash * $fail_rate; $return_cash = $totle_cash * (1 - $fail_rate); $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('task_fail', $data); $res = keke_finance_class::cash_in($this->_guid, $return_cash, 'task_fail', '', 'task', $this->_task_id, $profit); if ($res) { $objProm = keke_prom_class::get_instance(); $p_event = $objProm->get_prom_event($this->_task_id, $this->_guid, "pub_task"); } return array('return_credit' => $return_credit, 'return_cash' => $return_cash); }
public function dispose_task_return($action) { if (in_array($this->_task_info['task_status'], array('7', '8', '9', '10'))) { return false; } $uid = $this->_uid; $prom_obj = $objProm = keke_prom_class::get_instance(); $task_cash = floatval($this->_task_info['task_cash']); $refund_rate = floatval($this->_task_info['task_fail_rate']) / 100; $hege_count = $this->get_work_count("work_status=6"); $hege_count and $use_cash = floatval($this->_task_info['single_cash']) * $hege_count; $work_count = intval($this->_task_info['work_count']); $cash = floatval($task_cash); if ($hege_count > 0) { $sy = $cash - $use_cash; if ($sy >= 0) { $refund_cash = $sy; } } else { $refund_cash = $cash; } $ref_cash = $refund_cash * (1 - $refund_rate); $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem($action, $data); keke_finance_class::cash_in($this->_guid, $ref_cash, $action, '', 'task', $this->_task_id, $refund_cash * $refund_rate); return array('refund_cash' => $refund_cash); }
$nodraw_arr = $withdraw_obj->query_keke_witkey_withdraw(); $withdraw_obj->setWhere(' withdraw_id in (' . $ids . ') '); switch ($sbt_action) { case $_lang['mulit_nopass']: foreach ($nodraw_arr as $v) { if ($v[withdraw_status] == 1) { $withdraw_id = $v['withdraw_id']; $where = "withdraw_id = '{$withdraw_id}' "; $withdraw_info = db_factory::get_one("select * from " . TABLEPRE . "witkey_withdraw where {$where}"); $withdraw_cash = $withdraw_info['withdraw_cash']; $uid = $withdraw_info['uid']; $username = $withdraw_info['username']; $pay_way = array_merge(keke_glob_class::get_bank(), keke_glob_class::get_online_pay()); $data = array(':pay_way' => $pay_way[$withdraw_info['pay_type']], ':pay_account' => $withdraw_info['pay_account'], ':pay_name' => $withdraw_info['pay_name']); 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']));
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);
$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');
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'); } } }
public function task_gs_timeout() { global $kekezu; global $_lang; $prom_obj = $objProm = keke_prom_class::get_instance(); if (time() > $this->_task_info['sp_end_time'] && $this->_task_info['task_status'] == 5) { $prize_work_arr = db_factory::query(sprintf("select * from %switkey_task_work where task_id='%d' and work_status in(1,2,3) ", TABLEPRE, $this->_task_id)); $prize_date = $this->get_prize_date(); $bid_uid = array(); foreach ($prize_work_arr as $k => $v) { $prize = "prize_" . $v['work_status']; $prize_cash = $prize_date['cash'][$prize]; $prize_real_cash = $prize_cash * (1 - $this->_task_config['task_rate'] / 100); $data = array(':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('task_bid', $data); keke_finance_class::cash_in($v['uid'], $prize_real_cash, 'task_bid', '', 'task', $this->_task_id, $prize_cash - $prize_real_cash); $prize_total_cash += $prize_cash; $status_desc_arr = array("1" => $_lang['work_get_prize1'], "2" => $_lang['work_get_prize2'], "3" => $_lang['work_get_prize3']); $v_arr = array($_lang['username'] => $v['username'], $_lang['model_name'] => $this->_model_name, $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $this->_task_title, $_lang['bid_cash'] => $prize_cash); $prom_obj->dispose_prom_event("bid_task", $v['uid'], $this->_task_id); keke_user_mark_class::create_mark_log($this->_model_code, 1, $v['uid'], $this->_guid, $v['work_id'], $prize_cash, $this->_task_id, $v['username'], $this->_gusername); keke_user_mark_class::create_mark_log($this->_model_code, 2, $this->_guid, $v['uid'], $v['work_id'], $prize_cash * (1 - $this->_task_config['task_rate'] / 100), $this->_task_id, $this->_gusername, $v['username']); $this->plus_mark_num(); $bid_uid[] = $v['uid']; } $this->set_task_status(8); $prom_obj->dispose_prom_event("pub_task", $this->_guid, $this->_task_id); $if_sy = $this->_task_info['task_cash'] - $prize_total_cash; if (intval($if_sy) > 0) { $return_g_cash = $if_sy * (1 - $this->_task_config['task_fail_rate'] / 100); $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('task_remain_return', $data); keke_finance_class::cash_in($this->_guid, floatval($return_g_cash), 'task_remain_return', '', 'task', $this->_task_id, $if_sy - $return_g_cash); $v_arr = array($_lang['username'] => $this->_gusername, $_lang['model_name'] => $this->_model_name, $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $this->_task_title, $_lang['reason'] => $_lang['gs_timeout_and_task_over_and_return_your_remain_cash']); keke_msg_class::notify_user($this->_guid, $this->_gusername, 'task_complete', $_lang['task_js'], $v_arr, 1); } else { $v_arr = array($_lang['username'] => $this->_gusername, $_lang['model_name'] => $this->_model_name, $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $this->_task_title, $_lang['reason'] => $_lang['gs_timeout_and_task_complete']); keke_msg_class::notify_user($this->_guid, $this->_gusername, 'task_complete', $_lang['task_js'], $v_arr, 1); } } }
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_auto_return($remain_cash) { global $kekezu; $config = $this->_task_config; $task_info = $this->_task_info; $fail_rate = $this->_fail_rate; $site_profit = $remain_cash * $fail_rate / 100; $return_cash = $remain_cash - $site_profit; $data = array(':model_name' => $this->_model_code, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('task_auto_return', $data); return keke_finance_class::cash_in($this->_guid, $return_cash, 'task_auto_return', '', 'task', $this->_task_id, $site_profit); }
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=5"); $config = unserialize($model_info[config]); $task_info = get_task_info($task_id); if ($task_info[task_status] == 2 || $task_info[task_status] == 3 || $task_info[task_status == 4]) { keke_finance_class::cash_in($task_info['uid'], $task_info['real_cash'] * (100 - $config[task_fail_rate]) / 100, 'task_fail', '', 'task_fail'); db_factory::execute("update " . TABLEPRE . "witkey_task set task_status=9 where task_id=" . intval($task_id)); } $work_info = db_factory::get_one("select * from " . TABLEPRE . "witkey_task_bid where task_id='" . intval($task_id) . "' and bid_status=4"); $sumcash = db_factory::query("select sum(plan_amount) as cash from " . TABLEPRE . "witkey_task_plan where bid_id='" . intval($work_info[bid_id]) . "' and task_id='" . intval($task_info[task_id]) . "' and plan_status!=2"); if ($work_info) { keke_msg_class::send_private_message("任务结束", kekezu::str_filter(kekezu::escape($content)), $work_info['uid'], $work_info['username']); keke_finance_class::cash_in($task_info['uid'], $sumcash[0]['cash'] * (100 - $config[task_fail_rate]) / 100, 'task_fail', '', 'task_fail'); db_factory::execute("update " . TABLEPRE . "witkey_task_bid set bid_status=0 where task_id='" . intval($task_id) . "' and bid_status=4"); } $v_arr = array("模型名称" => $model_info['model_name'], "任务标题" => '<a href="' . $kekezu->_sys_config['website_url'] . '/index.php?do=task&id=' . $task_info['task_id'] . '">' . $task_info['task_title'] . '</a>', "理由" => kekezu::str_filter(kekezu::escape($content))); keke_msg_class::notify_user($task_info['uid'], $task_info['username'], 'task_end_manually', '任务结束通知', $v_arr); kekezu::admin_show_msg($_lang['operate_notice'], $url_str, 2, $_lang['operate_success'], 'success'); break; case "pass": $res = keke_task_config::task_audit_pass($task_id); $v_arr = array($_lang['username'] => "{$task_audit_arr['username']}", $_lang['task_link'] => $url, $_lang['start_time'] => $start_time, $_lang['end_time'] => $end_time, $_lang['task_id'] => "#" . $task_id); keke_shop_class::notify_user($task_audit_arr['uid'], $task_audit_arr['username'], 'task_auth_success', $_lang['task_auth_success'], $v_arr, 1); kekezu::admin_show_msg($_lang['operate_notice'], $url_str, 2, $_lang['audit_success'], 'success'); break; case "nopass": if ($is_submit == "1") { $res = keke_task_config::task_audit_nopass($task_id);