/** * 发送模板短信 * sendTemplateSMS("手机号码","内容数据","模板Id"); * @param to 手机号码集合,用英文逗号分开 * @param datas 内容数据 格式为数组 例如:array('Marry','Alon'),如不需替换请填 null * @param $tempId 模板Id */ function sendTemplateSMS($to, $datas, $tempId) { // 发送模板短信 //echo "Sending TemplateSMS to $to <br/>"; $result = $this->rest->sendTemplateSMS($to, $datas, $tempId); Common_Log::debug(json_encode($result)); Common_Log::debug(json_encode($to)); Common_Log::debug(json_encode($datas)); Common_Log::debug(json_encode($tempId)); if ($result == NULL) { $info['state'] = ''; $info['msg'] = "发送失败"; return $info; } if ($result->statusCode != 0) { // echo "error code :" . $result->statusCode . "<br>"; // echo "error msg :" . $result->statusMsg . "<br>"; //TODO 添加错误处理逻辑 $info['state'] = $result->statusCode; $info['msg'] = $result->statusMsg; return $info; } else { //TODO 添加成功处理逻辑 // echo "Sendind TemplateSMS success!<br/>"; // 获取返回信息 $smsmessage = $result->TemplateSMS; // echo "dateCreated:".$smsmessage->dateCreated."<br/>"; // echo "smsMessageSid:".$smsmessage->smsMessageSid."<br/>"; //TODO 添加成功处理逻辑 $info['state'] = 0; $info['msg'] = $smsmessage->smsMessageSid; $info['dateCreated'] = $smsmessage->dateCreated; return $info; } }
public static function notice($fmt) { // extend notice content $ext_content = ''; foreach (self::$notice_arr as $k => $v) { if (is_numeric($k)) { $ext_content .= $v; } else { $ext_content .= " {$k}[{$v}]"; } } self::$notice_arr = array(); // add extend notice content in args $args = func_get_args(); array_shift($args); array_push($args, $ext_content); return self::write_log(self::LOG_NOTICE, "%s " . $fmt, $args); }
function displayJsonUdo($code, $data = NULL, $msg = NULL) { header('Content-Type:application/json;charset=UTF-8'); $msg = $msg ? $msg : (isset(Common_Error::$errmsg[$code]) ? Common_Error::$errmsg[$code] : ''); $return = array('code' => $code, 'msg' => $msg, 'data' => $data); Common_Log::debug(json_encode($return)); exit(json_encode($return, JSON_NUMERIC_CHECK)); }
/** * 中断控制 * @param string $msg * @access private * @return void * @update 2013/6/14 11:45:33 */ private function halt($sql = 'NO SQL') { if (self::$DEBUG) { printf("mysqli>>> mysql_errno:%s\t mysql_error:%s\t <font color='red'>SQL:%s</font>\r\n<br/>", $this->dbconn->errno, $this->dbconn->error, $sql); } Common_Log::mysql(sprintf("mysql_errno:%s\t mysql_error:%s\t SQL:%s", $this->dbconn->errno, $this->dbconn->error, $sql)); //这里写日志 }
} // change Common_Db_Base to common/db/Base $nclassname = ''; $e = explode('_', $classname); $p = array_pop($e); while ($p != '/') { $nclassname = $p . $nclassname; $p = strtolower(array_pop($e)) . '/'; } $include_path = array('./lib/'); foreach ($include_path as $path) { $filename = $path . $nclassname . '.php'; if (file_exists($filename)) { require_once $filename; break; } } } // init public static function init() { spl_autoload_register(array(__CLASS__, '_j_autoload_')); } } Lgn::init(); // init log if (defined('__MODEL_NAME__')) { $modelname = __MODEL_NAME__; Common_Log::set('normal_log', 'log/' . $modelname . '.log'); Common_Log::set('alter_log', 'log/' . $modelname . '.log'); }