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); }
public function auto_choose() { global $_K, $kekezu; global $_lang; switch ($this->_task_config['end_action']) { case "refund": $this->dispose_task_return(); break; case "split": $bid_uid = array(); $task_info = $this->_task_info; $split_num = intval($this->_task_config['witkey_num']); if ($split_num) { $single_cash = $task_info['task_cash'] / $split_num; $prom_obj = $objProm = keke_prom_class::get_instance(); $site_profit = $single_cash * $this->_profit_rate / 100; $cash = $single_cash - $site_profit; $split_style = $this->_task_config['auto_choose_rule']; if (in_array($split_style, array('work_time', 'take_num', 'seller_credit'))) { switch ($split_style) { case "work_time": $order_field = "a.work_time asc"; break; case "take_num": $order_field = "c.take_num desc"; break; case "seller_credit": $order_field = "c.seller_credit desc"; break; } $sql = "select a.*,b.oauth_id from %switkey_task_work a left join %switkey_member_oauth b on a.uid=b.uid\n\t\t\t\t\t\t\t\t\tleft join %switkey_space c on a.uid=c.uid\n\t\t\t\t\t\t\t\twhere a.task_id='%d' and a.work_status='0' order by %s,a.work_time asc limit 0,%d"; $work_list = db_factory::query(sprintf($sql, TABLEPRE, TABLEPRE, TABLEPRE, $this->_task_id, $order_field, $split_num)); $key = array_keys($work_list); $count = sizeof($key); for ($i = 0; $i < $count; $i++) { $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($work_list[$i]['uid'], $cash, 'task_bid', '', 'task', $this->_task_id, $site_profit); $this->set_work_status($work_list[$i]['work_id'], 4); if ($prom_obj->is_meet_requirement("bid_task", $this->_task_id)) { $prom_obj->create_prom_event("bid_task", $work_list[$i]['uid'], $this->_task_id, $single_cash); $prom_obj->dispose_prom_event("bid_task", $work_list[$i]['uid'], $work_list[$i]['work_id']); } $url = '<a href ="' . $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id . '">' . $this->_task_title . '</a>'; $v = array($_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $url); $this->notify_user("auto_choose", $_lang['task_auto_choose_bid'], $v, 1, $work_list[$i]['uid']); keke_user_mark_class::create_mark_log($this->_model_code, '1', $work_list[$i]['uid'], $this->_guid, $work_list[$i]['work_id'], $single_cash, $this->_task_id, $work_list[$i]['username'], $this->_gusername); keke_user_mark_class::create_mark_log($this->_model_code, '2', $this->_guid, $work_list[$i]['uid'], $work_list[$i]['work_id'], $cash, $this->_task_id, $this->_gusername, $work_list[$i]['username']); $feed_arr = array("feed_username" => array("content" => $work_list[$i]['uid'], "url" => "index.php?do=seller&id={$work_list[$i]['uid']}"), "action" => array("content" => $_lang['success_bid_haved'], "url" => ""), "event" => array("content" => $this->_task_title, "url" => "index.php?do=task&id={$this->_task_id}", 'cash' => $cash)); kekezu::save_feed($feed_arr, $work_list[$i]['uid'], $work_list[$i]['username'], 'work_accept', $this->_task_id); $this->plus_accepted_num($work_list[$i]['uid']); $this->plus_mark_num(); $bid_uid[] = $work_list[$i]['uid']; } if ($split_num > $count) { $remain_cash = $task_info['task_cash'] - $count * $single_cash; $res = $this->dispose_auto_return($remain_cash); if ($res) { $v = array($_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $url); $this->notify_user("auto_choose", $_lang['task_auto_choose_work_and_return'], $v, 2, $this->_guid); } } $this->set_task_status(8); $prom_obj->dispose_prom_event("pub_task", $this->_guid, $this->_task_id); } elseif ($split_style == 'master_choose') { $this->set_task_status(7); } } else { $this->dispose_task_return(); } break; } $url = '<a href ="' . $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id . '">' . $this->_task_title . '</a>'; $v_arr = array($_lang['username'] => '$this->_gusername', $_lang['model_name'] => $this->_model_name, $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $url); keke_msg_class::notify_user($this->_guid, $this->_gusername, 'auto_choose', $_lang['aito_choose_work_notice'], $v_arr, 1); }
public function dispose_task() { global $_lang; $pass = true; if ($this->set_task_status(8)) { $task_info = $this->_task_info; $host_cash = $task_info['host_amount']; $rate = $task_info['profit_rate']; $profit = floatval($host_cash * $rate / 100); $get_cash = floatval($host_cash - $profit); keke_finance_class::cash_in($this->_guid, $task_info['deposit_cash'], 'deposit_return', '', 'task', $this->_task_id); $work_info = $this->work_exists(); $match_info = $this->get_match_work($work_info['work_id']); $data = array(':model_name' => $this->_model_name, ':task_id' => $this->_task_id, ':task_title' => $this->_task_title); keke_finance_class::init_mem('task_bid', $data); keke_finance_class::cash_in($work_info['uid'], $get_cash, 'task_bid', '', 'task', $this->_task_id, $profit); keke_finance_class::cash_in($work_info['uid'], $match_info['deposit_cash'], 'deposit_return', '', 'task', $this->_task_id); $this->plus_accepted_num($work_info['uid']); keke_user_mark_class::create_mark_log($this->_model_code, 1, $work_info['uid'], $this->_guid, $work_info['work_id'], $host_cash, $this->_task_id, $work_info['username'], $this->_gusername); keke_user_mark_class::create_mark_log($this->_model_code, 2, $this->_guid, $work_info['uid'], $work_info['work_id'], $get_cash, $this->_task_id, $this->_gusername, $work_info['username']); $this->plus_mark_num(); $w_notice = array($_lang['description'] => $_lang['hirer_has_acceptance_your_work'], $_lang['task_title'] => $this->_notice_url); $this->notify_user('match_task', $_lang['task_acceptance_ok'], $w_notice, 1, $work_info['uid']); $feed_arr = array("feed_username" => array("content" => $work_info['username'], "url" => "index.php?do=seller&id={$work_info['uid']}"), "action" => array("content" => $_lang['match_task_over'], "url" => ""), "event" => array("content" => $this->_task_title, "url" => $this->_task_url, 'cash' => number_format($get_cash, '2'))); kekezu::save_feed($feed_arr, $work_info['uid'], $work_info['username'], 'work_accept', $this->_task_id); } else { $pass = false; } return $pass; }
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 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); } } }
$objId = $arrBidInfo['bid_id']; $toUid = $arrBidInfo['uid']; $arrMark = keke_user_mark_class::get_mark_info(array('model_code' => $modelCode, 'obj_id' => $objId, 'by_uid' => $gUid, 'uid' => $toUid)); $markInfo = $arrMark['mark_info']['0']; $intUserType = $markInfo['mark_type']; $aidList = keke_user_mark_class::get_mark_aid($intUserType); $aidInfo = keke_user_mark_class::get_user_aid($markInfo['by_uid'], $markInfo['mark_type'], $markInfo['mark_status'], 2, $markInfo['model_code'], $objId); $strJumpUrl = "index.php?do=task&id={$taskId}&view=mark#detail"; require keke_tpl_class::template('task/' . $arrModelInfo['model_code'] . '/tpl/default/gz_step6'); die; break; case "wk": $arrBidInfo = $objTask->get_bid_info(); $arrBidInfo = $objTask->get_task_info(); $taskId = $arrTaskInfo['task_id']; keke_user_mark_class::create_mark_log('tender', 1, $arrBidInfo['uid'], $arrTaskInfo['uid'], $arrBidInfo['bid_id'], $arrBidInfo['quote'], $arrTaskInfo['task_id'], $arrBidInfo['username'], $arrTaskInfo['username']); $modelCode = 'tender'; $objId = $arrBidInfo['bid_id']; $toUid = $arrTaskInfo['uid']; $arrMark = keke_user_mark_class::get_mark_info(array('model_code' => $modelCode, 'obj_id' => $objId, 'by_uid' => $gUid, 'uid' => $toUid)); $markInfo = $arrMark['mark_info']['0']; $intUserType = $markInfo['mark_type']; $aidList = keke_user_mark_class::get_mark_aid($intUserType); $aidInfo = keke_user_mark_class::get_user_aid($markInfo['by_uid'], $markInfo['mark_type'], $markInfo['mark_status'], 2, $markInfo['model_code'], $objId); $strJumpUrl = "index.php?do=task&id={$taskId}&view=mark#detail"; require keke_tpl_class::template('task/' . $arrModelInfo['model_code'] . '/tpl/default/wk_step6'); die; break; case "turnaround": if (0 === $gUid) { kekezu::show_msg('未登陆用户,无权操作', 'index.php?do=login', 3, NULL, 'warning');
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 plan_confirm($plan_id, $plan_step) { global $_K, $kekezu; global $_lang; $plan_ids = $this->get_plan_ids(); if (is_array($plan_ids) && in_array($plan_id, $plan_ids)) { $title_url = "<a href=\"" . $_K['siteurl'] . "/index.php?do=task&id=" . $this->_task_id . "\">" . $this->_task_title . "</a>"; $size = sizeof($plan_ids); if ($this->plan_cash($plan_id, $title_url)) { if (intval($plan_step) == $size) { $objProm = keke_prom_class::get_instance(); $objProm->dispose_prom_event("pub_task", $this->_guid, $this->_task_id); $objProm->dispose_prom_event("bid_task", $this->_bid_info['uid'], $this->_task_id); $this->set_task_status(8); $this->plus_mark_num(); $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); keke_msg_class::notify_user($this->_guid, $this->_gusername, 'task_over', $_lang['task_over_notice'], $v_arr, 1); $sum = self::getTuoGuanCash($this->_task_id); keke_user_mark_class::create_mark_log($this->_model_code, '1', $this->_bid_info['uid'], $this->_guid, $this->_bid_info['bid_id'], $sum, $this->_task_id, $this->_bid_info['username'], $this->_gusername); $cash = floatval($sum) * (100 - intval($this->_task_info['profit_rate'])) / 100; keke_user_mark_class::create_mark_log($this->_model_code, '2', $this->_guid, $this->_bid_info['uid'], $this->_bid_info['bid_id'], $cash, $this->_task_id, $this->_gusername, $this->_bid_info['username']); } return true; } else { return true; } } else { return $_lang['the_plan_not_exist']; } }
public function work_choosed($work_info, $title_url) { global $_K, $kekezu; global $_lang, $_currencies, $currency; $objProm = keke_prom_class::get_instance(); $task_total_cash = floatval($this->_task_info['task_cash']); $task_real_cash = $task_total_cash * (1 - intval($this->_task_info['profit_rate']) / 100); $single_cash = floatval($this->_task_info['single_cash']); $real_cash = $task_real_cash / intval($this->_task_info['work_count']); $profit_cash = $single_cash - $real_cash; $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($work_info['uid'], $real_cash, 'task_bid', '', 'task', $this->_task_id, $profit_cash); $url = '<a href ="' . $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id . '">' . $this->_task_title . '</a>'; $status_arr = self::get_work_status(); $v = array($_lang['work_status'] => $status_arr[6], $_lang['username'] => $work_info['username'], $_lang['website_name'] => $kekezu->_sys_config['website_name'], $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $url, $_lang['bid_cash'] => $_currencies[$currency]['symbol_left'] . $real_cash . $_currencies[$currency]['symbol_right']); $this->notify_user("task_bid", $_lang['work_bid'], $v, '1', $work_info['uid']); $feed_arr = array("feed_username" => array("content" => $work_info['username'], "url" => "index.php?do=seller&id={$work_info['uid']}"), "action" => array("content" => $_lang['success_bid_haved'], "url" => ""), "event" => array("content" => "{$this->_task_title}", "url" => "index.php?do=task&id={$this->_task_id}", 'cash' => number_format($real_cash, '2'))); kekezu::save_feed($feed_arr, $work_info['uid'], $work_info['username'], 'work_accept', $this->_task_id); $this->plus_accepted_num($work_info['uid']); $this->plus_mark_num(); $objProm = keke_prom_class::get_instance(); if ($objProm->is_meet_requirement("bid_task", $this->_task_id)) { $objProm->create_prom_event("bid_task", $work_info['uid'], $this->_task_id, $single_cash); $objProm->dispose_prom_event("bid_task", $work_info['uid'], $this->_task_id); } keke_user_mark_class::create_mark_log($this->_model_code, '1', $work_info['uid'], $this->_guid, $work_info['work_id'], $this->_task_info['single_cash'], $this->_task_id, $work_info['username'], $this->_gusername); keke_user_mark_class::create_mark_log($this->_model_code, '2', $this->_guid, $work_info['uid'], $work_info['work_id'], $real_cash, $this->_task_id, $this->_gusername, $work_info['username']); }