/** * 普通消息公共调用 * MsgType : text image voice video 等 */ function commonMsg($postData) { $msgData = array(); if ($postData['MsgType'] == 'text' && !empty($postData['Content'])) { switch ($postData['Content']) { case 'hello': $text = '您好'; break; default: $text = '欢迎访问WEB人生百科'; } $paramsData['Content'] = $text; $paramsData['MsgType'] = 'text'; } send_msg($postData, $paramsData); }
/** * 使用团购券 * @param unknown_type $password 密码 * @param unknown_type $location_id 所消费的门店ID * @param unknown_type $account_id 执行使用的商家账号ID * @param unknown_type $send_return 是否要发放奖励 * @param unknown_type $send_notify 是否发放通知(短信/邮件) * return:true,false true:已使用掉 false:未使用掉 */ function use_coupon($password, $location_id = 0, $account_id = 0, $send_return = false, $send_notify = false) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_coupon set is_balance = 1 ,location_id=" . $location_id . ", confirm_account = " . $account_id . ",confirm_time=" . NOW_TIME . " where password = '******' and confirm_time = 0"); $coupon_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where password = '******'"); if ($GLOBALS['db']->affected_rows() && $coupon_data) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set consume_count = consume_count + 1 where id = " . $coupon_data['order_deal_id']); update_order_cache($coupon_data['order_id']); distribute_order($coupon_data['order_id']); $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $coupon_data['order_id']); if ($order_info) { $order_msg = "订单号" . $order_info['order_sn'] . " "; } if ($send_return) { if ($coupon_data['coupon_money'] > 0 || $coupon_data['coupon_score'] > 0) { $money = $coupon_data['coupon_money']; $score = $coupon_data['coupon_score']; require_once APP_ROOT_PATH . "system/model/user.php"; $log = $order_msg . $password . "消费券验证成功"; modify_account(array("money" => $money, "score" => $score), $coupon_data['user_id'], $log); } } if ($send_notify) { send_use_coupon_sms(intval($coupon_data['id'])); //发送团购券确认消息 send_use_coupon_mail(intval($coupon_data['id'])); //发送团购券确认消息 } update_balance($coupon_data['id'], $coupon_data['deal_id']); $balance_price = $coupon_data['balance_price'] + $coupon_data['add_balance_price']; require_once APP_ROOT_PATH . "system/model/supplier.php"; modify_supplier_account("-" . $balance_price, $coupon_data['supplier_id'], 1, $order_msg . $password . "消费券验证成功"); //解冻资金 modify_supplier_account($balance_price, $coupon_data['supplier_id'], 2, $order_msg . $password . "消费券验证成功"); //等结算金额增加 modify_statements($coupon_data['coupon_price'], 11, $order_msg . $password . "消费券验证成功"); //增加消费额 modify_statements($balance_price, 12, $order_msg . $password . "消费券验证成功"); //增加消费额成本 send_msg($coupon_data['user_id'], "消费券验证成功", "orderitem", $coupon_data['order_deal_id']); auto_over_status($coupon_data['order_id']); //检测自动结单 } return $coupon_data['confirm_time'] > 0; }
public function queryCheckCode() { //dump($_POST); if (I('post.mobile')) { $result = send_msg(I('post.mobile')); echo $result; } }
die(json_encode(receive_msg(120))); case "asnap": $delay = 0 + filter_input(INPUT_GET, 'delay', FILTER_SANITIZE_NUMBER_INT); send_msg("T" . chr($delay)); die(json_encode(receive_msg(10))); case "addip": $sql = "insert into s set ip='" . get_ip() . "' on duplicate key update ip=ip"; qexec($sql); qresp("添加ip完成"); case "delip": $sql = "delete from s where ip='" . get_ip() . "'"; qexec($sql); qresp("删除ip完成"); } if (array_key_exists($cmd, $cmd_translation)) { send_msg($cmd_translation[$cmd]); die(json_encode(receive_msg(10))); } qresp('unsupport command:' . $cmd); function qresp($msg) { die(json_encode(array('msg' => "M{$msg}", 'ip' => 'none'))); } function send_msg($msg) { # 1 create fail; # 2 send fail; # 0 success; $ip = get_ip(); $r = 0; if (!($sock = socket_create(AF_INET, SOCK_DGRAM, 0))) {
function op_msg_del($id, $change, $reason, $check = false) { $message = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "message where id = " . $id); if ($check) { $result['status'] = 1; return $result; } if (check_user_auth("msg", "del")) { $sql = "delete from " . DB_PREFIX . "message where id = " . $id; $GLOBALS['db']->query($sql); $o_reason = $reason; $reason .= "留言被删除"; if ($change == 1) { modify_account(get_op_change("msg", "del"), $message['user_id'], $reason); $reason .= get_op_change_show("msg", "del"); } if ($change == 1 || $o_reason != "") { send_msg($message['user_id'], $reason, "notify", 0); } $result['status'] = 1; } else { $result['status'] = 0; $result['info'] = "没有权限"; } return $result; }
$reg_title = $row_pat_referring['Reg_Title']; $reg_name = $row_pat_referring['Reg_name']; $reg_email = $row_pat_referring['Reg_email']; $pat_name = $row_pat_referring['Patient_Name']; $ref_mob_number = $row_pat_referring['Ref_mob_number']; $ref_title = $row_pat_referring['Ref_Title']; $ref_name = $row_pat_referring['Ref_name']; $ref_email = $row_pat_referring['Ref_email']; //end of getting data $sms_msg_referring_doc = $hospital_name . " - Dear " . $reg_title . $reg_name . ", current status for patient " . $pat_name . " : " . $status; $sms_msg_referred_doc = $hospital_name . " - Dear " . $ref_title . $ref_name . ", current status for patient " . $pat_name . " : " . $status; $update_status = "update patient_stub set secondary_status='{$status}' where Patient_thread_id='{$pat_id}'"; $result = mysql_query($update_status); if ($result) { send_msg($reg_mob_number, $sms_msg_referring_doc); send_msg($ref_mob_number, $sms_msg_referred_doc); if ($reg_email != '') { $email_sender->send_email($reg_email, $sms_msg_referring_doc); } if ($ref_email != '') { $email_sender->send_email($ref_email, $sms_msg_referred_doc); } $success = array('status' => "Success", "msg" => "Patient status updated successfully"); echo json_encode($success); } else { $success = array('status' => "Failure", "msg" => "Patient status could not be updated"); echo json_encode($success); } function send_msg($mobile, $mobile_msg) { //$logger->write("INFO :","login with mobile".$mobile);
$sender = 'Startups'; //$ajax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']; if (!isset($_POST['getData']) || !$ajax) { return false; } $phone = $_POST['phone']; $data = json_decode($_POST['getData'], true); if (!isset($_SESSION['file'])) { $_SESSION['file'] = ''; } $founder = $_POST['found']; $sql = "INSERT INTO startups (name,year,founder,city,members,industry,description,logo,capital,phone)\n\t\tVALUES('{$data['name']}','{$data['year']}','{$founder}','{$data['city']}',\n\t\t'{$data['membersNum']}','{$data['industry']}','{$data['description']}',\n\t\t'{$_SESSION['file']}','{$data['capital']}',{$phone})"; mysql_query($sql) or die(mysql_error()); $id = mysql_insert_id(); $uniq = unique_digits(); send_msg($phone, 'hello'); echo $founder; function send_msg($phone, $content) { global $sender, $uniq; update_column('code', $uniq); $url = "http://smsoffice.ge/api/send.aspx?key=92f8f657cd3e46eb94157999366e958c&destination={$phone}&sender={$sender}&content={$uniq}"; $data = file_get_contents($url); //echo $url; //var_dump( $data, $url ); } function unique_digits($digits = 4) { $i = 0; //counter $pin = "";
<?php require 'core.php'; if (isset($_POST['send'])) { if (send_msg($_POST['sender'], $_POST['message'])) { echo 'Message Sent'; } else { echo 'Message Failed To Send'; } } ?> <html> <head> <meta charset="UTF-8"> <title> Chat App</title> <link type="text/css" rel="stylesheet" href="main.css"> </head> <body> <div id="input"> <form action="index.php" method="post"> <label>Enter Name <input type="text" name="sender"/> </label> <label>Enter Message: <input type="text" name="message"/> </label> <input type="submit" name="send" value="Send"> </form> </div> <div id="messages"> </div> <script type="text/javascript" src="jquery-1.11.3.min.js"></script> <script type="text/javascript" src="auto_chat.js"></script>
$visibility = 1; $insert_pending_referring_in = mysql_query("insert into doctor_stub (Doctor_Title,Doctor_name,Doctor_mobile_number,visibility,Doctor_unregistered) values('{$doctor_title}','{$name}','{$mobile}','{$visibility}','{$temp}')"); } if ($doctor_id != "") { $doctor_stub_id = $doctor_id; } $refering_in_query = mysql_query("INSERT INTO hospital_refer_in_doctor_stub(refer_in_doc_title,refer_in_doc_name, refer_in_doc_mobile,refer_in_doc_email,refer_by_hos_id,doc_stub_id) VALUES ('{$doctor_title}','{$name}','{$mobile}','{$email}','{$hospital_id}','{$doctor_stub_id}')"); //query to get the helper clarification table $getClarificationHelper = mysql_query("select * from clarification_member_by_hospital where hospital_id='{$hospital_id}'"); $row_helper = mysql_fetch_assoc($getClarificationHelper); $person = $row_helper['person_name']; $mobile_number = $row_helper['mobile_number']; $extra_notes = $row_helper['extra_notes']; $clarification_msg = "For any help, contact " . $person . " at " . $mobile_number . ".Thanks." . $Doctor_HospitalName . "." . $extra_notes; $mobile_txt_msg = $Doctor_HospitalName . ": Dear " . $doctor_title . $name . " You have been added as a Referring doctor by " . $Doctor_HospitalName . ". Please use this below link to download the app: " . $link . " Or you can search for Referralio on android or ios app store"; send_msg($mobile, $mobile_txt_msg); if ($email != '') { $email_sender->send_email($email, $mobile_txt_msg); } if ($refering_in_query == "success") { send_msg($mobile, $clarification_msg); $success = array('status' => "Success", "msg" => "Successfully Registered"); } else { $success = array('status' => "Failure", "msg" => "Refer In doctor could not be registered"); } echo json_encode($success); exit(0); function send_msg($mobile, $mobile_msg) { //$logger->write("INFO :","login with mobile".$mobile); $msg = "";
function projectDispatch($op) { switch ($op) { case "project": project(); break; case "addprj": addprj(); break; case "addprj_now": if (!isset($_POST["undo"])) { addprj_now(); } else { project(); } break; case "showprj": show_prj(); break; case "manprjadmin": manprjadmin(); break; case "update_admins": update_admins(); break; case "prjadditem": if (isset($_POST["undo"])) { Util::jump_to("index.php?modname=project&op=showprj&id=" . $_GET["id"]); } else { if ($_GET["type"] == "news") { edit_news("new"); } if ($_GET["type"] == "todo") { edit_todo("new"); } if ($_GET["type"] == "task") { edit_tasks("new"); } if ($_GET["type"] == "file") { edit_files("new"); } } break; case "prjedititem": if (isset($_POST["undo"])) { Util::jump_to("index.php?modname=project&op=showprj&id=" . $_GET["id"]); } else { if ($_GET["type"] == "news") { edit_news(); } if ($_GET["type"] == "todo") { edit_todo(); } if ($_GET["type"] == "task") { edit_tasks(); } if ($_GET["type"] == "file") { edit_files(); } } break; case "prjdelitem": del_item(); break; case "prjsendmsg": send_msg(); break; case "prjreadmsg": read_msg(); break; case "modprj": if ($_GET["id"] == 0) { sel_prj("modprj"); } else { if (!isset($_POST["undo"])) { mod_prj($_GET["id"]); } else { project(); } } break; case "delprj": if ($_GET["id"] == 0) { sel_prj("delprj"); } else { del_prj(); } break; case "prjreaditem": read_item(); break; case "editprogtot": edit_progtot(); break; case "download": require_once _base_ . '/lib/lib.download.php'; $id = importVar('id', true, 0); $type = importVar('type'); $can_view = checkPerm('view', true); switch ($type) { case "file": $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_msg WHERE pid='{$id}' {$filter} ORDER BY {$oby} {$ord}, id DESC;"); list($pid, $fname, $ftitle) = sql_fetch_row(sql_query("\r\n\t\t\t\t\tSELECT pid, fname, ftitle\r\n\t\t\t\t\tFROM " . $GLOBALS["prefix_lms"] . "_prj_files\r\n\t\t\t\t\tWHERE id = '{$id}'")); $myprj = user_projects(Docebo::user()->getIdSt()); if ($can_view && in_array($pid, $myprj)) { $expFileName = explode('.', $fname); $totPart = count($expFileName) - 1; sendFile(_FPATH_INTERNAL, $fname, $expFileName[$totPart], $ftitle); } else { die('You can\'t access'); } break; } break; } }
if ($Doctor_photograph != "") { $logger->write("INFO inside file image putting"); $file_put = file_put_contents($file, $data); } $success = array('status' => "Success", "msg" => "Successfully doctor has been registered"); //$this->response($this->json($success),200); //sending text message to registered doctor_id_present(not modified in testing server yet) $link = "https://play.google.com/store/apps/details?id=com.hospitalcheck.referralio&hl=en"; $mobile_txt_msg = $hospital_name . " - Dear " . $doctor_title . $Doctor_name . " You have been added as a Hospital doctor of " . $Doctor_HospitalName . " hospital"; $link_txt_msg = "Please use this below link to download the app: " . $link; $logger->write("calling mobile msg"); send_msg($Doctor_mobile_number, $mobile_txt_msg); send_msg($Doctor_mobile_number, $link_txt_msg); $mobile_txt_msg1 = $hospital_name . " - Your username is " . $Doctor_mobile_number . " and password is " . $Doctor_password; $logger->write("calling mobile msg" . $mobile_txt_msg1); send_msg($Doctor_mobile_number, $mobile_txt_msg1); //sending email to registered doctor $email_msg = $hospital_name . " - Dear " . $doctor_title . $Doctor_name . " You have been added as a doctor by hospital " . $Doctor_HospitalName . " with username and password " . $Doctor_mobile_number . "," . $Doctor_password . " respectively"; //$logger->write("calling email sender"); $email_sender->send_email($Doctor_email, $email_msg . $link_txt_msg); echo json_encode($success); exit(0); } else { $success = array('status' => "Failed", "msg" => "SQL query failed"); //$this->response($this->json($error), 400); echo json_encode($success); exit(0); } } else { $success = array('status' => "Failed", "msg" => "A user already registered with this mobile number"); //$this->response($this->json($error), 400);
if (isset($_SESSION['CURRENT_LOGIN_ID']) && isset($_SESSION['CURRENT_LOGIN_USER'])) { require_once 'class/Config.php'; require_once 'class/Info_commodity.php'; require_once 'class/commodity/Transaction_state_config.php'; $commodity_id = (int) $_GET['commodity_id']; //连接数据库 $conn = Config::connect(); $commodity = new Info_commodity($conn, $commodity_id); $commodity_ary = $commodity->get_commodity(); //判断当前用户是否具有权限: 当当前用户不是发布者 if ($commodity_ary[Config_commodity::publisher] != $_SESSION['CURRENT_LOGIN_ID']) { //更新商品状态 $commodity->update(Transaction_state_config::acceptor_comfirmed); //创建订单 if (create_transaction($conn, $commodity_ary)) { send_msg($commodity_ary); include_once 'smarty_init.php'; $smarty->display(""); } else { } } else { } } else { include 'Login.php'; } function send_msg($commodity_ary) { if ($commodity_ary[Config_commodity::course_or_reward] == Commodity_type_Config::course) { $content = '尊敬的用户您好,您发布的课程 ' . $commodity_ary[Config_commodity::title] . '已被客户 ' . $_SESSION['CURRENT_LOGIN_USER'] . '选中。请前往领行客户中心查看详情并于客户联系'; } else { $content = '尊敬的用户您好,您发布的悬赏 ' . $commodity_ary[Config_commodity::title] . '已被客户 ' . $_SESSION['CURRENT_LOGIN_USER'] . '选中。请前往领行客户中心查看详情并于客户联系';
/** * Send message bug_actions. */ function bug_actions($p_event, $p_event_str, $p_bug_id) { if (check_user_from_projects_table($p_bug_id)) { $f_action = gpc_get_string('action'); switch ($f_action) { case 'CLOSE': if (ON == plugin_config_get('send_mes_new_state_90')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); $bugnote_text = gpc_get_string('bugnote_text', ''); send_msg(get_xmpp_login($reporter_user_id), gen_close_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case 'MOVE': if (ON == plugin_config_get('send_mes_move_bug')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); send_msg(get_xmpp_login($reporter_user_id), gen_move_bug_msg($reporter_user_id, $p_bug_id)); } break; case 'RESOLVE': if (ON == plugin_config_get('send_mes_new_state_80')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); $bugnote_text = gpc_get_string('bugnote_text', ''); send_msg(get_xmpp_login($reporter_user_id), gen_resolve_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case 'ASSIGN': if (ON == plugin_config_get('send_mes_new_assign')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); send_msg(get_xmpp_login($reporter_user_id), gen_assign_bug_msg_in($reporter_user_id, $p_bug_id)); send_msg(get_xmpp_login(gpc_get_int('assign')), gen_assign_bug_msg_out($reporter_user_id, $p_bug_id)); } break; case 'UP_PRIOR': if (ON == plugin_config_get('send_mes_up_prior')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); send_msg(get_xmpp_login($reporter_user_id), gen_up_priority_bug_msg($reporter_user_id, $p_bug_id)); } break; case 'UP_STATUS': if (ON == plugin_config_get('send_mes_up_status')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); $bugnote_text = gpc_get_string('bugnote_text', ''); $status = gpc_get_int('status'); switch ($status) { case '10': if (ON == plugin_config_get('send_mes_new_state_10')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case '20': if (ON == plugin_config_get('send_mes_new_state_20')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case '30': if (ON == plugin_config_get('send_mes_new_state_30')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case '40': if (ON == plugin_config_get('send_mes_new_state_40')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case '50': if (ON == plugin_config_get('send_mes_new_state_50')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case '80': if (ON == plugin_config_get('send_mes_new_state_80')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; case '90': if (ON == plugin_config_get('send_mes_new_state_90')) { send_msg(get_xmpp_login($reporter_user_id), gen_up_status_bug_msg($reporter_user_id, $p_bug_id, $bugnote_text)); } break; } } break; case 'UP_CATEGORY': if (gpc_get_int('category') != 0 && ON == plugin_config_get('send_mes_up_category')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); send_msg(get_xmpp_login($reporter_user_id), gen_up_category_bug_msg($reporter_user_id, $p_bug_id)); } break; case 'VIEW_STATUS': if (ON == plugin_config_get('send_mes_up_view')) { $reporter_user_id = bug_get_field($p_bug_id, 'reporter_id'); send_msg(get_xmpp_login($reporter_user_id), gen_up_view_status_bug_msg($reporter_user_id, $p_bug_id)); } break; } } }
$i++; } ?> </div> <div class="nachrichten_push"></div> </div> <div class="nachrichten_footer"><textarea class="nachrichten_input" rows="3"> <?php //schauen ob user einen chatnamen eingegeben hat. if (isset($_GET['sender']) && !empty($_GET['sender'])) { $sender = $_GET['sender']; //Abfrage ob überhaupt eine Nachricht eingeben wurde if (isset($_GET['message']) && !empty($_GET['message'])) { $message = $_GET['message']; //Nachricht abschicken. Falls nicht möglich, wird eine Fehlermeldung ausgegeben. if (send_msg($sender, $message)) { echo 'Nachricht gesendet'; } else { echo 'Nachricht konnte nicht gesendet werden. Versuchen Sie es später noch einmal!'; } } else { echo 'Es wurde keine Nachricht eingegeben!'; } } else { echo 'Kein Name wurde eingegeben!'; } ?> </textarea></div> </div> </div>
$id = $db->insert_id(); unset($sqldb); $sqldb[] = "id='{$id}'"; $sqldb[] = "fid='{$fid}'"; $sqldb[] = "uid='{$lfjuid}'"; /*检查判断辅信息表要插入哪些字段的内容*/ foreach ($field_db as $key => $value) { isset($postdb[$key]) && ($sqldb[] = "`{$key}`='{$postdb[$key]}'"); } $sql = implode(",", $sqldb); $db->query("INSERT INTO `{$_pre}content_{$mid}` SET {$sql}"); if ($webdb[order_send_mail]) { send_mail($infodb[email], "有客户向你询价了", "请尽快查看<A HREF='{$Murl}/member/joinshow.php?id={$id}' target='_blank'>{$Murl}/member/joinshow.php?id={$id}</A>", 0); } if ($webdb[order_send_msg]) { send_msg($infodb[uid], "有客户向你询价了", "请尽快查看<A HREF='{$Murl}/member/joinshow.php?fid={$fid}&id={$id}' target='_blank'>{$Murl}/member/joinshow.php?id={$id}</A>"); } refreshto("bencandy.php?fid={$fid}&id={$cid}", "你的询价单已发出,请等待回应!"); } elseif ($action == "del") { del_order($id); refreshto("bencandy.php?fid={$fid}&id={$cid}", "删除成功"); } elseif ($job == "edit") { $rsdb = $db->get_one("SELECT A.*,B.* FROM `{$_pre}join` A LEFT JOIN `{$_pre}content_{$mid}` B ON A.id=B.id WHERE A.id='{$id}'"); if ($rsdb[uid] != $lfjuid && !$web_admin) { showerr("你无权修改"); } $hownum = $rsdb[shopnum]; /*表单默认变量作处理*/ $Module_db->formGetVale($field_db, $rsdb); $atc = "edit"; require ROOT_PATH . "inc/head.php";
/** * 为会员发放系统的群发消息 */ function send_system_msg($user_id) { $user_id_key = str_pad($user_id, 6, 0, STR_PAD_LEFT); $msg_systems = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "msg_system where (end_time = 0 or end_time > " . NOW_TIME . ") and user_ids = '' or (match(user_ids) against('" . $user_id_key . "' IN BOOLEAN MODE))"); foreach ($msg_systems as $msg) { if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "msg_box where user_id = " . $user_id . " and data_id = " . $msg['id'] . " and type = 'system'") == 0) { send_msg($user_id, $msg['content'], "system", $msg['id']); } } }
public function do_verify() { $order_item_id = intval($_REQUEST['order_item_id']); $coupon_id = intval($_REQUEST['coupon_id']); if ($order_item_id) { $oi = $order_item_id; $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $order_item_id); $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $data['order_id']); $delivery_notice = $GLOBALS['db']->getRow("select n.* from " . DB_PREFIX . "delivery_notice as n left join " . DB_PREFIX . "deal_order as o on n.order_id = o.id where n.order_item_id = " . $order_item_id . " and o.id = " . $data['order_id'] . " and is_arrival <> 1 order by delivery_time desc"); if ($delivery_notice) { require_once APP_ROOT_PATH . "system/model/deal_order.php"; $res = confirm_delivery($delivery_notice['notice_sn'], $order_item_id); if ($res) { send_msg($order_info['user_id'], "订单经管理员审核,确认收货", "orderitem", $oi); $data['status'] = true; $data['info'] = "操作收货成功"; ajax_return($data); } else { $data['status'] = 0; $data['info'] = "操作收货失败"; ajax_return($data); } } else { $data['status'] = 0; $data['info'] = "订单已收货"; ajax_return($data); } } elseif ($coupon_id) { $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_coupon where id = " . $coupon_id); if ($data['refund_status'] == 2) { $this->error("已退款", 1); } if ($data) { $oi = $data['order_deal_id']; $order_item = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order_item where id = " . $data['order_deal_id']); $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $order_item['order_id']); require_once APP_ROOT_PATH . "system/model/deal_order.php"; $rs = use_coupon($data['password'], 0, 0, true, true); if ($rs) { $this->success("验证成功", 1); } else { $this->error("验证失败", 1); } } else { $this->error("非法操作", 1); } } }
//end of changes for referral map entry if ($sql_insert) { //for sending text message to patient $logger->write("INFO :", "inside success"); $msg_pat_txt = $hospital_name . " :- You have been referred to " . $doc_ref_title . $doc_ref_id_name . " by " . $doc_title . $doctor_name; //send_msg($pat_mobile,$msg_pat_txt);//commented as per requested //for sending text message to referred doctor $msg_doc_txt = $hospital_name . " - Patient " . $pat_name . " has been referred to you by " . $doc_title . $doctor_name; send_msg($doc_ref_mobile_number, $msg_doc_txt); if ($doc_ref_email != '') { $email_sender->send_email($doc_ref_email, $msg_doc_txt); } //for sending text message to referring doctor $msg_doc_txt = $hospital_name . " - Dear " . $doc_title . $doctor_name . ", Thank you for referring Patient " . $pat_name; //.".You can get real time updates of this patient by downloading Referralio app on your phone"; send_msg($doc_mob_number, $msg_doc_txt); if ($doc_email != '') { $email_sender->send_email($doc_email, $msg_doc_txt); } $registatoin_ids = array($gcm_id); $message = array("msg" => " " . $hospital_name . " - " . $doc_ref_title . $doc_ref_id_name . " has reffered a patient " . $pat_name, "flag_push" => "Refer", "Refer_In_cnt" => $cnt_refer_in); $result = $gcm->send_notification($registatoin_ids, $message); $success = array('status' => "Success", "msg" => "Patient successfully registered", "result" => $result); echo json_encode($success); } else { $success = array('status' => "Failure", "msg" => "Transaction Could not be registered", "result" => $result); echo json_encode($success); } function json($data) { if (is_array($data)) {
function order_paid_done($order_id) { //处理支付成功后的操作 /** * 1. 发货 * 2. 超量发货的存到会员中心 * 3. 发券 * 4. 发放抽奖 */ require_once APP_ROOT_PATH . "system/model/deal.php"; require_once APP_ROOT_PATH . "system/model/supplier.php"; require_once APP_ROOT_PATH . "system/model/deal_order.php"; $order_id = intval($order_id); $stock_status = true; //团购状态 $order_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_order where id = " . $order_id); if ($order_info['type'] == 0) { //首先验证所有的规格库存 $order_goods_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_order_item where order_id = " . $order_id); foreach ($order_goods_list as $k => $v) { if ($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "attr_stock where deal_id = " . $v['deal_id'] . " and locate(attr_str,'" . $v['attr_str'] . "') > 0")) { $sql = "update " . DB_PREFIX . "attr_stock set buy_count = buy_count + " . $v['number'] . " where deal_id = " . $v['deal_id'] . " and ((buy_count + " . $v['number'] . " <= stock_cfg) or stock_cfg = 0 )" . " and locate(attr_str,'" . $v['attr_str'] . "') > 0 "; $GLOBALS['db']->query($sql); //增加商品的发货量 $rs = $GLOBALS['db']->affected_rows(); if ($rs) { $affect_attr_list[] = $v; } else { $stock_status = false; break; } } } if ($stock_status) { $goods_list = $GLOBALS['db']->getAll("select buy_type,deal_id,sum(number) as num,sum(add_balance_price_total) as add_balance_price_total,sum(balance_total_price) as balance_total_price,sum(return_total_money) as return_total_money,sum(return_total_score) as return_total_score from " . DB_PREFIX . "deal_order_item where order_id = " . $order_id . " group by deal_id"); foreach ($goods_list as $k => $v) { $sql = "update " . DB_PREFIX . "deal set buy_count = buy_count + " . $v['num'] . ",user_count = user_count + 1 where id=" . $v['deal_id'] . " and ((buy_count + " . $v['num'] . "<= max_bought) or max_bought = 0) " . " and time_status = 1 and buy_status <> 2"; $GLOBALS['db']->query($sql); //增加商品的发货量 $rs = $GLOBALS['db']->affected_rows(); if ($rs) { $affect_list[] = $v; //记录下更新成功的团购商品,用于回滚 } else { //失败成功,即过期支付,超量支付 $stock_status = false; break; } } } $return_money = 0; //非发券非配送的即时返还 $return_score = 0; //非发券非配送的即时返还 $use_score = 0; //积分商品所耗费的积分 if ($stock_status) { foreach ($goods_list as $k => $v) { $deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . intval($v['deal_id'])); //统计商户销售额 $supplier_log = "ID:" . $deal_info['id'] . " " . $deal_info['sub_name'] . " 订单:" . $order_info['order_sn']; modify_supplier_account($v['balance_total_price'] + $v['add_balance_price_total'], $deal_info['supplier_id'], 0, $supplier_log); if ($deal_info['is_coupon'] == 0 && $deal_info['is_delivery'] == 0) { //更新订单中相关产品的消费状态 $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set consume_count = consume_count + 1 where order_id = " . $order_info['id'] . " and deal_id = " . $deal_info['id']); update_order_cache($order_info['id']); distribute_order($order_info['id']); modify_supplier_account($v['balance_total_price'] + $v['add_balance_price_total'], $deal_info['supplier_id'], 2, $supplier_log); //等结算金额增加 } else { modify_supplier_account($v['balance_total_price'] + $v['add_balance_price_total'], $deal_info['supplier_id'], 1, $supplier_log); //冻结资金 } //不发货不发券的实时返还 if ($deal_info['is_coupon'] == 0 && $deal_info['is_delivery'] == 0 && $v['buy_type'] == 0) { $return_money += $v['return_total_money']; $return_score += $v['return_total_score']; } if ($v['buy_type'] == 1) { $use_score += $v['return_total_score']; } $balance_price += $v['balance_total_price']; $add_balance_price += $v['add_balance_price_total']; //发券 if ($deal_info['is_coupon'] == 1) { if ($deal_info['deal_type'] == 1) { $deal_order_item_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_order_item where order_id = " . $order_info['id'] . " and deal_id = " . $v['deal_id']); foreach ($deal_order_item_list as $item) { // for($i=0;$i<$item['number'];$i++) //按单 // { //需要发券 /** * 1. 先从已有团购券中发送 * 2. 无有未发送的券,自动发送 * 3. 发送状态的is_valid 都是 0, 该状态的激活在syn_deal_status中处理 */ /*修正后台手动建团购劵,购买的时候按单发送团购劵,数量不一致*/ $sql = "update " . DB_PREFIX . "deal_coupon set user_id=" . $order_info['user_id'] . ",order_id = " . $order_info['id'] . ",order_deal_id = " . $item['id'] . ",expire_refund = " . $deal_info['expire_refund'] . ",any_refund = " . $deal_info['any_refund'] . ",coupon_price = " . $item['total_price'] . ",coupon_score = " . $item['return_total_score'] . ",coupon_money = " . $item['return_total_money'] . ",add_balance_price = " . $item['add_balance_price'] . ",deal_type = " . $deal_info['deal_type'] . ",balance_price = " . $item['balance_total_price'] . " where deal_id = " . $v['deal_id'] . " and user_id = 0 " . " and is_delete = 0 order by id ASC limit 1"; $GLOBALS['db']->query($sql); $exist_coupon = $GLOBALS['db']->affected_rows(); if (!$exist_coupon) { //未发送成功,即无可发放的预设团购券 add_coupon($v['deal_id'], $order_info['user_id'], 0, '', '', 0, 0, $item['id'], $order_info['id']); } // } } } else { $deal_order_item_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_order_item where order_id = " . $order_info['id'] . " and deal_id = " . $v['deal_id']); foreach ($deal_order_item_list as $item) { for ($i = 0; $i < $item['number']; $i++) { //需要发券 /** * 1. 先从已有团购券中发送 * 2. 无有未发送的券,自动发送 * 3. 发送状态的is_valid 都是 0, 该状态的激活在syn_deal_status中处理 */ $sql = "update " . DB_PREFIX . "deal_coupon set user_id=" . $order_info['user_id'] . ",order_id = " . $order_info['id'] . ",order_deal_id = " . $item['id'] . ",expire_refund = " . $deal_info['expire_refund'] . ",any_refund = " . $deal_info['any_refund'] . ",coupon_price = " . $item['unit_price'] . ",coupon_score = " . $item['return_score'] . ",coupon_money = " . $item['return_money'] . ",add_balance_price = " . $item['add_balance_price'] . ",deal_type = " . $deal_info['deal_type'] . ",balance_price = " . $item['balance_unit_price'] . " where deal_id = " . $v['deal_id'] . " and user_id = 0 " . " and is_delete = 0 limit 1"; $GLOBALS['db']->query($sql); $exist_coupon = $GLOBALS['db']->affected_rows(); if (!$exist_coupon) { //未发送成功,即无可发放的预设团购券 add_coupon($v['deal_id'], $order_info['user_id'], 0, '', '', 0, 0, $item['id'], $order_info['id']); } } } } } //发券结束 } //开始处理返还的积分或现金,此处返还不用发货不用配送不用发券的产品返还 require_once APP_ROOT_PATH . "system/model/user.php"; if ($return_money != 0) { $msg = sprintf($GLOBALS['lang']['ORDER_RETURN_MONEY'], $order_info['order_sn']); modify_account(array('money' => $return_money, 'score' => 0), $order_info['user_id'], $msg); } if ($return_score != 0) { $msg = sprintf($GLOBALS['lang']['ORDER_RETURN_SCORE'], $order_info['order_sn']); modify_account(array('money' => 0, 'score' => $return_score), $order_info['user_id'], $msg); send_score_sms($order_info['id']); send_score_mail($order_info['id']); } if ($use_score != 0) { $user_score = $GLOBALS['db']->getOne("select score from " . DB_PREFIX . "user where id = " . $order_info['user_id']); if ($user_score + $use_score < 0) { //积分不足,不能支付 $msg = $order_info['order_sn'] . "订单支付失败,积分不足"; $refund_money = $order_info['pay_amount']; if ($order_info['account_money'] > $refund_money) { $account_money_now = $order_info['account_money'] - $refund_money; } else { $account_money_now = 0; } $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set account_money = " . $account_money_now . " where id = " . $order_info['id']); if ($order_info['ecv_money'] > $refund_money) { $ecv_money_now = $order_info['ecv_money'] - $refund_money; } else { $ecv_money_now = 0; } $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set ecv_money = " . $ecv_money_now . " where id = " . $order_info['id']); if ($refund_money > 0) { modify_account(array('money' => $refund_money, 'score' => 0), $order_info['user_id'], $msg); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_money = refund_money + " . $refund_money . ",refund_amount = refund_amount + " . $refund_money . ",after_sale = 1,refund_status = 2 where id = " . $order_info['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set refund_status = 2 where order_id = " . $order_info['id']); order_log($order_info['order_sn'] . "积分不足," . format_price($refund_money) . "已退到会员余额", $order_info['id']); modify_statements("-" . $refund_money, 1, $order_info['order_sn'] . "积分不足,退款"); modify_statements($refund_money, 2, $order_info['order_sn'] . "积分不足,退款"); } else { order_log($order_info['order_sn'] . "积分不足", $order_info['id']); } require_once APP_ROOT_PATH . "system/model/deal_order.php"; update_order_cache($order_info['id']); over_order($order_info['id']); } else { modify_account(array('score' => $use_score), $order_info['user_id'], "积分商品兑换"); send_score_sms($order_info['id']); send_score_mail($order_info['id']); order_log($order_info['order_sn'] . "积分订单支付成功", $order_info['id']); send_msg($order_info['user_id'], "订单" . $order_info['order_sn'] . "兑换成功", "orderitem", $order_goods_list[0]['id']); if ($order_info['total_price'] > 0) { modify_statements($order_info['total_price'], 8, $order_info['order_sn'] . "订单成功付款"); } //增加营业额 } } else { //开始处理返利,只创建返利, 发放将与msg_list的自动运行一起执行 // $user_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id = ".$order_info['user_id']); // //开始查询所购买的列表中支不支持促销 // $is_referrals = 1; //默认为返利 // foreach($goods_list as $k=>$v) // { // $is_referrals = $GLOBALS['db']->getOne("select is_referral from ".DB_PREFIX."deal where id = ".$v['deal_id']); // if($is_referrals == 0) // { // break; // } // } // if($user_info['referral_count']<app_conf("REFERRAL_LIMIT")&&$is_referrals == 1) // { // //开始返利给推荐人 // $parent_info = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."user where id = ".$user_info['pid']); // if($parent_info) // { // if((app_conf("REFERRAL_IP_LIMIT")==1&&$parent_info['login_ip']!=CLIENT_IP)||app_conf("REFERRAL_IP_LIMIT")==0) //IP限制 // { // if(app_conf("INVITE_REFERRALS_TYPE")==0) //现金返利 // { // $referral_data['user_id'] = $parent_info['id']; //初返利的会员ID // $referral_data['rel_user_id'] = $user_info['id']; //被推荐且发生购买的会员ID // $referral_data['create_time'] = NOW_TIME; // $referral_data['money'] = app_conf("INVITE_REFERRALS"); // $referral_data['order_id'] = $order_info['id']; // $GLOBALS['db']->autoExecute(DB_PREFIX."referrals",$referral_data); //插入 // } // else // { // $referral_data['user_id'] = $parent_info['id']; //初返利的会员ID // $referral_data['rel_user_id'] = $user_info['id']; //被推荐且发生购买的会员ID // $referral_data['create_time'] = NOW_TIME; // $referral_data['score'] = app_conf("INVITE_REFERRALS"); // $referral_data['order_id'] = $order_info['id']; // $GLOBALS['db']->autoExecute(DB_PREFIX."referrals",$referral_data); //插入 // } // $GLOBALS['db']->query("update ".DB_PREFIX."user set referral_count = referral_count + 1 where id = ".$user_info['id']); // } // } // } //超出充值 if ($order_info['pay_amount'] > $order_info['total_price']) { require_once APP_ROOT_PATH . "system/model/user.php"; if ($order_info['total_price'] < 0) { $msg = sprintf($GLOBALS['lang']['MONEYORDER_INCHARGE'], $order_info['order_sn']); } else { $msg = sprintf($GLOBALS['lang']['OUTOFMONEY_INCHARGE'], $order_info['order_sn']); } $refund_money = $order_info['pay_amount'] - $order_info['total_price']; if ($order_info['account_money'] > $refund_money) { $account_money_now = $order_info['account_money'] - $refund_money; } else { $account_money_now = 0; } $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set account_money = " . $account_money_now . " where id = " . $order_info['id']); if ($order_info['ecv_money'] > $refund_money) { $ecv_money_now = $order_info['ecv_money'] - $refund_money; } else { $ecv_money_now = 0; } $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set ecv_money = " . $ecv_money_now . " where id = " . $order_info['id']); modify_account(array('money' => $refund_money, 'score' => 0), $order_info['user_id'], $msg); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set refund_money = refund_money + " . $refund_money . ",refund_amount = refund_amount + " . $refund_money . " where id = " . $order_info['id']); order_log($order_info['order_sn'] . "订单超额支付," . format_price($refund_money) . "已退到会员余额", $order_info['id']); modify_statements("-" . $refund_money, 1, $order_info['order_sn'] . "订单超额"); modify_statements($refund_money, 2, $order_info['order_sn'] . "订单超额"); } modify_statements($order_info['total_price'], 8, $order_info['order_sn'] . "订单成功付款"); //增加营业额 $balance_total = $GLOBALS['db']->getOne("select sum(balance_total_price)+sum(add_balance_price_total) from " . DB_PREFIX . "deal_order_item where order_id = " . $order_info['id']); modify_statements($balance_total, 9, $order_info['order_sn'] . "订单成功付款"); //增加营业额中的成本 //生成抽奖 $lottery_list = $GLOBALS['db']->getAll("select d.id as did,doi.number from " . DB_PREFIX . "deal_order_item as doi left join " . DB_PREFIX . "deal_order as do on doi.order_id = do.id left join " . DB_PREFIX . "deal as d on doi.deal_id = d.id where d.is_lottery = 1 and do.id = " . $order_info['id']); $lottery_user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($order_info['user_id'])); //如为首次抽奖,先为推荐人生成抽奖号 $lottery_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "lottery where user_id = " . intval($order_info['user_id'])); if ($lottery_count == 0 && $lottery_user['pid'] != 0) { $lottery_puser = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($lottery_user['pid'])); foreach ($lottery_list as $lottery) { $k = 0; do { if ($k > 10) { break; } $buy_count = $GLOBALS['db']->getOne("select buy_count from " . DB_PREFIX . "deal where id = " . $lottery['did']); $max_sn = $buy_count - $lottery['number'] + intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "lottery where deal_id = " . intval($lottery['did']) . " and buyer_id <> 0 ")); //$max_sn = intval($GLOBALS['db']->getOne("select lottery_sn from ".DB_PREFIX."lottery where deal_id = '".$lottery['did']."' order by lottery_sn desc limit 1")); $sn = $max_sn + 1; $sn = str_pad($sn, "6", "0", STR_PAD_LEFT); $sql = "insert into " . DB_PREFIX . "lottery (`lottery_sn`,`deal_id`,`user_id`,`mobile`,`create_time`,`buyer_id`) select '" . $sn . "','" . $lottery['did'] . "'," . $lottery_puser['id'] . ",'" . $lottery_puser['lottery_mobile'] . "'," . NOW_TIME . "," . $order_info['user_id'] . " from dual where not exists( select * from " . DB_PREFIX . "lottery where deal_id = " . $lottery['did'] . " and lottery_sn = '" . $sn . "')"; $GLOBALS['db']->query($sql); send_lottery_sms(intval($GLOBALS['db']->insert_id())); $k++; } while (intval($GLOBALS['db']->insert_id()) == 0); } } foreach ($lottery_list as $lottery) { for ($i = 0; $i < $lottery['number']; $i++) { $k = 0; do { if ($k > 10) { break; } $buy_count = $GLOBALS['db']->getOne("select buy_count from " . DB_PREFIX . "deal where id = " . $lottery['did']); $max_sn = $buy_count - $lottery['number'] + intval($GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "lottery where deal_id = " . intval($lottery['did']) . " and buyer_id <> 0 ")); //$max_sn = intval($GLOBALS['db']->getOne("select lottery_sn from ".DB_PREFIX."lottery where deal_id = '".$lottery['did']."' order by lottery_sn desc limit 1")); $sn = $max_sn + $i + 1; $sn = str_pad($sn, "6", "0", STR_PAD_LEFT); $sql = "insert into " . DB_PREFIX . "lottery (`lottery_sn`,`deal_id`,`user_id`,`mobile`,`create_time`,`buyer_id`) select '" . $sn . "','" . $lottery['did'] . "'," . $order_info['user_id'] . ",'" . $lottery_user['mobile'] . "'," . NOW_TIME . ",0 from dual where not exists( select * from " . DB_PREFIX . "lottery where deal_id = " . $lottery['did'] . " and lottery_sn = '" . $sn . "')"; $GLOBALS['db']->query($sql); send_lottery_sms(intval($GLOBALS['db']->insert_id())); $k++; } while (intval($GLOBALS['db']->insert_id()) == 0); } } send_msg($order_info['user_id'], "订单" . $order_info['order_sn'] . "付款成功", "orderitem", $order_goods_list[0]['id']); } } else { //开始模拟事务回滚 foreach ($affect_attr_list as $k => $v) { $sql = "update " . DB_PREFIX . "attr_stock set buy_count = buy_count - " . $v['number'] . " where deal_id = " . $v['deal_id'] . " and locate(attr_str,'" . $v['attr_str'] . "') > 0 "; $GLOBALS['db']->query($sql); //回滚已发的货量 } foreach ($affect_list as $k => $v) { $sql = "update " . DB_PREFIX . "deal set buy_count = buy_count - " . $v['num'] . ",user_count = user_count - 1 where id=" . $v['deal_id']; $GLOBALS['db']->query($sql); //回滚已发的货量 } $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set refund_status = 2 where order_id = " . $order_info['id']); //超出充值 require_once APP_ROOT_PATH . "system/model/user.php"; $msg = sprintf($GLOBALS['lang']['OUTOFSTOCK_INCHARGE'], $order_info['order_sn']); modify_account(array('money' => $order_info['total_price'], 'score' => 0), $order_info['user_id'], $msg); order_log($order_info['order_sn'] . "订单库存不足," . format_price($order_info['total_price']) . "已退到会员余额", $order_info['id']); modify_statements("-" . $order_info['total_price'], 1, $order_info['order_sn'] . "订单库存不足"); modify_statements($order_info['total_price'], 2, $order_info['order_sn'] . "订单库存不足"); //将订单的extra_status 状态更新为2,并自动退款 $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set extra_status = 2, after_sale = 1, refund_money = pay_amount where id = " . intval($order_info['id'])); update_order_cache($order_info['id']); //记录退款的订单日志 $log['log_info'] = $msg; $log['log_time'] = NOW_TIME; $log['order_id'] = intval($order_info['id']); $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order_log", $log); } //同步所有未过期的团购状态 foreach ($goods_list as $item) { syn_deal_status($item['deal_id'], true); } auto_over_status($order_id); //自动结单 } else { //订单充值 // $GLOBALS['db']->query("update ".DB_PREFIX."deal_order set order_status = 1 where id = ".$order_info['id']); //充值单自动结单 require_once APP_ROOT_PATH . "system/model/user.php"; $msg = sprintf($GLOBALS['lang']['USER_INCHARGE_DONE'], $order_info['order_sn']); modify_account(array('money' => $order_info['total_price'] - $order_info['payment_fee'], 'score' => 0), $order_info['user_id'], $msg); modify_statements("-" . $order_info['total_price'], 1, $order_info['order_sn'] . "会员充值"); modify_statements($order_info['total_price'], 2, $order_info['order_sn'] . "会员充值,含手续费"); send_msg($order_info['user_id'], "成功充值" . format_price($order_info['total_price'] - $order_info['payment_fee']), "notify", $order_id); auto_over_status($order_id); //自动结单 } }
public function queryCheckCode1() { //dump($_POST); if ($_SESSION['type'] == 1) { $Form = M('investor_personal'); $data['user_id'] = session('id'); $data['mobile'] = encode(I('post.mobile')); $exist = $Form->where('mobile="%s" and user_id = "%s"', $data['mobile'], $data['user_id'])->select(); if ($exist) { $result = send_msg(I('post.mobile')); echo $result; } } else { if ($_SESSION['type'] == 2) { $Form = M('entrepreneur_personal'); $data['user_id'] = session('id'); $data['phone'] = encode(I('post.mobile')); $exist = $Form->where('phone="%s" and user_id = "%s"', $data['phone'], $data['user_id'])->select(); if ($exist) { $result = send_msg(I('post.mobile')); echo $result; } } else { echo 401; } } }
$pass1 = generate_key(); $pass = hash_pass($pass1); $new_user_name = filter($_POST['new_user_name']); $new_user_email = filter($_POST['new_user_email']); $today = date('Y-m-d'); $check = mysql_query("SELECT user_name, usr_email FROM " . USERS . " WHERE user_name = '{$new_user_name}' OR usr_email = AES_ENCRYPT('{$new_user_email}', '{$salt}')") or die(mysql_error()); if (mysql_num_rows($check) > 0) { $err[] = "A user with the username or email address already exists"; } if (!check_email($new_user_email)) { $err[] = "You must enter a valid email"; } if (empty($err)) { $add_user = mysql_query("INSERT INTO " . USERS . " (`user_name`, `usr_email`, `user_level`, `usr_pwd`, `date`, `approved`) VALUES ('{$new_user_name}', AES_ENCRYPT('{$new_user_email}', '{$salt}'), 1, '{$pass}', '{$today}', 1)") or die(mysql_error()); $message = "Hello,\n\t\tYou have been registered as a user with SOMEWEBSITE by an administrator.\n\t\tYou may login to your account by going to:\n\n\t\t" . SITE_BASE . "/login.php\n\n\t\tAnd logging in with the following information:\n\t\tUsername: "******"\n\t\tPassword: "******"\n\n\t\tThank you,\n\t\tAdmin"; send_msg($new_user_email, "User Registration", $message); $msg[] = "Successfully added " . $new_user_name . " and an email has been sent to the user."; } } ?> <script> </script> </head> <body> <div id="container"> <?php include '../includes/constant/nav.inc.php'; ?> <h1>Hey <?php
} else { $plugin_name = $id; } ?> <div id='loading'> <div><img src='../pixmaps/loading3.gif' alt='<?php echo _("Loading"); ?> '/><span><?php echo $action . _(" {$plugin_name}, please wait a few seconds"); ?> ...</span></div> </div> <?php send_msg($cmd, $ip_get, $id); ?> <script type="text/javascript"> GB_hide(); </script> <?php } // Sensors perm check if (!Session::menu_perms('configuration-menu', 'PolicySensors')) { echo ossim_error(_("You need permissions of section '") . "<b>" . _("Configuration -> AlienVault Components -> Sensors") . "</b>" . _("' to see this page. Contact with the administrator."), AV_NOTICE); exit; } ?> <div id='loading'> <div>
public function do_delivery() { $s_account_info = $GLOBALS['account_info']; $supplier_id = intval($s_account_info['supplier_id']); require_once APP_ROOT_PATH . "system/model/deal_order.php"; $order_item_table_name = get_supplier_order_item_table_name($supplier_id); $order_table_name = get_supplier_order_table_name($supplier_id); $id = intval($_REQUEST['id']); //发货商品的ID $delivery_sn = strim($_REQUEST['delivery_sn']); $memo = strim($_REQUEST['memo']); $express_id = intval($_REQUEST['express_id']); $location_id = intval($_REQUEST['location_id']); $order_id = $GLOBALS['db']->getOne("select order_id from " . $order_item_table_name . " where id = " . $id); $order_info = $GLOBALS['db']->getRow("select * from " . $order_table_name . " where id = '" . $order_id . "'"); if (empty($delivery_sn)) { $data['status'] = 0; $data['info'] = "请输入快递单号"; ajax_return($data); } $item = $GLOBALS['db']->getRow("select doi.* from " . $order_item_table_name . " as doi left join " . DB_PREFIX . "deal_location_link as l on doi.deal_id = l.deal_id where doi.id = " . $id . " and l.location_id in (" . implode(",", $s_account_info['location_ids']) . ")"); if ($item) { $rs = make_delivery_notice($order_id, $id, $delivery_sn, $memo, $express_id, $location_id); if ($rs) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set delivery_status = 1 where id = " . $id); } send_delivery_mail($delivery_sn, $item['name'], $order_id); send_delivery_sms($delivery_sn, $item['name'], $order_id); //开始同步订单的发货状态 $order_deal_items = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_order_item where order_id = " . $order_id); foreach ($order_deal_items as $k => $v) { if ($v['delivery_status'] == 5) { unset($order_deal_items[$k]); } } $delivery_deal_items = $order_deal_items; foreach ($delivery_deal_items as $k => $v) { if ($v['delivery_status'] == 0) { unset($delivery_deal_items[$k]); } } if (count($delivery_deal_items) == 0 && count($order_deal_items) != 0) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set delivery_status = 0,update_time = '" . NOW_TIME . "' where id = " . $order_id); //未发货 } elseif (count($delivery_deal_items) > 0 && count($order_deal_items) != 0 && count($delivery_deal_items) < count($order_deal_items)) { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set delivery_status = 1,update_time = '" . NOW_TIME . "' where id = " . $order_id); //部分发 } else { $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order set delivery_status = 2,update_time = '" . NOW_TIME . "' where id = " . $order_id); //全部发 } order_log($item['name'] . "发货了,发货单号:" . $delivery_sn, $order_id); update_order_cache($order_id); distribute_order($order_id); send_msg($order_info['user_id'], $item['name'] . "发货了,发货单号:" . $delivery_sn, "orderitem", $item['id']); $data['status'] = 1; $data['info'] = "发货成功"; ajax_return($data); } else { $data['status'] = 0; $data['info'] = "非法的数据"; ajax_return($data); } }