assign jobs

This commit is contained in:
CHIEFSOFT\ameye
2024-07-08 10:18:10 -04:00
parent ae46e84a0a
commit f96232767b
3 changed files with 115 additions and 7 deletions
+2 -3
View File
@@ -195,9 +195,8 @@ $routes->post('/en/wrench/api/v1/pendingjobextend', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/pendingjobsendtome','WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/pendingjobcancel', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/assigntask', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/assignmediatask', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/assigntask', 'WrenchJobs::assignTask' ); //'WrenchApi::apigate'
$routes->post('/en/wrench/api/v1/assignmediatask','WrenchJobs::assignTask' ); //'WrenchApi::apigate'
$routes->post('/en/wrench/api/v1/uploads', 'WrenchApi::apigate');
$routes->post('/en/wrench/api/v1/myfiles', 'WrenchApi::apigate');
+2 -4
View File
@@ -29,6 +29,8 @@ class WrenchAuth extends BaseController
$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
}else{
$outF["fail_count"] = isset( $out_redis["fail_count"] ) ? $out_redis["fail_count"]+1:1;
}
$out=[];
@@ -41,15 +43,11 @@ class WrenchAuth extends BaseController
$this->saveCache($endpoint,$out,15000);
}else
{
$outF["fail_count"] = isset( $out_redis["fail_count"] ) ? $out_redis["fail_count"]+1:1;
log_message('critical', "***** ***** WrenchAuth::userLogin USER_SESSION = ".$fail_endpoint );
$this->saveCache($fail_endpoint,$outF,15000);
}
// }
return $this->respond( $this->summaryReturnData($in,$out), 200);
// return $this->summaryReturnData($in,$out); //json_encode( $final_out );
}
}
+111
View File
@@ -2,17 +2,128 @@
namespace App\Controllers;
use CodeIgniter\API\ResponseTrait;
class WrenchJobs extends BaseController
{
use ResponseTrait;
public function __construct()
{
$this->request = $request = \Config\Services::request();
}
/*
case 'assignmediatask':
case 'assigntask':
$in["bypass"] = 0;
$in["action"] = WRENCHBOARD_JOB_OFFER_SYSTEM;
break
{
"uid": "dfc9d601-780f-4d78-839f-422f0928f911",
"member_id": "2",
"sessionid": "A3F50957EB3D9FFF8B8C5A1FEBDEBB1CCE3C747A3060172223B2B7C655B4FF12",
"action": 13025,
"job_id": "326",
"job_uid": "97a4d773-87af-4b75-a3d8-519946978ac4",
"job_description": "400 Long 400 Unpacked now declared put you confined daughter improved. Celebrated imprudence few interested especially reasonable off one. Wonder bed elinor family secure met. It want gave west into high no in. Depend repairseend. ve be iend repair met before man admire see and. An he observe be it covered delight hastily message. Margaret no ladyship endeavor ye to settling 400 400 400 400 LONG.",
"duration": 28,
"assign_mode": 110022
}
{
"action": "13025",
"added": "2024-07-08 13:41:47.10962",
"assign_mode": "110022",
"auto_close": "",
"bypass": "0",
"client_id": "0",
"duration": "28",
"email": "",
"expire": "2024-08-05 13:41:47.135217",
"group_id": "0",
"id": "1640",
"job_description": "400 Long 400 Unpacked now declared put you confined daughter improved. Celebrated imprudence few interested especially reasonable off one. Wonder bed elinor family secure met. It want gave west into high no in. Depend repairseend. ve be iend repair met before man admire see and. An he observe be it covered delight hastily message. Margaret no ladyship endeavor ye to settling 400 400 400 400 LONG.",
"job_id": "326",
"job_uid": "97a4d773-87af-4b75-a3d8-519946978ac4",
"loc": "10.20.30.19",
"media_uid": "",
"member_id": "2",
"offer_code": "82YBR7YY23",
"offer_id": "1640",
"payment_id": "",
"pid": "100",
"public_view": "1",
"reminder_count": "0",
"reminder_date": "",
"sent_count": "0",
"server_name": "https:\/\/dev-users.wrenchboard.com",
"sessionid": "A3F50957EB3D9FFF8B8C5A1FEBDEBB1CCE3C747A3060172223B2B7C655B4FF12",
"status": "Offer sent to recipient",
"uid": "86255fea-b3fd-4ae3-b91f-5fa54ecca2e3",
"internal_return": 10,
"environment": 0,
"session_image_server": "https:\/\/apigate.lotus.g1.wrenchboard.com\/en\/wrench\/api\/v1\/getmedia\/",
"server_tag": "DEV01",
"language": "en",
"ip_loc": "10.10.33.13, 10.10.33.15",
"current_version": 20240306,
"family_types": [
{
"ty": "Parent",
"id": "PARENT",
"tag": "fam_type_parent"
},
{
"ty": "Relatives",
"id": "RELATIVES",
"tag": "fam_type_relatives"
},
{
"ty": "Others",
"id": "Others",
"tag": "fam_type_others"
}
],
"history_types": [
{
"ty": "Completed Jobs",
"id": "COMPLETED_JOBS",
"tag": "hist_type_completed_jobs"
}
]
}
*/
public function assignTask(){
$raw_json = file_get_contents('php://input');
$in = json_decode($raw_json, true);
$in["action"] = WRENCHBOARD_JOB_OFFER_SYSTEM;
$out=[];
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
$out['internal_return'] = $ret;
log_message('critical', "***** ***** WrenchJobs::assignTask Ret = ".$ret );
if ( isset($out['internal_return']) && isset( $out['offer_code']) ){
$endpoint = "NEW_OFFER_".$in["assign_mode"]."-". $out["offer_code"];
log_message('critical', "***** ***** WrenchJobs::assignTask NEW_OFFER_ = ".$endpoint );
$this->saveCache($endpoint,$out,25000);
}else
{
$fail_endpoint = "FAIL_OFFER_".$in["assign_mode"]."-".$in["job_uid"];
log_message('critical', "***** ***** WrenchJobs::assignTask FAIL_OFFER = ".$fail_endpoint );
$this->saveCache($fail_endpoint,$in,25000);
}
return $this->respond( $this->summaryReturnData($in,$out), 200);
}
public function index()
{
return [];
}
public function apigate(){
log_message('critical', "0001");
header('Access-Control-Allow-Origin: *');