Commit c5fe59a2 by biao

1

parent e5adc5f6
......@@ -39,19 +39,12 @@ define("COMPASS_MEMCACHE_HOST", "127.0.0.1");
define("COMPASS_MEMCACHE_PORT", "11211");
define("MEMCACHE_VERSION", 1);
// 短消息相关设定
define("SMS_F","1"); //默认值1
define("SMS_COMPANY_ID", "70393"); //企业帐号
define("SMS_APP_ID", "1400270299"); //用户帐号
define("SMS_APP_KEY", "3c6208374d1940652303ae08396ce5f8"); //密码
// 微信认证相关【公众号】
define("WECHAT_APP_ID","wxe16f5f4f71862e9f");
define("WECHAT_APP_SECRET","138738e444eab87a39cf2ed33886da5d");
define("WECHAT_APP_ID","wxeef50c5d0ef117d1");
define("WECHAT_APP_SECRET","e8612f5ad62b779f2e86c7ca1b3cb0cc");
define("WECHAT_AUTH_TOKEN","COMPASS");
define("WECHAT_PAY_MCHID","1371137902");
define("WECHAT_PAY_KEY","a1b2c3defghijKlmnopqrstuvwx4y5z6");
define("WECHAT_PAY_KEY","a1b1112c3defghijKlmnopqrstuvwx4y5z6");
// 固定テンプレート用ディレクトリ
......
<?
// クラス、設定読み込み
//添加或者删除用户的收藏记录
require_once ("../user_include.inc");
ErrorLogger::doOutput("Koala...ajax_operate_favorite.php....Start.", 0);
$action_type = ParamUtil::getRequestString("action_type");//delete/add
$data_type = ParamUtil::getRequestString("data_type");//word/article
$data_id = ParamUtil::getRequestNumber("data_id", 0);
ErrorLogger::doOutput("Koala...ajax_operate_favorite.php....action_type=" . $action_type, 0);
ErrorLogger::doOutput("Koala...ajax_operate_favorite.php....data_type=" . $data_type, 0);
ErrorLogger::doOutput("Koala...ajax_operate_favorite.php....data_id=" . $data_id, 0);
//参数错误
if(empty($action_type) || ($action_type!="delete" && $action_type!="add")) {
responseNG("NG_PARAM", "参数错误!");
}
if(empty($data_type) || ($data_type!="word" && $data_type!="article")) {
responseNG("NG_PARAM", "参数错误!");
}
if(empty($data_id) || $data_id==0) {
responseNG("NG_PARAM", "参数错误!");
}
//判断用户登陆状态
$ta = new TemplateAction();
if(!$ta->isLogin()) {
responseNG("NG_LOGIN", "未登录!");
}
//检查数据是否存在
if($action_type == "add" && $data_type == "word") {
$word_dat = WordDat::getById($data_id);
if(empty($word_dat)) {
responseNG("NG_PARAM", "参数错误!");
}
}
if($action_type == "add" && $data_type == "article") {
$article_dat = ArticleDat::getById($data_id);
if(empty($article_dat)) {
responseNG("NG_PARAM", "参数错误!");
}
}
$user_id = $ta->user->id;
//是否重复登陆
if($action_type == "add") {
$param = array();
$param["user_id"] = $user_id;
$param["data_type"] = $data_type;
$param["data_id"] = $data_id;
$param["delete_flg"] = false;
$tmp_favorite_count = UserFavoriteDat::getListCount($param);
if ($tmp_favorite_count > 0) {
responseNG("NG_REPEAT", "重复添加!");
}
}
//数据操作
$sql = "";
if($action_type == "add") {
$sql = "INSERT INTO user_favorite_dat(user_id, data_type, data_id) values('{$user_id}', '{$data_type}', '{$data_id}')";
}
if($action_type == "delete") {
$sql = "DELETE FROM user_favorite_dat WHERE delete_flg=false and user_id='{$user_id}' and data_type='{$data_type}' and data_id='{$data_id}'";
}
ErrorLogger::doOutput("Koala...ajax_operate_favorite.php....sql=" . $sql, 0);
$db = &KoalaDBManager::getInstance();
$db->executeQuery($sql);
responseOK("操作成功!");
function responseNG($status, $message) {
$result = array("status"=>$status, "message"=>$message);
print json_encode($result);
exit;
}
function responseOK($message) {
$result = array("status"=>"OK", "message"=>$message);
print json_encode($result);
exit;
}
?>
\ No newline at end of file
<?
// クラス、設定読み込み
require_once ("../user_include.inc");
ErrorLogger::doOutput("Koala...ajax_user_register.php....Start.", 0);
$mobile = ParamUtil::getRequestString("mobile");
$nickname = ParamUtil::getRequestString("nickname");
$verifycode = ParamUtil::getRequestString("verifycode");
//渠道编号,默认为系统自带
$channel_no = ParamUtil::getRequestString("channel_no", "1000");
ErrorLogger::doOutput("Koala...ajax_user_register.php....mobile=" . $mobile, 0);
ErrorLogger::doOutput("Koala...ajax_user_register.php....nickname=" . $nickname, 0);
ErrorLogger::doOutput("Koala...ajax_user_register.php....verifycode=" . $verifycode, 0);
ErrorLogger::doOutput("Koala...ajax_user_register.php....channel_no=" . $channel_no, 0);
//获取不到手机号码
if(empty($mobile)) {
responseNG("请输入手机号码!");
}
//获取不到用用户名称
if(empty($nickname)) {
responseNG("请输入您的姓名!");
}
//获取不到验证码
if(empty($verifycode)) {
responseNG("请输入手机验证码!");
}
//检测验证码
$param = array();
$param["delete_flg"] = false;
$param["phone"] = $mobile;
$param["code"] = $verifycode;
$param["is_used"] = false;
$param["ok_flg"] = true;
$sms_verfication_dat_list = SmsVerficationDat::getList($param, "id", "desc", 0, 1);
if (count($sms_verfication_dat_list) < 1) {
responseNG("短信码验证失败,可尝试重发验证码。");
} else {
$sms_verfication_dat = $sms_verfication_dat_list[0];
$sms_verfication_dat->is_used = true;
$sms_verfication_dat->save();
}
//检测用户是否已经注册
$param = array();
$param["delete_flg"] = false;
$param["mobile"] = $mobile;
$user_list = UserMst::getList($param);
//存在的情况下,注册一条数据
if(!empty($user_list)) {
responseNG("您已经注册过,请关注【考拉学日语】公众号领取福利!");
}
//不存在的情况下,注册一条数据
$user_mst = new UserMst();
$user_mst->nickname = $nickname;
$user_mst->mobile = $mobile;
$user_mst->channel_no = $channel_no;
$user_mst->status = '1';
$user_mst->save();
//设定到session中保持
$_SESSION['_user_'] = $user_mst;
ErrorLogger::doOutput("Koala...ajax_user_register.php....End.", 0);
responseOK("注册成功!");
function responseNG($message) {
$result = array("status"=>"NG", "message"=>$message);
header("Access-Control-Allow-Origin: *");
print json_encode($result);
exit;
}
function responseOK($message) {
$result = array("status"=>"OK", "message"=>$message);
header("Access-Control-Allow-Origin: *");
print json_encode($result);
exit;
}
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment