12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\monitor\controller;
- use think\Cache;
- use app\common\service\MailService;
- use app\common\service\HelperService;
- /**
- * 销售数据出队列
- * Class RequestPop
- */
- class Salespop extends Basepop
- {
- public $_listKey = 'sales_list';
- public function start(){
- $this->main($this->_listKey, 1000, '销售数据');
- }
-
- private function _getBaseUrl($companyNo){
- switch($companyNo){
- case 106:
- return "http://erp.ahamu.cn";
- case 117:
- return "http://fabld.ahamu.cn";
- case 105:
- case 898:
- return "http://erp_qbb.ahamu.cn";
- default :
- return false;
- }
- }
- public function mainFunc($requestArr){
- try{
-
- HelperService::$_startExecTime = microtime(true);
- $baseUrl = $this->_getBaseUrl($requestArr['company_no']);
- if(empty($baseUrl)){
- return true;
- }
-
- $url = $baseUrl."/index/Index/sales";
- $returnData = HelperService::httpPost($url, json_encode($requestArr), false);
- HelperService::$_sysParams = $requestArr;
- HelperService::addLog($returnData,$url,"ERP");
-
- // return @json_decode($returnData,true);
- return true;
- } catch (\Exception $ex){
- $mailService = new MailService();
- $mailService->send('leo',"销售数据出队异常","",$ex->getMessage(),[['mail'=>'2990412861@qq.com','name'=>'leo.xie']]);
- }
- }
-
- public function stop(){
- Cache::rm($this->_listKey.'_pop_program');
- echo "restart success\n";
- }
-
- public function getCache(){
- $salesList = Cache::get($this->_listKey.'_pop_program');
- var_dump($salesList);
- }
- }
|