ayHaru 4 years ago
parent
commit
590ba13f18
2 changed files with 68 additions and 3 deletions
  1. 13 2
      admin/control/merchant.php
  2. 55 1
      mobile/control/merchant_info.php

+ 13 - 2
admin/control/merchant.php

@@ -459,7 +459,18 @@ class merchantControl extends SystemControl
     public function rechargeOp()
     public function rechargeOp()
     {
     {
         if (chksubmit()) {
         if (chksubmit()) {
-            $this->add_money();
+            $mchid = $this->add_money();
+            $model_merchant = Model('merchant');
+            $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+            if ($merchant_info['alarm_amount'] < $merchant_info['available_predeposit'])
+            {
+                //更新预警短信通知限制
+                $mch_cache = rcache("merchant-notify" , 'refill-');
+                $caches = empty($mch_cache['data']) ? [] : unserialize($mch_cache['data']);
+                $caches[$mchid] = ['last_time' => 0, 'send_count' => 0];
+                wcache("merchant-notify", ['data' => serialize($caches)], 'refill-');
+            }
+            showMessage('操作成功', 'index.php?act=merchant&op=refill_evidence');
         } else {
         } else {
             $apply_id = $_GET['apply_id'];
             $apply_id = $_GET['apply_id'];
             if (!empty($apply_id)) {
             if (!empty($apply_id)) {
@@ -550,7 +561,7 @@ class merchantControl extends SystemControl
             $model_merchant->editRefillEvidence(['apply_id' => $apply_id], ['is_operation' => 2]);
             $model_merchant->editRefillEvidence(['apply_id' => $apply_id], ['is_operation' => 2]);
             $trans->commit();
             $trans->commit();
             $this->log($log_msg, 1);
             $this->log($log_msg, 1);
-            showMessage('操作成功', 'index.php?act=merchant&op=refill_evidence');
+            return $evidence_info['mchid'];
         } catch (Exception $e) {
         } catch (Exception $e) {
             $trans->rollback();
             $trans->rollback();
             $this->log($log_msg, 0);
             $this->log($log_msg, 0);

+ 55 - 1
mobile/control/merchant_info.php

@@ -12,7 +12,7 @@ class merchant_infoControl extends mbMerchantControl
     {
     {
         $mchid = $this->mchid();
         $mchid = $this->mchid();
         $model_merchant = Model('merchant');
         $model_merchant = Model('merchant');
-        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid], 'mchid,admin_id,name,alarm_amount,ip_white_list,use_key,contact_name,contact_phone');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid], 'mchid,admin_id,name,alarm_amount,ip_white_list,use_key,contact_name,contact_phone,warning_phone');
         $model_member = Model('member');
         $model_member = Model('member');
         $member_info = $model_member->getMemberInfo(['member_id' => $merchant_info['admin_id']], 'available_predeposit');
         $member_info = $model_member->getMemberInfo(['member_id' => $merchant_info['admin_id']], 'available_predeposit');
         if (empty($member_info)) {
         if (empty($member_info)) {
@@ -25,6 +25,11 @@ class merchant_infoControl extends mbMerchantControl
         } else {
         } else {
             $merchant_info['ips'] = unserialize($merchant_info['ip_white_list']);
             $merchant_info['ips'] = unserialize($merchant_info['ip_white_list']);
         }
         }
+        if (empty($merchant_info['warning_phone'])) {
+            $merchant_info['warning_phone'] = [];
+        } else {
+            $merchant_info['warning_phone'] = unserialize($merchant_info['warning_phone']);
+        }
         $cond['add_time'] = ['between', [strtotime(date("Y-m-d",time())), time()]];
         $cond['add_time'] = ['between', [strtotime(date("Y-m-d",time())), time()]];
         $cond['status'] = $cond['is_operation'] = 2;
         $cond['status'] = $cond['is_operation'] = 2;
         $cond['mchid'] = $mchid;
         $cond['mchid'] = $mchid;
@@ -222,6 +227,55 @@ class merchant_infoControl extends mbMerchantControl
         }
         }
     }
     }
 
 
+    public function addwphoneOp()
+    {
+        $mchid = $this->mchid();
+        $phone = $_POST['phone'];
+        if (empty($phone)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $phone = explode(',' ,trim($phone));
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        if (empty($merchant_info['warning_phone'])) {
+            $phones = [];
+        } else {
+            $phones = unserialize($merchant_info['warning_phone']);
+        }
+        foreach ($phone as $item) {
+            $phones[] = $item;
+        }
+        $phones = array_unique($phones);
+        $model_merchant->editMerchant(['warning_phone' => serialize($phones)], ['mchid' => $merchant_info['mchid']]);
+        return self::outsuccess([]);
+    }
+
+    public function wphonedelOp()
+    {
+        $mchid = $this->mchid();
+        $phone = $_POST['phone'];
+        if (empty($phone)) {
+            return self::outerr(errcode::ErrParamter, "参数错误");
+        }
+        $phone = trim($phone);
+        $model_merchant = Model('merchant');
+        $merchant_info = $model_merchant->getMerchantInfo(['mchid' => $mchid]);
+        $phones = unserialize($merchant_info['warning_phone']);
+        $new_phones = [];
+        foreach ($phones as $value) {
+            if ($value != $phone) {
+                $new_phones[] = $value;
+            }
+        }
+        if (empty($new_phones)) {
+            $new_phones = '';
+        } else {
+            $new_phones = serialize($new_phones);
+        }
+        $model_merchant->editMerchant(['warning_phone' => $new_phones], ['mchid' => $merchant_info['mchid']]);
+        return self::outsuccess([]);
+    }
+
     public function setkeyOp()
     public function setkeyOp()
     {
     {
         $mchid = $this->mchid();
         $mchid = $this->mchid();