Created
March 4, 2019 10:28
-
-
Save nutch31/3f91a53ffe0f2b9b40824fba2779b76c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get All Lead Forms | |
* | |
* @param request analyticCampaignId | |
* @param optional page, limit | |
*/ | |
public function Response_getCampaignWidget($input) | |
{ | |
$response = array(); | |
$request->didPhone[] = $input["overAllUniqueLeadsDidPhone"]; | |
$request->startDateTime = $input["overAllUniqueLeadsStartDate"]; | |
$request->endDateTime = $input["overAllUniqueLeadsEndDate"]; | |
$param = app()->make('App\Http\Controllers\Api\CallController'); | |
$res = $param->Reponse_getCalls_DidPhoneArray_Unique( | |
$request | |
); | |
return $res; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function Reponse_getCalls_DidPhoneArray_Unique(Request $request) | |
{ | |
$response = array(); | |
$count = DB::table('calls') | |
->join('channels', 'channels.channel_id', '=', 'calls.channel_id') | |
->whereIn('channels.tracking_phone', $request->didPhone) | |
->where('is_duplicated', '=', '0') | |
->whereBetween('calls.date', [$request->startDateTime, $request->endDateTime]); | |
if(isset($request->status)) | |
{ | |
$count = $count->where('calls.status', '=', $request->status); | |
} | |
$count = $count->count(); | |
$dt = Carbon::createFromFormat('Y-m-d H:i:s', $request->startDateTime); | |
//$dt->setTimezone($this->timezone); | |
$StartDateTime = $dt->format(DateTime::ISO8601); | |
$dt2 = Carbon::createFromFormat('Y-m-d H:i:s', $request->endDateTime); | |
//$dt2->setTimezone($this->timezone); | |
$EndDateTime = $dt2->format(DateTime::ISO8601); | |
$response['fromDateTime'] = "$StartDateTime"; | |
$response['totalUniqueCalls'] = "$count"; | |
$response['toDateTime'] = "$EndDateTime"; | |
//$response = json_encode($response); | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment