Prechádzať zdrojové kódy

evidence sms and refill order search add where

ayHaru 4 rokov pred
rodič
commit
671eda1ae8

+ 9 - 3
core/framework/libraries/sms.php

@@ -79,11 +79,11 @@ class Sms
      */
     private function mysend_yuntx($mobile, $content)
     {
-        $type = $this->getYuntxTpl(intval($content['type']));
+        $type = $this->getYuntxTpl($content['type']);
         if(empty($type)) {
             return -1;
         }
-
+        Log::record("type : {$type}",Log::DEBUG);
         return $this->send_msg($mobile, $content['datas'], $type);
     }
 
@@ -91,7 +91,9 @@ class Sms
     {
         static $sms_tpls = [
             'register'  => '756830',
-            'resetpass' => '63477'
+            'resetpass' => '63477',
+            'evidence' => '879537',
+            'balance_warning' => '879588'
 //            self::getbonus_code => '63479',
 //            self::getbind_code => '59006',
 //            self::newcomer_code => '92893',
@@ -103,6 +105,10 @@ class Sms
         ];
         if($type == sms_helper::register) {
             return $sms_tpls['register'];
+        }elseif ($type == sms_helper::evidence){
+            return $sms_tpls['evidence'];
+        }elseif ($type == sms_helper::balance_warning){
+            return $sms_tpls['balance_warning'];
         }
         else {
             return false;

+ 3 - 0
data/config/prod/base.ini.php

@@ -31,6 +31,9 @@ $config['wap_site_url'] 		= $SRV_HOST.'/wap';
 $config['chat_site_url'] 		= $SRV_HOST.'/chat';
 $config['node_site_url'] 		= 'http://127.0.0.1:8090';
 $config['delivery_site_url']    = $SRV_HOST.'/delivery';
+$config['system_manager_phones'] = [
+    '13911129867' , '18500608333' , '18500350111' , '15136908757'
+];
 
 if(defined('USE_REMOTE_IMAGE') && USE_REMOTE_IMAGE == true) {
     $config['upload_site_url']		= $REMOTE_IMG_HOST.'/data/upload';

+ 6 - 0
data/config/win/base.ini.php

@@ -29,6 +29,12 @@ $config['wap_site_url'] 		= $SRV_HOST.'/wap';
 $config['chat_site_url'] 		= $SRV_HOST.'/chat';
 $config['node_site_url'] 		= 'http://127.0.0.1:8090';
 $config['delivery_site_url']    = $SRV_HOST.'/delivery';
+//$config['system_manager_phones'] = [
+//    '13911129867' , '18500608333' , '18500350111' , '15136908757'
+//];
+$config['system_manager_phones'] = [
+    '17801048874' , '17611378259'
+];
 
 if(defined('USE_REMOTE_IMAGE') && USE_REMOTE_IMAGE == true) {
     $config['upload_site_url']		= $REMOTE_IMG_HOST.'/data/upload';

+ 2 - 0
helper/sms_helper.php

@@ -22,6 +22,8 @@ class sms_helper
     const order_sended = 'order_sended';
     const order_received = 'order_received';
     const after_comment = 'after_comment';
+    const evidence  = 'evidence';
+    const balance_warning = 'balance_warning';
 
     static private $arrTypes = ['register','resetpass','getbonus','getwxbind','getfcode',
         'order_sended','order_received','after_comment'];

+ 4 - 0
mobile/control/merchant_info.php

@@ -25,6 +25,10 @@ class merchant_infoControl extends mbMerchantControl
         } else {
             $merchant_info['ips'] = unserialize($merchant_info['ip_white_list']);
         }
+        $cond['add_time'] = ['between', [strtotime(date("Y-m-d",time())), time()]];
+        $cond['status'] = $cond['is_operation'] = 2;
+        $day_evidence = $model_merchant->getRefillEvidence($cond);
+        $merchant_info['evidence_count'] = count($day_evidence);
         return self::outsuccess($merchant_info);
     }
 

+ 13 - 3
mobile/control/merchant_order.php

@@ -17,12 +17,22 @@ class merchant_orderControl extends mbMerchantControl
         if (!empty($_GET['card_type'])) {
             $cond['refill_order.card_type'] = $_GET['card_type'];
         }
+        if (!empty($_GET['refill_amount'])) {
+            $cond['refill_order.refill_amount'] = $_GET['refill_amount'];
+        }
+        if (!empty($_GET['mch_order'])) {
+            $cond['refill_order.mch_order'] = $_GET['mch_order'];
+        }
+        if (in_array($_GET['order_state'], array('0', '30', '40'))) {
+            $cond['vr_order.order_state'] = $_GET['order_state'];
+            if($_GET['order_state'] == 30 && $_GET['time'] == 1){
+                $cond['refill_order.order_time'] = ['lt', (time() - 3600)];
+            }
+        }
         if ($_GET['start_time'] > 0 && $_GET['end_time'] > 0) {
             $cond['refill_order.order_time'] = ['between', [$_GET['start_time'], $_GET['end_time']]];
         }
-        $fields = 'refill_order.order_id,refill_order.order_sn,refill_order.mchid,refill_order.card_no,
-        refill_order.mch_order,refill_order.card_type,refill_order.order_time,refill_order.notify_time,
-        refill_order.refill_amount,refill_order.mch_amount,vr_order.order_state,refill_order.channel_name,refill_order.ch_trade_no,refill_order.official_sn';
+        $fields = 'refill_order.*,vr_order.order_state';
         $order_list = $model_vr_order->getMerchantOrderList($cond, $this->page, $fields, 'refill_order.order_id desc');
         $order_list = $this->merchant_order_format($order_list);
         $result['data'] = $order_list;

+ 6 - 0
mobile/control/refill_evidence.php

@@ -59,6 +59,12 @@ class refill_evidenceControl extends mbMerchantControl
 
         $ret = $model_merchant->addRefillEvidence($data);
         if ($ret) {
+            global $config;
+            $phones = $config['system_manager_phones'];
+            foreach ($phones as $phone) {
+                $ret = QueueClient::push('sendSMS', ['mobile'=>$phone,'type'=>'evidence','datas' => [date("m月d日H时") , $merchant_info['company_name'] , $params['amount']]]);
+                Log::record("phone : {$phone} , result : {$ret}",Log::DEBUG);
+            }
             return self::outsuccess([]);
         } else {
             return self::outerr(errcode::ErrOperation, "系统错误.");

+ 15 - 0
test/TestSms.php

@@ -37,6 +37,21 @@ class TestSms extends TestCase
         $ret = $sms->send_code($mobile, sms_helper::register,false);
     }
 
+    public function testEvidence(){
+//        $type = 'balance_warning';
+//        $ret = QueueClient::push('sendSMS', ['mobile'=>17801048874,'type'=>$type,'datas' => [date("m月d日H时") , 500]]);
+//        $type = 'evidence';
+//        $ret = QueueClient::push('sendSMS', ['mobile'=>17801048874,'type'=>$type,'datas' => [date("m月d日H时") , 'yezi' , 500]]);
+
+        $merchants = Model('merchant')->getMerchantList([],'','','merchant.*,member.available_predeposit');
+        foreach ($merchants as $merchant){
+            if($merchant['available_predeposit'] < $merchant['alarm_amount'] || $merchant['available_predeposit'] < 10000 && !empty($merchant['contact_phone']))
+            {
+                QueueClient::push('sendSMS', ['mobile'=>$merchant['contact_phone'],'type'=>'balance_warning','datas' => [date("m月d日H时") , $merchant['available_predeposit']]]);
+            }
+        }
+    }
+
     public function testInvitee()
     {
         $sms = new Sms();