瀏覽代碼

add order limit

stanley-king 4 年之前
父節點
當前提交
1167c90193

+ 35 - 79
admin/control/merchant.php

@@ -5,8 +5,8 @@
  **by 好商城V3 www.33hao.com 运营版*/
 
 defined('InShopNC') or exit('Access Invalid!');
+
 require_once(BASE_HELPER_PATH . '/refill/RefillFactory.php');
-use refill;
 
 
 class merchantControl extends SystemControl
@@ -151,8 +151,8 @@ class merchantControl extends SystemControl
 
     public function priceOp()
     {
-        $lang = Language::getLangContent();
-        if (chksubmit()) {
+        if (chksubmit())
+        {
             $mchid = $_POST['mchid'];
 
             //合并表单数据
@@ -163,13 +163,14 @@ class merchantControl extends SystemControl
             foreach ($card_types as $key => $card_type) {
                 $data['card_type'] = $card_type;
                 $data['spec'] = intval($specs[$key]);
-                $data['price'] = number_format($prices[$key], 2, '.', '');
+                $data['price'] = ncPriceFormat($prices[$key]);
                 $data['amount_limit'] = $amount_limit[$key];
                 $params[] = $data;
             }
-            foreach ($params as $param) {
-                if($param['price'] > 0)
-                {
+
+            foreach ($params as $param)
+            {
+                if($param['price'] > 0) {
                     $insert['mchid'] = $mchid;
                     $insert['spec'] = $param['spec'];
                     $insert['price'] = $param['price'];
@@ -178,12 +179,13 @@ class merchantControl extends SystemControl
                     $inserts[] = $insert;
                 }
             }
-            if(empty($inserts))
-            {
+
+            if(empty($inserts)) {
                 showMessage('操作成功', 'index.php?act=merchant&op=merchant');
             }
-            $model_merchant = Model('merchant');
+
             try {
+                $model_merchant = Model('merchant');
                 $trans = new trans_wapper($model_merchant, __METHOD__);
                 //删除旧费率
                 $model_merchant->delPrices($mchid);
@@ -196,6 +198,7 @@ class merchantControl extends SystemControl
                 showMessage('操作失败', 'index.php?act=merchant&op=merchant', 'html', 'error');
             }
         }
+
         $mchid = $_GET['mchid'] ?? 0;
         $goods = $this->GoodsFormat($mchid);
         Tpl::output('goods', $goods);
@@ -218,20 +221,25 @@ class merchantControl extends SystemControl
     private function GoodsFormat($mchid)
     {
         global $config;
-        $goods = $this->GoodsKeyFormat($config['provider_goods']);
+        $cardtype_amounts = $this->cardtype_amounts($config['provider_goods']);
+
         $model_merchant = Model('merchant');
         $items = $model_merchant->table('merchant_price')->where(['mchid' => $mchid])->select();
-        foreach ($goods as $key => $value) {
-            foreach ($value as $amount) {
-                $goods_name = $this->scard_type($key);
+        foreach ($cardtype_amounts as $card_type => $amounts)
+        {
+            foreach ($amounts as $amount)
+            {
+                $goods_name = $this->scard_type($card_type);
                 $data['goods_name'] = $goods_name;
-                $data['card_type'] = $key;
+                $data['card_type'] = $card_type;
                 $data['spec'] = $amount;
                 $data['amount_limit'] = -1;
                 $data['price'] = 0;
-                foreach ($items as $item) {
+
+                foreach ($items as $item)
+                {
                     $item['types'] = explode(',' , $item['card_types']);
-                    if ($amount == $item['spec'] && in_array($key , $item['types'])) {
+                    if ($amount == $item['spec'] && in_array($card_type , $item['types'])) {
                         $data['price'] = $item['price'];
                         $data['amount_limit'] = $item['amount_limit'];
                     }
@@ -242,10 +250,11 @@ class merchantControl extends SystemControl
         return $result;
     }
 
-    private function GoodsKeyFormat($goods)
+    private function cardtype_amounts($goods)
     {
         $data = [];
-        foreach ($goods as $key => $value) {
+        foreach ($goods as $key => $value)
+        {
             if ($key == 'petrochina') { //中石油
                 $key = 1;
             } elseif ($key == 'sinopec') { //中石化
@@ -256,29 +265,13 @@ class merchantControl extends SystemControl
                 $key = 5;
             } elseif ($key == 'chinatelecom') { //中国电信
                 $key = 6;
+            } else {
+                continue;
             }
+
             $data[$key] = $value;
         }
-        return $data;
-    }
 
-    private function PricesFormat($items)
-    {
-        $data = [];
-        foreach ($items as $key => $item) {
-            if (strlen($item['card_types']) > 1) {
-                $card_types = explode(',', $item['card_types']);
-                foreach ($card_types as $card_type) {
-                    $item['card_type'] = $card_type;
-                    unset($item['card_types']);
-                    $data[] = $item;
-                }
-            } else {
-                $item['card_type'] = $item['card_types'];
-                unset($item['card_types']);
-                $data[] = $item;
-            }
-        }
         return $data;
     }
 
@@ -313,12 +306,11 @@ class merchantControl extends SystemControl
                 $list = $model_merchant->getMerchantInfo($condition);
                 if (empty($list)) {
                     echo 'true';
-                    exit;
                 } else {
                     echo 'false';
-                    exit;
                 }
-                break;
+                exit;
+
             /**
              * 验证机构是否存在
              */
@@ -327,12 +319,10 @@ class merchantControl extends SystemControl
                 $list = $model_merchant->getMerchantInfo($condition);
                 if (!empty($list)) {
                     echo 'true';
-                    exit;
                 } else {
                     echo 'false';
-                    exit;
                 }
-                break;
+                exit;
         }
     }
 
@@ -341,8 +331,6 @@ class merchantControl extends SystemControl
      */
     public function refill_evidenceOp()
     {
-        $lang = Language::getLangContent();
-
         $model_merchant = Model('merchant');
         $condition = [];
         if (trim($_GET['mch_name']) != '') {
@@ -459,6 +447,7 @@ class merchantControl extends SystemControl
         $order_sn = $apply_id;
         $admininfo = $this->getAdminInfo();
         $log_msg = "管理员【" . $admininfo['admin_name'] . "】操作会员【" . $member_info['member_name'] . "】预存款,金额为" . $money . ",编号为" . $order_sn;
+
         $admin_act = 'sys_add_money';
         switch ($_POST['operatetype']) {
             case 1:
@@ -767,18 +756,6 @@ class merchantControl extends SystemControl
         }
     }
 
-    private function whereStr_ct($cond){
-        if(empty($cond)){
-            return '';
-        }
-        $where = '';
-        foreach ($cond as $key => $value){
-            $where .= "( {$key} = '{$value}' ) AND ";
-        }
-        $where = ' WHERE ' . $where;
-        return rtrim($where ,' AND ');
-    }
-
     private function scard_type(int $card_type)
     {
         if ($card_type == 1) { //中石油
@@ -796,27 +773,6 @@ class merchantControl extends SystemControl
         }
     }
 
-    private function topcard_type($str_type)
-    {
-        if (empty($str_type)) {
-            return '未知';
-        }
-        $str_type = trim(strtolower($str_type));
-        if ($str_type == 'petrochina') { //中石油
-            return '中石油';
-        } elseif ($str_type == 'sinopec') { //中石化
-            return '中石化';
-        } elseif ($str_type == 'chinamobile') { //中国移动
-            return '中国移动';
-        } elseif ($str_type == 'chinaunicom') { //中国联通
-            return '中国联通';
-        } elseif ($str_type == 'chinatelecom') { //中国电信
-            return '中国电信';
-        } else {
-            return '未知';
-        }
-    }
-
     private function elapse_time($seconds)
     {
         $minutes = intval($seconds / 60);

+ 4 - 0
data/config/dev/base.ini.php

@@ -33,6 +33,10 @@ $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';
     $config['resource_site_url']	= $REMOTE_IMG_HOST.'/data/resource';

+ 10 - 0
data/config/dev/refill.ini.php

@@ -1,6 +1,16 @@
 <?php
 
+//充值额度基本表
+$config['provider_goods'] = [
+    'petrochina'    => [100 , 200 , 500 , 1000 , 2000],
+    'sinopec'       => [100 , 200 , 500 , 1000 , 2000],
+    'chinamobile'   => [10 , 20 , 30 , 50 , 100 , 200 , 500 , 1000],
+    'chinaunicom'   => [10 , 20 , 30 , 50 , 100 , 200 , 500 , 1000],
+    'chinatelecom'  => [10 , 20 , 30 , 50 , 100 , 200 , 500 , 1000]
+];
 
+
+//充值渠道配置表
 $suhc_oil = ['name' => 'suhc', 'store_id' => 8, 'card_type' => ['sinopec'],
     'amount' => [100 => ['goods_id' => 6226, 'price' => 96.8],
         200 => ['goods_id' => 6227, 'price' => 193.6],

+ 12 - 0
data/config/prod/refill.ini.php

@@ -1,5 +1,17 @@
 <?php
 
+//充值额度基本表
+$config['provider_goods'] = [
+    'petrochina'    => [100 , 200 , 500 , 1000 , 2000],
+    'sinopec'       => [100 , 200 , 500 , 1000 , 2000],
+    'chinamobile'   => [10 , 20 , 30 , 50 , 100 , 200 , 500 , 1000],
+    'chinaunicom'   => [10 , 20 , 30 , 50 , 100 , 200 , 500 , 1000],
+    'chinatelecom'  => [10 , 20 , 30 , 50 , 100 , 200 , 500 , 1000]
+];
+
+
+//充值渠道配置表
+
 //速汇充京东加油通道
 $suhc_oil = ['name' => 'suhc', 'store_id' => 7, 'card_type' => ['sinopec'],
     'amount' => [100 => ['goods_id' => 6290, 'price' => 96.8],

+ 4 - 0
data/config/test/base.ini.php

@@ -30,6 +30,10 @@ $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';
     $config['resource_site_url']	= $REMOTE_IMG_HOST.'/data/resource';

+ 1 - 0
helper/refill/RefillFactory.php

@@ -400,6 +400,7 @@ class RefillFactory
         if (empty($providers)) {
             return [202, "找不到合适的充值通道"];
         }
+
         if (empty($notify_url)) {
             $notify_url = "";
         }