function die_err_code_ret($data, $line = "", $desp = "") { $err_code = $data['status']; if (!isset($err_code)) { $err_code = 0; } global $log; if ($log) { $log->tag_line($line); if ($desp == "") { $log->log(iLOG_ERROR, "---------> <" . $log->iTag_file . ":" . $line . "> " . $log->iLog_user . " " . $log->iLog_key . " error:" . $err_code . " info:" . err_info($err_code)); } else { $log->log(iLOG_ERROR, "---------> <" . $log->iTag_file . ":" . $line . "> " . $log->iLog_user . " " . $log->iLog_key . " error:" . $err_code . " info:" . err_info($err_code) . " desp:" . $desp); } $log->stop(); } $data['desc'] = err_info($err_code); die(json_encode($data)); }
function sendemail($body_arr) { extract($body_arr); $mail = new PHPMailer(); //实例化 $mail->IsSMTP(); // 启用SMTP $mail->Host = _MAILHOST_; //'smtp.exmail.qq.com';//hisun.hisunsray.com 'smtp.126.com';// //SMTP服务器 $mail->Port = 25; //465; //邮件发送端口 $mail->SMTPAuth = true; //启用SMTP认证 $mail->CharSet = "UTF-8"; //字符集 $mail->Encoding = "base64"; //编码方式 $mail->Username = _MAILUSERNAME_; //'*****@*****.**';//lixd@hisunsray.com// 你的邮箱 $mail->Password = _MAILPASSWORD_; //'3Brush21';//'1234567890';你的密码 $mail->Subject = $subject; //邮件标题 $mail->From = _MAILUSERNAME_; //'*****@*****.**';//lixd@hisunsray.com; //发件人地址(也就是你的邮箱) $mail->FromName = $fromname; //'三把刷子';//constant("sendmailname"); //发件人姓名 $address = $to; //"*****@*****.**";//收件人email $mail->AddAddress($address, "亲"); //添加收件人(地址,昵称) /* test--- $arr_attachment_path = array(0=>'D:/phpStudy/WWW/agent/Application/Home/Common/mail/a.jpg', 1=>'D:/phpStudy/WWW/agent/Application/Home/Common/mail/b.jpg'); */ if ($attach) { foreach ($attach as $attachment_path) { if ($attachment_path != '') { $mail->AddAttachment($attachment_path); // 添加附件,并指定名称 } } } $mail->IsHTML(true); //支持html格式内容 /* test--- $arr_img_path = array(0=>'D:/phpStudy/WWW/agent/Application/Home/Common/mail/a.jpg', 1=>'D:/phpStudy/WWW/agent/Application/Home/Common/mail/b.jpg'); */ if ($img) { $i = 0; foreach ($img as $img_path) { if ($img_path != '') { $img_id = 'img_' . $i++; $mail->AddEmbeddedImage($img_path, $img_id); $body .= '</br> <img alt="eee" src="cid:' . $img_id . '"/>'; } } } $mail->Body = $body; //发送邮件 $ret = $mail->Send(); if (!$ret) { $resp = array('status' => 1006, "desc" => err_info(1006)); } else { $resp = array('status' => 0, "desc" => err_info(0)); } return $resp; }
function clt_json_encode($record, $result) { $resp_arr = array('status' => $result["@vo_result"], 'desc' => err_info($result["@vo_result"]), 'out_data' => str2array($result["@vo_data"], ',', '='), 'data' => $record); return $resp_arr; }
function base_fun($body_arr) { global $_INTERFACE; //声明配置文件 global $_NOCHECKLOGIN; $inter_num = arr_key_value("inter_num", $body_arr); //获取接口号 $resp_arr = array(); if (!arr_key_value_login($inter_num, $_NOCHECKLOGIN)) { //检测登录状态 $body_arr['userid'] = getSessonUserData('userid'); if (!$body_arr['userid']) { //方便测试,这里先注释 $resp_arr['status'] = 1035; $resp_arr['desc'] = err_info($resp_arr['status']); return $resp_arr; } } switch ($inter_num) { case "0001": //web //web case "0046": //app require_once dirname(__FILE__) . "/pay/index.php"; $resp_arr = generate_order($body_arr); break; case "0005": #绑定提交 require_once dirname(__FILE__) . "/bind/code/bind.php"; $resp_arr = bind_general($body_arr); break; case "0006": #绑定校验 require_once dirname(__FILE__) . "/bind/code/bind.php"; $resp_arr = bind_check($body_arr); break; case "0007": #密码找回提交 require_once dirname(__FILE__) . "/getpwd/code/getpwd.php"; $resp_arr = get_pwd_general($body_arr); break; case "0008": #密码找回校验 require_once dirname(__FILE__) . "/getpwd/code/getpwd.php"; $resp_arr = get_pwd_check($body_arr); break; case "0027": #发送验证码 require_once dirname(__FILE__) . "/sms/code/sendsms.php"; $resp_arr = sms_general($body_arr); break; case "0028": //图片验证码校验 require_once dirname(__FILE__) . "/verifycode/verifyCode.php"; $resp_arr = verify_code($body_arr); break; case "0029": //发送邮件 require_once dirname(__FILE__) . "/mail/sendmail.php"; $resp_arr = sendemail($body_arr); break; case "0030": // 文件上传 require_once dirname(__FILE__) . "/fileupload/code/fileuploadservice.php"; $resp_arr = serviceHandle($body_arr); // 该方法需要根据业务需求进行修改 break; case "0032": //html2pdf require_once dirname(__FILE__) . "/html2pdf/html2pdf.class.php"; $html2pdf = new html2pdf(); $dest = dirname(dirname(__FILE__)) . $body_arr['dest']; $d_filename = $body_arr['d_filename']; $sourcehtmlfile = $body_arr['sourcehtmlfile']; $resp_arr = $html2pdf->createpdf($dest, $d_filename, $sourcehtmlfile); // break; case "0036": // 获取服务器时间 require_once dirname(__FILE__) . "/systime/getsystime.php"; $resp_arr = getsystime(); // 该方法需要根据业务需求进行修改 break; case "0037": //发送注册激活邮件activeuser require_once dirname(__FILE__) . "/activeuser/code/activeuser.php"; $resp_arr = activeuser_general($body_arr); break; case "0038": //验证 注册激活邮件activeuser require_once dirname(__FILE__) . "/activeuser/code/activeuser.php"; $resp_arr = activeuser_check($body_arr); break; case "0039": //登出 require_once dirname(__FILE__) . "/libcode/session.php"; $resp_arr = clearsessionjump($body_arr); break; case "0040": //生成图片,保存在服务器 require_once dirname(__FILE__) . "/createpic/createpic.php"; $resp_arr = createpicserver($body_arr); break; case "0043": //跳转到支付渠道,网页版支付 require_once dirname(__FILE__) . "/pay/index.php"; $resp_arr = jump_paychannel($body_arr); break; case "0044": //返回支付信息,移动端app支付 require_once dirname(__FILE__) . "/pay/index.php"; $resp_arr = echo_paychannel($body_arr); break; case "0045": //查询订单,移动端app require_once dirname(__FILE__) . "/pay/index.php"; $resp_arr = queryorderstatus($body_arr); break; case "0050": //购物车模块 require_once dirname(__FILE__) . "/shopping/index.php"; $resp_arr = dealCartFlow($body_arr); break; case "0051": //会员、积分模块 break; default: $procedure = arr_key_value($inter_num, $_INTERFACE); //根据接口号获取存储名 //执行存储过程 $resp_arr = exec_procedure($body_arr, $procedure); break; } if ($inter_num == "0026" && $resp_arr['status'] == 0) { //登录成功,记录userid到session中 $ret = setSessonUserData('userid', $resp_arr['out_data']['userid']); if ($body_arr['rememberpwd']) { //记住密码 rememberpwd($body_arr['account'], $body_arr['passwd'], $body_arr['second']); } } return $resp_arr; }