public function appWorkChoose($work_id, $to_status)
 {
     global $kekezu, $_K;
     global $_lang;
     $intWorkStatus = db_factory::get_count(sprintf(" select work_status from %switkey_task_work where work_id='%d' and uid='%d'", TABLEPRE, $work_id, $this->_uid));
     if ($intWorkStatus == '8') {
         app_class::response(array('ret' => 106));
     } else {
         switch ($to_status) {
             case "4":
                 $has_bidwork = db_factory::get_count(sprintf(" select count(work_id) from %switkey_task_work where work_status='4' and task_id = '%d' ", TABLEPRE, $this->_task_id));
                 if ($has_bidwork) {
                     app_class::response(array('ret' => 107));
                 } else {
                     if ($intWorkStatus == '7') {
                         app_class::response(array('ret' => 107));
                     }
                 }
                 break;
             case "5":
                 switch ($intWorkStatus) {
                     case "4":
                         app_class::response(array('ret' => 107));
                         break;
                     case "5":
                         app_class::response(array('ret' => 107));
                         break;
                     case "7":
                         app_class::response(array('ret' => 107));
                         break;
                 }
                 break;
             case "7":
                 switch ($intWorkStatus) {
                     case "4":
                         app_class::response(array('ret' => 107));
                         break;
                     case "7":
                         app_class::response(array('ret' => 107));
                         break;
                 }
                 break;
         }
     }
     $status_arr = $this->get_work_status();
     $task_info = $this->_task_info;
     $work_info = $this->get_task_work($work_id);
     if ($to_status == 4) {
         if ($this->_task_status == 7) {
             $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));
             keke_user_mark_class::create_mark_log($this->_model_code, '1', $work_info['uid'], $this->_guid, $work_info['work_id'], $cash_info['task_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'], $cash_info['real_cash'], $this->_task_id, $this->_gusername, $work_info['username']);
             $this->plus_mark_num();
             $site_profit = $cash_info['task_cash'] - $cash_info['real_cash'];
             $data = array(':task_id' => $this->_task_id, ':task_title' => $this->_task_info['task_title']);
             keke_finance_class::init_mem('task_bid', $data);
             keke_finance_class::cash_in($work_info['uid'], $cash_info['real_cash'], 'task_bid', '', 'task', $this->_task_id, $site_profit);
             $this->set_task_status('8');
             $feed_arr = array("feed_username" => array("content" => $work_info['uid'], "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' => $cash_info['real_cash']));
             kekezu::save_feed($feed_arr, $work_info['uid'], $work_info['username'], 'work_accept', $this->_task_id);
             $this->plus_accepted_num($work_info['uid']);
         } else {
             if ($this->_task_config['notice_period']) {
                 $this->set_task_status('5');
                 $this->set_task_sp_end_time();
             } else {
                 if ($this->set_task_status(6)) {
                     $agree_id = $this->create_agree_date($work_info);
                 }
             }
             $this->plus_accepted_num($work_info['uid']);
             $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, $this->_task_info['task_cash']);
             }
         }
     }
     $res = $this->set_work_status($work_id, $to_status);
     $notify_url = '<a href ="' . $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id . '" target="_blank" >' . $this->_task_title . '</a>';
     if ($to_status == 4) {
         $v = array($_lang['work_status'] => $status_arr[$to_status], $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $notify_url, $_lang['bid_cash'] => $this->_task_info['real_cash']);
         $this->notify_user("task_bid", $_lang['work'] . $status_arr[$to_status], $v, 1, $work_info['uid']);
     } elseif ($to_status == 5) {
         $v = array($_lang['work_status'] => $status_arr[$to_status], $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $notify_url);
         $this->notify_user("work_rw", $_lang['work'] . $status_arr[$to_status], $v, 1, $work_info['uid']);
     } else {
         $v = array($_lang['work_status'] => $status_arr[$to_status], $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $notify_url);
         $this->notify_user("work_out", $_lang['work'] . $status_arr[$to_status], $v, 1, $work_info['uid']);
     }
     if ($res) {
         app_class::response(array('ret' => 0, 'agree_id' => $agree_id));
     } else {
         app_class::response(array('ret' => 1));
     }
 }
Example #2
0
 function __destruct()
 {
     parent::__destruct();
 }
