#define WRENCHBOARD_PROMOADMIN_LOGIN 220010
This commit is contained in:
@@ -461,6 +461,8 @@ enum { PARTNER_STRIPE };
|
||||
#define WRENCHBOARD_MARKET_PLAN01_START 220001
|
||||
#define WRENCHBOARD_MARKET_PLAN01_NEXT1 220003
|
||||
|
||||
#define WRENCHBOARD_PROMOADMIN_LOGIN 220010
|
||||
|
||||
#define WRENCHBOARD_MARKET_END 229999
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,10 @@ long market_calls(CVars in, CVars &out) {
|
||||
case WRENCHBOARD_MARKET_PLAN01_NEXT1:
|
||||
return WrenchPromoLoad(in, out);
|
||||
break;
|
||||
|
||||
case WRENCHBOARD_PROMOADMIN_LOGIN:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
} catch (bad_parameter) {
|
||||
|
||||
@@ -480,5 +480,8 @@ define('DISAPROVE_BALANCE', 3);
|
||||
const WRENCHBOARD_MARKET_START = 220000;
|
||||
const WRENCHBOARD_MARKET_PLAN01_START = 220001;
|
||||
const WRENCHBOARD_MARKET_PLAN01_NEXT1 = 220003;
|
||||
|
||||
const WRENCHBOARD_PROMOADMIN_LOGIN = 220010;
|
||||
|
||||
const WRENCHBOARD_MARKET_END = 229999;
|
||||
|
||||
|
||||
@@ -98,7 +98,47 @@ class Promo extends BaseController
|
||||
}
|
||||
|
||||
public function promoAuth(){
|
||||
log_message('critical', "***** ***** promoAuth::userLogin ****" );
|
||||
// $in = $this->request->getPostGet();
|
||||
$raw_json = file_get_contents('php://input');
|
||||
$in = json_decode($raw_json, true);
|
||||
|
||||
$in["action"] = WRENCHBOARD_PROMOADMIN_LOGIN;
|
||||
if (!isset($in["login_mode"])){
|
||||
$in["login_mode"] = MOBILE_LOGIN;
|
||||
}
|
||||
|
||||
|
||||
// make safe for redis
|
||||
$outF["username"] = str_replace("@", "_", $in["username"]);
|
||||
$outF["username"] = str_replace(".", "_", $outF["username"]);
|
||||
$outF["original_username"] = $in["username"];
|
||||
$outF["loc"] = $in["loc"];
|
||||
$fail_endpoint = "PROMO-LOGIN_FAILED-".$outF["username"]."-";
|
||||
//===================REDIS DATA IN CASE OF FAIL
|
||||
$out_redis = $this->getCache($fail_endpoint); // try find in cache
|
||||
if (isset($out_redis["fail_count"]) && $out_redis["fail_count"] > 2){
|
||||
// we need stop here
|
||||
log_message('critical', "Danger ***** ***** promoAuth::userLogin FAIL = ".$out_redis["fail_count"] );
|
||||
}else{
|
||||
$outF["fail_count"] = isset( $out_redis["fail_count"] ) ? $out_redis["fail_count"]+1:1;
|
||||
}
|
||||
$out=[];
|
||||
|
||||
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
|
||||
$out['internal_return'] = $ret;
|
||||
log_message('critical', "***** ***** promoAuth::userLogin Ret = ".$ret );
|
||||
if ( $out['internal_return'] == 100 ){
|
||||
$endpoint = "PROMO-USER_SESSION-". str_pad($out["member_id"], 12, "0", STR_PAD_LEFT) ."-";
|
||||
log_message('critical', "***** ***** promoAuth::promoAuth USER_SESSION = ".$endpoint );
|
||||
$this->saveCache($endpoint,$out,15000);
|
||||
}else
|
||||
{
|
||||
log_message('critical', "***** ***** WrenchAuth::userLogin USER_SESSION = ".$fail_endpoint );
|
||||
$this->saveCache($fail_endpoint,$outF,15000);
|
||||
}
|
||||
|
||||
return $this->respond( $this->summaryReturnData($in,$out), 200);
|
||||
}
|
||||
public function promoList(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user