Example #3
0
 public static function create_service_order($service_info, $isApp = false, $serviceOrderInfo = array(), $step = '')
 {
     global $uid, $username, $_K;
     global $_lang;
     if ($uid == $service_info['uid']) {
         if ($isApp) {
             app_class::response(array('ret' => 1003));
         } else {
             return $_lang['seller_can_not_order_self'];
         }
     }
     $oder_obj = new Keke_witkey_order_class();
     $order_detail = new Keke_witkey_order_detail_class();
     switch ($service_info['model_id']) {
         case "6":
             $type = $_lang['work'];
             $service_cash = $service_info['price'];
             break;
         case "7":
             $type = $_lang['service'];
             $service_cash = $serviceOrderInfo['price'];
             break;
     }
     $order_name = $service_info['title'];
     $order_body = $_lang['buy_goods'] . "<a href=\"index.php?do=goods&id={$service_info['service_id']}\">" . $order_name . "</a>";
     if ($service_info['model_id'] == 6) {
         $detail_type = 'goods';
         $order_status = 'wait';
     } else {
         $detail_type = 'service';
         $order_status = 'seller_confirm';
     }
     $order_id = keke_order_class::create_order($service_info['model_id'], $service_info['uid'], $service_info['username'], $order_name, $service_cash, $order_body, $order_status, $service_info['leave_message']);
     if ($order_id) {
         if ($service_info['model_id'] == 7) {
             $serviceOrderInfo['order_id'] = $order_id;
             keke_order_class::createServiceOrder($serviceOrderInfo);
         }
         keke_order_class::create_order_detail($order_id, $order_name, 'service', intval($service_info[service_id]), $service_cash);
         $msg_obj = new keke_msg_class();
         $service_url = "<a href=\"" . $_K[siteurl] . "/index.php?do=goods&id=" . $service_info[service_id] . "\">" . $order_name . "</a>";
         $strLeaveMessage = $service_info['leave_message'];
         $order_url = "<a href=\"" . $_K[siteurl] . "/index.php?do=order&sid=" . $service_info['service_id'] . "&orderId=" . $order_id . "#userCenter\">#" . $order_id . "</a>";
         $s_notice = array($_lang['user_action'] => $username . $_lang['order_buy'], $_lang['service_name'] => $service_url, $_lang['service_type'] => $type, $_lang['buyer_leave_message'] => $strLeaveMessage, $_lang['order_link'] => $order_url);
         if ($service_info['model_id'] == '7') {
             unset($s_notice[$_lang['buyer_leave_message']]);
             $msgAction = 'service_order';
             $shopMx = '服务';
         } else {
             $msgAction = 'goods_order';
             $shopMx = '作品';
         }
         $contact = db_factory::get_one(sprintf(" select mobile,email from %switkey_space where uid='%d'", TABLEPRE, $service_info[uid]));
         if ($service_info['model_id'] != '6' && $step != 'step1') {
             $order_info = keke_order_class::get_order_info($order_id);
             $b_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>";
             $v_arr = array($_lang['user_msg'] => $order_info['seller_username'], '商品标题' => $order_info['order_name'], $_lang['order_link'] => $b_order_link, '商品模型名称' => $shopMx);
             $msg_obj->send_message($service_info['uid'], $service_info['username'], "order_create", $_lang['you_has_new'] . $type . $_lang['order'], $v_arr, $contact['email'], $contact['mobile']);
             $arrTaskInfo = db_factory::get_one("select * from " . TABLEPRE . "witkey_service where service_id=" . intval($service_info[service_id]));
             $feed_arr = array("feed_username" => array("content" => $arrTaskInfo['username'], "url" => "index.php?do=seller&id=" . $arrTaskInfo['uid']), "action" => array("content" => $_lang['buy'], "url" => ''), "event" => array("content" => $order_name, "url" => "index.php?do=goods&id={$service_info['service_id']}"));
             kekezu::save_feed($feed_arr, $uid, $username, 'buy_' . $detail_type, $service_info['service_id'], $service_url);
             $feed_arr = array("feed_username" => array("content" => $username, "url" => "index.php?do=seller&id=" . $uid), "action" => array("content" => $_lang['buy'], "url" => ''), "event" => array("content" => $order_name, "url" => "index.php?do=goods&id={$service_info['service_id']}"));
             kekezu::save_feed($feed_arr, $arrTaskInfo['uid'], $arrTaskInfo['username'], 'buy_' . $detail_type . '_bei', $service_info['service_id'], $service_url);
         }
         if ($isApp) {
             app_class::response(array('ret' => 0, 'orderid' => $order_id));
         } else {
             return $order_id;
         }
     } else {
         if ($isApp) {
             app_class::response(array('ret' => 1004));
         } else {
             return $_lang['order_produce_fail'];
         }
     }
 }
 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 appWorkChoose($work_id, $to_status)
 {
     global $_K, $kekezu;
     global $_lang;
     $work_status = db_factory::get_count(sprintf(" select work_status from %switkey_task_work where work_id='%d'", TABLEPRE, $work_id));
     if ($work_status == '8') {
         app_class::response(array('ret' => 106));
     } else {
         $prize_date = $this->get_prize_date();
         $prize_work_date = $this->get_prize_work_count();
         $work_count = $prize_work_date["prize_" . $to_status];
         $prize_count = $prize_date['count']["prize_" . $to_status];
         if ($work_count == $prize_count) {
             app_class::response(array('ret' => 108));
         }
     }
     $status_arr = $this->get_work_status();
     if ($this->set_work_status($work_id, $to_status)) {
         $status_desc_arr = array("1" => $_lang['work_get_prize1'], "2" => $_lang['work_get_prize2'], "3" => $_lang['work_get_prize3']);
         $work_info = $this->get_task_work($work_id);
         $prize_date = $this->get_prize_date();
         $prize_cash = $prize_date['cash']['prize_' . $to_status];
         $prize_real_cash = $prize_cash * (1 - $this->_task_config['task_rate'] / 100);
         $url = '<a href ="' . $_K['siteurl'] . '/index.php?do=task&id=' . $this->_task_id . '" target="_blank" >' . $this->_task_title . '</a>';
         $v = array($_lang['work_status'] => $status_desc_arr[$to_status], $_lang['task_id'] => $this->_task_id, $_lang['task_title'] => $url, $_lang['bid_cash'] => $prize_cash);
         $this->notify_user("task_bid", $status_desc_arr[$to_status], $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' => $prize_real_cash));
         kekezu::save_feed($feed_arr, $work_info['uid'], $work_info['username'], 'work_accept', $this->_task_id);
         $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, $prize_cash);
         }
         $this->plus_accepted_num($work_info['uid']);
         $this->check_if_gs();
         app_class::response(array('ret' => 0));
     } else {
         app_class::response(array('ret' => 1));
     }
 }
Example #6
0
 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 appWorkChoose($work_id, $to_status)
 {
     global $_K, $kekezu;
     global $_lang;
     $work_status = db_factory::get_count(sprintf("select work_status from %switkey_task_work where work_id='%d'", TABLEPRE, $work_id));
     if (intval($work_status) === 0) {
         if ($to_status == 6) {
             if (!$this->check_work_if_standard('hege')) {
                 app_class::response(array('ret' => 109));
             }
         }
     } else {
         app_class::response(array('ret' => 106));
     }
     $work_status_arr = $this->_work_status_arr;
     if ($this->set_work_status($work_id, $to_status)) {
         $title_url = "<a href =" . $_K['siteurl'] . "/index.php?do=task&id=" . $this->_task_id . " target=\"_blank\">" . $this->_task_title . "</a>";
         $work_info = $this->get_task_work($work_id);
         if ($to_status == 6) {
             $this->work_choosed($work_info, $title_url);
             if (!$this->check_work_if_standard('hege')) {
                 if ($this->set_task_status(8)) {
                     $objProm = keke_prom_class::get_instance();
                     $objProm->dispose_prom_event("bid_task", $work_info['uid'], $this->_task_id);
                     $objProm->dispose_prom_event("pub_task", $this->_guid, $this->_task_id);
                     if ($this->_task_info['task_union'] > 1) {
                         $bid_uid = array();
                         $ids = db_factory::query('select uid from ' . TABLEPRE . 'witkey_task_work where work_status=6 and task_id=' . $this->_task_id);
                         foreach ($ids as $v) {
                             $bid_uid[] = $v['uid'];
                         }
                     }
                 }
             }
         } elseif ($to_status == 7) {
             $arr = array($_lang['username'] => $work_info['username'], $_lang['task_title'] => $this->_task_title, $_lang['website_name'] => $_K['sitename'], $_lang['task_id'] => $this->_task_id);
             keke_msg_class::notify_user($work_info['uid'], $work_info['username'], 'task_unbid', $_lang['work_fail1'], $arr, 1);
         }
         app_class::response(array('ret' => 0));
     } else {
         app_class::response(array('ret' => 1));
     }
 }
Example #8
0
 function __construct()
 {
     parent::__construct();
 }